2 DevicePathToText protocol as defined in the UEFI 2.0 specification.
4 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
5 All rights reserved. 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 Adjusts the size of a previously allocated buffer.
20 @param OldPool A pointer to the buffer whose size is being adjusted.
21 @param OldSize The size of the current buffer.
22 @param NewSize The size of the new buffer.
24 @return A pointer to the new buffer or NULL if allocation fails.
38 NewPool
= AllocateZeroPool (NewSize
);
41 if (OldPool
!= NULL
) {
42 if (NewPool
!= NULL
) {
43 CopyMem (NewPool
, OldPool
, OldSize
< NewSize
? OldSize
: NewSize
);
53 Concatenates a formatted unicode string to allocated pool. The caller must
54 free the resulting buffer.
56 @param Str Tracks the allocated pool, size in use, and
57 amount of pool allocated.
58 @param Fmt The format string
59 @param ... Variable arguments based on the format string.
61 @return Allocated buffer with the formatted string printed in it.
62 The caller must free the allocated buffer. The buffer
63 allocation is not packed.
68 IN OUT POOL_PRINT
*Str
,
77 AppendStr
= AllocateZeroPool (0x1000);
78 if (AppendStr
== NULL
) {
83 UnicodeVSPrint (AppendStr
, 0x1000, Fmt
, Args
);
85 if (NULL
== Str
->Str
) {
86 Size
= StrSize (AppendStr
);
87 Str
->Str
= AllocateZeroPool (Size
);
88 ASSERT (Str
->Str
!= NULL
);
90 Size
= StrSize (AppendStr
) - sizeof (UINT16
);
91 Size
= Size
+ StrSize (Str
->Str
);
92 Str
->Str
= ReallocatePool (
97 ASSERT (Str
->Str
!= NULL
);
100 Str
->MaxLen
= MAX_CHAR
* sizeof (UINT16
);
101 if (Size
< Str
->MaxLen
) {
102 StrCat (Str
->Str
, AppendStr
);
103 Str
->Len
= Size
- sizeof (UINT16
);
106 FreePool (AppendStr
);
111 Converts a PCI device path structure to its string representive.
113 @param Str The string representive of input device.
114 @param DevPath The input device path structure.
115 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
116 of the display node is used, where applicable. If DisplayOnly
117 is FALSE, then the longer text representation of the display node
119 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
120 representation for a device node can be used, where applicable.
125 IN OUT POOL_PRINT
*Str
,
127 IN BOOLEAN DisplayOnly
,
128 IN BOOLEAN AllowShortcuts
131 PCI_DEVICE_PATH
*Pci
;
134 CatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
138 Converts a PC Card device path structure to its string representive.
140 @param Str The string representive of input device.
141 @param DevPath The input device path structure.
142 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
143 of the display node is used, where applicable. If DisplayOnly
144 is FALSE, then the longer text representation of the display node
146 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
147 representation for a device node can be used, where applicable.
151 DevPathToTextPccard (
152 IN OUT POOL_PRINT
*Str
,
154 IN BOOLEAN DisplayOnly
,
155 IN BOOLEAN AllowShortcuts
158 PCCARD_DEVICE_PATH
*Pccard
;
161 CatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
165 Converts a Memory Map device path structure to its string representive.
167 @param Str The string representive of input device.
168 @param DevPath The input device path structure.
169 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
170 of the display node is used, where applicable. If DisplayOnly
171 is FALSE, then the longer text representation of the display node
173 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
174 representation for a device node can be used, where applicable.
178 DevPathToTextMemMap (
179 IN OUT POOL_PRINT
*Str
,
181 IN BOOLEAN DisplayOnly
,
182 IN BOOLEAN AllowShortcuts
185 MEMMAP_DEVICE_PATH
*MemMap
;
190 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
192 MemMap
->StartingAddress
,
193 MemMap
->EndingAddress
198 Converts a Vendor device path structure to its string representive.
200 @param Str The string representive of input device.
201 @param DevPath The input device path structure.
202 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
203 of the display node is used, where applicable. If DisplayOnly
204 is FALSE, then the longer text representation of the display node
206 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
207 representation for a device node can be used, where applicable.
211 DevPathToTextVendor (
212 IN OUT POOL_PRINT
*Str
,
214 IN BOOLEAN DisplayOnly
,
215 IN BOOLEAN AllowShortcuts
218 VENDOR_DEVICE_PATH
*Vendor
;
222 UINT32 FlowControlMap
;
225 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
226 switch (DevicePathType (&Vendor
->Header
)) {
227 case HARDWARE_DEVICE_PATH
:
231 case MESSAGING_DEVICE_PATH
:
233 if (AllowShortcuts
) {
234 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
235 CatPrint (Str
, L
"VenPcAnsi()");
237 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
238 CatPrint (Str
, L
"VenVt100()");
240 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
241 CatPrint (Str
, L
"VenVt100Plus()");
243 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
244 CatPrint (Str
, L
"VenUft8()");
246 } else if (CompareGuid (&Vendor
->Guid
, &mEfiDevicePathMessagingUartFlowControlGuid
)) {
247 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
248 switch (FlowControlMap
& 0x00000003) {
250 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
254 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
258 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
266 } else if (CompareGuid (&Vendor
->Guid
, &mEfiDevicePathMessagingSASGuid
)) {
269 L
"SAS(0x%lx,0x%lx,0x%x,",
270 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
271 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
272 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
274 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
275 if ((Info
& 0x0f) == 0) {
276 CatPrint (Str
, L
"NoTopology,0,0,0,");
277 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
281 ((Info
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
282 ((Info
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
283 ((Info
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
285 if ((Info
& 0x0f) == 1) {
286 CatPrint (Str
, L
"0,");
288 CatPrint (Str
, L
"0x%x,", (Info
>> 8) & 0xff);
291 CatPrint (Str
, L
"0,0,0,0,");
294 CatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
296 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
297 CatPrint (Str
, L
"DebugPort()");
303 case MEDIA_DEVICE_PATH
:
312 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
313 CatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
314 if (DataLength
!= 0) {
315 CatPrint (Str
, L
",");
316 for (Index
= 0; Index
< DataLength
; Index
++) {
317 CatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
321 CatPrint (Str
, L
")");
325 Converts a Controller device path structure to its string representive.
327 @param Str The string representive of input device.
328 @param DevPath The input device path structure.
329 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
330 of the display node is used, where applicable. If DisplayOnly
331 is FALSE, then the longer text representation of the display node
333 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
334 representation for a device node can be used, where applicable.
338 DevPathToTextController (
339 IN OUT POOL_PRINT
*Str
,
341 IN BOOLEAN DisplayOnly
,
342 IN BOOLEAN AllowShortcuts
345 CONTROLLER_DEVICE_PATH
*Controller
;
347 Controller
= DevPath
;
351 Controller
->ControllerNumber
356 Converts a ACPI device path structure to its string representive.
358 @param Str The string representive of input device.
359 @param DevPath The input device path structure.
360 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
361 of the display node is used, where applicable. If DisplayOnly
362 is FALSE, then the longer text representation of the display node
364 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
365 representation for a device node can be used, where applicable.
370 IN OUT POOL_PRINT
*Str
,
372 IN BOOLEAN DisplayOnly
,
373 IN BOOLEAN AllowShortcuts
376 ACPI_HID_DEVICE_PATH
*Acpi
;
379 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
380 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
382 CatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
386 CatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
390 CatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
394 CatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
398 CatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
402 CatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
406 CatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
411 Converts EISA identification to string.
413 @param EisaId The input EISA identification.
414 @param Text A pointer to the output string.
426 //UnicodeSPrint ("%X", 0x0a03) => "0000000000000A03"
428 UnicodeSPrint (PnpIdStr
, 17 * 2, L
"%16X", EisaId
>> 16);
432 sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (PnpIdStr
),
434 '@' + ((EisaId
>> 10) & 0x1f),
435 '@' + ((EisaId
>> 5) & 0x1f),
436 '@' + ((EisaId
>> 0) & 0x1f),
442 Converts a ACPI extended HID device path structure to its string representive.
444 @param Str The string representive of input device.
445 @param DevPath The input device path structure.
446 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
447 of the display node is used, where applicable. If DisplayOnly
448 is FALSE, then the longer text representation of the display node
450 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
451 representation for a device node can be used, where applicable.
455 DevPathToTextAcpiEx (
456 IN OUT POOL_PRINT
*Str
,
458 IN BOOLEAN DisplayOnly
,
459 IN BOOLEAN AllowShortcuts
462 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
470 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
471 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
472 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
474 EisaIdToText (AcpiEx
->HID
, HIDText
);
475 EisaIdToText (AcpiEx
->CID
, CIDText
);
477 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (AcpiEx
->UID
== 0)) {
483 L
"AcpiExp(%s,%s,%a)",
489 if (AllowShortcuts
) {
493 if (AcpiEx
->HID
== 0) {
494 CatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
496 CatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
499 if (AcpiEx
->UID
== 0) {
500 CatPrint (Str
, L
"%a,", UIDStr
);
502 CatPrint (Str
, L
"0x%x,", AcpiEx
->UID
);
505 if (AcpiEx
->CID
== 0) {
506 CatPrint (Str
, L
"%a)", CIDStr
);
508 CatPrint (Str
, L
"%s)", CIDText
);
513 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
526 Converts a ACPI address device path structure to its string representive.
528 @param Str The string representive of input device.
529 @param DevPath The input device path structure.
530 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
531 of the display node is used, where applicable. If DisplayOnly
532 is FALSE, then the longer text representation of the display node
534 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
535 representation for a device node can be used, where applicable.
539 DevPathToTextAcpiAdr (
540 IN OUT POOL_PRINT
*Str
,
542 IN BOOLEAN DisplayOnly
,
543 IN BOOLEAN AllowShortcuts
546 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
549 UINT16 AdditionalAdrCount
;
552 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
553 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
555 CatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
556 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
557 CatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
559 CatPrint (Str
, L
")");
563 Converts a ATAPI device path structure to its string representive.
565 @param Str The string representive of input device.
566 @param DevPath The input device path structure.
567 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
568 of the display node is used, where applicable. If DisplayOnly
569 is FALSE, then the longer text representation of the display node
571 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
572 representation for a device node can be used, where applicable.
577 IN OUT POOL_PRINT
*Str
,
579 IN BOOLEAN DisplayOnly
,
580 IN BOOLEAN AllowShortcuts
583 ATAPI_DEVICE_PATH
*Atapi
;
588 CatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
593 Atapi
->PrimarySecondary
? L
"Secondary" : L
"Primary",
594 Atapi
->SlaveMaster
? L
"Slave" : L
"Master",
601 Converts a SCSI device path structure to its string representive.
603 @param Str The string representive of input device.
604 @param DevPath The input device path structure.
605 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
606 of the display node is used, where applicable. If DisplayOnly
607 is FALSE, then the longer text representation of the display node
609 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
610 representation for a device node can be used, where applicable.
615 IN OUT POOL_PRINT
*Str
,
617 IN BOOLEAN DisplayOnly
,
618 IN BOOLEAN AllowShortcuts
621 SCSI_DEVICE_PATH
*Scsi
;
624 CatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
628 Converts a Fibre device path structure to its string representive.
630 @param Str The string representive of input device.
631 @param DevPath The input device path structure.
632 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
633 of the display node is used, where applicable. If DisplayOnly
634 is FALSE, then the longer text representation of the display node
636 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
637 representation for a device node can be used, where applicable.
642 IN OUT POOL_PRINT
*Str
,
644 IN BOOLEAN DisplayOnly
,
645 IN BOOLEAN AllowShortcuts
648 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
651 CatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
655 Converts a 1394 device path structure to its string representive.
657 @param Str The string representive of input device.
658 @param DevPath The input device path structure.
659 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
660 of the display node is used, where applicable. If DisplayOnly
661 is FALSE, then the longer text representation of the display node
663 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
664 representation for a device node can be used, where applicable.
669 IN OUT POOL_PRINT
*Str
,
671 IN BOOLEAN DisplayOnly
,
672 IN BOOLEAN AllowShortcuts
675 F1394_DEVICE_PATH
*F1394DevPath
;
677 F1394DevPath
= DevPath
;
679 // Guid has format of IEEE-EUI64
681 CatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
685 Converts a USB device path structure to its string representive.
687 @param Str The string representive of input device.
688 @param DevPath The input device path structure.
689 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
690 of the display node is used, where applicable. If DisplayOnly
691 is FALSE, then the longer text representation of the display node
693 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
694 representation for a device node can be used, where applicable.
699 IN OUT POOL_PRINT
*Str
,
701 IN BOOLEAN DisplayOnly
,
702 IN BOOLEAN AllowShortcuts
705 USB_DEVICE_PATH
*Usb
;
708 CatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
712 Converts a USB WWID device path structure to its string representive.
714 @param Str The string representive of input device.
715 @param DevPath The input device path structure.
716 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
717 of the display node is used, where applicable. If DisplayOnly
718 is FALSE, then the longer text representation of the display node
720 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
721 representation for a device node can be used, where applicable.
725 DevPathToTextUsbWWID (
726 IN OUT POOL_PRINT
*Str
,
728 IN BOOLEAN DisplayOnly
,
729 IN BOOLEAN AllowShortcuts
732 USB_WWID_DEVICE_PATH
*UsbWWId
;
733 CHAR16
*SerialNumberStr
;
739 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
740 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
741 if (SerialNumberStr
[Length
- 1] != 0) {
743 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
745 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
747 SerialNumberStr
= NewStr
;
752 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
755 UsbWWId
->InterfaceNumber
,
761 Converts a Logic Unit device path structure to its string representive.
763 @param Str The string representive of input device.
764 @param DevPath The input device path structure.
765 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
766 of the display node is used, where applicable. If DisplayOnly
767 is FALSE, then the longer text representation of the display node
769 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
770 representation for a device node can be used, where applicable.
774 DevPathToTextLogicalUnit (
775 IN OUT POOL_PRINT
*Str
,
777 IN BOOLEAN DisplayOnly
,
778 IN BOOLEAN AllowShortcuts
781 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
783 LogicalUnit
= DevPath
;
784 CatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
788 Converts a USB class device path structure to its string representive.
790 @param Str The string representive of input device.
791 @param DevPath The input device path structure.
792 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
793 of the display node is used, where applicable. If DisplayOnly
794 is FALSE, then the longer text representation of the display node
796 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
797 representation for a device node can be used, where applicable.
801 DevPathToTextUsbClass (
802 IN OUT POOL_PRINT
*Str
,
804 IN BOOLEAN DisplayOnly
,
805 IN BOOLEAN AllowShortcuts
808 USB_CLASS_DEVICE_PATH
*UsbClass
;
809 BOOLEAN IsKnownSubClass
;
814 IsKnownSubClass
= TRUE
;
815 switch (UsbClass
->DeviceClass
) {
816 case USB_CLASS_AUDIO
:
817 CatPrint (Str
, L
"UsbAudio");
820 case USB_CLASS_CDCCONTROL
:
821 CatPrint (Str
, L
"UsbCDCControl");
825 CatPrint (Str
, L
"UsbHID");
828 case USB_CLASS_IMAGE
:
829 CatPrint (Str
, L
"UsbImage");
832 case USB_CLASS_PRINTER
:
833 CatPrint (Str
, L
"UsbPrinter");
836 case USB_CLASS_MASS_STORAGE
:
837 CatPrint (Str
, L
"UsbMassStorage");
841 CatPrint (Str
, L
"UsbHub");
844 case USB_CLASS_CDCDATA
:
845 CatPrint (Str
, L
"UsbCDCData");
848 case USB_CLASS_SMART_CARD
:
849 CatPrint (Str
, L
"UsbSmartCard");
852 case USB_CLASS_VIDEO
:
853 CatPrint (Str
, L
"UsbVideo");
856 case USB_CLASS_DIAGNOSTIC
:
857 CatPrint (Str
, L
"UsbDiagnostic");
860 case USB_CLASS_WIRELESS
:
861 CatPrint (Str
, L
"UsbWireless");
865 IsKnownSubClass
= FALSE
;
869 if (IsKnownSubClass
) {
872 L
"(0x%x,0x%x,0x%x,0x%x)",
875 UsbClass
->DeviceSubClass
,
876 UsbClass
->DeviceProtocol
881 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
882 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
885 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
888 UsbClass
->DeviceProtocol
891 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
894 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
897 UsbClass
->DeviceProtocol
900 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
903 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
906 UsbClass
->DeviceProtocol
914 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
917 UsbClass
->DeviceClass
,
918 UsbClass
->DeviceSubClass
,
919 UsbClass
->DeviceProtocol
924 Converts a SATA device path structure to its string representive.
926 @param Str The string representive of input device.
927 @param DevPath The input device path structure.
928 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
929 of the display node is used, where applicable. If DisplayOnly
930 is FALSE, then the longer text representation of the display node
932 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
933 representation for a device node can be used, where applicable.
938 IN OUT POOL_PRINT
*Str
,
940 IN BOOLEAN DisplayOnly
,
941 IN BOOLEAN AllowShortcuts
944 SATA_DEVICE_PATH
*Sata
;
949 L
"Sata(0x%x,0x%x,0x%x)",
950 (UINTN
) Sata
->HBAPortNumber
,
951 (UINTN
) Sata
->PortMultiplierPortNumber
,
957 Converts a I20 device path structure to its string representive.
959 @param Str The string representive of input device.
960 @param DevPath The input device path structure.
961 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
962 of the display node is used, where applicable. If DisplayOnly
963 is FALSE, then the longer text representation of the display node
965 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
966 representation for a device node can be used, where applicable.
971 IN OUT POOL_PRINT
*Str
,
973 IN BOOLEAN DisplayOnly
,
974 IN BOOLEAN AllowShortcuts
977 I2O_DEVICE_PATH
*I2ODevPath
;
979 I2ODevPath
= DevPath
;
980 CatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
984 Converts a MAC address device path structure to its string representive.
986 @param Str The string representive of input device.
987 @param DevPath The input device path structure.
988 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
989 of the display node is used, where applicable. If DisplayOnly
990 is FALSE, then the longer text representation of the display node
992 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
993 representation for a device node can be used, where applicable.
997 DevPathToTextMacAddr (
998 IN OUT POOL_PRINT
*Str
,
1000 IN BOOLEAN DisplayOnly
,
1001 IN BOOLEAN AllowShortcuts
1004 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1005 UINTN HwAddressSize
;
1008 MacDevPath
= DevPath
;
1010 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1011 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1015 CatPrint (Str
, L
"MAC(");
1017 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1018 CatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1021 CatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1025 Converts a IPv4 device path structure to its string representive.
1027 @param Str The string representive of input device.
1028 @param DevPath The input device path structure.
1029 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1030 of the display node is used, where applicable. If DisplayOnly
1031 is FALSE, then the longer text representation of the display node
1033 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1034 representation for a device node can be used, where applicable.
1039 IN OUT POOL_PRINT
*Str
,
1041 IN BOOLEAN DisplayOnly
,
1042 IN BOOLEAN AllowShortcuts
1045 IPv4_DEVICE_PATH
*IPDevPath
;
1047 IPDevPath
= DevPath
;
1051 L
"IPv4(%d.%d.%d.%d)",
1052 IPDevPath
->RemoteIpAddress
.Addr
[0],
1053 IPDevPath
->RemoteIpAddress
.Addr
[1],
1054 IPDevPath
->RemoteIpAddress
.Addr
[2],
1055 IPDevPath
->RemoteIpAddress
.Addr
[3]
1062 L
"IPv4(%d.%d.%d.%d,%s,%s,%d.%d.%d.%d)",
1063 IPDevPath
->RemoteIpAddress
.Addr
[0],
1064 IPDevPath
->RemoteIpAddress
.Addr
[1],
1065 IPDevPath
->RemoteIpAddress
.Addr
[2],
1066 IPDevPath
->RemoteIpAddress
.Addr
[3],
1067 IPDevPath
->Protocol
? L
"TCP" : L
"UDP",
1068 (IPDevPath
->StaticIpAddress
== TRUE
) ? L
"Static" : L
"DHCP",
1069 IPDevPath
->LocalIpAddress
.Addr
[0],
1070 IPDevPath
->LocalIpAddress
.Addr
[1],
1071 IPDevPath
->LocalIpAddress
.Addr
[2],
1072 IPDevPath
->LocalIpAddress
.Addr
[3]
1077 Converts a IPv6 device path structure to its string representive.
1079 @param Str The string representive of input device.
1080 @param DevPath The input device path structure.
1081 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1082 of the display node is used, where applicable. If DisplayOnly
1083 is FALSE, then the longer text representation of the display node
1085 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1086 representation for a device node can be used, where applicable.
1091 IN OUT POOL_PRINT
*Str
,
1093 IN BOOLEAN DisplayOnly
,
1094 IN BOOLEAN AllowShortcuts
1097 IPv6_DEVICE_PATH
*IPDevPath
;
1099 IPDevPath
= DevPath
;
1103 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
1104 IPDevPath
->RemoteIpAddress
.Addr
[0],
1105 IPDevPath
->RemoteIpAddress
.Addr
[1],
1106 IPDevPath
->RemoteIpAddress
.Addr
[2],
1107 IPDevPath
->RemoteIpAddress
.Addr
[3],
1108 IPDevPath
->RemoteIpAddress
.Addr
[4],
1109 IPDevPath
->RemoteIpAddress
.Addr
[5],
1110 IPDevPath
->RemoteIpAddress
.Addr
[6],
1111 IPDevPath
->RemoteIpAddress
.Addr
[7],
1112 IPDevPath
->RemoteIpAddress
.Addr
[8],
1113 IPDevPath
->RemoteIpAddress
.Addr
[9],
1114 IPDevPath
->RemoteIpAddress
.Addr
[10],
1115 IPDevPath
->RemoteIpAddress
.Addr
[11],
1116 IPDevPath
->RemoteIpAddress
.Addr
[12],
1117 IPDevPath
->RemoteIpAddress
.Addr
[13],
1118 IPDevPath
->RemoteIpAddress
.Addr
[14],
1119 IPDevPath
->RemoteIpAddress
.Addr
[15]
1126 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)",
1127 IPDevPath
->RemoteIpAddress
.Addr
[0],
1128 IPDevPath
->RemoteIpAddress
.Addr
[1],
1129 IPDevPath
->RemoteIpAddress
.Addr
[2],
1130 IPDevPath
->RemoteIpAddress
.Addr
[3],
1131 IPDevPath
->RemoteIpAddress
.Addr
[4],
1132 IPDevPath
->RemoteIpAddress
.Addr
[5],
1133 IPDevPath
->RemoteIpAddress
.Addr
[6],
1134 IPDevPath
->RemoteIpAddress
.Addr
[7],
1135 IPDevPath
->RemoteIpAddress
.Addr
[8],
1136 IPDevPath
->RemoteIpAddress
.Addr
[9],
1137 IPDevPath
->RemoteIpAddress
.Addr
[10],
1138 IPDevPath
->RemoteIpAddress
.Addr
[11],
1139 IPDevPath
->RemoteIpAddress
.Addr
[12],
1140 IPDevPath
->RemoteIpAddress
.Addr
[13],
1141 IPDevPath
->RemoteIpAddress
.Addr
[14],
1142 IPDevPath
->RemoteIpAddress
.Addr
[15],
1143 IPDevPath
->Protocol
? L
"TCP" : L
"UDP",
1144 (IPDevPath
->StaticIpAddress
== TRUE
) ? L
"Static" : L
"DHCP",
1145 IPDevPath
->LocalIpAddress
.Addr
[0],
1146 IPDevPath
->LocalIpAddress
.Addr
[1],
1147 IPDevPath
->LocalIpAddress
.Addr
[2],
1148 IPDevPath
->LocalIpAddress
.Addr
[3],
1149 IPDevPath
->LocalIpAddress
.Addr
[4],
1150 IPDevPath
->LocalIpAddress
.Addr
[5],
1151 IPDevPath
->LocalIpAddress
.Addr
[6],
1152 IPDevPath
->LocalIpAddress
.Addr
[7],
1153 IPDevPath
->LocalIpAddress
.Addr
[8],
1154 IPDevPath
->LocalIpAddress
.Addr
[9],
1155 IPDevPath
->LocalIpAddress
.Addr
[10],
1156 IPDevPath
->LocalIpAddress
.Addr
[11],
1157 IPDevPath
->LocalIpAddress
.Addr
[12],
1158 IPDevPath
->LocalIpAddress
.Addr
[13],
1159 IPDevPath
->LocalIpAddress
.Addr
[14],
1160 IPDevPath
->LocalIpAddress
.Addr
[15]
1165 Converts an Infini Band device path structure to its string representive.
1167 @param Str The string representive of input device.
1168 @param DevPath The input device path structure.
1169 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1170 of the display node is used, where applicable. If DisplayOnly
1171 is FALSE, then the longer text representation of the display node
1173 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1174 representation for a device node can be used, where applicable.
1178 DevPathToTextInfiniBand (
1179 IN OUT POOL_PRINT
*Str
,
1181 IN BOOLEAN DisplayOnly
,
1182 IN BOOLEAN AllowShortcuts
1185 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1187 InfiniBand
= DevPath
;
1190 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1191 InfiniBand
->ResourceFlags
,
1192 InfiniBand
->PortGid
,
1193 InfiniBand
->ServiceId
,
1194 InfiniBand
->TargetPortId
,
1195 InfiniBand
->DeviceId
1200 Converts a UART device path structure to its string representive.
1202 @param Str The string representive of input device.
1203 @param DevPath The input device path structure.
1204 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1205 of the display node is used, where applicable. If DisplayOnly
1206 is FALSE, then the longer text representation of the display node
1208 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1209 representation for a device node can be used, where applicable.
1214 IN OUT POOL_PRINT
*Str
,
1216 IN BOOLEAN DisplayOnly
,
1217 IN BOOLEAN AllowShortcuts
1220 UART_DEVICE_PATH
*Uart
;
1224 switch (Uart
->Parity
) {
1254 if (Uart
->BaudRate
== 0) {
1255 CatPrint (Str
, L
"Uart(DEFAULT,");
1257 CatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1260 if (Uart
->DataBits
== 0) {
1261 CatPrint (Str
, L
"DEFAULT,");
1263 CatPrint (Str
, L
"%d,", Uart
->DataBits
);
1266 CatPrint (Str
, L
"%c,", Parity
);
1268 switch (Uart
->StopBits
) {
1270 CatPrint (Str
, L
"D)");
1274 CatPrint (Str
, L
"1)");
1278 CatPrint (Str
, L
"1.5)");
1282 CatPrint (Str
, L
"2)");
1286 CatPrint (Str
, L
"x)");
1292 Converts an iSCSI device path structure to its string representive.
1294 @param Str The string representive of input device.
1295 @param DevPath The input device path structure.
1296 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1297 of the display node is used, where applicable. If DisplayOnly
1298 is FALSE, then the longer text representation of the display node
1300 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1301 representation for a device node can be used, where applicable.
1305 DevPathToTextiSCSI (
1306 IN OUT POOL_PRINT
*Str
,
1308 IN BOOLEAN DisplayOnly
,
1309 IN BOOLEAN AllowShortcuts
1312 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1315 ISCSIDevPath
= DevPath
;
1318 L
"iSCSI(%a,0x%x,0x%lx,",
1319 ISCSIDevPath
->iSCSITargetName
,
1320 ISCSIDevPath
->TargetPortalGroupTag
,
1324 Options
= ISCSIDevPath
->LoginOption
;
1325 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1326 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1327 if (((Options
>> 11) & 0x0001) != 0) {
1328 CatPrint (Str
, L
"%s,", L
"None");
1329 } else if (((Options
>> 12) & 0x0001) != 0) {
1330 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1332 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
1336 CatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1340 Converts a Hard drive device path structure to its string representive.
1342 @param Str The string representive of input device.
1343 @param DevPath The input device path structure.
1344 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1345 of the display node is used, where applicable. If DisplayOnly
1346 is FALSE, then the longer text representation of the display node
1348 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1349 representation for a device node can be used, where applicable.
1353 DevPathToTextHardDrive (
1354 IN OUT POOL_PRINT
*Str
,
1356 IN BOOLEAN DisplayOnly
,
1357 IN BOOLEAN AllowShortcuts
1360 HARDDRIVE_DEVICE_PATH
*Hd
;
1363 switch (Hd
->SignatureType
) {
1364 case SIGNATURE_TYPE_MBR
:
1367 L
"HD(%d,%s,0x%08x,",
1368 Hd
->PartitionNumber
,
1370 *((UINT32
*) (&(Hd
->Signature
[0])))
1374 case SIGNATURE_TYPE_GUID
:
1378 Hd
->PartitionNumber
,
1380 (EFI_GUID
*) &(Hd
->Signature
[0])
1388 Hd
->PartitionNumber
,
1394 CatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1398 Converts a CDROM device path structure to its string representive.
1400 @param Str The string representive of input device.
1401 @param DevPath The input device path structure.
1402 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1403 of the display node is used, where applicable. If DisplayOnly
1404 is FALSE, then the longer text representation of the display node
1406 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1407 representation for a device node can be used, where applicable.
1411 DevPathToTextCDROM (
1412 IN OUT POOL_PRINT
*Str
,
1414 IN BOOLEAN DisplayOnly
,
1415 IN BOOLEAN AllowShortcuts
1418 CDROM_DEVICE_PATH
*Cd
;
1422 CatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1426 CatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1430 Converts a File device path structure to its string representive.
1432 @param Str The string representive of input device.
1433 @param DevPath The input device path structure.
1434 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1435 of the display node is used, where applicable. If DisplayOnly
1436 is FALSE, then the longer text representation of the display node
1438 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1439 representation for a device node can be used, where applicable.
1443 DevPathToTextFilePath (
1444 IN OUT POOL_PRINT
*Str
,
1446 IN BOOLEAN DisplayOnly
,
1447 IN BOOLEAN AllowShortcuts
1450 FILEPATH_DEVICE_PATH
*Fp
;
1453 CatPrint (Str
, L
"%s", Fp
->PathName
);
1457 Converts a Media protocol device path structure to its string representive.
1459 @param Str The string representive of input device.
1460 @param DevPath The input device path structure.
1461 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1462 of the display node is used, where applicable. If DisplayOnly
1463 is FALSE, then the longer text representation of the display node
1465 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1466 representation for a device node can be used, where applicable.
1470 DevPathToTextMediaProtocol (
1471 IN OUT POOL_PRINT
*Str
,
1473 IN BOOLEAN DisplayOnly
,
1474 IN BOOLEAN AllowShortcuts
1477 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1479 MediaProt
= DevPath
;
1480 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1484 Converts a Firmware Volume device path structure to its string representive.
1486 @param Str The string representive of input device.
1487 @param DevPath The input device path structure.
1488 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1489 of the display node is used, where applicable. If DisplayOnly
1490 is FALSE, then the longer text representation of the display node
1492 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1493 representation for a device node can be used, where applicable.
1498 IN OUT POOL_PRINT
*Str
,
1500 IN BOOLEAN DisplayOnly
,
1501 IN BOOLEAN AllowShortcuts
1504 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1507 CatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1511 Converts a Firmware Volume File device path structure to its string representive.
1513 @param Str The string representive of input device.
1514 @param DevPath The input device path structure.
1515 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1516 of the display node is used, where applicable. If DisplayOnly
1517 is FALSE, then the longer text representation of the display node
1519 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1520 representation for a device node can be used, where applicable.
1524 DevPathToTextFvFile (
1525 IN OUT POOL_PRINT
*Str
,
1527 IN BOOLEAN DisplayOnly
,
1528 IN BOOLEAN AllowShortcuts
1531 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1534 CatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1538 Converts a BIOS Boot Specification device path structure to its string representive.
1540 @param Str The string representive of input device.
1541 @param DevPath The input device path structure.
1542 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1543 of the display node is used, where applicable. If DisplayOnly
1544 is FALSE, then the longer text representation of the display node
1546 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1547 representation for a device node can be used, where applicable.
1552 IN OUT POOL_PRINT
*Str
,
1554 IN BOOLEAN DisplayOnly
,
1555 IN BOOLEAN AllowShortcuts
1558 BBS_BBS_DEVICE_PATH
*Bbs
;
1562 switch (Bbs
->DeviceType
) {
1563 case BBS_TYPE_FLOPPY
:
1567 case BBS_TYPE_HARDDRIVE
:
1571 case BBS_TYPE_CDROM
:
1575 case BBS_TYPE_PCMCIA
:
1583 case BBS_TYPE_EMBEDDED_NETWORK
:
1593 CatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1595 CatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
1599 CatPrint (Str
, L
")");
1603 CatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
1607 Converts an End-of-Device-Path structure to its string representive.
1609 @param Str The string representive of input device.
1610 @param DevPath The input device path structure.
1611 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1612 of the display node is used, where applicable. If DisplayOnly
1613 is FALSE, then the longer text representation of the display node
1615 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1616 representation for a device node can be used, where applicable.
1620 DevPathToTextEndInstance (
1621 IN OUT POOL_PRINT
*Str
,
1623 IN BOOLEAN DisplayOnly
,
1624 IN BOOLEAN AllowShortcuts
1627 CatPrint (Str
, L
",");
1631 Converts an unknown device path structure to its string representive.
1633 @param Str The string representive of input device.
1634 @param DevPath The input device path structure.
1635 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1636 of the display node is used, where applicable. If DisplayOnly
1637 is FALSE, then the longer text representation of the display node
1639 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1640 representation for a device node can be used, where applicable.
1644 DevPathToTextNodeUnknown (
1645 IN OUT POOL_PRINT
*Str
,
1647 IN BOOLEAN DisplayOnly
,
1648 IN BOOLEAN AllowShortcuts
1651 CatPrint (Str
, L
"?");
1654 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
[] = {
1655 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
1656 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
1657 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
1658 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
1659 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
1660 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
1661 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
1662 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
1663 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
1664 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
1665 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
1666 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
1667 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
1668 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
1669 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
1670 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
1671 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
1672 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
1673 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
1674 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
1675 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
1676 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
1677 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
1678 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
1679 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
1680 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
1681 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
1682 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
1683 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1684 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
1685 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1686 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
1687 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
1688 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
1689 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
1694 Converts a device node to its string representation.
1696 @param DeviceNode A Pointer to the device node to be converted.
1697 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1698 of the display node is used, where applicable. If DisplayOnly
1699 is FALSE, then the longer text representation of the display node
1701 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1702 representation for a device node can be used, where applicable.
1704 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
1705 is NULL or there was insufficient memory.
1710 ConvertDeviceNodeToText (
1711 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
1712 IN BOOLEAN DisplayOnly
,
1713 IN BOOLEAN AllowShortcuts
1719 VOID (*DumpNode
)(POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1721 if (DeviceNode
== NULL
) {
1725 ZeroMem (&Str
, sizeof (Str
));
1728 // Process the device path node
1731 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
++) {
1732 if (DevicePathType (DeviceNode
) == DevPathToTextTable
[Index
].Type
&&
1733 DevicePathSubType (DeviceNode
) == DevPathToTextTable
[Index
].SubType
1735 DumpNode
= DevPathToTextTable
[Index
].Function
;
1740 // If not found, use a generic function
1742 if (DumpNode
== NULL
) {
1743 DumpNode
= DevPathToTextNodeUnknown
;
1749 DumpNode (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
1752 // Shrink pool used for string allocation
1754 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1755 Str
.Str
= ReallocatePool (Str
.Str
, NewSize
, NewSize
);
1756 ASSERT (Str
.Str
!= NULL
);
1757 Str
.Str
[Str
.Len
] = 0;
1762 Converts a device path to its text representation.
1764 @param DevicePath A Pointer to the device to be converted.
1765 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1766 of the display node is used, where applicable. If DisplayOnly
1767 is FALSE, then the longer text representation of the display node
1769 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1770 representation for a device node can be used, where applicable.
1772 @return A pointer to the allocated text representation of the device path or
1773 NULL if DeviceNode is NULL or there was insufficient memory.
1778 ConvertDevicePathToText (
1779 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
1780 IN BOOLEAN DisplayOnly
,
1781 IN BOOLEAN AllowShortcuts
1785 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1786 EFI_DEVICE_PATH_PROTOCOL
*AlignedDevPathNode
;
1789 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1791 if (DevicePath
== NULL
) {
1795 ZeroMem (&Str
, sizeof (Str
));
1798 // Process each device path node
1800 DevPathNode
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
1801 while (!IsDevicePathEnd (DevPathNode
)) {
1803 // Find the handler to dump this device path node
1806 for (Index
= 0; DevPathToTextTable
[Index
].Function
; Index
+= 1) {
1808 if (DevicePathType (DevPathNode
) == DevPathToTextTable
[Index
].Type
&&
1809 DevicePathSubType (DevPathNode
) == DevPathToTextTable
[Index
].SubType
1811 DumpNode
= DevPathToTextTable
[Index
].Function
;
1816 // If not found, use a generic function
1819 DumpNode
= DevPathToTextNodeUnknown
;
1822 // Put a path seperator in if needed
1824 if ((Str
.Len
!= 0) && DumpNode
!= DevPathToTextEndInstance
) {
1825 if (*(Str
.Str
+ Str
.Len
/ sizeof (CHAR16
) - 1) != L
',') {
1826 CatPrint (&Str
, L
"/");
1830 AlignedDevPathNode
= AllocateCopyPool (DevicePathNodeLength (DevPathNode
), DevPathNode
);
1832 // Print this node of the device path
1834 DumpNode (&Str
, AlignedDevPathNode
, DisplayOnly
, AllowShortcuts
);
1835 FreePool (AlignedDevPathNode
);
1838 // Next device path node
1840 DevPathNode
= NextDevicePathNode (DevPathNode
);
1843 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1844 Str
.Str
= ReallocatePool (Str
.Str
, NewSize
, NewSize
);
1845 ASSERT (Str
.Str
!= NULL
);
1846 Str
.Str
[Str
.Len
] = 0;