这篇教程C++ DevicePathSubType函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DevicePathSubType函数的典型用法代码示例。如果您正苦于以下问题:C++ DevicePathSubType函数的具体用法?C++ DevicePathSubType怎么用?C++ DevicePathSubType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DevicePathSubType函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DevicePathInstanceEFI_DEVICE_PATH *DevicePathInstance ( IN OUT EFI_DEVICE_PATH **DevicePath, OUT UINTN *Size ){ EFI_DEVICE_PATH *Start, *Next, *DevPath; UINTN Count; DevPath = *DevicePath; Start = DevPath; if (!DevPath) { return NULL; } // // Check for end of device path type // for (Count = 0; ; Count++) { Next = NextDevicePathNode(DevPath); if (IsDevicePathEndType(DevPath)) { break; } if (Count > 01000) { // // BugBug: Debug code to catch bogus device paths // DEBUG((D_ERROR, "DevicePathInstance: DevicePath %x Size %d", *DevicePath, ((UINT8 *) DevPath) - ((UINT8 *) Start) )); DumpHex (0, 0, ((UINT8 *) DevPath) - ((UINT8 *) Start), Start); break; } DevPath = Next; } ASSERT (DevicePathSubType(DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE || DevicePathSubType(DevPath) == END_INSTANCE_DEVICE_PATH_SUBTYPE); // // Set next position // if (DevicePathSubType(DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) { Next = NULL; } *DevicePath = Next; // // Return size and start of device path instance // *Size = ((UINT8 *) DevPath) - ((UINT8 *) Start); return Start;}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:59,
示例2: disk_get_part_uuidEFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[37]) { EFI_DEVICE_PATH *device_path; EFI_STATUS r = EFI_NOT_FOUND; /* export the device path this image is started from */ device_path = DevicePathFromHandle(handle); if (device_path) { EFI_DEVICE_PATH *path, *paths; paths = UnpackDevicePath(device_path); for (path = paths; !IsDevicePathEnd(path); path = NextDevicePathNode(path)) { HARDDRIVE_DEVICE_PATH *drive; if (DevicePathType(path) != MEDIA_DEVICE_PATH) continue; if (DevicePathSubType(path) != MEDIA_HARDDRIVE_DP) continue; drive = (HARDDRIVE_DEVICE_PATH *)path; if (drive->SignatureType != SIGNATURE_TYPE_GUID) continue; GuidToString(uuid, (EFI_GUID *)&drive->Signature); r = EFI_SUCCESS; break; } FreePool(paths); } return r;}
开发者ID:ajeddeloh,项目名称:systemd,代码行数:30,
示例3: GetFilePathList/* Currently this function is useless */void GetFilePathList(BDS_LOAD_OPTION* BdsLoadOption, char* buffer, int descSize){ if (BdsLoadOption->FilePathListLength <= 0) return; EFI_DEVICE_PATH_PROTOCOL* DevicePathNode = BdsLoadOption->FilePathList; // File path fields DevicePathNode = BdsLoadOption->FilePathList; if (DevicePathType(DevicePathNode) != MEDIA_DEVICE_PATH_TYPE) return; while (!IsDevicePathEndType(DevicePathNode)) { switch (DevicePathSubType(DevicePathNode)) { case HARDDRIVE_SUBTYPE: printf("HDD"); break; case FILE_PATH_SUBTYPE: printf("FILE"); break; } DevicePathNode = NextDevicePathNode(DevicePathNode); }}
开发者ID:ExtremeGTX,项目名称:Win32-UEFILibrary,代码行数:30,
示例4: BdsLoadOptionPxeListEFI_STATUSBdsLoadOptionPxeList ( IN OUT LIST_ENTRY* BdsLoadOptionList ){ EFI_STATUS Status; UINTN HandleCount; EFI_HANDLE *HandleBuffer; UINTN Index; BDS_SUPPORTED_DEVICE *SupportedDevice; EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol; EFI_SIMPLE_NETWORK_PROTOCOL* SimpleNet; CHAR16 DeviceDescription[BOOT_DEVICE_DESCRIPTION_MAX]; EFI_MAC_ADDRESS *Mac; EFI_DEVICE_PATH_PROTOCOL *DevicePathNode; // List all the PXE Protocols Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiPxeBaseCodeProtocolGuid, NULL, &HandleCount, &HandleBuffer); if (EFI_ERROR (Status)) { return Status; } for (Index = 0; Index < HandleCount; Index++) { // We only select the handle WITH a Device Path AND the PXE Protocol Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol); if (!EFI_ERROR(Status)) { // Allocate BDS Supported Device structure SupportedDevice = (BDS_SUPPORTED_DEVICE*)AllocatePool(sizeof(BDS_SUPPORTED_DEVICE)); //Status = gBS->LocateProtocol (&gEfiSimpleNetworkProtocolGuid, NULL, (VOID **)&SimpleNet); Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiSimpleNetworkProtocolGuid, (VOID **)&SimpleNet); if (!EFI_ERROR(Status)) { Mac = &SimpleNet->Mode->CurrentAddress; UnicodeSPrint (DeviceDescription,BOOT_DEVICE_DESCRIPTION_MAX,L"MAC Address: %02x:%02x:%02x:%02x:%02x:%02x", Mac->Addr[0], Mac->Addr[1], Mac->Addr[2], Mac->Addr[3], Mac->Addr[4], Mac->Addr[5]); } else { Status = GenerateDeviceDescriptionName (HandleBuffer[Index], DeviceDescription); ASSERT_EFI_ERROR (Status); } UnicodeSPrint (SupportedDevice->Description,BOOT_DEVICE_DESCRIPTION_MAX,L"PXE on %s",DeviceDescription); if(NULL != SupportedDevice) { SupportedDevice->DevicePathProtocol = DevicePathProtocol; DevicePathNode = DevicePathProtocol; while (!IsDevicePathEnd (DevicePathNode)) { if ((DevicePathType (DevicePathNode) == MESSAGING_DEVICE_PATH) && ( DevicePathSubType (DevicePathNode) == MSG_MAC_ADDR_DP) ) { SupportedDevice->Support = &BdsLoadOptionSupportList[BDS_DEVICE_PXE]; InsertTailList (BdsLoadOptionList,&SupportedDevice->Link); break; } DevicePathNode = NextDevicePathNode (DevicePathNode); } } } } return EFI_SUCCESS;}
开发者ID:hzhuang1,项目名称:uefi,代码行数:59,
示例5: ASSERT/** Determines if a device path node is an end node of a device path instance. Determines if a device path node specified by Node is an end node of a device path instance. If Node represents the end of a device path instance, then TRUE is returned. Otherwise, FALSE is returned. If Node is NULL, then ASSERT(). @param Node A pointer to a device path node data structure. @retval TRUE The device path node specified by Node is the end of a device path instance. @retval FALSE The device path node specified by Node is not the end of a device path instance.**/BOOLEANEFIAPIIsDevicePathEndInstance ( IN CONST VOID *Node ){ ASSERT (Node != NULL); return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);}
开发者ID:FishYu1222,项目名称:edk2,代码行数:27,
示例6: ChangeVariableDevicePath/** Update the device path that describing a terminal device based on the new BaudRate, Data Bits, parity and Stop Bits set. @param DevicePath terminal device's path**/VOIDChangeVariableDevicePath ( IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath ){ EFI_DEVICE_PATH_PROTOCOL *Node; ACPI_HID_DEVICE_PATH *Acpi; UART_DEVICE_PATH *Uart; UINTN Com; BM_TERMINAL_CONTEXT *NewTerminalContext; BM_MENU_ENTRY *NewMenuEntry; Node = DevicePath; Node = NextDevicePathNode (Node); Com = 0; while (!IsDevicePathEnd (Node)) { Acpi = (ACPI_HID_DEVICE_PATH *) Node; if (IsIsaSerialNode (Acpi)) { CopyMem (&Com, &Acpi->UID, sizeof (UINT32)); } if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) { NewMenuEntry = BOpt_GetMenuEntry ( &TerminalMenu, Com ); ASSERT (NewMenuEntry != NULL); NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext; Uart = (UART_DEVICE_PATH *) Node; CopyMem ( &Uart->BaudRate, &NewTerminalContext->BaudRate, sizeof (UINT64) ); CopyMem ( &Uart->DataBits, &NewTerminalContext->DataBits, sizeof (UINT8) ); CopyMem ( &Uart->Parity, &NewTerminalContext->Parity, sizeof (UINT8) ); CopyMem ( &Uart->StopBits, &NewTerminalContext->StopBits, sizeof (UINT8) ); } Node = NextDevicePathNode (Node); }}
开发者ID:B-Rich,项目名称:edk2,代码行数:65,
示例7: DevicePathSubTypestatic NVME_NAMESPACE_DEVICE_PATH *get_nvme_device_path(EFI_DEVICE_PATH *p){ for (; !IsDevicePathEndType(p); p = NextDevicePathNode(p)) { if (DevicePathType(p) == MESSAGING_DEVICE_PATH && DevicePathSubType(p) == MSG_NVME_NAMESPACE_DP) return (NVME_NAMESPACE_DEVICE_PATH *)p; } return NULL;}
开发者ID:01org,项目名称:kernelflinger,代码行数:10,
示例8: get_pci_device_pathPCI_DEVICE_PATH* get_pci_device_path(EFI_DEVICE_PATH *p){ while (!IsDevicePathEndType(p)) { if (DevicePathType(p) == HARDWARE_DEVICE_PATH && DevicePathSubType(p) == HW_PCI_DP) return (PCI_DEVICE_PATH *)p; p = NextDevicePathNode(p); } return NULL;}
开发者ID:avoidik,项目名称:hardware_intel_efi_kernelflinger,代码行数:10,
示例9: GetNextDevicePathInstanceEFIAPIGetNextDevicePathInstance ( IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT UINTN *Size ){ EFI_DEVICE_PATH_PROTOCOL *DevPath; EFI_DEVICE_PATH_PROTOCOL *ReturnValue; UINT8 Temp; ASSERT (Size != NULL); if (DevicePath == NULL || *DevicePath == NULL) { *Size = 0; return NULL; } if (!IsDevicePathValid (*DevicePath, 0)) { return NULL; } // // Find the end of the device path instance // DevPath = *DevicePath; while (!IsDevicePathEndType (DevPath)) { DevPath = NextDevicePathNode (DevPath); } // // Compute the size of the device path instance // *Size = ((UINTN) DevPath - (UINTN) (*DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL); // // Make a copy and return the device path instance // Temp = DevPath->SubType; DevPath->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; ReturnValue = DuplicateDevicePath (*DevicePath); DevPath->SubType = Temp; // // If DevPath is the end of an entire device path, then another instance // does not follow, so *DevicePath is set to NULL. // if (DevicePathSubType (DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) { *DevicePath = NULL; } else { *DevicePath = NextDevicePathNode (DevPath); } return ReturnValue;}
开发者ID:Zokormazo,项目名称:refind,代码行数:54,
示例10: GetFloppyDevicePath/** * Get the device path of floppy disk. */EFI_STATUSGetFloppyDevicePath ( OUT EFI_DEVICE_PATH_PROTOCOL **FloppyDevicePath ){ EFI_STATUS Status; UINTN NoHandle; EFI_HANDLE *Buffer; UINTN Index; EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *RemainPath; EFI_DEVICE_PATH_PROTOCOL *LastNode; ACPI_HID_DEVICE_PATH *AcpiNode; Status = gtBS->LocateHandleBuffer ( ByProtocol, &gEfiDevicePathProtocolGuid, NULL, &NoHandle, &Buffer ); if (EFI_ERROR(Status)) { return Status; } for (Index = 0; Index < NoHandle; Index++) { Status = gtBS->HandleProtocol ( Buffer[Index], &gEfiDevicePathProtocolGuid, &DevicePath ); RemainPath = DevicePath; LastNode = DevicePath; while (!IsDevicePathEnd (RemainPath)) { LastNode = RemainPath; RemainPath = NextDevicePathNode (RemainPath); } // // Is LastNode ACPI device path node ? // if ((DevicePathType (LastNode) == 2) && (DevicePathSubType (LastNode) == 1)) { AcpiNode = (ACPI_HID_DEVICE_PATH*)LastNode; // // Is floppy device path ? // if (EISA_ID_TO_NUM(AcpiNode->HID) == 0x0604) { *FloppyDevicePath = DevicePath; return EFI_SUCCESS; } } } return EFI_NOT_FOUND;}
开发者ID:jljusten,项目名称:efi-sct,代码行数:57,
示例11: IsIsaSerialNode/** Check whether the device path node is ISA Serial Node. @param Acpi Device path node to be checked @retval TRUE It's ISA Serial Node. @retval FALSE It's NOT ISA Serial Node.**/BOOLEANIsIsaSerialNode ( IN ACPI_HID_DEVICE_PATH *Acpi ){ return (BOOLEAN) ( (DevicePathType (Acpi) == ACPI_DEVICE_PATH) && (DevicePathSubType (Acpi) == ACPI_DP) && (ReadUnaligned32 (&Acpi->HID) == EISA_PNP_ID (0x0501)) );}
开发者ID:B-Rich,项目名称:edk2,代码行数:20,
示例12: IsUartFlowControlNode/** Check the device path node whether it's the Flow Control node or not. @param[in] FlowControl The device path node to be checked. @retval TRUE It's the Flow Control node. @retval FALSE It's not.**/BOOLEANIsUartFlowControlNode ( IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl ){ return (BOOLEAN) ( (DevicePathType (FlowControl) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (FlowControl) == MSG_VENDOR_DP) && (CompareGuid (&FlowControl->Guid, &gEfiUartDevicePathGuid)) );}
开发者ID:B-Rich,项目名称:edk2,代码行数:20,
示例13: CompareDevicePaths// Compare device pathsstatic INTN CompareDevicePaths(CONST EFI_DEVICE_PATH *dp1, CONST EFI_DEVICE_PATH *dp2){ if (dp1 == NULL || dp2 == NULL) return -1; while (1) { UINT8 type1, type2; UINT8 subtype1, subtype2; UINT16 len1, len2; INTN ret; type1 = DevicePathType(dp1); type2 = DevicePathType(dp2); if (type1 != type2) return (int) type2 - (int) type1; subtype1 = DevicePathSubType(dp1); subtype2 = DevicePathSubType(dp2); if (subtype1 != subtype2) return (int) subtype1 - (int) subtype2; len1 = DevicePathNodeLength(dp1); len2 = DevicePathNodeLength(dp2); if (len1 != len2) return (int) len1 - (int) len2; ret = CompareMem(dp1, dp2, len1); if (ret != 0) return ret; if (IsDevicePathEnd(dp1)) break; dp1 = (EFI_DEVICE_PATH*) ((char *)dp1 + len1); dp2 = (EFI_DEVICE_PATH*) ((char *)dp2 + len2); } return 0;}
开发者ID:linnaea,项目名称:uefi-ntfs-multiboot,代码行数:42,
示例14: SerialControllerDriverSupported/** Check to see if this driver supports the given controller @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. @param Controller The handle of the controller to test. @param RemainingDevicePath A pointer to the remaining portion of a device path. @return EFI_SUCCESS This driver can support the given controller**/EFI_STATUSEFIAPISerialControllerDriverSupported ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ){ EFI_STATUS Status; UART_DEVICE_PATH *Uart; UART_FLOW_CONTROL_DEVICE_PATH *FlowControl; // // Test RemainingDevicePath // if ((RemainingDevicePath != NULL) && !IsDevicePathEnd (RemainingDevicePath)) { Status = EFI_UNSUPPORTED; Uart = SkipControllerDevicePathNode (RemainingDevicePath, NULL, NULL); if (DevicePathType (Uart) != MESSAGING_DEVICE_PATH || DevicePathSubType (Uart) != MSG_UART_DP || DevicePathNodeLength (Uart) != sizeof (UART_DEVICE_PATH) ) { return EFI_UNSUPPORTED; } // // Do a rough check because Clock Rate is unknown until DriverBindingStart() // if (!VerifyUartParameters (0, Uart->BaudRate, Uart->DataBits, Uart->Parity, Uart->StopBits, NULL, NULL)) { return EFI_UNSUPPORTED; } FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Uart); if (IsUartFlowControlDevicePathNode (FlowControl)) { // // If the second node is Flow Control Node, // return error when it request other than hardware flow control. // if ((ReadUnaligned32 (&FlowControl->FlowControlMap) & ~UART_FLOW_CONTROL_HARDWARE) != 0) { return EFI_UNSUPPORTED; } } } Status = IsSioSerialController (Controller); if (EFI_ERROR (Status)) { Status = IsPciSerialController (Controller); } return Status;}
开发者ID:MattDevo,项目名称:edk2,代码行数:62,
示例15: SEnvPrintDevicePathEntryVOIDSEnvPrintDevicePathEntry ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN Verbose )/*++Routine Description:Arguments: DevicePath - The device path Verbose - VerboseReturns:--*/{ UINT8 Type; UINT8 SubType; INTN Index; // // Process print device path entry // Type = (UINT8) DevicePathType (DevicePath); SubType = DevicePathSubType (DevicePath); for (Index = 0; SEnvDP_Strings[Index].Type != END_DEVICE_PATH_TYPE; Index++) { if (Type == SEnvDP_Strings[Index].Type) { if (SubType > SEnvDP_Strings[Index].MaxSubType) { SubType = 0; } PrintToken ( STRING_TOKEN (STR_SHELLENV_DPROT_DEVICE_PATH_FOR), HiiEnvHandle, SEnvDP_Strings[Index].TypeString, SEnvDP_Strings[Index].SubTypeStr[SubType] ); if (Verbose) { if (SEnvDP_Strings[Index].Function != NULL) { SEnvDP_Strings[Index].Function (DevicePath); } } return ; } } PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_DEVICE_PATH_ERROR), HiiEnvHandle);}
开发者ID:DYX884877791,项目名称:edk-Shell,代码行数:51,
示例16: EfiGetNameGuidFromFwVolDevicePathNodeEFIAPIEfiGetNameGuidFromFwVolDevicePathNode ( IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode){ ASSERT (FvDevicePathNode != NULL); if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH && DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_PIWG_FW_FILE_DP) { return (EFI_GUID *) &FvDevicePathNode->FvFileName; } return NULL;}
开发者ID:shivamurthy,项目名称:hikey-edk2,代码行数:14,
示例17: HttpBootParseFilePath/** Get the URI address string from the input device path. Caller need to free the buffer in the UriAddress pointer. @param[in] FilePath Pointer to the device path which contains a URI device path node. @param[out] UriAddress The URI address string extract from the device path. @retval EFI_SUCCESS The URI string is returned. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.**/EFI_STATUSHttpBootParseFilePath ( IN EFI_DEVICE_PATH_PROTOCOL *FilePath, OUT CHAR8 **UriAddress ){ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; URI_DEVICE_PATH *UriDevicePath; CHAR8 *Uri; UINTN UriStrLength; if (FilePath == NULL) { return EFI_INVALID_PARAMETER; } *UriAddress = NULL; // // Extract the URI address from the FilePath // TempDevicePath = FilePath; while (!IsDevicePathEnd (TempDevicePath)) { if ((DevicePathType (TempDevicePath) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (TempDevicePath) == MSG_URI_DP)) { UriDevicePath = (URI_DEVICE_PATH*) TempDevicePath; // // UEFI Spec doesn't require the URI to be a NULL-terminated string // So we allocate a new buffer and always append a '/0' to it. // UriStrLength = DevicePathNodeLength (UriDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); if (UriStrLength == 0) { // // return a NULL UriAddress if it's a empty URI device path node. // break; } Uri = AllocatePool (UriStrLength + 1); if (Uri == NULL) { return EFI_OUT_OF_RESOURCES; } CopyMem (Uri, UriDevicePath->Uri, DevicePathNodeLength (UriDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL)); Uri[DevicePathNodeLength (UriDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL)] = '/0'; *UriAddress = Uri; } TempDevicePath = NextDevicePathNode (TempDevicePath); } return EFI_SUCCESS;}
开发者ID:kraxel,项目名称:edk2,代码行数:62,
示例18: GetDeviceConsistMappingInfo/** Function to walk the device path looking for a dumpable node. @param[in] MappingItem The Item to fill with data. @param[in] DevicePath The path of the item to get data on. @return EFI_SUCCESS Always returns success.**/EFI_STATUSEFIAPIGetDeviceConsistMappingInfo ( IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath ){ VOID (EFIAPI *SerialFun) (EFI_DEVICE_PATH_PROTOCOL *, DEVICE_CONSIST_MAPPING_INFO *); UINTN Index; ASSERT(DevicePath != NULL); ASSERT(MappingItem != NULL); SetMem (&MappingItem->Csd, sizeof (POOL_PRINT), 0); while (!IsDevicePathEnd (DevicePath)) { // // Find the handler to dump this device path node // SerialFun = NULL; for (Index = 0; DevPathConsistMappingTable[Index].SerialFun != NULL; Index += 1) { if (DevicePathType (DevicePath) == DevPathConsistMappingTable[Index].Type && DevicePathSubType (DevicePath) == DevPathConsistMappingTable[Index].SubType ) { SerialFun = DevPathConsistMappingTable[Index].SerialFun; break; } } // // If not found, use a generic function // if (!SerialFun) { SerialFun = DevPathSerialDefault; } SerialFun (DevicePath, MappingItem); // // Next device path node // DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (DevicePath); } return EFI_SUCCESS;}
开发者ID:B-Rich,项目名称:edk2,代码行数:55,
示例19: simple_schemestatic INTNsimple_scheme(device_t *tab, UINTN n){ EFI_DEVICE_PATH *dp1, *dp; devices_types_t *p; UINTN i; /* * note that this test is necessary but not sufficient to guarantee that this scheme * will work because, we have no way of detecting that the machine got actually * rebooted if the EDD30 variable was forced. this comes from the fact, that elilo * can be invoked once, aborted and then restarted with no machine reboot. * * XXX: there may be a way to detect this with the another variable which would * be in volatile memory only */ if (elilo_opt.edd30_on == 0) { VERB_PRT(4, Print(L"%s device naming scheme only works with EDD3.0 enabled/n", NAMING_SCHEME)); return -1; } for(i=0; i < n; i++) { dp = DevicePathFromHandle(tab[i].dev); if (dp == NULL) { ERR_PRT((L"cannot get device path for device %d", i)); continue; } dp1 = dp = UnpackDevicePath(dp); while (!IsDevicePathEnd(dp)) { p = dev_types; while (p->type) { if ( p->type == DevicePathType(dp) && p->subtype == DevicePathSubType(dp)) { (*p->device_func)(tab+i, dp); goto done; } p++; } dp = NextDevicePathNode(dp); }done: FreePool(dp1); } return 0;}
开发者ID:jeppeter,项目名称:elilo,代码行数:47,
示例20: EfiGetNameGuidFromFwVolDevicePathNodeEFIAPIEfiGetNameGuidFromFwVolDevicePathNode ( IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode ){ ASSERT (FvDevicePathNode != NULL); // // EFI Specification extension on Media Device Path. MEDIA_FW_VOL_FILEPATH_DEVICE_PATH is adopted by UEFI later and added in UEFI2.10. // In EdkCompatibility Package, we only support MEDIA_FW_VOL_FILEPATH_DEVICE_PATH that complies with // EFI 1.10 and UEFI 2.10. // if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH && DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_PIWG_FW_FILE_DP) { return (EFI_GUID *) &FvDevicePathNode->FvFileName; } return NULL;}
开发者ID:bhanug,项目名称:virtualbox,代码行数:19,
示例21: EblPrintLoadFileInfo /** Print information about the Load File devices. If the device supports PXE dump out extra information @param File Open File for the device**/VOIDEblPrintLoadFileInfo ( IN EFI_OPEN_FILE *File ){ EFI_DEVICE_PATH_PROTOCOL *DevicePathNode; MAC_ADDR_DEVICE_PATH *MacAddr; UINTN HwAddressSize; UINTN Index; if (File == NULL) { return; } AsciiPrint (" %a: %a ", File->DeviceName, EblLoadFileBootTypeString (File->EfiHandle)); if (File->DevicePath != NULL) { // Try to print out the MAC address for (DevicePathNode = File->DevicePath; !IsDevicePathEnd (DevicePathNode); DevicePathNode = NextDevicePathNode (DevicePathNode)) { if ((DevicePathType (DevicePathNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePathNode) == MSG_MAC_ADDR_DP)) { MacAddr = (MAC_ADDR_DEVICE_PATH *)DevicePathNode; HwAddressSize = sizeof (EFI_MAC_ADDRESS); if (MacAddr->IfType == 0x01 || MacAddr->IfType == 0x00) { HwAddressSize = 6; } AsciiPrint ("MAC "); for (Index = 0; Index < HwAddressSize; Index++) { AsciiPrint ("%02x", MacAddr->MacAddress.Addr[Index] & 0xff); } } } } AsciiPrint ("/n"); EfiClose (File); return;}
开发者ID:FishYu1222,项目名称:edk2,代码行数:49,
示例22: FindSubDevicePathstatic EFI_STATUSFindSubDevicePath(EFI_DEVICE_PATH *In, UINT8 Type, UINT8 SubType, EFI_DEVICE_PATH **Out){ EFI_DEVICE_PATH *dp = In; if (!In || !Out) return EFI_INVALID_PARAMETER; for (dp = In; !IsDevicePathEnd(dp); dp = NextDevicePathNode(dp)) { if (DevicePathType(dp) == Type && DevicePathSubType(dp) == SubType) { *Out = DuplicateDevicePath(dp); if (!*Out) return EFI_OUT_OF_RESOURCES; return EFI_SUCCESS; } } *Out = NULL; return EFI_NOT_FOUND;}
开发者ID:Acidburn0zzz,项目名称:shim,代码行数:20,
示例23: RetrieveUartUid/** Retrieve ACPI UID of UART from device path @param Handle The handle for the UART device. @param AcpiUid The ACPI UID on output. @retval TRUE Find valid UID from device path @retval FALSE Can't find**/BOOLEANRetrieveUartUid ( IN EFI_HANDLE Handle, IN OUT UINT32 *AcpiUid ){ EFI_STATUS Status; ACPI_HID_DEVICE_PATH *Acpi; EFI_DEVICE_PATH_PROTOCOL *DevicePath; Status = gBS->HandleProtocol ( Handle, &gEfiDevicePathProtocolGuid, (VOID **) &DevicePath ); if (EFI_ERROR (Status)) { return FALSE; } Acpi = NULL; for (; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) { if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePath) == MSG_UART_DP)) { break; } // // Acpi points to the node before the Uart node // Acpi = (ACPI_HID_DEVICE_PATH *) DevicePath; } if ((Acpi != NULL) && IsIsaSerialNode (Acpi)) { if (AcpiUid != NULL) { CopyMem (AcpiUid, &Acpi->UID, sizeof (UINT32)); } return TRUE; } else { return FALSE; }}
开发者ID:B-Rich,项目名称:edk2,代码行数:49,
示例24: BmDevicePathType/** For a bootable Device path, return its boot type. @param DevicePath The bootable device Path to check @retval AcpiFloppyBoot If given device path contains ACPI_DEVICE_PATH type device path node which HID is floppy device. @retval MessageAtapiBoot If given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_ATAPI_DP. @retval MessageSataBoot If given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_SATA_DP. @retval MessageScsiBoot If given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_SCSI_DP. @retval MessageUsbBoot If given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_USB_DP. @retval BmMiscBoot If tiven device path doesn't match the above condition.**/BM_BOOT_TYPEBmDevicePathType ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath ){ EFI_DEVICE_PATH_PROTOCOL *Node; EFI_DEVICE_PATH_PROTOCOL *NextNode; ASSERT (DevicePath != NULL); for (Node = DevicePath; !IsDevicePathEndType (Node); Node = NextDevicePathNode (Node)) { switch (DevicePathType (Node)) { case ACPI_DEVICE_PATH: if (EISA_ID_TO_NUM (((ACPI_HID_DEVICE_PATH *) Node)->HID) == 0x0604) { return BmAcpiFloppyBoot; } break; case HARDWARE_DEVICE_PATH: if (DevicePathSubType (Node) == HW_CONTROLLER_DP) { return BmHardwareDeviceBoot; } break; case MESSAGING_DEVICE_PATH: // // Skip LUN device node // NextNode = Node; do { NextNode = NextDevicePathNode (NextNode); } while ( (DevicePathType (NextNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType(NextNode) == MSG_DEVICE_LOGICAL_UNIT_DP) ); // // If the device path not only point to driver device, it is not a messaging device path, // if (!IsDevicePathEndType (NextNode)) { continue; } switch (DevicePathSubType (Node)) { case MSG_ATAPI_DP: return BmMessageAtapiBoot; break; case MSG_SATA_DP: return BmMessageSataBoot; break; case MSG_USB_DP: return BmMessageUsbBoot; break; case MSG_SCSI_DP: return BmMessageScsiBoot; break; } } } return BmMiscBoot;}
开发者ID:M1cha,项目名称:edk2,代码行数:84,
示例25: BmGetNetworkDescription/** Return the description for network boot device. @param Handle Controller handle. @return The description string.**/CHAR16 *BmGetNetworkDescription ( IN EFI_HANDLE Handle ){ EFI_STATUS Status; EFI_DEVICE_PATH_PROTOCOL *DevicePath; MAC_ADDR_DEVICE_PATH *Mac; VLAN_DEVICE_PATH *Vlan; EFI_DEVICE_PATH_PROTOCOL *Ip; EFI_DEVICE_PATH_PROTOCOL *Uri; CHAR16 *Description; UINTN DescriptionSize; Status = gBS->OpenProtocol ( Handle, &gEfiLoadFileProtocolGuid, NULL, gImageHandle, Handle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL ); if (EFI_ERROR (Status)) { return NULL; } Status = gBS->OpenProtocol ( Handle, &gEfiDevicePathProtocolGuid, (VOID **) &DevicePath, gImageHandle, Handle, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status) || (DevicePath == NULL)) { return NULL; } // // The PXE device path is like: // ....../Mac(...)[/Vlan(...)] // ....../Mac(...)[/Vlan(...)]/IPv4(...) // ....../Mac(...)[/Vlan(...)]/IPv6(...) // // The HTTP device path is like: // ....../Mac(...)[/Vlan(...)]/IPv4(...)/Uri(...) // ....../Mac(...)[/Vlan(...)]/IPv6(...)/Uri(...) // while (!IsDevicePathEnd (DevicePath) && ((DevicePathType (DevicePath) != MESSAGING_DEVICE_PATH) || (DevicePathSubType (DevicePath) != MSG_MAC_ADDR_DP)) ) { DevicePath = NextDevicePathNode (DevicePath); } if (IsDevicePathEnd (DevicePath)) { return NULL; } Mac = (MAC_ADDR_DEVICE_PATH *) DevicePath; DevicePath = NextDevicePathNode (DevicePath); if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePath) == MSG_VLAN_DP) ) { Vlan = (VLAN_DEVICE_PATH *) DevicePath; DevicePath = NextDevicePathNode (DevicePath); } else { Vlan = NULL; } if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && ((DevicePathSubType (DevicePath) == MSG_IPv4_DP) || (DevicePathSubType (DevicePath) == MSG_IPv6_DP)) ) { Ip = DevicePath; DevicePath = NextDevicePathNode (DevicePath); } else { Ip = NULL; } if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePath) == MSG_URI_DP) ) { Uri = DevicePath; DevicePath = NextDevicePathNode (DevicePath); } else { Uri = NULL; } // // Build description like below: // "PXEv6 (MAC:112233445566 VLAN1)"//.........这里部分代码省略.........
开发者ID:M1cha,项目名称:edk2,代码行数:101,
示例26: GetFileName/** Get file name from device path. The file name may contain one or more device path node. Save the file name in a buffer if file name is found. The caller is responsible to free the buffer. @param[in] DevicePath A pointer to a device path. @param[out] FileName The callee allocated buffer to save the file name if file name is found. @param[out] FileNameOffset The offset of file name in device path if file name is found. @retval UINTN The file name length. 0 means file name is not found.**/UINTNGetFileName ( IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINT8 **FileName, OUT UINTN *FileNameOffset ){ UINTN Length; EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath; EFI_DEVICE_PATH_PROTOCOL *RootDevicePath; CHAR8 *NodeStr; UINTN NodeStrLength; CHAR16 LastNodeChar; CHAR16 FirstNodeChar; // // Get the length of DevicePath before file name. // Length = 0; RootDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)DevicePath; while (!IsDevicePathEnd (RootDevicePath)) { if ((DevicePathType(RootDevicePath) == MEDIA_DEVICE_PATH) && (DevicePathSubType(RootDevicePath) == MEDIA_FILEPATH_DP)) { break; } Length += DevicePathNodeLength (RootDevicePath); RootDevicePath = NextDevicePathNode (RootDevicePath); } *FileNameOffset = Length; if (Length == 0) { return 0; } // // Get the file name length. // Length = 0; TmpDevicePath = RootDevicePath; while (!IsDevicePathEnd (TmpDevicePath)) { if ((DevicePathType(TmpDevicePath) != MEDIA_DEVICE_PATH) || (DevicePathSubType(TmpDevicePath) != MEDIA_FILEPATH_DP)) { break; } Length += DevicePathNodeLength (TmpDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL); TmpDevicePath = NextDevicePathNode (TmpDevicePath); } if (Length == 0) { return 0; } *FileName = AllocateZeroPool (Length); ASSERT (*FileName != NULL); // // Copy the file name to the buffer. // Length = 0; LastNodeChar = '//'; TmpDevicePath = RootDevicePath; while (!IsDevicePathEnd (TmpDevicePath)) { if ((DevicePathType(TmpDevicePath) != MEDIA_DEVICE_PATH) || (DevicePathSubType(TmpDevicePath) != MEDIA_FILEPATH_DP)) { break; } FirstNodeChar = (CHAR16) ReadUnaligned16 ((UINT16 *)((UINT8 *)TmpDevicePath + sizeof (EFI_DEVICE_PATH_PROTOCOL))); NodeStr = (CHAR8 *)TmpDevicePath + sizeof (EFI_DEVICE_PATH_PROTOCOL); NodeStrLength = DevicePathNodeLength (TmpDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof(CHAR16); if ((FirstNodeChar == '//') && (LastNodeChar == '//')) { // // Skip separator "/" when there are two separators. // NodeStr += sizeof (CHAR16); NodeStrLength -= sizeof (CHAR16); } else if ((FirstNodeChar != '//') && (LastNodeChar != '//')) { // // Add separator "/" when there is no separator. // WriteUnaligned16 ((UINT16 *)(*FileName + Length), '//'); Length += sizeof (CHAR16); } CopyMem (*FileName + Length, NodeStr, NodeStrLength); Length += NodeStrLength; LastNodeChar = (CHAR16) ReadUnaligned16 ((UINT16 *) (NodeStr + NodeStrLength - sizeof(CHAR16))); TmpDevicePath = NextDevicePathNode (TmpDevicePath); }//.........这里部分代码省略.........
开发者ID:jeppeter,项目名称:vbox,代码行数:101,
示例27: GetFileType//.........这里部分代码省略......... &gEfiFirmwareVolume2ProtocolGuid, &TempDevicePath, &DeviceHandle ); if (!EFI_ERROR (Status)) { Status = gBS->OpenProtocol ( DeviceHandle, &gEfiFirmwareVolume2ProtocolGuid, NULL, NULL, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL ); if (!EFI_ERROR (Status)) { return IMAGE_FROM_FV; } } // // Next check to see if File is from a Block I/O device // DeviceHandle = NULL; TempDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)File; Status = gBS->LocateDevicePath ( &gEfiBlockIoProtocolGuid, &TempDevicePath, &DeviceHandle ); if (!EFI_ERROR (Status)) { BlockIo = NULL; Status = gBS->OpenProtocol ( DeviceHandle, &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo, NULL, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (!EFI_ERROR (Status) && BlockIo != NULL) { if (BlockIo->Media != NULL) { if (BlockIo->Media->RemovableMedia) { // // Block I/O is present and specifies the media is removable // return IMAGE_FROM_REMOVABLE_MEDIA; } else { // // Block I/O is present and specifies the media is not removable // return IMAGE_FROM_FIXED_MEDIA; } } } } // // File is not in a Firmware Volume or on a Block I/O device, so check to see if // the device path supports the Simple File System Protocol. // DeviceHandle = NULL; TempDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)File; Status = gBS->LocateDevicePath ( &gEfiSimpleFileSystemProtocolGuid, &TempDevicePath, &DeviceHandle ); if (!EFI_ERROR (Status)) { // // Simple File System is present without Block I/O, so assume media is fixed. // return IMAGE_FROM_FIXED_MEDIA; } // // File is not from an FV, Block I/O or Simple File System, so the only options // left are a PCI Option ROM and a Load File Protocol such as a PXE Boot from a NIC. // TempDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)File; while (!IsDevicePathEndType (TempDevicePath)) { switch (DevicePathType (TempDevicePath)) { case MEDIA_DEVICE_PATH: if (DevicePathSubType (TempDevicePath) == MEDIA_RELATIVE_OFFSET_RANGE_DP) { return IMAGE_FROM_OPTION_ROM; } break; case MESSAGING_DEVICE_PATH: if (DevicePathSubType(TempDevicePath) == MSG_MAC_ADDR_DP) { return IMAGE_FROM_REMOVABLE_MEDIA; } break; default: break; } TempDevicePath = NextDevicePathNode (TempDevicePath); } return IMAGE_UNKNOWN;}
开发者ID:jeppeter,项目名称:vbox,代码行数:101,
示例28: UpdateBootManager/** This function invokes Boot Manager. If all devices have not a chance to be connected, the connect all will be triggered. It then enumerate all boot options. If a boot option from the Boot Manager page is selected, Boot Manager will boot from this boot option. **/VOIDUpdateBootManager ( VOID ){ UINTN Index; EFI_BOOT_MANAGER_LOAD_OPTION *BootOption; UINTN BootOptionCount; EFI_STRING_ID Token; CHAR16 *HelpString; EFI_STRING_ID HelpToken; UINT16 *TempStr; EFI_HII_HANDLE HiiHandle; UINTN TempSize; VOID *StartOpCodeHandle; VOID *EndOpCodeHandle; EFI_IFR_GUID_LABEL *StartLabel; EFI_IFR_GUID_LABEL *EndLabel; UINT16 DeviceType; BOOLEAN IsLegacyOption; BOOLEAN NeedEndOp; UINTN MaxLen; DeviceType = (UINT16) -1; EfiBootManagerConnectAll (); // // for better user experience // 1. User changes HD configuration (e.g.: unplug HDD), here we have a chance to remove the HDD boot option // 2. User enables/disables UEFI PXE, here we have a chance to add/remove EFI Network boot option // EfiBootManagerRefreshAllBootOption (); // // BdsDxe doesn't group the legacy boot options for the same device type // It's UI's choice. // GroupMultipleLegacyBootOption4SameType (); BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot); HiiHandle = gBootManagerPrivate.HiiHandle; // // Allocate space for creation of UpdateData Buffer // StartOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (StartOpCodeHandle != NULL); EndOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (EndOpCodeHandle != NULL); // // Create Hii Extend Label OpCode as the start opcode // StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; StartLabel->Number = LABEL_BOOT_OPTION; // // Create Hii Extend Label OpCode as the end opcode // EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; EndLabel->Number = LABEL_BOOT_OPTION_END; mKeyInput = 0; NeedEndOp = FALSE; for (Index = 0; Index < BootOptionCount; Index++) { // // At this stage we are creating a menu entry, thus the Keys are reproduceable // mKeyInput++; // // Don't display the hidden/inactive boot option // if (((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) || ((BootOption[Index].Attributes & LOAD_OPTION_ACTIVE) == 0)) { continue; } // // Group the legacy boot option in the sub title created dynamically // IsLegacyOption = (BOOLEAN) ( (DevicePathType (BootOption[Index].FilePath) == BBS_DEVICE_PATH) && (DevicePathSubType (BootOption[Index].FilePath) == BBS_BBS_DP) ); if (!IsLegacyOption && NeedEndOp) { NeedEndOp = FALSE; HiiCreateEndOpCode (StartOpCodeHandle); }//.........这里部分代码省略.........
开发者ID:wensunshine,项目名称:VisualUefi,代码行数:101,
注:本文中的DevicePathSubType函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DevicePathToStr函数代码示例 C++ DevicePathNodeLength函数代码示例 |