当前位置: 首页>>代码示例>>C++>>正文


C++ EFI_BOOT_SERVICES::LocateHandleBuffer方法代码示例

本文整理汇总了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;
}
开发者ID:antoinemiquel,项目名称:ipxe,代码行数:61,代码来源:efi_pci.c

示例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;
}
开发者ID:jief666,项目名称:clover,代码行数:20,代码来源:BootServices.c


注:本文中的EFI_BOOT_SERVICES::LocateHandleBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。