本文整理汇总了C++中EFI_BOOT_SERVICES::LocateHandleBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ EFI_BOOT_SERVICES::LocateHandleBuffer方法的具体用法?C++ EFI_BOOT_SERVICES::LocateHandleBuffer怎么用?C++ EFI_BOOT_SERVICES::LocateHandleBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EFI_BOOT_SERVICES
的用法示例。
在下文中一共展示了EFI_BOOT_SERVICES::LocateHandleBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: efipci_root
/**
* Locate EFI PCI root bridge I/O protocol
*
* @v pci PCI device
* @ret handle EFI PCI root bridge handle
* @ret root EFI PCI root bridge I/O protocol, or NULL if not found
* @ret rc Return status code
*/
static int efipci_root ( struct pci_device *pci, EFI_HANDLE *handle,
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **root ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE *handles;
UINTN num_handles;
union {
void *interface;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *root;
} u;
EFI_STATUS efirc;
UINTN i;
int rc;
/* Enumerate all handles */
if ( ( efirc = bs->LocateHandleBuffer ( ByProtocol,
&efi_pci_root_bridge_io_protocol_guid,
NULL, &num_handles, &handles ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( pci, "EFIPCI " PCI_FMT " cannot locate root bridges: "
"%s\n", PCI_ARGS ( pci ), strerror ( rc ) );
goto err_locate;
}
/* Look for matching root bridge I/O protocol */
for ( i = 0 ; i < num_handles ; i++ ) {
*handle = handles[i];
if ( ( efirc = bs->OpenProtocol ( *handle,
&efi_pci_root_bridge_io_protocol_guid,
&u.interface, efi_image_handle, *handle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( pci, "EFIPCI " PCI_FMT " cannot open %s: %s\n",
PCI_ARGS ( pci ), efi_handle_name ( *handle ),
strerror ( rc ) );
continue;
}
if ( u.root->SegmentNumber == PCI_SEG ( pci->busdevfn ) ) {
*root = u.root;
bs->FreePool ( handles );
return 0;
}
bs->CloseProtocol ( *handle,
&efi_pci_root_bridge_io_protocol_guid,
efi_image_handle, *handle );
}
DBGC ( pci, "EFIPCI " PCI_FMT " found no root bridge\n",
PCI_ARGS ( pci ) );
rc = -ENOENT;
bs->FreePool ( handles );
err_locate:
return rc;
}
示例2: PRINT
EFI_STATUS EFIAPI
OvrLocateHandleBuffer(
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol,
IN VOID *SearchKey,
IN OUT UINTN *NoHandles,
OUT EFI_HANDLE **Buffer
)
{
EFI_STATUS Status;
STATIC UINTN OldBuffer = 0;
Status = gOrgBS.LocateHandleBuffer(SearchType, Protocol, SearchKey, NoHandles, Buffer);
if (!CompareGuid(Protocol, &mEfiSimplePointerProtocolGuid) || (UINTN)Buffer != OldBuffer) {
OldBuffer = (UINTN)Buffer;
PRINT("->LocateHandleBuffer(%s, %s, %p, %d, %p) = %r\n", EfiLocateSearchType[SearchType], GuidStr(Protocol), SearchKey, *NoHandles, *Buffer, Status);
}
return Status;
}