-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- DevicePathToText.c\r
-\r
-Abstract:\r
-\r
+/** @file\r
DevicePathToText protocol as defined in the UEFI 2.0 specification.\r
\r
---*/\r
-\r
-#include "DevicePath.h"\r
-\r
-STATIC\r
-EFI_DEVICE_PATH_PROTOCOL *\r
-UnpackDevicePath (\r
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Function unpacks a device path data structure so that all the nodes of a device path \r
- are naturally aligned.\r
-\r
- Arguments:\r
- DevPath - A pointer to a device path data structure\r
-\r
- Returns:\r
- If the memory for the device path is successfully allocated, then a pointer to the \r
- new device path is returned. Otherwise, NULL is returned.\r
-\r
---*/\r
-{\r
- EFI_DEVICE_PATH_PROTOCOL *Src;\r
- EFI_DEVICE_PATH_PROTOCOL *Dest;\r
- EFI_DEVICE_PATH_PROTOCOL *NewPath;\r
- UINTN Size;\r
-\r
- if (DevPath == NULL) {\r
- return NULL;\r
- }\r
- //\r
- // Walk device path and round sizes to valid boundries\r
- //\r
- Src = DevPath;\r
- Size = 0;\r
- for (;;) {\r
- Size += DevicePathNodeLength (Src);\r
- Size += ALIGN_SIZE (Size);\r
-\r
- if (IsDevicePathEnd (Src)) {\r
- break;\r
- }\r
-\r
- Src = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (Src);\r
- }\r
- //\r
- // Allocate space for the unpacked path\r
- //\r
- NewPath = AllocateZeroPool (Size);\r
- if (NewPath != NULL) {\r
-\r
- ASSERT (((UINTN) NewPath) % MIN_ALIGNMENT_SIZE == 0);\r
-\r
- //\r
- // Copy each node\r
- //\r
- Src = DevPath;\r
- Dest = NewPath;\r
- for (;;) {\r
- Size = DevicePathNodeLength (Src);\r
- CopyMem (Dest, Src, Size);\r
- Size += ALIGN_SIZE (Size);\r
- SetDevicePathNodeLength (Dest, Size);\r
- Dest->Type |= EFI_DP_TYPE_UNPACKED;\r
- Dest = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) Dest) + Size);\r
-\r
- if (IsDevicePathEnd (Src)) {\r
- break;\r
- }\r
-\r
- Src = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (Src);\r
- }\r
- }\r
-\r
- return NewPath;\r
-}\r
-\r
-STATIC\r
-VOID *\r
-ReallocatePool (\r
- IN VOID *OldPool,\r
- IN UINTN OldSize,\r
- IN UINTN NewSize\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Adjusts the size of a previously allocated buffer.\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
\r
- Arguments:\r
- OldPool - A pointer to the buffer whose size is being adjusted.\r
- OldSize - The size of the current buffer.\r
- NewSize - The size of the new buffer.\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
- Returns:\r
- EFI_SUCEESS - The requested number of bytes were allocated.\r
- EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.\r
- EFI_INVALID_PARAMETER - The buffer was invalid.\r
+**/\r
\r
---*/\r
-{\r
- VOID *NewPool;\r
+#include "DevicePath.h"\r
\r
- NewPool = NULL;\r
- if (NewSize) {\r
- NewPool = AllocateZeroPool (NewSize);\r
- }\r
+/**\r
+ Concatenates a formatted unicode string to allocated pool. The caller must\r
+ free the resulting buffer.\r
\r
- if (OldPool) {\r
- if (NewPool) {\r
- CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);\r
- }\r
+ @param Str Tracks the allocated pool, size in use, and\r
+ amount of pool allocated.\r
+ @param Fmt The format string\r
+ @param ... Variable arguments based on the format string.\r
\r
- FreePool (OldPool);\r
- }\r
+ @return Allocated buffer with the formatted string printed in it.\r
+ The caller must free the allocated buffer. The buffer\r
+ allocation is not packed.\r
\r
- return NewPool;\r
-}\r
-\r
-STATIC\r
+**/\r
CHAR16 *\r
+EFIAPI\r
CatPrint (\r
IN OUT POOL_PRINT *Str,\r
IN CHAR16 *Fmt,\r
...\r
)\r
-/*++\r
-\r
- Routine Description:\r
- Concatenates a formatted unicode string to allocated pool. \r
- The caller must free the resulting buffer.\r
-\r
- Arguments:\r
- Str - Tracks the allocated pool, size in use, and \r
- amount of pool allocated.\r
- Fmt - The format string\r
-\r
- Returns:\r
- Allocated buffer with the formatted string printed in it. \r
- The caller must free the allocated buffer. The buffer\r
- allocation is not packed.\r
-\r
---*/\r
{\r
UINT16 *AppendStr;\r
+ UINTN AppendCount;\r
VA_LIST Args;\r
- UINTN Size;\r
\r
AppendStr = AllocateZeroPool (0x1000);\r
- if (AppendStr == NULL) {\r
- return Str->Str;\r
- }\r
+ ASSERT (AppendStr != NULL);\r
\r
VA_START (Args, Fmt);\r
- UnicodeVSPrint (AppendStr, 0x1000, Fmt, Args);\r
+ AppendCount = UnicodeVSPrint (AppendStr, 0x1000, Fmt, Args);\r
VA_END (Args);\r
- if (NULL == Str->Str) {\r
- Size = StrSize (AppendStr);\r
- Str->Str = AllocateZeroPool (Size);\r
- ASSERT (Str->Str != NULL);\r
- } else {\r
- Size = StrSize (AppendStr) - sizeof (UINT16);\r
- Size = Size + StrSize (Str->Str);\r
+\r
+ if (Str->Length + AppendCount * sizeof (CHAR16) > Str->Capacity) {\r
+ Str->Capacity = Str->Length + (AppendCount + 1) * sizeof (CHAR16) * 2;\r
Str->Str = ReallocatePool (\r
- Str->Str,\r
- StrSize (Str->Str),\r
- Size\r
- );\r
+ Str->Length,\r
+ Str->Capacity,\r
+ Str->Str\r
+ );\r
ASSERT (Str->Str != NULL);\r
}\r
\r
- Str->MaxLen = MAX_CHAR * sizeof (UINT16);\r
- if (Size < Str->MaxLen) {\r
+ if (Str->Length == 0) {\r
+ StrCpy (Str->Str, AppendStr);\r
+ Str->Length = (AppendCount + 1) * sizeof (CHAR16);\r
+ } else {\r
StrCat (Str->Str, AppendStr);\r
- Str->Len = Size - sizeof (UINT16);\r
+ Str->Length += AppendCount * sizeof (CHAR16);\r
}\r
\r
FreePool (AppendStr);\r
return Str->Str;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a PCI device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextPci (\r
IN OUT POOL_PRINT *Str,\r
PCI_DEVICE_PATH *Pci;\r
\r
Pci = DevPath;\r
- CatPrint (Str, L"Pci(%x,%x)", Pci->Function, Pci->Device);\r
+ CatPrint (Str, L"Pci(0x%x,0x%x)", Pci->Device, Pci->Function);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a PC Card device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextPccard (\r
IN OUT POOL_PRINT *Str,\r
PCCARD_DEVICE_PATH *Pccard;\r
\r
Pccard = DevPath;\r
- CatPrint (Str, L"PcCard(%x)", Pccard->FunctionNumber);\r
+ CatPrint (Str, L"PcCard(0x%x)", Pccard->FunctionNumber);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a Memory Map device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextMemMap (\r
IN OUT POOL_PRINT *Str,\r
MemMap = DevPath;\r
CatPrint (\r
Str,\r
- L"MemoryMapped(%lx,%lx)",\r
+ L"MemoryMapped(0x%x,0x%lx,0x%lx)",\r
+ MemMap->MemoryType,\r
MemMap->StartingAddress,\r
MemMap->EndingAddress\r
);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a Vendor device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextVendor (\r
IN OUT POOL_PRINT *Str,\r
VENDOR_DEVICE_PATH *Vendor;\r
CHAR16 *Type;\r
UINTN Index;\r
+ UINTN DataLength;\r
UINT32 FlowControlMap;\r
UINT16 Info;\r
\r
} else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {\r
CatPrint (Str, L"VenUft8()");\r
return ;\r
- } else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingUartFlowControlGuid)) {\r
+ } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {\r
FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);\r
switch (FlowControlMap & 0x00000003) {\r
case 0:\r
}\r
\r
return ;\r
- } else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingSASGuid)) {\r
+ } else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) {\r
CatPrint (\r
Str,\r
- L"SAS(%lx,%lx,%x,",\r
+ L"SAS(0x%lx,0x%lx,0x%x,",\r
((SAS_DEVICE_PATH *) Vendor)->SasAddress,\r
((SAS_DEVICE_PATH *) Vendor)->Lun,\r
((SAS_DEVICE_PATH *) Vendor)->RelativeTargetPort\r
CatPrint (\r
Str,\r
L"%s,%s,%s,",\r
- (Info & (0x1 << 4)) ? L"SATA" : L"SAS",\r
- (Info & (0x1 << 5)) ? L"External" : L"Internal",\r
- (Info & (0x1 << 6)) ? L"Expanded" : L"Direct"\r
+ ((Info & (0x1 << 4)) != 0) ? L"SATA" : L"SAS",\r
+ ((Info & (0x1 << 5)) != 0) ? L"External" : L"Internal",\r
+ ((Info & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct"\r
);\r
if ((Info & 0x0f) == 1) {\r
CatPrint (Str, L"0,");\r
} else {\r
- CatPrint (Str, L"%x,", (Info >> 8) & 0xff);\r
+ CatPrint (Str, L"0x%x,", (Info >> 8) & 0xff);\r
}\r
} else {\r
CatPrint (Str, L"0,0,0,0,");\r
}\r
\r
- CatPrint (Str, L"%x)", ((SAS_DEVICE_PATH *) Vendor)->Reserved);\r
+ CatPrint (Str, L"0x%x)", ((SAS_DEVICE_PATH *) Vendor)->Reserved);\r
return ;\r
} else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {\r
CatPrint (Str, L"DebugPort()");\r
return ;\r
- } else {\r
- return ;\r
- //\r
- // reserved\r
- //\r
}\r
}\r
break;\r
break;\r
}\r
\r
- CatPrint (Str, L"Ven%s(%g,", Type, &Vendor->Guid);\r
- for (Index = 0; Index < DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH); Index++) {\r
- CatPrint (Str, L"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);\r
+ DataLength = DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH);\r
+ CatPrint (Str, L"Ven%s(%g", Type, &Vendor->Guid);\r
+ if (DataLength != 0) {\r
+ CatPrint (Str, L",");\r
+ for (Index = 0; Index < DataLength; Index++) {\r
+ CatPrint (Str, L"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);\r
+ }\r
}\r
\r
CatPrint (Str, L")");\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a Controller device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextController (\r
IN OUT POOL_PRINT *Str,\r
Controller = DevPath;\r
CatPrint (\r
Str,\r
- L"Ctrl(%x)",\r
+ L"Ctrl(0x%x)",\r
Controller->ControllerNumber\r
);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a ACPI device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextAcpi (\r
IN OUT POOL_PRINT *Str,\r
\r
Acpi = DevPath;\r
if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
- if (AllowShortcuts) {\r
- switch (EISA_ID_TO_NUM (Acpi->HID)) {\r
- case 0x0a03:\r
- CatPrint (Str, L"PciRoot(%x)", Acpi->UID);\r
- break;\r
+ switch (EISA_ID_TO_NUM (Acpi->HID)) {\r
+ case 0x0a03:\r
+ CatPrint (Str, L"PciRoot(0x%x)", Acpi->UID);\r
+ break;\r
\r
- case 0x0604:\r
- CatPrint (Str, L"Floppy(%x)", Acpi->UID);\r
- break;\r
+ case 0x0a08:\r
+ CatPrint (Str, L"PcieRoot(0x%x)", Acpi->UID);\r
+ break;\r
\r
- case 0x0301:\r
- CatPrint (Str, L"Keyboard(%x)", Acpi->UID);\r
- break;\r
+ case 0x0604:\r
+ CatPrint (Str, L"Floppy(0x%x)", Acpi->UID);\r
+ break;\r
\r
- case 0x0501:\r
- CatPrint (Str, L"Serial(%x)", Acpi->UID);\r
- break;\r
+ case 0x0301:\r
+ CatPrint (Str, L"Keyboard(0x%x)", Acpi->UID);\r
+ break;\r
\r
- case 0x0401:\r
- CatPrint (Str, L"ParallelPort(%x)", Acpi->UID);\r
- break;\r
+ case 0x0501:\r
+ CatPrint (Str, L"Serial(0x%x)", Acpi->UID);\r
+ break;\r
\r
- default:\r
- break;\r
- }\r
+ case 0x0401:\r
+ CatPrint (Str, L"ParallelPort(0x%x)", Acpi->UID);\r
+ break;\r
\r
- return ;\r
+ default:\r
+ CatPrint (Str, L"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);\r
+ break;\r
}\r
-\r
- CatPrint (Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);\r
} else {\r
- CatPrint (Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);\r
+ CatPrint (Str, L"Acpi(0x%08x,0x%x)", Acpi->HID, Acpi->UID);\r
}\r
}\r
\r
-#define NextStrA(a) ((UINT8 *) (((UINT8 *) (a)) + AsciiStrLen ((CHAR8 *) (a)) + 1))\r
+/**\r
+ Converts EISA identification to string.\r
+\r
+ @param EisaId The input EISA identification.\r
+ @param Text A pointer to the output string.\r
+\r
+**/\r
+VOID\r
+EisaIdToText (\r
+ IN UINT32 EisaId,\r
+ IN OUT CHAR16 *Text\r
+ )\r
+{\r
+ CHAR16 PnpIdStr[17];\r
+\r
+ //\r
+ //UnicodeSPrint ("%X", 0x0a03) => "0000000000000A03"\r
+ //\r
+ UnicodeSPrint (PnpIdStr, 17 * 2, L"%16X", EisaId >> 16);\r
+\r
+ UnicodeSPrint (\r
+ Text,\r
+ sizeof (CHAR16) + sizeof (CHAR16) + sizeof (CHAR16) + sizeof (PnpIdStr),\r
+ L"%c%c%c%s",\r
+ '@' + ((EisaId >> 10) & 0x1f),\r
+ '@' + ((EisaId >> 5) & 0x1f),\r
+ '@' + ((EisaId >> 0) & 0x1f),\r
+ PnpIdStr + (16 - 4)\r
+ );\r
+}\r
+\r
+/**\r
+ Converts a ACPI extended HID device path structure to its string representative.\r
\r
-STATIC\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
-DevPathToTextExtAcpi (\r
+DevPathToTextAcpiEx (\r
IN OUT POOL_PRINT *Str,\r
IN VOID *DevPath,\r
IN BOOLEAN DisplayOnly,\r
IN BOOLEAN AllowShortcuts\r
)\r
{\r
- ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *AcpiExt;\r
- UINT8 *NextString;\r
+ ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;\r
+ CHAR8 *HIDStr;\r
+ CHAR8 *UIDStr;\r
+ CHAR8 *CIDStr;\r
+ CHAR16 HIDText[11];\r
+ CHAR16 CIDText[11];\r
+\r
+ AcpiEx = DevPath;\r
+ HIDStr = (CHAR8 *) (((UINT8 *) AcpiEx) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));\r
+ UIDStr = HIDStr + AsciiStrLen (HIDStr) + 1;\r
+ CIDStr = UIDStr + AsciiStrLen (UIDStr) + 1;\r
+\r
+ EisaIdToText (AcpiEx->HID, HIDText);\r
+ EisaIdToText (AcpiEx->CID, CIDText);\r
+\r
+ if ((*HIDStr == '\0') && (*CIDStr == '\0') && (AcpiEx->UID == 0)) {\r
+ //\r
+ // use AcpiExp()\r
+ //\r
+ CatPrint (\r
+ Str,\r
+ L"AcpiExp(%s,%s,%a)",\r
+ HIDText,\r
+ CIDText,\r
+ UIDStr\r
+ );\r
+ } else {\r
+ if (AllowShortcuts) {\r
+ //\r
+ // display only\r
+ //\r
+ if (AcpiEx->HID == 0) {\r
+ CatPrint (Str, L"AcpiEx(%a,", HIDStr);\r
+ } else {\r
+ CatPrint (Str, L"AcpiEx(%s,", HIDText);\r
+ }\r
\r
- AcpiExt = DevPath;\r
+ if (AcpiEx->UID == 0) {\r
+ CatPrint (Str, L"%a,", UIDStr);\r
+ } else {\r
+ CatPrint (Str, L"0x%x,", AcpiEx->UID);\r
+ }\r
\r
- if (AllowShortcuts) {\r
- NextString = NextStrA (AcpiExt->HidUidCidStr);\r
- if ((*(AcpiExt->HidUidCidStr) == '\0') &&\r
- (*(NextStrA (NextString)) == '\0') &&\r
- (AcpiExt->UID == 0)\r
- ) {\r
- if ((AcpiExt->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
- CatPrint (\r
- Str,\r
- L"AcpiExp(PNP%04x,%x,%a)",\r
- EISA_ID_TO_NUM (AcpiExt->HID),\r
- AcpiExt->CID,\r
- NextStrA (AcpiExt->HidUidCidStr)\r
- );\r
+ if (AcpiEx->CID == 0) {\r
+ CatPrint (Str, L"%a)", CIDStr);\r
} else {\r
- CatPrint (\r
- Str,\r
- L"AcpiExp(%08x,%x,%a)",\r
- AcpiExt->HID,\r
- AcpiExt->CID,\r
- NextStrA (AcpiExt->HidUidCidStr)\r
- );\r
+ CatPrint (Str, L"%s)", CIDText);\r
}\r
+ } else {\r
+ CatPrint (\r
+ Str,\r
+ L"AcpiEx(%s,%s,0x%x,%a,%a,%a)",\r
+ HIDText,\r
+ CIDText,\r
+ AcpiEx->UID,\r
+ HIDStr,\r
+ CIDStr,\r
+ UIDStr\r
+ );\r
}\r
- return ;\r
}\r
+}\r
\r
- NextString = NextStrA (AcpiExt->HidUidCidStr);\r
- NextString = NextStrA (NextString);\r
- if ((AcpiExt->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
- CatPrint (\r
- Str,\r
- L"AcpiEx(PNP%04x,%x,%x,%a,%a,%a)",\r
- EISA_ID_TO_NUM (AcpiExt->HID),\r
- AcpiExt->CID,\r
- AcpiExt->UID,\r
- AcpiExt->HidUidCidStr,\r
- NextString,\r
- NextStrA (AcpiExt->HidUidCidStr)\r
- );\r
- } else {\r
- CatPrint (\r
- Str,\r
- L"AcpiEx(%08x,%x,%x,%a,%a,%a)",\r
- AcpiExt->HID,\r
- AcpiExt->CID,\r
- AcpiExt->UID,\r
- AcpiExt->HidUidCidStr,\r
- NextString,\r
- NextStrA (AcpiExt->HidUidCidStr)\r
- );\r
+/**\r
+ Converts a ACPI address device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextAcpiAdr (\r
+ IN OUT POOL_PRINT *Str,\r
+ IN VOID *DevPath,\r
+ IN BOOLEAN DisplayOnly,\r
+ IN BOOLEAN AllowShortcuts\r
+ )\r
+{\r
+ ACPI_ADR_DEVICE_PATH *AcpiAdr;\r
+ UINT16 Index;\r
+ UINT16 Length;\r
+ UINT16 AdditionalAdrCount;\r
+\r
+ AcpiAdr = DevPath;\r
+ Length = (UINT16) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);\r
+ AdditionalAdrCount = (UINT16) ((Length - 8) / 4);\r
+\r
+ CatPrint (Str, L"AcpiAdr(0x%x", AcpiAdr->ADR);\r
+ for (Index = 0; Index < AdditionalAdrCount; Index++) {\r
+ CatPrint (Str, L",0x%x", *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));\r
}\r
+ CatPrint (Str, L")");\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a ATAPI device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextAtapi (\r
IN OUT POOL_PRINT *Str,\r
Atapi = DevPath;\r
\r
if (DisplayOnly) {\r
- CatPrint (Str, L"Ata(%x)", Atapi->Lun);\r
+ CatPrint (Str, L"Ata(0x%x)", Atapi->Lun);\r
} else {\r
CatPrint (\r
Str,\r
- L"Ata(%s,%s,%x)",\r
- Atapi->PrimarySecondary ? L"Secondary" : L"Primary",\r
- Atapi->SlaveMaster ? L"Slave" : L"Master",\r
+ L"Ata(%s,%s,0x%x)",\r
+ (Atapi->PrimarySecondary == 1) ? L"Secondary" : L"Primary",\r
+ (Atapi->SlaveMaster == 1) ? L"Slave" : L"Master",\r
Atapi->Lun\r
);\r
}\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a SCSI device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextScsi (\r
IN OUT POOL_PRINT *Str,\r
SCSI_DEVICE_PATH *Scsi;\r
\r
Scsi = DevPath;\r
- CatPrint (Str, L"Scsi(%x,%x)", Scsi->Pun, Scsi->Lun);\r
+ CatPrint (Str, L"Scsi(0x%x,0x%x)", Scsi->Pun, Scsi->Lun);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a Fibre device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextFibre (\r
IN OUT POOL_PRINT *Str,\r
FIBRECHANNEL_DEVICE_PATH *Fibre;\r
\r
Fibre = DevPath;\r
- CatPrint (Str, L"Fibre(%lx,%lx)", Fibre->WWN, Fibre->Lun);\r
+ CatPrint (Str, L"Fibre(0x%lx,0x%lx)", Fibre->WWN, Fibre->Lun);\r
+}\r
+\r
+/**\r
+ Converts a FibreEx device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextFibreEx (\r
+ IN OUT POOL_PRINT *Str,\r
+ IN VOID *DevPath,\r
+ IN BOOLEAN DisplayOnly,\r
+ IN BOOLEAN AllowShortcuts\r
+ )\r
+{\r
+ FIBRECHANNELEX_DEVICE_PATH *FibreEx;\r
+ UINTN Index;\r
+\r
+ FibreEx = DevPath;\r
+ CatPrint (Str, L"FibreEx(0x");\r
+ for (Index = 0; Index < sizeof (FibreEx->WWN) / sizeof (FibreEx->WWN[0]); Index++) {\r
+ CatPrint (Str, L"%02x", FibreEx->WWN[Index]);\r
+ }\r
+ CatPrint (Str, L",0x");\r
+ for (Index = 0; Index < sizeof (FibreEx->Lun) / sizeof (FibreEx->Lun[0]); Index++) {\r
+ CatPrint (Str, L"%02x", FibreEx->Lun[Index]);\r
+ }\r
+ CatPrint (Str, L")");\r
+}\r
+\r
+/**\r
+ Converts a Sas Ex device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextSasEx (\r
+ IN OUT POOL_PRINT *Str,\r
+ IN VOID *DevPath,\r
+ IN BOOLEAN DisplayOnly,\r
+ IN BOOLEAN AllowShortcuts\r
+ )\r
+{\r
+ SASEX_DEVICE_PATH *SasEx;\r
+ UINTN Index;\r
+\r
+ SasEx = DevPath;\r
+ CatPrint (Str, L"SasEx(0x");\r
+\r
+ for (Index = 0; Index < sizeof (SasEx->SasAddress) / sizeof (SasEx->SasAddress[0]); Index++) {\r
+ CatPrint (Str, L"%02x", SasEx->SasAddress[Index]);\r
+ }\r
+ CatPrint (Str, L",0x");\r
+ for (Index = 0; Index < sizeof (SasEx->Lun) / sizeof (SasEx->Lun[0]); Index++) {\r
+ CatPrint (Str, L"%02x", SasEx->Lun[Index]);\r
+ }\r
+ CatPrint (Str, L",0x%x,", SasEx->RelativeTargetPort);\r
+\r
+ if ((SasEx->DeviceTopology & 0x0f) == 0) {\r
+ CatPrint (Str, L"NoTopology,0,0,0");\r
+ } else if (((SasEx->DeviceTopology & 0x0f) == 1) || ((SasEx->DeviceTopology & 0x0f) == 2)) {\r
+ CatPrint (\r
+ Str,\r
+ L"%s,%s,%s,",\r
+ ((SasEx->DeviceTopology & (0x1 << 4)) != 0) ? L"SATA" : L"SAS",\r
+ ((SasEx->DeviceTopology & (0x1 << 5)) != 0) ? L"External" : L"Internal",\r
+ ((SasEx->DeviceTopology & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct"\r
+ );\r
+ if ((SasEx->DeviceTopology & 0x0f) == 1) {\r
+ CatPrint (Str, L"0");\r
+ } else {\r
+ CatPrint (Str, L"0x%x", (SasEx->DeviceTopology >> 8) & 0xff);\r
+ }\r
+ } else {\r
+ CatPrint (Str, L"0,0,0,0");\r
+ }\r
+\r
+ CatPrint (Str, L")");\r
+ return ;\r
+\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a 1394 device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToText1394 (\r
IN OUT POOL_PRINT *Str,\r
IN BOOLEAN AllowShortcuts\r
)\r
{\r
- F1394_DEVICE_PATH *F1394;\r
+ F1394_DEVICE_PATH *F1394DevPath;\r
\r
- F1394 = DevPath;\r
- CatPrint (Str, L"I1394(%lx)", F1394->Guid);\r
+ F1394DevPath = DevPath;\r
+ //\r
+ // Guid has format of IEEE-EUI64\r
+ //\r
+ CatPrint (Str, L"I1394(%016lx)", F1394DevPath->Guid);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a USB device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextUsb (\r
IN OUT POOL_PRINT *Str,\r
USB_DEVICE_PATH *Usb;\r
\r
Usb = DevPath;\r
- CatPrint (Str, L"USB(%x,%x)", Usb->ParentPortNumber, Usb->InterfaceNumber);\r
+ CatPrint (Str, L"USB(0x%x,0x%x)", Usb->ParentPortNumber, Usb->InterfaceNumber);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a USB WWID device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextUsbWWID (\r
IN OUT POOL_PRINT *Str,\r
)\r
{\r
USB_WWID_DEVICE_PATH *UsbWWId;\r
+ CHAR16 *SerialNumberStr;\r
+ CHAR16 *NewStr;\r
+ UINT16 Length;\r
\r
UsbWWId = DevPath;\r
+\r
+ SerialNumberStr = (CHAR16 *) ((UINT8 *) UsbWWId + sizeof (USB_WWID_DEVICE_PATH));\r
+ Length = (UINT16) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));\r
+ if (SerialNumberStr [Length - 1] != 0) {\r
+ //\r
+ // In case no NULL terminator in SerialNumber, create a new one with NULL terminator\r
+ //\r
+ NewStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), SerialNumberStr);\r
+ ASSERT (NewStr != NULL);\r
+ NewStr [Length] = 0;\r
+ SerialNumberStr = NewStr;\r
+ }\r
+\r
CatPrint (\r
Str,\r
- L"UsbWwid(%x,%x,%x,\"WWID\")",\r
+ L"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",\r
UsbWWId->VendorId,\r
UsbWWId->ProductId,\r
- UsbWWId->InterfaceNumber\r
+ UsbWWId->InterfaceNumber,\r
+ SerialNumberStr\r
);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a Logic Unit device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextLogicalUnit (\r
IN OUT POOL_PRINT *Str,\r
DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;\r
\r
LogicalUnit = DevPath;\r
- CatPrint (Str, L"Unit(%x)", LogicalUnit->Lun);\r
+ CatPrint (Str, L"Unit(0x%x)", LogicalUnit->Lun);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a USB class device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextUsbClass (\r
IN OUT POOL_PRINT *Str,\r
)\r
{\r
USB_CLASS_DEVICE_PATH *UsbClass;\r
+ BOOLEAN IsKnownSubClass;\r
+\r
\r
UsbClass = DevPath;\r
\r
- if (AllowShortcuts == TRUE) {\r
- switch (UsbClass->DeviceClass) {\r
- case 1:\r
- CatPrint (\r
- Str,\r
- L"UsbAudio(%x,%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
- UsbClass->DeviceProtocol\r
- );\r
- break;\r
+ IsKnownSubClass = TRUE;\r
+ switch (UsbClass->DeviceClass) {\r
+ case USB_CLASS_AUDIO:\r
+ CatPrint (Str, L"UsbAudio");\r
+ break;\r
\r
- case 2:\r
- CatPrint (\r
- Str,\r
- L"UsbCDCControl(%x,%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
- UsbClass->DeviceProtocol\r
- );\r
- break;\r
+ case USB_CLASS_CDCCONTROL:\r
+ CatPrint (Str, L"UsbCDCControl");\r
+ break;\r
\r
- case 3:\r
- CatPrint (\r
- Str,\r
- L"UsbHID(%x,%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
- UsbClass->DeviceProtocol\r
- );\r
- break;\r
+ case USB_CLASS_HID:\r
+ CatPrint (Str, L"UsbHID");\r
+ break;\r
\r
- case 6:\r
- CatPrint (\r
- Str,\r
- L"UsbImage(%x,%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
- UsbClass->DeviceProtocol\r
- );\r
- break;\r
+ case USB_CLASS_IMAGE:\r
+ CatPrint (Str, L"UsbImage");\r
+ break;\r
\r
- case 7:\r
- CatPrint (\r
- Str,\r
- L"UsbPrinter(%x,%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
- UsbClass->DeviceProtocol\r
- );\r
- break;\r
+ case USB_CLASS_PRINTER:\r
+ CatPrint (Str, L"UsbPrinter");\r
+ break;\r
\r
- case 8:\r
- CatPrint (\r
- Str,\r
- L"UsbMassStorage(%x,%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
- UsbClass->DeviceProtocol\r
- );\r
- break;\r
+ case USB_CLASS_MASS_STORAGE:\r
+ CatPrint (Str, L"UsbMassStorage");\r
+ break;\r
\r
- case 9:\r
- CatPrint (\r
- Str,\r
- L"UsbHub(%x,%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
- UsbClass->DeviceProtocol\r
- );\r
- break;\r
+ case USB_CLASS_HUB:\r
+ CatPrint (Str, L"UsbHub");\r
+ break;\r
\r
- case 10:\r
- CatPrint (\r
- Str,\r
- L"UsbCDCData(%x,%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
- UsbClass->DeviceProtocol\r
- );\r
- break;\r
+ case USB_CLASS_CDCDATA:\r
+ CatPrint (Str, L"UsbCDCData");\r
+ break;\r
\r
- case 11:\r
- CatPrint (\r
- Str,\r
- L"UsbSmartCard(%x,%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
- UsbClass->DeviceProtocol\r
- );\r
- break;\r
+ case USB_CLASS_SMART_CARD:\r
+ CatPrint (Str, L"UsbSmartCard");\r
+ break;\r
+\r
+ case USB_CLASS_VIDEO:\r
+ CatPrint (Str, L"UsbVideo");\r
+ break;\r
+\r
+ case USB_CLASS_DIAGNOSTIC:\r
+ CatPrint (Str, L"UsbDiagnostic");\r
+ break;\r
+\r
+ case USB_CLASS_WIRELESS:\r
+ CatPrint (Str, L"UsbWireless");\r
+ break;\r
\r
- case 14:\r
+ default:\r
+ IsKnownSubClass = FALSE;\r
+ break;\r
+ }\r
+\r
+ if (IsKnownSubClass) {\r
+ CatPrint (\r
+ Str,\r
+ L"(0x%x,0x%x,0x%x,0x%x)",\r
+ UsbClass->VendorId,\r
+ UsbClass->ProductId,\r
+ UsbClass->DeviceSubClass,\r
+ UsbClass->DeviceProtocol\r
+ );\r
+ return;\r
+ }\r
+\r
+ if (UsbClass->DeviceClass == USB_CLASS_RESERVE) {\r
+ if (UsbClass->DeviceSubClass == USB_SUBCLASS_FW_UPDATE) {\r
CatPrint (\r
Str,\r
- L"UsbVideo(%x,%x,%x,%x)",\r
+ L"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",\r
UsbClass->VendorId,\r
UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
UsbClass->DeviceProtocol\r
);\r
- break;\r
-\r
- case 220:\r
+ return;\r
+ } else if (UsbClass->DeviceSubClass == USB_SUBCLASS_IRDA_BRIDGE) {\r
CatPrint (\r
Str,\r
- L"UsbDiagnostic(%x,%x,%x,%x)",\r
+ L"UsbIrdaBridge(0x%x,0x%x,0x%x)",\r
UsbClass->VendorId,\r
UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
UsbClass->DeviceProtocol\r
);\r
- break;\r
-\r
- case 224:\r
+ return;\r
+ } else if (UsbClass->DeviceSubClass == USB_SUBCLASS_TEST) {\r
CatPrint (\r
Str,\r
- L"UsbWireless(%x,%x,%x,%x)",\r
+ L"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",\r
UsbClass->VendorId,\r
UsbClass->ProductId,\r
- UsbClass->DeviceSubClass,\r
UsbClass->DeviceProtocol\r
);\r
- break;\r
+ return;\r
+ }\r
+ }\r
\r
- case 254:\r
- if (UsbClass->DeviceSubClass == 1) {\r
- CatPrint (\r
- Str,\r
- L"UsbDeviceFirmwareUpdate(%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceProtocol\r
- );\r
- } else if (UsbClass->DeviceSubClass == 2) {\r
- CatPrint (\r
- Str,\r
- L"UsbIrdaBridge(%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceProtocol\r
- );\r
- } else if (UsbClass->DeviceSubClass == 3) {\r
- CatPrint (\r
- Str,\r
- L"UsbTestAndMeasurement(%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceProtocol\r
- );\r
- }\r
- break;\r
+ CatPrint (\r
+ Str,\r
+ L"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",\r
+ UsbClass->VendorId,\r
+ UsbClass->ProductId,\r
+ UsbClass->DeviceClass,\r
+ UsbClass->DeviceSubClass,\r
+ UsbClass->DeviceProtocol\r
+ );\r
+}\r
\r
- default:\r
- break;\r
- }\r
+/**\r
+ Converts a SATA device path structure to its string representative.\r
\r
- return ;\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextSata (\r
+ IN OUT POOL_PRINT *Str,\r
+ IN VOID *DevPath,\r
+ IN BOOLEAN DisplayOnly,\r
+ IN BOOLEAN AllowShortcuts\r
+ )\r
+{\r
+ SATA_DEVICE_PATH *Sata;\r
+\r
+ Sata = DevPath;\r
+ if ((Sata->PortMultiplierPortNumber & SATA_HBA_DIRECT_CONNECT_FLAG) != 0) {\r
+ CatPrint (\r
+ Str,\r
+ L"Sata(0x%x,0x%x)",\r
+ Sata->HBAPortNumber,\r
+ Sata->Lun\r
+ );\r
+ } else {\r
+ CatPrint (\r
+ Str,\r
+ L"Sata(0x%x,0x%x,0x%x)",\r
+ Sata->HBAPortNumber,\r
+ Sata->PortMultiplierPortNumber,\r
+ Sata->Lun\r
+ );\r
}\r
-\r
- CatPrint (\r
- Str,\r
- L"UsbClass(%x,%x,%x,%x,%x)",\r
- UsbClass->VendorId,\r
- UsbClass->ProductId,\r
- UsbClass->DeviceClass,\r
- UsbClass->DeviceSubClass,\r
- UsbClass->DeviceProtocol\r
- );\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a I20 device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextI2O (\r
IN OUT POOL_PRINT *Str,\r
IN BOOLEAN AllowShortcuts\r
)\r
{\r
- I2O_DEVICE_PATH *I2O;\r
+ I2O_DEVICE_PATH *I2ODevPath;\r
\r
- I2O = DevPath;\r
- CatPrint (Str, L"I2O(%x)", I2O->Tid);\r
+ I2ODevPath = DevPath;\r
+ CatPrint (Str, L"I2O(0x%x)", I2ODevPath->Tid);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a MAC address device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextMacAddr (\r
IN OUT POOL_PRINT *Str,\r
IN BOOLEAN AllowShortcuts\r
)\r
{\r
- MAC_ADDR_DEVICE_PATH *MAC;\r
+ MAC_ADDR_DEVICE_PATH *MacDevPath;\r
UINTN HwAddressSize;\r
UINTN Index;\r
\r
- MAC = DevPath;\r
+ MacDevPath = DevPath;\r
\r
HwAddressSize = sizeof (EFI_MAC_ADDRESS);\r
- if (MAC->IfType == 0x01 || MAC->IfType == 0x00) {\r
+ if (MacDevPath->IfType == 0x01 || MacDevPath->IfType == 0x00) {\r
HwAddressSize = 6;\r
}\r
\r
CatPrint (Str, L"MAC(");\r
\r
for (Index = 0; Index < HwAddressSize; Index++) {\r
- CatPrint (Str, L"%02x", MAC->MacAddress.Addr[Index]);\r
+ CatPrint (Str, L"%02x", MacDevPath->MacAddress.Addr[Index]);\r
}\r
\r
- CatPrint (Str, L",%x)", MAC->IfType);\r
+ CatPrint (Str, L",0x%x)", MacDevPath->IfType);\r
+}\r
+\r
+/**\r
+ Converts network protocol string to its text representation.\r
+\r
+ @param Str The string representative of input device.\r
+ @param Protocol The network protocol ID.\r
+\r
+**/\r
+VOID\r
+CatNetworkProtocol (\r
+ IN OUT POOL_PRINT *Str,\r
+ IN UINT16 Protocol\r
+ )\r
+{\r
+ if (Protocol == RFC_1700_TCP_PROTOCOL) {\r
+ CatPrint (Str, L"TCP");\r
+ } else if (Protocol == RFC_1700_UDP_PROTOCOL) {\r
+ CatPrint (Str, L"UDP");\r
+ } else {\r
+ CatPrint (Str, L"0x%x", Protocol);\r
+ }\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a IPv4 device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextIPv4 (\r
IN OUT POOL_PRINT *Str,\r
IN BOOLEAN AllowShortcuts\r
)\r
{\r
- IPv4_DEVICE_PATH *IP;\r
+ IPv4_DEVICE_PATH *IPDevPath;\r
\r
- IP = DevPath;\r
- if (DisplayOnly == TRUE) {\r
+ IPDevPath = DevPath;\r
+ if (DisplayOnly) {\r
CatPrint (\r
Str,\r
L"IPv4(%d.%d.%d.%d)",\r
- IP->RemoteIpAddress.Addr[0],\r
- IP->RemoteIpAddress.Addr[1],\r
- IP->RemoteIpAddress.Addr[2],\r
- IP->RemoteIpAddress.Addr[3]\r
+ IPDevPath->RemoteIpAddress.Addr[0],\r
+ IPDevPath->RemoteIpAddress.Addr[1],\r
+ IPDevPath->RemoteIpAddress.Addr[2],\r
+ IPDevPath->RemoteIpAddress.Addr[3]\r
);\r
return ;\r
}\r
\r
CatPrint (\r
Str,\r
- L"IPv4(%d.%d.%d.%d,%s,%s,%d.%d.%d.%d)",\r
- IP->RemoteIpAddress.Addr[0],\r
- IP->RemoteIpAddress.Addr[1],\r
- IP->RemoteIpAddress.Addr[2],\r
- IP->RemoteIpAddress.Addr[3],\r
- IP->Protocol ? L"TCP" : L"UDP",\r
- (IP->StaticIpAddress == TRUE) ? L"Static" : L"DHCP",\r
- IP->LocalIpAddress.Addr[0],\r
- IP->LocalIpAddress.Addr[1],\r
- IP->LocalIpAddress.Addr[2],\r
- IP->LocalIpAddress.Addr[3]\r
+ L"IPv4(%d.%d.%d.%d,",\r
+ IPDevPath->RemoteIpAddress.Addr[0],\r
+ IPDevPath->RemoteIpAddress.Addr[1],\r
+ IPDevPath->RemoteIpAddress.Addr[2],\r
+ IPDevPath->RemoteIpAddress.Addr[3]\r
+ );\r
+\r
+ CatNetworkProtocol (\r
+ Str,\r
+ IPDevPath->Protocol\r
+ );\r
+\r
+ CatPrint (\r
+ Str,\r
+ L",%s,%d.%d.%d.%d",\r
+ IPDevPath->StaticIpAddress ? L"Static" : L"DHCP",\r
+ IPDevPath->LocalIpAddress.Addr[0],\r
+ IPDevPath->LocalIpAddress.Addr[1],\r
+ IPDevPath->LocalIpAddress.Addr[2],\r
+ IPDevPath->LocalIpAddress.Addr[3]\r
);\r
+ if (DevicePathNodeLength (IPDevPath) == sizeof (IPv4_DEVICE_PATH)) {\r
+ CatPrint (\r
+ Str,\r
+ L",%d.%d.%d.%d,%d.%d.%d.%d",\r
+ IPDevPath->GatewayIpAddress.Addr[0],\r
+ IPDevPath->GatewayIpAddress.Addr[1],\r
+ IPDevPath->GatewayIpAddress.Addr[2],\r
+ IPDevPath->GatewayIpAddress.Addr[3],\r
+ IPDevPath->SubnetMask.Addr[0],\r
+ IPDevPath->SubnetMask.Addr[1],\r
+ IPDevPath->SubnetMask.Addr[2],\r
+ IPDevPath->SubnetMask.Addr[3]\r
+ );\r
+ }\r
+ CatPrint (Str, L")");\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a IPv6 device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextIPv6 (\r
IN OUT POOL_PRINT *Str,\r
IN BOOLEAN AllowShortcuts\r
)\r
{\r
- IPv6_DEVICE_PATH *IP;\r
+ IPv6_DEVICE_PATH *IPDevPath;\r
\r
- IP = DevPath;\r
- if (DisplayOnly == TRUE) {\r
+ IPDevPath = DevPath;\r
+ if (DisplayOnly) {\r
CatPrint (\r
Str,\r
L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",\r
- IP->RemoteIpAddress.Addr[0],\r
- IP->RemoteIpAddress.Addr[1],\r
- IP->RemoteIpAddress.Addr[2],\r
- IP->RemoteIpAddress.Addr[3],\r
- IP->RemoteIpAddress.Addr[4],\r
- IP->RemoteIpAddress.Addr[5],\r
- IP->RemoteIpAddress.Addr[6],\r
- IP->RemoteIpAddress.Addr[7],\r
- IP->RemoteIpAddress.Addr[8],\r
- IP->RemoteIpAddress.Addr[9],\r
- IP->RemoteIpAddress.Addr[10],\r
- IP->RemoteIpAddress.Addr[11],\r
- IP->RemoteIpAddress.Addr[12],\r
- IP->RemoteIpAddress.Addr[13],\r
- IP->RemoteIpAddress.Addr[14],\r
- IP->RemoteIpAddress.Addr[15]\r
+ IPDevPath->RemoteIpAddress.Addr[0],\r
+ IPDevPath->RemoteIpAddress.Addr[1],\r
+ IPDevPath->RemoteIpAddress.Addr[2],\r
+ IPDevPath->RemoteIpAddress.Addr[3],\r
+ IPDevPath->RemoteIpAddress.Addr[4],\r
+ IPDevPath->RemoteIpAddress.Addr[5],\r
+ IPDevPath->RemoteIpAddress.Addr[6],\r
+ IPDevPath->RemoteIpAddress.Addr[7],\r
+ IPDevPath->RemoteIpAddress.Addr[8],\r
+ IPDevPath->RemoteIpAddress.Addr[9],\r
+ IPDevPath->RemoteIpAddress.Addr[10],\r
+ IPDevPath->RemoteIpAddress.Addr[11],\r
+ IPDevPath->RemoteIpAddress.Addr[12],\r
+ IPDevPath->RemoteIpAddress.Addr[13],\r
+ IPDevPath->RemoteIpAddress.Addr[14],\r
+ IPDevPath->RemoteIpAddress.Addr[15]\r
);\r
return ;\r
}\r
\r
CatPrint (\r
Str,\r
- L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,%s,%s,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",\r
- IP->RemoteIpAddress.Addr[0],\r
- IP->RemoteIpAddress.Addr[1],\r
- IP->RemoteIpAddress.Addr[2],\r
- IP->RemoteIpAddress.Addr[3],\r
- IP->RemoteIpAddress.Addr[4],\r
- IP->RemoteIpAddress.Addr[5],\r
- IP->RemoteIpAddress.Addr[6],\r
- IP->RemoteIpAddress.Addr[7],\r
- IP->RemoteIpAddress.Addr[8],\r
- IP->RemoteIpAddress.Addr[9],\r
- IP->RemoteIpAddress.Addr[10],\r
- IP->RemoteIpAddress.Addr[11],\r
- IP->RemoteIpAddress.Addr[12],\r
- IP->RemoteIpAddress.Addr[13],\r
- IP->RemoteIpAddress.Addr[14],\r
- IP->RemoteIpAddress.Addr[15],\r
- IP->Protocol ? L"TCP" : L"UDP",\r
- (IP->StaticIpAddress == TRUE) ? L"Static" : L"DHCP",\r
- IP->LocalIpAddress.Addr[0],\r
- IP->LocalIpAddress.Addr[1],\r
- IP->LocalIpAddress.Addr[2],\r
- IP->LocalIpAddress.Addr[3],\r
- IP->LocalIpAddress.Addr[4],\r
- IP->LocalIpAddress.Addr[5],\r
- IP->LocalIpAddress.Addr[6],\r
- IP->LocalIpAddress.Addr[7],\r
- IP->LocalIpAddress.Addr[8],\r
- IP->LocalIpAddress.Addr[9],\r
- IP->LocalIpAddress.Addr[10],\r
- IP->LocalIpAddress.Addr[11],\r
- IP->LocalIpAddress.Addr[12],\r
- IP->LocalIpAddress.Addr[13],\r
- IP->LocalIpAddress.Addr[14],\r
- IP->LocalIpAddress.Addr[15]\r
+ L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,",\r
+ IPDevPath->RemoteIpAddress.Addr[0],\r
+ IPDevPath->RemoteIpAddress.Addr[1],\r
+ IPDevPath->RemoteIpAddress.Addr[2],\r
+ IPDevPath->RemoteIpAddress.Addr[3],\r
+ IPDevPath->RemoteIpAddress.Addr[4],\r
+ IPDevPath->RemoteIpAddress.Addr[5],\r
+ IPDevPath->RemoteIpAddress.Addr[6],\r
+ IPDevPath->RemoteIpAddress.Addr[7],\r
+ IPDevPath->RemoteIpAddress.Addr[8],\r
+ IPDevPath->RemoteIpAddress.Addr[9],\r
+ IPDevPath->RemoteIpAddress.Addr[10],\r
+ IPDevPath->RemoteIpAddress.Addr[11],\r
+ IPDevPath->RemoteIpAddress.Addr[12],\r
+ IPDevPath->RemoteIpAddress.Addr[13],\r
+ IPDevPath->RemoteIpAddress.Addr[14],\r
+ IPDevPath->RemoteIpAddress.Addr[15]\r
+ );\r
+ \r
+ CatNetworkProtocol (\r
+ Str,\r
+ IPDevPath->Protocol\r
+ );\r
+\r
+ switch (IPDevPath->IpAddressOrigin) {\r
+ case 0:\r
+ CatPrint (Str, L",Static");\r
+ break;\r
+ case 1:\r
+ CatPrint (Str, L",StatelessAutoConfigure");\r
+ break;\r
+ default:\r
+ CatPrint (Str, L",StatefulAutoConfigure");\r
+ break;\r
+ }\r
+\r
+ CatPrint (\r
+ Str,\r
+ L",%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",\r
+ IPDevPath->LocalIpAddress.Addr[0],\r
+ IPDevPath->LocalIpAddress.Addr[1],\r
+ IPDevPath->LocalIpAddress.Addr[2],\r
+ IPDevPath->LocalIpAddress.Addr[3],\r
+ IPDevPath->LocalIpAddress.Addr[4],\r
+ IPDevPath->LocalIpAddress.Addr[5],\r
+ IPDevPath->LocalIpAddress.Addr[6],\r
+ IPDevPath->LocalIpAddress.Addr[7],\r
+ IPDevPath->LocalIpAddress.Addr[8],\r
+ IPDevPath->LocalIpAddress.Addr[9],\r
+ IPDevPath->LocalIpAddress.Addr[10],\r
+ IPDevPath->LocalIpAddress.Addr[11],\r
+ IPDevPath->LocalIpAddress.Addr[12],\r
+ IPDevPath->LocalIpAddress.Addr[13],\r
+ IPDevPath->LocalIpAddress.Addr[14],\r
+ IPDevPath->LocalIpAddress.Addr[15]\r
);\r
+\r
+ if (DevicePathNodeLength (IPDevPath) == sizeof (IPv6_DEVICE_PATH)) {\r
+ CatPrint (\r
+ Str,\r
+ L",0x%x,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",\r
+ IPDevPath->PrefixLength,\r
+ IPDevPath->GatewayIpAddress.Addr[0],\r
+ IPDevPath->GatewayIpAddress.Addr[1],\r
+ IPDevPath->GatewayIpAddress.Addr[2],\r
+ IPDevPath->GatewayIpAddress.Addr[3],\r
+ IPDevPath->GatewayIpAddress.Addr[4],\r
+ IPDevPath->GatewayIpAddress.Addr[5],\r
+ IPDevPath->GatewayIpAddress.Addr[6],\r
+ IPDevPath->GatewayIpAddress.Addr[7],\r
+ IPDevPath->GatewayIpAddress.Addr[8],\r
+ IPDevPath->GatewayIpAddress.Addr[9],\r
+ IPDevPath->GatewayIpAddress.Addr[10],\r
+ IPDevPath->GatewayIpAddress.Addr[11],\r
+ IPDevPath->GatewayIpAddress.Addr[12],\r
+ IPDevPath->GatewayIpAddress.Addr[13],\r
+ IPDevPath->GatewayIpAddress.Addr[14],\r
+ IPDevPath->GatewayIpAddress.Addr[15]\r
+ );\r
+ }\r
+ CatPrint (Str, L")");\r
}\r
\r
-STATIC\r
+/**\r
+ Converts an Infini Band device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextInfiniBand (\r
IN OUT POOL_PRINT *Str,\r
InfiniBand = DevPath;\r
CatPrint (\r
Str,\r
- L"Infiniband(%x,%g,%lx,%lx,%lx)",\r
+ L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",\r
InfiniBand->ResourceFlags,\r
InfiniBand->PortGid,\r
InfiniBand->ServiceId,\r
);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a UART device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextUart (\r
IN OUT POOL_PRINT *Str,\r
}\r
}\r
\r
-STATIC\r
+/**\r
+ Converts an iSCSI device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextiSCSI (\r
IN OUT POOL_PRINT *Str,\r
IN BOOLEAN AllowShortcuts\r
)\r
{\r
- ISCSI_DEVICE_PATH_WITH_NAME *iSCSI;\r
+ ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;\r
UINT16 Options;\r
\r
- iSCSI = DevPath;\r
+ ISCSIDevPath = DevPath;\r
CatPrint (\r
Str,\r
- L"iSCSI(%s,%x,%lx,",\r
- iSCSI->iSCSITargetName,\r
- iSCSI->TargetPortalGroupTag,\r
- iSCSI->Lun\r
+ L"iSCSI(%a,0x%x,0x%lx,",\r
+ ISCSIDevPath->TargetName,\r
+ ISCSIDevPath->TargetPortalGroupTag,\r
+ ISCSIDevPath->Lun\r
);\r
\r
- Options = iSCSI->LoginOption;\r
- CatPrint (Str, L"%s,", ((Options >> 1) & 0x0001) ? L"CRC32C" : L"None");\r
- CatPrint (Str, L"%s,", ((Options >> 3) & 0x0001) ? L"CRC32C" : L"None");\r
- if ((Options >> 11) & 0x0001) {\r
+ Options = ISCSIDevPath->LoginOption;\r
+ CatPrint (Str, L"%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None");\r
+ CatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None");\r
+ if (((Options >> 11) & 0x0001) != 0) {\r
CatPrint (Str, L"%s,", L"None");\r
- } else if ((Options >> 12) & 0x0001) {\r
+ } else if (((Options >> 12) & 0x0001) != 0) {\r
CatPrint (Str, L"%s,", L"CHAP_UNI");\r
} else {\r
CatPrint (Str, L"%s,", L"CHAP_BI");\r
\r
}\r
\r
- CatPrint (Str, L"%s)", (iSCSI->NetworkProtocol == 0) ? L"TCP" : L"reserved");\r
+ CatPrint (Str, L"%s)", (ISCSIDevPath->NetworkProtocol == 0) ? L"TCP" : L"reserved");\r
+}\r
+\r
+/**\r
+ Converts a VLAN device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextVlan (\r
+ IN OUT POOL_PRINT *Str,\r
+ IN VOID *DevPath,\r
+ IN BOOLEAN DisplayOnly,\r
+ IN BOOLEAN AllowShortcuts\r
+ )\r
+{\r
+ VLAN_DEVICE_PATH *Vlan;\r
+\r
+ Vlan = DevPath;\r
+ CatPrint (Str, L"Vlan(%d)", Vlan->VlanId);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a Hard drive device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextHardDrive (\r
IN OUT POOL_PRINT *Str,\r
\r
Hd = DevPath;\r
switch (Hd->SignatureType) {\r
- case 0:\r
- CatPrint (\r
- Str,\r
- L"HD(%d,%s,0,",\r
- Hd->PartitionNumber,\r
- L"None"\r
- );\r
- break;\r
-\r
case SIGNATURE_TYPE_MBR:\r
CatPrint (\r
Str,\r
- L"HD(%d,%s,%08x,",\r
+ L"HD(%d,%s,0x%08x,",\r
Hd->PartitionNumber,\r
L"MBR",\r
*((UINT32 *) (&(Hd->Signature[0])))\r
Str,\r
L"HD(%d,%s,%g,",\r
Hd->PartitionNumber,\r
- L"GUID",\r
+ L"GPT",\r
(EFI_GUID *) &(Hd->Signature[0])\r
);\r
break;\r
\r
default:\r
+ CatPrint (\r
+ Str,\r
+ L"HD(%d,%d,0,",\r
+ Hd->PartitionNumber,\r
+ Hd->SignatureType\r
+ );\r
break;\r
}\r
\r
- CatPrint (Str, L"%lx,%lx)", Hd->PartitionStart, Hd->PartitionSize);\r
+ CatPrint (Str, L"0x%lx,0x%lx)", Hd->PartitionStart, Hd->PartitionSize);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a CDROM device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextCDROM (\r
IN OUT POOL_PRINT *Str,\r
CDROM_DEVICE_PATH *Cd;\r
\r
Cd = DevPath;\r
- if (DisplayOnly == TRUE) {\r
- CatPrint (Str, L"CDROM(%x)", Cd->BootEntry);\r
+ if (DisplayOnly) {\r
+ CatPrint (Str, L"CDROM(0x%x)", Cd->BootEntry);\r
return ;\r
}\r
\r
- CatPrint (Str, L"CDROM(%x,%lx,%lx)", Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize);\r
+ CatPrint (Str, L"CDROM(0x%x,0x%lx,0x%lx)", Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a File device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextFilePath (\r
IN OUT POOL_PRINT *Str,\r
CatPrint (Str, L"%s", Fp->PathName);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a Media protocol device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextMediaProtocol (\r
IN OUT POOL_PRINT *Str,\r
CatPrint (Str, L"Media(%g)", &MediaProt->Protocol);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a Firmware Volume device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextFv (\r
+ IN OUT POOL_PRINT *Str,\r
+ IN VOID *DevPath,\r
+ IN BOOLEAN DisplayOnly,\r
+ IN BOOLEAN AllowShortcuts\r
+ )\r
+{\r
+ MEDIA_FW_VOL_DEVICE_PATH *Fv;\r
+\r
+ Fv = DevPath;\r
+ CatPrint (Str, L"Fv(%g)", &Fv->FvName);\r
+}\r
+\r
+/**\r
+ Converts a Firmware Volume File device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathToTextFvFile (\r
+ IN OUT POOL_PRINT *Str,\r
+ IN VOID *DevPath,\r
+ IN BOOLEAN DisplayOnly,\r
+ IN BOOLEAN AllowShortcuts\r
+ )\r
+{\r
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFile;\r
+\r
+ FvFile = DevPath;\r
+ CatPrint (Str, L"FvFile(%g)", &FvFile->FvFileName);\r
+}\r
+\r
+/**\r
+ Converts a Relative Offset device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
+VOID\r
+DevPathRelativeOffsetRange (\r
+ IN OUT POOL_PRINT *Str,\r
+ IN VOID *DevPath,\r
+ IN BOOLEAN DisplayOnly,\r
+ IN BOOLEAN AllowShortcuts\r
+ )\r
+{\r
+ MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;\r
+\r
+ Offset = DevPath;\r
+ CatPrint (\r
+ Str,\r
+ L"Offset(0x%lx,0x%lx)",\r
+ Offset->StartingOffset,\r
+ Offset->EndingOffset\r
+ );\r
+}\r
+\r
+/**\r
+ Converts a BIOS Boot Specification device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextBBS (\r
IN OUT POOL_PRINT *Str,\r
break;\r
\r
default:\r
- Type = L"?";\r
+ Type = NULL;\r
break;\r
}\r
\r
- CatPrint (Str, L"BBS(%s,%a", Type, Bbs->String);\r
+ if (Type != NULL) {\r
+ CatPrint (Str, L"BBS(%s,%a", Type, Bbs->String);\r
+ } else {\r
+ CatPrint (Str, L"BBS(0x%x,%a", Bbs->DeviceType, Bbs->String);\r
+ }\r
\r
- if (DisplayOnly == TRUE) {\r
+ if (DisplayOnly) {\r
CatPrint (Str, L")");\r
return ;\r
}\r
\r
- CatPrint (Str, L",%x)", Bbs->StatusFlag);\r
+ CatPrint (Str, L",0x%x)", Bbs->StatusFlag);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts an End-of-Device-Path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextEndInstance (\r
IN OUT POOL_PRINT *Str,\r
CatPrint (Str, L",");\r
}\r
\r
-STATIC\r
+/**\r
+ Converts an unknown device path structure to its string representative.\r
+\r
+ @param Str The string representative of input device.\r
+ @param DevPath The input device path structure.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+**/\r
VOID\r
DevPathToTextNodeUnknown (\r
IN OUT POOL_PRINT *Str,\r
{HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor},\r
{HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController},\r
{ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi},\r
- {ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextExtAcpi},\r
+ {ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextAcpiEx},\r
+ {ACPI_DEVICE_PATH, ACPI_ADR_DP, DevPathToTextAcpiAdr},\r
{MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi},\r
{MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi},\r
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre},\r
+ {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx},\r
+ {MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx},\r
{MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394},\r
{MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb},\r
{MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID},\r
{MESSAGING_DEVICE_PATH, MSG_DEVICE_LOGICAL_UNIT_DP, DevPathToTextLogicalUnit},\r
{MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, DevPathToTextUsbClass},\r
+ {MESSAGING_DEVICE_PATH, MSG_SATA_DP, DevPathToTextSata},\r
{MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O},\r
{MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr},\r
{MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4},\r
{MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart},\r
{MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor},\r
{MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI},\r
+ {MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan},\r
{MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive},\r
{MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM},\r
{MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor},\r
- {MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},\r
{MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol},\r
{MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},\r
+ {MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_VOL_DP, DevPathToTextFv},\r
+ {MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP, DevPathToTextFvFile},\r
+ {MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, DevPathRelativeOffsetRange},\r
{BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS},\r
{END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance},\r
{0, 0, NULL}\r
};\r
\r
+/**\r
+ Converts a device node to its string representation.\r
+\r
+ @param DeviceNode A Pointer to the device node to be converted.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
+ of the display node is used, where applicable. If DisplayOnly\r
+ is FALSE, then the longer text representation of the display node\r
+ is used.\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ representation for a device node can be used, where applicable.\r
+\r
+ @return A pointer to the allocated text representation of the device node or NULL if DeviceNode\r
+ is NULL or there was insufficient memory.\r
+\r
+**/\r
CHAR16 *\r
+EFIAPI\r
ConvertDeviceNodeToText (\r
IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,\r
IN BOOLEAN DisplayOnly,\r
IN BOOLEAN AllowShortcuts\r
)\r
-/*++\r
-\r
- Routine Description:\r
- Convert a device node to its text representation.\r
-\r
- Arguments:\r
- DeviceNode - Points to the device node to be converted.\r
- DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation\r
- of the display node is used, where applicable. If DisplayOnly\r
- is FALSE, then the longer text representation of the display node\r
- is used.\r
- AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text\r
- representation for a device node can be used, where applicable.\r
-\r
- Returns:\r
- A pointer - a pointer to the allocated text representation of the device node.\r
- NULL - if DeviceNode is NULL or there was insufficient memory.\r
-\r
---*/\r
{\r
POOL_PRINT Str;\r
UINTN Index;\r
- UINTN NewSize;\r
VOID (*DumpNode)(POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);\r
\r
if (DeviceNode == NULL) {\r
//\r
DumpNode (&Str, (VOID *) DeviceNode, DisplayOnly, AllowShortcuts);\r
\r
- //\r
- // Shrink pool used for string allocation\r
- //\r
- NewSize = (Str.Len + 1) * sizeof (CHAR16);\r
- Str.Str = ReallocatePool (Str.Str, NewSize, NewSize);\r
ASSERT (Str.Str != NULL);\r
- Str.Str[Str.Len] = 0;\r
return Str.Str;\r
}\r
\r
-CHAR16 *\r
-ConvertDevicePathToText (\r
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
- IN BOOLEAN DisplayOnly,\r
- IN BOOLEAN AllowShortcuts\r
- )\r
-/*++\r
+/**\r
+ Converts a device path to its text representation.\r
\r
- Routine Description:\r
- Convert a device path to its text representation.\r
-\r
- Arguments:\r
- DeviceNode - Points to the device path to be converted.\r
- DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation\r
+ @param DevicePath A Pointer to the device to be converted.\r
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r
of the display node is used, where applicable. If DisplayOnly\r
is FALSE, then the longer text representation of the display node\r
is used.\r
- AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text\r
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
representation for a device node can be used, where applicable.\r
\r
- Returns:\r
- A pointer - a pointer to the allocated text representation of the device path.\r
- NULL - if DeviceNode is NULL or there was insufficient memory.\r
+ @return A pointer to the allocated text representation of the device path or\r
+ NULL if DeviceNode is NULL or there was insufficient memory.\r
\r
---*/\r
+**/\r
+CHAR16 *\r
+EFIAPI\r
+ConvertDevicePathToText (\r
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
+ IN BOOLEAN DisplayOnly,\r
+ IN BOOLEAN AllowShortcuts\r
+ )\r
{\r
POOL_PRINT Str;\r
EFI_DEVICE_PATH_PROTOCOL *DevPathNode;\r
- EFI_DEVICE_PATH_PROTOCOL *UnpackDevPath;\r
+ EFI_DEVICE_PATH_PROTOCOL *AlignedDevPathNode;\r
UINTN Index;\r
- UINTN NewSize;\r
VOID (*DumpNode) (POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);\r
\r
if (DevicePath == NULL) {\r
\r
ZeroMem (&Str, sizeof (Str));\r
\r
- //\r
- // Unpacked the device path\r
- //\r
- UnpackDevPath = UnpackDevicePath ((EFI_DEVICE_PATH_PROTOCOL *) DevicePath);\r
- ASSERT (UnpackDevPath != NULL);\r
-\r
//\r
// Process each device path node\r
//\r
- DevPathNode = UnpackDevPath;\r
+ DevPathNode = (EFI_DEVICE_PATH_PROTOCOL *) DevicePath;\r
while (!IsDevicePathEnd (DevPathNode)) {\r
//\r
// Find the handler to dump this device path node\r
//\r
DumpNode = NULL;\r
- for (Index = 0; DevPathToTextTable[Index].Function; Index += 1) {\r
+ for (Index = 0; DevPathToTextTable[Index].Function != NULL; Index += 1) {\r
\r
if (DevicePathType (DevPathNode) == DevPathToTextTable[Index].Type &&\r
DevicePathSubType (DevPathNode) == DevPathToTextTable[Index].SubType\r
DumpNode = DevPathToTextNodeUnknown;\r
}\r
//\r
- // Put a path seperator in if needed\r
+ // Put a path separator in if needed\r
//\r
- if (Str.Len && DumpNode != DevPathToTextEndInstance) {\r
- if (*(Str.Str + Str.Len / sizeof (CHAR16) - 1) != L',') { \r
+ if ((Str.Length != 0) && (DumpNode != DevPathToTextEndInstance)) {\r
+ if (*(Str.Str + Str.Length / sizeof (CHAR16) - 1) != L',') {\r
CatPrint (&Str, L"/");\r
- } \r
+ }\r
}\r
+ \r
+ AlignedDevPathNode = AllocateCopyPool (DevicePathNodeLength (DevPathNode), DevPathNode);\r
//\r
// Print this node of the device path\r
//\r
- DumpNode (&Str, DevPathNode, DisplayOnly, AllowShortcuts);\r
-\r
+ DumpNode (&Str, AlignedDevPathNode, DisplayOnly, AllowShortcuts);\r
+ FreePool (AlignedDevPathNode);\r
+ \r
//\r
// Next device path node\r
//\r
DevPathNode = NextDevicePathNode (DevPathNode);\r
}\r
- //\r
- // Shrink pool used for string allocation\r
- //\r
- FreePool (UnpackDevPath);\r
\r
- NewSize = (Str.Len + 1) * sizeof (CHAR16);\r
- Str.Str = ReallocatePool (Str.Str, NewSize, NewSize);\r
- ASSERT (Str.Str != NULL);\r
- Str.Str[Str.Len] = 0;\r
- return Str.Str;\r
+ if (Str.Str == NULL) {\r
+ return AllocateZeroPool (sizeof (CHAR16));\r
+ } else {\r
+ return Str.Str;\r
+ }\r
}\r