2 DevicePathToText protocol as defined in the UEFI 2.0 specification.
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "DevicePath.h"
18 Concatenates a formatted unicode string to allocated pool. The caller must
19 free the resulting buffer.
21 @param Str Tracks the allocated pool, size in use, and
22 amount of pool allocated.
23 @param Fmt The format string
24 @param ... Variable arguments based on the format string.
26 @return Allocated buffer with the formatted string printed in it.
27 The caller must free the allocated buffer. The buffer
28 allocation is not packed.
34 IN OUT POOL_PRINT
*Str
,
43 AppendStr
= AllocateZeroPool (0x1000);
44 if (AppendStr
== NULL
) {
49 UnicodeVSPrint (AppendStr
, 0x1000, Fmt
, Args
);
51 if (NULL
== Str
->Str
) {
52 Size
= StrSize (AppendStr
);
53 Str
->Str
= AllocateZeroPool (Size
);
54 ASSERT (Str
->Str
!= NULL
);
56 Size
= StrSize (AppendStr
) - sizeof (UINT16
);
57 Size
= Size
+ StrSize (Str
->Str
);
58 Str
->Str
= ReallocatePool (
63 ASSERT (Str
->Str
!= NULL
);
66 Str
->MaxLen
= MAX_CHAR
* sizeof (UINT16
);
67 if (Size
< Str
->MaxLen
) {
68 StrCat (Str
->Str
, AppendStr
);
69 Str
->Len
= Size
- sizeof (UINT16
);
77 Converts a PCI device path structure to its string representative.
79 @param Str The string representative of input device.
80 @param DevPath The input device path structure.
81 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
82 of the display node is used, where applicable. If DisplayOnly
83 is FALSE, then the longer text representation of the display node
85 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
86 representation for a device node can be used, where applicable.
91 IN OUT POOL_PRINT
*Str
,
93 IN BOOLEAN DisplayOnly
,
94 IN BOOLEAN AllowShortcuts
100 CatPrint (Str
, L
"Pci(0x%x,0x%x)", (UINTN
) Pci
->Device
, (UINTN
) Pci
->Function
);
104 Converts a PC Card device path structure to its string representative.
106 @param Str The string representative of input device.
107 @param DevPath The input device path structure.
108 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
109 of the display node is used, where applicable. If DisplayOnly
110 is FALSE, then the longer text representation of the display node
112 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
113 representation for a device node can be used, where applicable.
117 DevPathToTextPccard (
118 IN OUT POOL_PRINT
*Str
,
120 IN BOOLEAN DisplayOnly
,
121 IN BOOLEAN AllowShortcuts
124 PCCARD_DEVICE_PATH
*Pccard
;
127 CatPrint (Str
, L
"PcCard(0x%x)", (UINTN
) Pccard
->FunctionNumber
);
131 Converts a Memory Map device path structure to its string representative.
133 @param Str The string representative of input device.
134 @param DevPath The input device path structure.
135 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
136 of the display node is used, where applicable. If DisplayOnly
137 is FALSE, then the longer text representation of the display node
139 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
140 representation for a device node can be used, where applicable.
144 DevPathToTextMemMap (
145 IN OUT POOL_PRINT
*Str
,
147 IN BOOLEAN DisplayOnly
,
148 IN BOOLEAN AllowShortcuts
151 MEMMAP_DEVICE_PATH
*MemMap
;
156 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
157 (UINTN
) MemMap
->MemoryType
,
158 MemMap
->StartingAddress
,
159 MemMap
->EndingAddress
164 Converts a Vendor device path structure to its string representative.
166 @param Str The string representative of input device.
167 @param DevPath The input device path structure.
168 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
169 of the display node is used, where applicable. If DisplayOnly
170 is FALSE, then the longer text representation of the display node
172 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
173 representation for a device node can be used, where applicable.
177 DevPathToTextVendor (
178 IN OUT POOL_PRINT
*Str
,
180 IN BOOLEAN DisplayOnly
,
181 IN BOOLEAN AllowShortcuts
184 VENDOR_DEVICE_PATH
*Vendor
;
188 UINT32 FlowControlMap
;
191 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
192 switch (DevicePathType (&Vendor
->Header
)) {
193 case HARDWARE_DEVICE_PATH
:
197 case MESSAGING_DEVICE_PATH
:
199 if (AllowShortcuts
) {
200 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
201 CatPrint (Str
, L
"VenPcAnsi()");
203 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
204 CatPrint (Str
, L
"VenVt100()");
206 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
207 CatPrint (Str
, L
"VenVt100Plus()");
209 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
210 CatPrint (Str
, L
"VenUft8()");
212 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
213 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
214 switch (FlowControlMap
& 0x00000003) {
216 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
220 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
224 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
232 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
235 L
"SAS(0x%lx,0x%lx,0x%x,",
236 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
237 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
238 (UINTN
) ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
240 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
241 if ((Info
& 0x0f) == 0) {
242 CatPrint (Str
, L
"NoTopology,0,0,0,");
243 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
247 ((Info
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
248 ((Info
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
249 ((Info
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
251 if ((Info
& 0x0f) == 1) {
252 CatPrint (Str
, L
"0,");
254 CatPrint (Str
, L
"0x%x,",(UINTN
) (Info
>> 8) & 0xff);
257 CatPrint (Str
, L
"0,0,0,0,");
260 CatPrint (Str
, L
"0x%x)", (UINTN
) ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
262 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
263 CatPrint (Str
, L
"DebugPort()");
269 case MEDIA_DEVICE_PATH
:
278 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
279 CatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
280 if (DataLength
!= 0) {
281 CatPrint (Str
, L
",");
282 for (Index
= 0; Index
< DataLength
; Index
++) {
283 CatPrint (Str
, L
"%02x", (UINTN
) ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
287 CatPrint (Str
, L
")");
291 Converts a Controller device path structure to its string representative.
293 @param Str The string representative of input device.
294 @param DevPath The input device path structure.
295 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
296 of the display node is used, where applicable. If DisplayOnly
297 is FALSE, then the longer text representation of the display node
299 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
300 representation for a device node can be used, where applicable.
304 DevPathToTextController (
305 IN OUT POOL_PRINT
*Str
,
307 IN BOOLEAN DisplayOnly
,
308 IN BOOLEAN AllowShortcuts
311 CONTROLLER_DEVICE_PATH
*Controller
;
313 Controller
= DevPath
;
317 (UINTN
) Controller
->ControllerNumber
322 Converts a ACPI device path structure to its string representative.
324 @param Str The string representative of input device.
325 @param DevPath The input device path structure.
326 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
327 of the display node is used, where applicable. If DisplayOnly
328 is FALSE, then the longer text representation of the display node
330 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
331 representation for a device node can be used, where applicable.
336 IN OUT POOL_PRINT
*Str
,
338 IN BOOLEAN DisplayOnly
,
339 IN BOOLEAN AllowShortcuts
342 ACPI_HID_DEVICE_PATH
*Acpi
;
345 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
346 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
348 CatPrint (Str
, L
"PciRoot(0x%x)", (UINTN
) Acpi
->UID
);
352 CatPrint (Str
, L
"Floppy(0x%x)", (UINTN
) Acpi
->UID
);
356 CatPrint (Str
, L
"Keyboard(0x%x)", (UINTN
) Acpi
->UID
);
360 CatPrint (Str
, L
"Serial(0x%x)", (UINTN
) Acpi
->UID
);
364 CatPrint (Str
, L
"ParallelPort(0x%x)", (UINTN
) Acpi
->UID
);
368 CatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", (UINTN
) EISA_ID_TO_NUM (Acpi
->HID
), (UINTN
) Acpi
->UID
);
372 CatPrint (Str
, L
"Acpi(0x%08x,0x%x)", (UINTN
) Acpi
->HID
, (UINTN
) Acpi
->UID
);
377 Converts EISA identification to string.
379 @param EisaId The input EISA identification.
380 @param Text A pointer to the output string.
392 //UnicodeSPrint ("%X", 0x0a03) => "0000000000000A03"
394 UnicodeSPrint (PnpIdStr
, 17 * 2, L
"%16X", EisaId
>> 16);
398 sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (PnpIdStr
),
400 '@' + ((EisaId
>> 10) & 0x1f),
401 '@' + ((EisaId
>> 5) & 0x1f),
402 '@' + ((EisaId
>> 0) & 0x1f),
408 Converts a ACPI extended HID device path structure to its string representative.
410 @param Str The string representative of input device.
411 @param DevPath The input device path structure.
412 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
413 of the display node is used, where applicable. If DisplayOnly
414 is FALSE, then the longer text representation of the display node
416 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
417 representation for a device node can be used, where applicable.
421 DevPathToTextAcpiEx (
422 IN OUT POOL_PRINT
*Str
,
424 IN BOOLEAN DisplayOnly
,
425 IN BOOLEAN AllowShortcuts
428 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
436 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
437 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
438 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
440 EisaIdToText (AcpiEx
->HID
, HIDText
);
441 EisaIdToText (AcpiEx
->CID
, CIDText
);
443 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (AcpiEx
->UID
== 0)) {
449 L
"AcpiExp(%s,%s,%a)",
455 if (AllowShortcuts
) {
459 if (AcpiEx
->HID
== 0) {
460 CatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
462 CatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
465 if (AcpiEx
->UID
== 0) {
466 CatPrint (Str
, L
"%a,", UIDStr
);
468 CatPrint (Str
, L
"0x%x,", (UINTN
) AcpiEx
->UID
);
471 if (AcpiEx
->CID
== 0) {
472 CatPrint (Str
, L
"%a)", CIDStr
);
474 CatPrint (Str
, L
"%s)", CIDText
);
479 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
492 Converts a ACPI address device path structure to its string representative.
494 @param Str The string representative of input device.
495 @param DevPath The input device path structure.
496 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
497 of the display node is used, where applicable. If DisplayOnly
498 is FALSE, then the longer text representation of the display node
500 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
501 representation for a device node can be used, where applicable.
505 DevPathToTextAcpiAdr (
506 IN OUT POOL_PRINT
*Str
,
508 IN BOOLEAN DisplayOnly
,
509 IN BOOLEAN AllowShortcuts
512 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
515 UINT16 AdditionalAdrCount
;
518 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
519 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
521 CatPrint (Str
, L
"AcpiAdr(0x%x", (UINTN
) AcpiAdr
->ADR
);
522 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
523 CatPrint (Str
, L
",0x%x", (UINTN
) *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
525 CatPrint (Str
, L
")");
529 Converts a ATAPI device path structure to its string representative.
531 @param Str The string representative of input device.
532 @param DevPath The input device path structure.
533 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
534 of the display node is used, where applicable. If DisplayOnly
535 is FALSE, then the longer text representation of the display node
537 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
538 representation for a device node can be used, where applicable.
543 IN OUT POOL_PRINT
*Str
,
545 IN BOOLEAN DisplayOnly
,
546 IN BOOLEAN AllowShortcuts
549 ATAPI_DEVICE_PATH
*Atapi
;
554 CatPrint (Str
, L
"Ata(0x%x)", (UINTN
) Atapi
->Lun
);
559 (Atapi
->PrimarySecondary
== 1) ? L
"Secondary" : L
"Primary",
560 (Atapi
->SlaveMaster
== 1) ? L
"Slave" : L
"Master",
567 Converts a SCSI device path structure to its string representative.
569 @param Str The string representative of input device.
570 @param DevPath The input device path structure.
571 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
572 of the display node is used, where applicable. If DisplayOnly
573 is FALSE, then the longer text representation of the display node
575 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
576 representation for a device node can be used, where applicable.
581 IN OUT POOL_PRINT
*Str
,
583 IN BOOLEAN DisplayOnly
,
584 IN BOOLEAN AllowShortcuts
587 SCSI_DEVICE_PATH
*Scsi
;
590 CatPrint (Str
, L
"Scsi(0x%x,0x%x)", (UINTN
) Scsi
->Pun
, (UINTN
) Scsi
->Lun
);
594 Converts a Fibre device path structure to its string representative.
596 @param Str The string representative of input device.
597 @param DevPath The input device path structure.
598 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
599 of the display node is used, where applicable. If DisplayOnly
600 is FALSE, then the longer text representation of the display node
602 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
603 representation for a device node can be used, where applicable.
608 IN OUT POOL_PRINT
*Str
,
610 IN BOOLEAN DisplayOnly
,
611 IN BOOLEAN AllowShortcuts
614 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
617 CatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
621 Converts a 1394 device path structure to its string representative.
623 @param Str The string representative of input device.
624 @param DevPath The input device path structure.
625 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
626 of the display node is used, where applicable. If DisplayOnly
627 is FALSE, then the longer text representation of the display node
629 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
630 representation for a device node can be used, where applicable.
635 IN OUT POOL_PRINT
*Str
,
637 IN BOOLEAN DisplayOnly
,
638 IN BOOLEAN AllowShortcuts
641 F1394_DEVICE_PATH
*F1394DevPath
;
643 F1394DevPath
= DevPath
;
645 // Guid has format of IEEE-EUI64
647 CatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
651 Converts a USB device path structure to its string representative.
653 @param Str The string representative of input device.
654 @param DevPath The input device path structure.
655 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
656 of the display node is used, where applicable. If DisplayOnly
657 is FALSE, then the longer text representation of the display node
659 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
660 representation for a device node can be used, where applicable.
665 IN OUT POOL_PRINT
*Str
,
667 IN BOOLEAN DisplayOnly
,
668 IN BOOLEAN AllowShortcuts
671 USB_DEVICE_PATH
*Usb
;
674 CatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
678 Converts a USB WWID device path structure to its string representative.
680 @param Str The string representative of input device.
681 @param DevPath The input device path structure.
682 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
683 of the display node is used, where applicable. If DisplayOnly
684 is FALSE, then the longer text representation of the display node
686 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
687 representation for a device node can be used, where applicable.
691 DevPathToTextUsbWWID (
692 IN OUT POOL_PRINT
*Str
,
694 IN BOOLEAN DisplayOnly
,
695 IN BOOLEAN AllowShortcuts
698 USB_WWID_DEVICE_PATH
*UsbWWId
;
699 CHAR16
*SerialNumberStr
;
705 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
706 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
707 if (SerialNumberStr
[Length
- 1] != 0) {
709 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
711 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
712 ASSERT (NewStr
!= NULL
);
714 SerialNumberStr
= NewStr
;
719 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
720 (UINTN
) UsbWWId
->VendorId
,
721 (UINTN
) UsbWWId
->ProductId
,
722 (UINTN
) UsbWWId
->InterfaceNumber
,
728 Converts a Logic Unit device path structure to its string representative.
730 @param Str The string representative of input device.
731 @param DevPath The input device path structure.
732 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
733 of the display node is used, where applicable. If DisplayOnly
734 is FALSE, then the longer text representation of the display node
736 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
737 representation for a device node can be used, where applicable.
741 DevPathToTextLogicalUnit (
742 IN OUT POOL_PRINT
*Str
,
744 IN BOOLEAN DisplayOnly
,
745 IN BOOLEAN AllowShortcuts
748 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
750 LogicalUnit
= DevPath
;
751 CatPrint (Str
, L
"Unit(0x%x)", (UINTN
) LogicalUnit
->Lun
);
755 Converts a USB class device path structure to its string representative.
757 @param Str The string representative of input device.
758 @param DevPath The input device path structure.
759 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
760 of the display node is used, where applicable. If DisplayOnly
761 is FALSE, then the longer text representation of the display node
763 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
764 representation for a device node can be used, where applicable.
768 DevPathToTextUsbClass (
769 IN OUT POOL_PRINT
*Str
,
771 IN BOOLEAN DisplayOnly
,
772 IN BOOLEAN AllowShortcuts
775 USB_CLASS_DEVICE_PATH
*UsbClass
;
776 BOOLEAN IsKnownSubClass
;
781 IsKnownSubClass
= TRUE
;
782 switch (UsbClass
->DeviceClass
) {
783 case USB_CLASS_AUDIO
:
784 CatPrint (Str
, L
"UsbAudio");
787 case USB_CLASS_CDCCONTROL
:
788 CatPrint (Str
, L
"UsbCDCControl");
792 CatPrint (Str
, L
"UsbHID");
795 case USB_CLASS_IMAGE
:
796 CatPrint (Str
, L
"UsbImage");
799 case USB_CLASS_PRINTER
:
800 CatPrint (Str
, L
"UsbPrinter");
803 case USB_CLASS_MASS_STORAGE
:
804 CatPrint (Str
, L
"UsbMassStorage");
808 CatPrint (Str
, L
"UsbHub");
811 case USB_CLASS_CDCDATA
:
812 CatPrint (Str
, L
"UsbCDCData");
815 case USB_CLASS_SMART_CARD
:
816 CatPrint (Str
, L
"UsbSmartCard");
819 case USB_CLASS_VIDEO
:
820 CatPrint (Str
, L
"UsbVideo");
823 case USB_CLASS_DIAGNOSTIC
:
824 CatPrint (Str
, L
"UsbDiagnostic");
827 case USB_CLASS_WIRELESS
:
828 CatPrint (Str
, L
"UsbWireless");
832 IsKnownSubClass
= FALSE
;
836 if (IsKnownSubClass
) {
839 L
"(0x%x,0x%x,0x%x,0x%x)",
840 (UINTN
) UsbClass
->VendorId
,
841 (UINTN
) UsbClass
->ProductId
,
842 (UINTN
) UsbClass
->DeviceSubClass
,
843 (UINTN
) UsbClass
->DeviceProtocol
848 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
849 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
852 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
853 (UINTN
) UsbClass
->VendorId
,
854 (UINTN
) UsbClass
->ProductId
,
855 (UINTN
) UsbClass
->DeviceProtocol
858 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
861 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
862 (UINTN
) UsbClass
->VendorId
,
863 (UINTN
) UsbClass
->ProductId
,
864 (UINTN
) UsbClass
->DeviceProtocol
867 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
870 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
871 (UINTN
) UsbClass
->VendorId
,
872 (UINTN
) UsbClass
->ProductId
,
873 (UINTN
) UsbClass
->DeviceProtocol
881 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
882 (UINTN
) UsbClass
->VendorId
,
883 (UINTN
) UsbClass
->ProductId
,
884 (UINTN
) UsbClass
->DeviceClass
,
885 (UINTN
) UsbClass
->DeviceSubClass
,
886 (UINTN
) UsbClass
->DeviceProtocol
891 Converts a SATA device path structure to its string representative.
893 @param Str The string representative of input device.
894 @param DevPath The input device path structure.
895 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
896 of the display node is used, where applicable. If DisplayOnly
897 is FALSE, then the longer text representation of the display node
899 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
900 representation for a device node can be used, where applicable.
905 IN OUT POOL_PRINT
*Str
,
907 IN BOOLEAN DisplayOnly
,
908 IN BOOLEAN AllowShortcuts
911 SATA_DEVICE_PATH
*Sata
;
914 if ((Sata
->PortMultiplierPortNumber
& SATA_HBA_DIRECT_CONNECT_FLAG
) != 0) {
918 (UINTN
) Sata
->HBAPortNumber
,
924 L
"Sata(0x%x,0x%x,0x%x)",
925 (UINTN
) Sata
->HBAPortNumber
,
926 (UINTN
) Sata
->PortMultiplierPortNumber
,
933 Converts a I20 device path structure to its string representative.
935 @param Str The string representative of input device.
936 @param DevPath The input device path structure.
937 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
938 of the display node is used, where applicable. If DisplayOnly
939 is FALSE, then the longer text representation of the display node
941 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
942 representation for a device node can be used, where applicable.
947 IN OUT POOL_PRINT
*Str
,
949 IN BOOLEAN DisplayOnly
,
950 IN BOOLEAN AllowShortcuts
953 I2O_DEVICE_PATH
*I2ODevPath
;
955 I2ODevPath
= DevPath
;
956 CatPrint (Str
, L
"I2O(0x%x)", (UINTN
) I2ODevPath
->Tid
);
960 Converts a MAC address device path structure to its string representative.
962 @param Str The string representative of input device.
963 @param DevPath The input device path structure.
964 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
965 of the display node is used, where applicable. If DisplayOnly
966 is FALSE, then the longer text representation of the display node
968 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
969 representation for a device node can be used, where applicable.
973 DevPathToTextMacAddr (
974 IN OUT POOL_PRINT
*Str
,
976 IN BOOLEAN DisplayOnly
,
977 IN BOOLEAN AllowShortcuts
980 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
984 MacDevPath
= DevPath
;
986 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
987 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
991 CatPrint (Str
, L
"MAC(");
993 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
994 CatPrint (Str
, L
"%02x", (UINTN
) MacDevPath
->MacAddress
.Addr
[Index
]);
997 CatPrint (Str
, L
",0x%x)", (UINTN
) MacDevPath
->IfType
);
1001 Converts network protocol string to its text representation.
1003 @param Str The string representative of input device.
1004 @param Protocol The network protocol ID.
1008 CatNetworkProtocol (
1009 IN OUT POOL_PRINT
*Str
,
1013 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1014 CatPrint (Str
, L
"TCP");
1015 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1016 CatPrint (Str
, L
"UDP");
1018 CatPrint (Str
, L
"0x%x", Protocol
);
1023 Converts a IPv4 device path structure to its string representative.
1025 @param Str The string representative of input device.
1026 @param DevPath The input device path structure.
1027 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1028 of the display node is used, where applicable. If DisplayOnly
1029 is FALSE, then the longer text representation of the display node
1031 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1032 representation for a device node can be used, where applicable.
1037 IN OUT POOL_PRINT
*Str
,
1039 IN BOOLEAN DisplayOnly
,
1040 IN BOOLEAN AllowShortcuts
1043 IPv4_DEVICE_PATH
*IPDevPath
;
1045 IPDevPath
= DevPath
;
1049 L
"IPv4(%d.%d.%d.%d)",
1050 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[0],
1051 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[1],
1052 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[2],
1053 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[3]
1060 L
"IPv4(%d.%d.%d.%d,",
1061 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[0],
1062 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[1],
1063 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[2],
1064 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[3]
1067 CatNetworkProtocol (
1074 L
",%s,%d.%d.%d.%d)",
1075 IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP",
1076 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[0],
1077 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[1],
1078 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[2],
1079 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[3]
1084 Converts a IPv6 device path structure to its string representative.
1086 @param Str The string representative of input device.
1087 @param DevPath The input device path structure.
1088 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1089 of the display node is used, where applicable. If DisplayOnly
1090 is FALSE, then the longer text representation of the display node
1092 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1093 representation for a device node can be used, where applicable.
1098 IN OUT POOL_PRINT
*Str
,
1100 IN BOOLEAN DisplayOnly
,
1101 IN BOOLEAN AllowShortcuts
1104 IPv6_DEVICE_PATH
*IPDevPath
;
1106 IPDevPath
= DevPath
;
1110 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
1111 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[0],
1112 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[1],
1113 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[2],
1114 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[3],
1115 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[4],
1116 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[5],
1117 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[6],
1118 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[7],
1119 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[8],
1120 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[9],
1121 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[10],
1122 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[11],
1123 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[12],
1124 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[13],
1125 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[14],
1126 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[15]
1133 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,",
1134 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[0],
1135 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[1],
1136 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[2],
1137 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[3],
1138 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[4],
1139 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[5],
1140 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[6],
1141 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[7],
1142 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[8],
1143 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[9],
1144 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[10],
1145 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[11],
1146 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[12],
1147 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[13],
1148 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[14],
1149 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[15]
1152 CatNetworkProtocol (
1159 L
"%s,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
1160 IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP",
1161 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[0],
1162 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[1],
1163 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[2],
1164 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[3],
1165 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[4],
1166 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[5],
1167 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[6],
1168 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[7],
1169 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[8],
1170 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[9],
1171 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[10],
1172 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[11],
1173 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[12],
1174 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[13],
1175 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[14],
1176 (UINTN
) IPDevPath
->LocalIpAddress
.Addr
[15]
1181 Converts an Infini Band device path structure to its string representative.
1183 @param Str The string representative of input device.
1184 @param DevPath The input device path structure.
1185 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1186 of the display node is used, where applicable. If DisplayOnly
1187 is FALSE, then the longer text representation of the display node
1189 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1190 representation for a device node can be used, where applicable.
1194 DevPathToTextInfiniBand (
1195 IN OUT POOL_PRINT
*Str
,
1197 IN BOOLEAN DisplayOnly
,
1198 IN BOOLEAN AllowShortcuts
1201 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1203 InfiniBand
= DevPath
;
1206 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1207 (UINTN
) InfiniBand
->ResourceFlags
,
1208 InfiniBand
->PortGid
,
1209 InfiniBand
->ServiceId
,
1210 InfiniBand
->TargetPortId
,
1211 InfiniBand
->DeviceId
1216 Converts a UART device path structure to its string representative.
1218 @param Str The string representative of input device.
1219 @param DevPath The input device path structure.
1220 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1221 of the display node is used, where applicable. If DisplayOnly
1222 is FALSE, then the longer text representation of the display node
1224 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1225 representation for a device node can be used, where applicable.
1230 IN OUT POOL_PRINT
*Str
,
1232 IN BOOLEAN DisplayOnly
,
1233 IN BOOLEAN AllowShortcuts
1236 UART_DEVICE_PATH
*Uart
;
1240 switch (Uart
->Parity
) {
1270 if (Uart
->BaudRate
== 0) {
1271 CatPrint (Str
, L
"Uart(DEFAULT,");
1273 CatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1276 if (Uart
->DataBits
== 0) {
1277 CatPrint (Str
, L
"DEFAULT,");
1279 CatPrint (Str
, L
"%d,", (UINTN
) Uart
->DataBits
);
1282 CatPrint (Str
, L
"%c,", Parity
);
1284 switch (Uart
->StopBits
) {
1286 CatPrint (Str
, L
"D)");
1290 CatPrint (Str
, L
"1)");
1294 CatPrint (Str
, L
"1.5)");
1298 CatPrint (Str
, L
"2)");
1302 CatPrint (Str
, L
"x)");
1308 Converts an iSCSI device path structure to its string representative.
1310 @param Str The string representative of input device.
1311 @param DevPath The input device path structure.
1312 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1313 of the display node is used, where applicable. If DisplayOnly
1314 is FALSE, then the longer text representation of the display node
1316 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1317 representation for a device node can be used, where applicable.
1321 DevPathToTextiSCSI (
1322 IN OUT POOL_PRINT
*Str
,
1324 IN BOOLEAN DisplayOnly
,
1325 IN BOOLEAN AllowShortcuts
1328 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1331 ISCSIDevPath
= DevPath
;
1334 L
"iSCSI(%a,0x%x,0x%lx,",
1335 ISCSIDevPath
->TargetName
,
1336 (UINTN
) ISCSIDevPath
->TargetPortalGroupTag
,
1340 Options
= ISCSIDevPath
->LoginOption
;
1341 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1342 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1343 if (((Options
>> 11) & 0x0001) != 0) {
1344 CatPrint (Str
, L
"%s,", L
"None");
1345 } else if (((Options
>> 12) & 0x0001) != 0) {
1346 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1348 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
1352 CatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1356 Converts a VLAN device path structure to its string representative.
1358 @param Str The string representative of input device.
1359 @param DevPath The input device path structure.
1360 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1361 of the display node is used, where applicable. If DisplayOnly
1362 is FALSE, then the longer text representation of the display node
1364 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1365 representation for a device node can be used, where applicable.
1370 IN OUT POOL_PRINT
*Str
,
1372 IN BOOLEAN DisplayOnly
,
1373 IN BOOLEAN AllowShortcuts
1376 VLAN_DEVICE_PATH
*Vlan
;
1379 CatPrint (Str
, L
"Vlan(%d)", (UINTN
) Vlan
->VlanId
);
1383 Converts a Hard drive device path structure to its string representative.
1385 @param Str The string representative of input device.
1386 @param DevPath The input device path structure.
1387 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1388 of the display node is used, where applicable. If DisplayOnly
1389 is FALSE, then the longer text representation of the display node
1391 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1392 representation for a device node can be used, where applicable.
1396 DevPathToTextHardDrive (
1397 IN OUT POOL_PRINT
*Str
,
1399 IN BOOLEAN DisplayOnly
,
1400 IN BOOLEAN AllowShortcuts
1403 HARDDRIVE_DEVICE_PATH
*Hd
;
1406 switch (Hd
->SignatureType
) {
1407 case SIGNATURE_TYPE_MBR
:
1410 L
"HD(%d,%s,0x%08x,",
1411 (UINTN
) Hd
->PartitionNumber
,
1413 (UINTN
) *((UINT32
*) (&(Hd
->Signature
[0])))
1417 case SIGNATURE_TYPE_GUID
:
1421 (UINTN
) Hd
->PartitionNumber
,
1423 (EFI_GUID
*) &(Hd
->Signature
[0])
1431 (UINTN
) Hd
->PartitionNumber
,
1432 (UINTN
) Hd
->SignatureType
1437 CatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1441 Converts a CDROM device path structure to its string representative.
1443 @param Str The string representative of input device.
1444 @param DevPath The input device path structure.
1445 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1446 of the display node is used, where applicable. If DisplayOnly
1447 is FALSE, then the longer text representation of the display node
1449 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1450 representation for a device node can be used, where applicable.
1454 DevPathToTextCDROM (
1455 IN OUT POOL_PRINT
*Str
,
1457 IN BOOLEAN DisplayOnly
,
1458 IN BOOLEAN AllowShortcuts
1461 CDROM_DEVICE_PATH
*Cd
;
1465 CatPrint (Str
, L
"CDROM(0x%x)", (UINTN
) Cd
->BootEntry
);
1469 CatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", (UINTN
) Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1473 Converts a File device path structure to its string representative.
1475 @param Str The string representative of input device.
1476 @param DevPath The input device path structure.
1477 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1478 of the display node is used, where applicable. If DisplayOnly
1479 is FALSE, then the longer text representation of the display node
1481 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1482 representation for a device node can be used, where applicable.
1486 DevPathToTextFilePath (
1487 IN OUT POOL_PRINT
*Str
,
1489 IN BOOLEAN DisplayOnly
,
1490 IN BOOLEAN AllowShortcuts
1493 FILEPATH_DEVICE_PATH
*Fp
;
1496 CatPrint (Str
, L
"%s", Fp
->PathName
);
1500 Converts a Media protocol device path structure to its string representative.
1502 @param Str The string representative of input device.
1503 @param DevPath The input device path structure.
1504 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1505 of the display node is used, where applicable. If DisplayOnly
1506 is FALSE, then the longer text representation of the display node
1508 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1509 representation for a device node can be used, where applicable.
1513 DevPathToTextMediaProtocol (
1514 IN OUT POOL_PRINT
*Str
,
1516 IN BOOLEAN DisplayOnly
,
1517 IN BOOLEAN AllowShortcuts
1520 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1522 MediaProt
= DevPath
;
1523 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1527 Converts a Firmware Volume device path structure to its string representative.
1529 @param Str The string representative of input device.
1530 @param DevPath The input device path structure.
1531 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1532 of the display node is used, where applicable. If DisplayOnly
1533 is FALSE, then the longer text representation of the display node
1535 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1536 representation for a device node can be used, where applicable.
1541 IN OUT POOL_PRINT
*Str
,
1543 IN BOOLEAN DisplayOnly
,
1544 IN BOOLEAN AllowShortcuts
1547 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1550 CatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1554 Converts a Firmware Volume File device path structure to its string representative.
1556 @param Str The string representative of input device.
1557 @param DevPath The input device path structure.
1558 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1559 of the display node is used, where applicable. If DisplayOnly
1560 is FALSE, then the longer text representation of the display node
1562 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1563 representation for a device node can be used, where applicable.
1567 DevPathToTextFvFile (
1568 IN OUT POOL_PRINT
*Str
,
1570 IN BOOLEAN DisplayOnly
,
1571 IN BOOLEAN AllowShortcuts
1574 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1577 CatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1581 Converts a Relative Offset device path structure to its string representative.
1583 @param Str The string representative of input device.
1584 @param DevPath The input device path structure.
1585 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1586 of the display node is used, where applicable. If DisplayOnly
1587 is FALSE, then the longer text representation of the display node
1589 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1590 representation for a device node can be used, where applicable.
1594 DevPathRelativeOffsetRange (
1595 IN OUT POOL_PRINT
*Str
,
1597 IN BOOLEAN DisplayOnly
,
1598 IN BOOLEAN AllowShortcuts
1601 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1606 L
"Offset(0x%lx,0x%lx)",
1607 Offset
->StartingOffset
,
1608 Offset
->EndingOffset
1613 Converts a BIOS Boot Specification device path structure to its string representative.
1615 @param Str The string representative of input device.
1616 @param DevPath The input device path structure.
1617 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1618 of the display node is used, where applicable. If DisplayOnly
1619 is FALSE, then the longer text representation of the display node
1621 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1622 representation for a device node can be used, where applicable.
1627 IN OUT POOL_PRINT
*Str
,
1629 IN BOOLEAN DisplayOnly
,
1630 IN BOOLEAN AllowShortcuts
1633 BBS_BBS_DEVICE_PATH
*Bbs
;
1637 switch (Bbs
->DeviceType
) {
1638 case BBS_TYPE_FLOPPY
:
1642 case BBS_TYPE_HARDDRIVE
:
1646 case BBS_TYPE_CDROM
:
1650 case BBS_TYPE_PCMCIA
:
1658 case BBS_TYPE_EMBEDDED_NETWORK
:
1668 CatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1670 CatPrint (Str
, L
"BBS(0x%x,%a", (UINTN
) Bbs
->DeviceType
, Bbs
->String
);
1674 CatPrint (Str
, L
")");
1678 CatPrint (Str
, L
",0x%x)", (UINTN
) Bbs
->StatusFlag
);
1682 Converts an End-of-Device-Path structure to its string representative.
1684 @param Str The string representative of input device.
1685 @param DevPath The input device path structure.
1686 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1687 of the display node is used, where applicable. If DisplayOnly
1688 is FALSE, then the longer text representation of the display node
1690 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1691 representation for a device node can be used, where applicable.
1695 DevPathToTextEndInstance (
1696 IN OUT POOL_PRINT
*Str
,
1698 IN BOOLEAN DisplayOnly
,
1699 IN BOOLEAN AllowShortcuts
1702 CatPrint (Str
, L
",");
1706 Converts an unknown device path structure to its string representative.
1708 @param Str The string representative of input device.
1709 @param DevPath The input device path structure.
1710 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1711 of the display node is used, where applicable. If DisplayOnly
1712 is FALSE, then the longer text representation of the display node
1714 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1715 representation for a device node can be used, where applicable.
1719 DevPathToTextNodeUnknown (
1720 IN OUT POOL_PRINT
*Str
,
1722 IN BOOLEAN DisplayOnly
,
1723 IN BOOLEAN AllowShortcuts
1726 CatPrint (Str
, L
"?");
1729 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
[] = {
1730 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
1731 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
1732 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
1733 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
1734 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
1735 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
1736 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
1737 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
1738 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
1739 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
1740 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
1741 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
1742 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
1743 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
1744 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
1745 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
1746 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
1747 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
1748 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
1749 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
1750 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
1751 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
1752 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
1753 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
1754 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
1755 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
1756 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
1757 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
1758 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
1759 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
1760 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1761 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
1762 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
1763 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
1764 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
1765 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
1770 Converts a device node to its string representation.
1772 @param DeviceNode A Pointer to the device node to be converted.
1773 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1774 of the display node is used, where applicable. If DisplayOnly
1775 is FALSE, then the longer text representation of the display node
1777 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1778 representation for a device node can be used, where applicable.
1780 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
1781 is NULL or there was insufficient memory.
1786 ConvertDeviceNodeToText (
1787 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
1788 IN BOOLEAN DisplayOnly
,
1789 IN BOOLEAN AllowShortcuts
1795 VOID (*DumpNode
)(POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1797 if (DeviceNode
== NULL
) {
1801 ZeroMem (&Str
, sizeof (Str
));
1804 // Process the device path node
1807 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
++) {
1808 if (DevicePathType (DeviceNode
) == DevPathToTextTable
[Index
].Type
&&
1809 DevicePathSubType (DeviceNode
) == DevPathToTextTable
[Index
].SubType
1811 DumpNode
= DevPathToTextTable
[Index
].Function
;
1816 // If not found, use a generic function
1818 if (DumpNode
== NULL
) {
1819 DumpNode
= DevPathToTextNodeUnknown
;
1825 DumpNode (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
1828 // Shrink pool used for string allocation
1830 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1831 Str
.Str
= ReallocatePool (NewSize
, NewSize
, Str
.Str
);
1832 ASSERT (Str
.Str
!= NULL
);
1833 Str
.Str
[Str
.Len
] = 0;
1838 Converts a device path to its text representation.
1840 @param DevicePath A Pointer to the device to be converted.
1841 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1842 of the display node is used, where applicable. If DisplayOnly
1843 is FALSE, then the longer text representation of the display node
1845 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1846 representation for a device node can be used, where applicable.
1848 @return A pointer to the allocated text representation of the device path or
1849 NULL if DeviceNode is NULL or there was insufficient memory.
1854 ConvertDevicePathToText (
1855 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
1856 IN BOOLEAN DisplayOnly
,
1857 IN BOOLEAN AllowShortcuts
1861 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1862 EFI_DEVICE_PATH_PROTOCOL
*AlignedDevPathNode
;
1865 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1867 if (DevicePath
== NULL
) {
1871 ZeroMem (&Str
, sizeof (Str
));
1874 // Process each device path node
1876 DevPathNode
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
1877 while (!IsDevicePathEnd (DevPathNode
)) {
1879 // Find the handler to dump this device path node
1882 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
1884 if (DevicePathType (DevPathNode
) == DevPathToTextTable
[Index
].Type
&&
1885 DevicePathSubType (DevPathNode
) == DevPathToTextTable
[Index
].SubType
1887 DumpNode
= DevPathToTextTable
[Index
].Function
;
1892 // If not found, use a generic function
1895 DumpNode
= DevPathToTextNodeUnknown
;
1898 // Put a path separator in if needed
1900 if ((Str
.Len
!= 0) && DumpNode
!= DevPathToTextEndInstance
) {
1901 if (*(Str
.Str
+ Str
.Len
/ sizeof (CHAR16
) - 1) != L
',') {
1902 CatPrint (&Str
, L
"/");
1906 AlignedDevPathNode
= AllocateCopyPool (DevicePathNodeLength (DevPathNode
), DevPathNode
);
1908 // Print this node of the device path
1910 DumpNode (&Str
, AlignedDevPathNode
, DisplayOnly
, AllowShortcuts
);
1911 FreePool (AlignedDevPathNode
);
1914 // Next device path node
1916 DevPathNode
= NextDevicePathNode (DevPathNode
);
1919 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1920 Str
.Str
= ReallocatePool (NewSize
, NewSize
, Str
.Str
);
1921 ASSERT (Str
.Str
!= NULL
);
1922 Str
.Str
[Str
.Len
] = 0;