本文整理汇总了C++中DevicePathSubType函数的典型用法代码示例。如果您正苦于以下问题:C++ DevicePathSubType函数的具体用法?C++ DevicePathSubType怎么用?C++ DevicePathSubType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DevicePathSubType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DevicePathInstance
EFI_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;
}
示例2: disk_get_part_uuid
EFI_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;
}
示例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);
}
}
示例4: BdsLoadOptionPxeList
EFI_STATUS
BdsLoadOptionPxeList (
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;
}
示例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.
**/
BOOLEAN
EFIAPI
IsDevicePathEndInstance (
IN CONST VOID *Node
)
{
ASSERT (Node != NULL);
return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
}
示例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
**/
VOID
ChangeVariableDevicePath (
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);
}
}
示例7: DevicePathSubType
static 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;
}
示例8: get_pci_device_path
PCI_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;
}
示例9: GetNextDevicePathInstance
EFIAPI
GetNextDevicePathInstance (
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;
}
示例10: GetFloppyDevicePath
/**
* Get the device path of floppy disk.
*/
EFI_STATUS
GetFloppyDevicePath (
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;
}
示例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.
**/
BOOLEAN
IsIsaSerialNode (
IN ACPI_HID_DEVICE_PATH *Acpi
)
{
return (BOOLEAN) (
(DevicePathType (Acpi) == ACPI_DEVICE_PATH) &&
(DevicePathSubType (Acpi) == ACPI_DP) &&
(ReadUnaligned32 (&Acpi->HID) == EISA_PNP_ID (0x0501))
);
}
示例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.
**/
BOOLEAN
IsUartFlowControlNode (
IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl
)
{
return (BOOLEAN) (
(DevicePathType (FlowControl) == MESSAGING_DEVICE_PATH) &&
(DevicePathSubType (FlowControl) == MSG_VENDOR_DP) &&
(CompareGuid (&FlowControl->Guid, &gEfiUartDevicePathGuid))
);
}
示例13: CompareDevicePaths
// Compare device paths
static 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;
}
示例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_STATUS
EFIAPI
SerialControllerDriverSupported (
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;
}
示例15: SEnvPrintDevicePathEntry
VOID
SEnvPrintDevicePathEntry (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN BOOLEAN Verbose
)
/*++
Routine Description:
Arguments:
DevicePath - The device path
Verbose - Verbose
Returns:
--*/
{
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);
}