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 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.
33 IN OUT POOL_PRINT
*Str
,
42 AppendStr
= AllocateZeroPool (0x1000);
43 if (AppendStr
== NULL
) {
48 UnicodeVSPrint (AppendStr
, 0x1000, Fmt
, Args
);
50 if (NULL
== Str
->Str
) {
51 Size
= StrSize (AppendStr
);
52 Str
->Str
= AllocateZeroPool (Size
);
53 ASSERT (Str
->Str
!= NULL
);
55 Size
= StrSize (AppendStr
) - sizeof (UINT16
);
56 Size
= Size
+ StrSize (Str
->Str
);
57 Str
->Str
= ReallocatePool (
62 ASSERT (Str
->Str
!= NULL
);
65 Str
->MaxLen
= MAX_CHAR
* sizeof (UINT16
);
66 if (Size
< Str
->MaxLen
) {
67 StrCat (Str
->Str
, AppendStr
);
68 Str
->Len
= Size
- sizeof (UINT16
);
76 Converts a PCI device path structure to its string representative.
78 @param Str The string representative of input device.
79 @param DevPath The input device path structure.
80 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
81 of the display node is used, where applicable. If DisplayOnly
82 is FALSE, then the longer text representation of the display node
84 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
85 representation for a device node can be used, where applicable.
90 IN OUT POOL_PRINT
*Str
,
92 IN BOOLEAN DisplayOnly
,
93 IN BOOLEAN AllowShortcuts
99 CatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
103 Converts a PC Card device path structure to its string representative.
105 @param Str The string representative of input device.
106 @param DevPath The input device path structure.
107 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
108 of the display node is used, where applicable. If DisplayOnly
109 is FALSE, then the longer text representation of the display node
111 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
112 representation for a device node can be used, where applicable.
116 DevPathToTextPccard (
117 IN OUT POOL_PRINT
*Str
,
119 IN BOOLEAN DisplayOnly
,
120 IN BOOLEAN AllowShortcuts
123 PCCARD_DEVICE_PATH
*Pccard
;
126 CatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
130 Converts a Memory Map device path structure to its string representative.
132 @param Str The string representative of input device.
133 @param DevPath The input device path structure.
134 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
135 of the display node is used, where applicable. If DisplayOnly
136 is FALSE, then the longer text representation of the display node
138 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
139 representation for a device node can be used, where applicable.
143 DevPathToTextMemMap (
144 IN OUT POOL_PRINT
*Str
,
146 IN BOOLEAN DisplayOnly
,
147 IN BOOLEAN AllowShortcuts
150 MEMMAP_DEVICE_PATH
*MemMap
;
155 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
157 MemMap
->StartingAddress
,
158 MemMap
->EndingAddress
163 Converts a Vendor device path structure to its string representative.
165 @param Str The string representative of input device.
166 @param DevPath The input device path structure.
167 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
168 of the display node is used, where applicable. If DisplayOnly
169 is FALSE, then the longer text representation of the display node
171 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
172 representation for a device node can be used, where applicable.
176 DevPathToTextVendor (
177 IN OUT POOL_PRINT
*Str
,
179 IN BOOLEAN DisplayOnly
,
180 IN BOOLEAN AllowShortcuts
183 VENDOR_DEVICE_PATH
*Vendor
;
187 UINT32 FlowControlMap
;
190 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
191 switch (DevicePathType (&Vendor
->Header
)) {
192 case HARDWARE_DEVICE_PATH
:
196 case MESSAGING_DEVICE_PATH
:
198 if (AllowShortcuts
) {
199 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
200 CatPrint (Str
, L
"VenPcAnsi()");
202 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
203 CatPrint (Str
, L
"VenVt100()");
205 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
206 CatPrint (Str
, L
"VenVt100Plus()");
208 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
209 CatPrint (Str
, L
"VenUft8()");
211 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
212 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
213 switch (FlowControlMap
& 0x00000003) {
215 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
219 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
223 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
231 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
234 L
"SAS(0x%lx,0x%lx,0x%x,",
235 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
236 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
237 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
239 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
240 if ((Info
& 0x0f) == 0) {
241 CatPrint (Str
, L
"NoTopology,0,0,0,");
242 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
246 ((Info
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
247 ((Info
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
248 ((Info
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
250 if ((Info
& 0x0f) == 1) {
251 CatPrint (Str
, L
"0,");
253 CatPrint (Str
, L
"0x%x,", (Info
>> 8) & 0xff);
256 CatPrint (Str
, L
"0,0,0,0,");
259 CatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
261 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
262 CatPrint (Str
, L
"DebugPort()");
268 case MEDIA_DEVICE_PATH
:
277 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
278 CatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
279 if (DataLength
!= 0) {
280 CatPrint (Str
, L
",");
281 for (Index
= 0; Index
< DataLength
; Index
++) {
282 CatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
286 CatPrint (Str
, L
")");
290 Converts a Controller device path structure to its string representative.
292 @param Str The string representative of input device.
293 @param DevPath The input device path structure.
294 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
295 of the display node is used, where applicable. If DisplayOnly
296 is FALSE, then the longer text representation of the display node
298 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
299 representation for a device node can be used, where applicable.
303 DevPathToTextController (
304 IN OUT POOL_PRINT
*Str
,
306 IN BOOLEAN DisplayOnly
,
307 IN BOOLEAN AllowShortcuts
310 CONTROLLER_DEVICE_PATH
*Controller
;
312 Controller
= DevPath
;
316 Controller
->ControllerNumber
321 Converts a ACPI device path structure to its string representative.
323 @param Str The string representative of input device.
324 @param DevPath The input device path structure.
325 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
326 of the display node is used, where applicable. If DisplayOnly
327 is FALSE, then the longer text representation of the display node
329 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
330 representation for a device node can be used, where applicable.
335 IN OUT POOL_PRINT
*Str
,
337 IN BOOLEAN DisplayOnly
,
338 IN BOOLEAN AllowShortcuts
341 ACPI_HID_DEVICE_PATH
*Acpi
;
344 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
345 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
347 CatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
351 CatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
355 CatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
359 CatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
363 CatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
367 CatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
371 CatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
376 Converts EISA identification to string.
378 @param EisaId The input EISA identification.
379 @param Text A pointer to the output string.
391 //UnicodeSPrint ("%X", 0x0a03) => "0000000000000A03"
393 UnicodeSPrint (PnpIdStr
, 17 * 2, L
"%16X", EisaId
>> 16);
397 sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (PnpIdStr
),
399 '@' + ((EisaId
>> 10) & 0x1f),
400 '@' + ((EisaId
>> 5) & 0x1f),
401 '@' + ((EisaId
>> 0) & 0x1f),
407 Converts a ACPI extended HID device path structure to its string representative.
409 @param Str The string representative of input device.
410 @param DevPath The input device path structure.
411 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
412 of the display node is used, where applicable. If DisplayOnly
413 is FALSE, then the longer text representation of the display node
415 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
416 representation for a device node can be used, where applicable.
420 DevPathToTextAcpiEx (
421 IN OUT POOL_PRINT
*Str
,
423 IN BOOLEAN DisplayOnly
,
424 IN BOOLEAN AllowShortcuts
427 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
435 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
436 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
437 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
439 EisaIdToText (AcpiEx
->HID
, HIDText
);
440 EisaIdToText (AcpiEx
->CID
, CIDText
);
442 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (AcpiEx
->UID
== 0)) {
448 L
"AcpiExp(%s,%s,%a)",
454 if (AllowShortcuts
) {
458 if (AcpiEx
->HID
== 0) {
459 CatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
461 CatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
464 if (AcpiEx
->UID
== 0) {
465 CatPrint (Str
, L
"%a,", UIDStr
);
467 CatPrint (Str
, L
"0x%x,", AcpiEx
->UID
);
470 if (AcpiEx
->CID
== 0) {
471 CatPrint (Str
, L
"%a)", CIDStr
);
473 CatPrint (Str
, L
"%s)", CIDText
);
478 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
491 Converts a ACPI address device path structure to its string representative.
493 @param Str The string representative of input device.
494 @param DevPath The input device path structure.
495 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
496 of the display node is used, where applicable. If DisplayOnly
497 is FALSE, then the longer text representation of the display node
499 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
500 representation for a device node can be used, where applicable.
504 DevPathToTextAcpiAdr (
505 IN OUT POOL_PRINT
*Str
,
507 IN BOOLEAN DisplayOnly
,
508 IN BOOLEAN AllowShortcuts
511 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
514 UINT16 AdditionalAdrCount
;
517 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
518 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
520 CatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
521 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
522 CatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
524 CatPrint (Str
, L
")");
528 Converts a ATAPI device path structure to its string representative.
530 @param Str The string representative of input device.
531 @param DevPath The input device path structure.
532 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
533 of the display node is used, where applicable. If DisplayOnly
534 is FALSE, then the longer text representation of the display node
536 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
537 representation for a device node can be used, where applicable.
542 IN OUT POOL_PRINT
*Str
,
544 IN BOOLEAN DisplayOnly
,
545 IN BOOLEAN AllowShortcuts
548 ATAPI_DEVICE_PATH
*Atapi
;
553 CatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
558 Atapi
->PrimarySecondary
? L
"Secondary" : L
"Primary",
559 Atapi
->SlaveMaster
? L
"Slave" : L
"Master",
566 Converts a SCSI device path structure to its string representative.
568 @param Str The string representative of input device.
569 @param DevPath The input device path structure.
570 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
571 of the display node is used, where applicable. If DisplayOnly
572 is FALSE, then the longer text representation of the display node
574 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
575 representation for a device node can be used, where applicable.
580 IN OUT POOL_PRINT
*Str
,
582 IN BOOLEAN DisplayOnly
,
583 IN BOOLEAN AllowShortcuts
586 SCSI_DEVICE_PATH
*Scsi
;
589 CatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
593 Converts a Fibre device path structure to its string representative.
595 @param Str The string representative of input device.
596 @param DevPath The input device path structure.
597 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
598 of the display node is used, where applicable. If DisplayOnly
599 is FALSE, then the longer text representation of the display node
601 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
602 representation for a device node can be used, where applicable.
607 IN OUT POOL_PRINT
*Str
,
609 IN BOOLEAN DisplayOnly
,
610 IN BOOLEAN AllowShortcuts
613 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
616 CatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
620 Converts a 1394 device path structure to its string representative.
622 @param Str The string representative of input device.
623 @param DevPath The input device path structure.
624 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
625 of the display node is used, where applicable. If DisplayOnly
626 is FALSE, then the longer text representation of the display node
628 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
629 representation for a device node can be used, where applicable.
634 IN OUT POOL_PRINT
*Str
,
636 IN BOOLEAN DisplayOnly
,
637 IN BOOLEAN AllowShortcuts
640 F1394_DEVICE_PATH
*F1394DevPath
;
642 F1394DevPath
= DevPath
;
644 // Guid has format of IEEE-EUI64
646 CatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
650 Converts a USB device path structure to its string representative.
652 @param Str The string representative of input device.
653 @param DevPath The input device path structure.
654 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
655 of the display node is used, where applicable. If DisplayOnly
656 is FALSE, then the longer text representation of the display node
658 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
659 representation for a device node can be used, where applicable.
664 IN OUT POOL_PRINT
*Str
,
666 IN BOOLEAN DisplayOnly
,
667 IN BOOLEAN AllowShortcuts
670 USB_DEVICE_PATH
*Usb
;
673 CatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
677 Converts a USB WWID device path structure to its string representative.
679 @param Str The string representative of input device.
680 @param DevPath The input device path structure.
681 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
682 of the display node is used, where applicable. If DisplayOnly
683 is FALSE, then the longer text representation of the display node
685 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
686 representation for a device node can be used, where applicable.
690 DevPathToTextUsbWWID (
691 IN OUT POOL_PRINT
*Str
,
693 IN BOOLEAN DisplayOnly
,
694 IN BOOLEAN AllowShortcuts
697 USB_WWID_DEVICE_PATH
*UsbWWId
;
698 CHAR16
*SerialNumberStr
;
704 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
705 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
706 if (SerialNumberStr
[Length
- 1] != 0) {
708 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
710 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
711 ASSERT (NewStr
!= NULL
);
713 SerialNumberStr
= NewStr
;
718 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
721 UsbWWId
->InterfaceNumber
,
727 Converts a Logic Unit device path structure to its string representative.
729 @param Str The string representative of input device.
730 @param DevPath The input device path structure.
731 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
732 of the display node is used, where applicable. If DisplayOnly
733 is FALSE, then the longer text representation of the display node
735 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
736 representation for a device node can be used, where applicable.
740 DevPathToTextLogicalUnit (
741 IN OUT POOL_PRINT
*Str
,
743 IN BOOLEAN DisplayOnly
,
744 IN BOOLEAN AllowShortcuts
747 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
749 LogicalUnit
= DevPath
;
750 CatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
754 Converts a USB class device path structure to its string representative.
756 @param Str The string representative of input device.
757 @param DevPath The input device path structure.
758 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
759 of the display node is used, where applicable. If DisplayOnly
760 is FALSE, then the longer text representation of the display node
762 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
763 representation for a device node can be used, where applicable.
767 DevPathToTextUsbClass (
768 IN OUT POOL_PRINT
*Str
,
770 IN BOOLEAN DisplayOnly
,
771 IN BOOLEAN AllowShortcuts
774 USB_CLASS_DEVICE_PATH
*UsbClass
;
775 BOOLEAN IsKnownSubClass
;
780 IsKnownSubClass
= TRUE
;
781 switch (UsbClass
->DeviceClass
) {
782 case USB_CLASS_AUDIO
:
783 CatPrint (Str
, L
"UsbAudio");
786 case USB_CLASS_CDCCONTROL
:
787 CatPrint (Str
, L
"UsbCDCControl");
791 CatPrint (Str
, L
"UsbHID");
794 case USB_CLASS_IMAGE
:
795 CatPrint (Str
, L
"UsbImage");
798 case USB_CLASS_PRINTER
:
799 CatPrint (Str
, L
"UsbPrinter");
802 case USB_CLASS_MASS_STORAGE
:
803 CatPrint (Str
, L
"UsbMassStorage");
807 CatPrint (Str
, L
"UsbHub");
810 case USB_CLASS_CDCDATA
:
811 CatPrint (Str
, L
"UsbCDCData");
814 case USB_CLASS_SMART_CARD
:
815 CatPrint (Str
, L
"UsbSmartCard");
818 case USB_CLASS_VIDEO
:
819 CatPrint (Str
, L
"UsbVideo");
822 case USB_CLASS_DIAGNOSTIC
:
823 CatPrint (Str
, L
"UsbDiagnostic");
826 case USB_CLASS_WIRELESS
:
827 CatPrint (Str
, L
"UsbWireless");
831 IsKnownSubClass
= FALSE
;
835 if (IsKnownSubClass
) {
838 L
"(0x%x,0x%x,0x%x,0x%x)",
841 UsbClass
->DeviceSubClass
,
842 UsbClass
->DeviceProtocol
847 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
848 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
851 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
854 UsbClass
->DeviceProtocol
857 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
860 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
863 UsbClass
->DeviceProtocol
866 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
869 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
872 UsbClass
->DeviceProtocol
880 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
883 UsbClass
->DeviceClass
,
884 UsbClass
->DeviceSubClass
,
885 UsbClass
->DeviceProtocol
890 Converts a SATA device path structure to its string representative.
892 @param Str The string representative of input device.
893 @param DevPath The input device path structure.
894 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
895 of the display node is used, where applicable. If DisplayOnly
896 is FALSE, then the longer text representation of the display node
898 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
899 representation for a device node can be used, where applicable.
904 IN OUT POOL_PRINT
*Str
,
906 IN BOOLEAN DisplayOnly
,
907 IN BOOLEAN AllowShortcuts
910 SATA_DEVICE_PATH
*Sata
;
915 L
"Sata(0x%x,0x%x,0x%x)",
916 (UINTN
) Sata
->HBAPortNumber
,
917 (UINTN
) Sata
->PortMultiplierPortNumber
,
923 Converts a I20 device path structure to its string representative.
925 @param Str The string representative of input device.
926 @param DevPath The input device path structure.
927 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
928 of the display node is used, where applicable. If DisplayOnly
929 is FALSE, then the longer text representation of the display node
931 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
932 representation for a device node can be used, where applicable.
937 IN OUT POOL_PRINT
*Str
,
939 IN BOOLEAN DisplayOnly
,
940 IN BOOLEAN AllowShortcuts
943 I2O_DEVICE_PATH
*I2ODevPath
;
945 I2ODevPath
= DevPath
;
946 CatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
950 Converts a MAC address device path structure to its string representative.
952 @param Str The string representative of input device.
953 @param DevPath The input device path structure.
954 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
955 of the display node is used, where applicable. If DisplayOnly
956 is FALSE, then the longer text representation of the display node
958 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
959 representation for a device node can be used, where applicable.
963 DevPathToTextMacAddr (
964 IN OUT POOL_PRINT
*Str
,
966 IN BOOLEAN DisplayOnly
,
967 IN BOOLEAN AllowShortcuts
970 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
974 MacDevPath
= DevPath
;
976 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
977 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
981 CatPrint (Str
, L
"MAC(");
983 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
984 CatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
987 CatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
991 Converts a IPv4 device path structure to its string representative.
993 @param Str The string representative of input device.
994 @param DevPath The input device path structure.
995 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
996 of the display node is used, where applicable. If DisplayOnly
997 is FALSE, then the longer text representation of the display node
999 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1000 representation for a device node can be used, where applicable.
1005 IN OUT POOL_PRINT
*Str
,
1007 IN BOOLEAN DisplayOnly
,
1008 IN BOOLEAN AllowShortcuts
1011 IPv4_DEVICE_PATH
*IPDevPath
;
1013 IPDevPath
= DevPath
;
1017 L
"IPv4(%d.%d.%d.%d)",
1018 IPDevPath
->RemoteIpAddress
.Addr
[0],
1019 IPDevPath
->RemoteIpAddress
.Addr
[1],
1020 IPDevPath
->RemoteIpAddress
.Addr
[2],
1021 IPDevPath
->RemoteIpAddress
.Addr
[3]
1028 L
"IPv4(%d.%d.%d.%d,%s,%s,%d.%d.%d.%d)",
1029 IPDevPath
->RemoteIpAddress
.Addr
[0],
1030 IPDevPath
->RemoteIpAddress
.Addr
[1],
1031 IPDevPath
->RemoteIpAddress
.Addr
[2],
1032 IPDevPath
->RemoteIpAddress
.Addr
[3],
1033 IPDevPath
->Protocol
? L
"TCP" : L
"UDP",
1034 (IPDevPath
->StaticIpAddress
== TRUE
) ? L
"Static" : L
"DHCP",
1035 IPDevPath
->LocalIpAddress
.Addr
[0],
1036 IPDevPath
->LocalIpAddress
.Addr
[1],
1037 IPDevPath
->LocalIpAddress
.Addr
[2],
1038 IPDevPath
->LocalIpAddress
.Addr
[3]
1043 Converts a IPv6 device path structure to its string representative.
1045 @param Str The string representative of input device.
1046 @param DevPath The input device path structure.
1047 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1048 of the display node is used, where applicable. If DisplayOnly
1049 is FALSE, then the longer text representation of the display node
1051 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1052 representation for a device node can be used, where applicable.
1057 IN OUT POOL_PRINT
*Str
,
1059 IN BOOLEAN DisplayOnly
,
1060 IN BOOLEAN AllowShortcuts
1063 IPv6_DEVICE_PATH
*IPDevPath
;
1065 IPDevPath
= DevPath
;
1069 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
1070 IPDevPath
->RemoteIpAddress
.Addr
[0],
1071 IPDevPath
->RemoteIpAddress
.Addr
[1],
1072 IPDevPath
->RemoteIpAddress
.Addr
[2],
1073 IPDevPath
->RemoteIpAddress
.Addr
[3],
1074 IPDevPath
->RemoteIpAddress
.Addr
[4],
1075 IPDevPath
->RemoteIpAddress
.Addr
[5],
1076 IPDevPath
->RemoteIpAddress
.Addr
[6],
1077 IPDevPath
->RemoteIpAddress
.Addr
[7],
1078 IPDevPath
->RemoteIpAddress
.Addr
[8],
1079 IPDevPath
->RemoteIpAddress
.Addr
[9],
1080 IPDevPath
->RemoteIpAddress
.Addr
[10],
1081 IPDevPath
->RemoteIpAddress
.Addr
[11],
1082 IPDevPath
->RemoteIpAddress
.Addr
[12],
1083 IPDevPath
->RemoteIpAddress
.Addr
[13],
1084 IPDevPath
->RemoteIpAddress
.Addr
[14],
1085 IPDevPath
->RemoteIpAddress
.Addr
[15]
1092 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)",
1093 IPDevPath
->RemoteIpAddress
.Addr
[0],
1094 IPDevPath
->RemoteIpAddress
.Addr
[1],
1095 IPDevPath
->RemoteIpAddress
.Addr
[2],
1096 IPDevPath
->RemoteIpAddress
.Addr
[3],
1097 IPDevPath
->RemoteIpAddress
.Addr
[4],
1098 IPDevPath
->RemoteIpAddress
.Addr
[5],
1099 IPDevPath
->RemoteIpAddress
.Addr
[6],
1100 IPDevPath
->RemoteIpAddress
.Addr
[7],
1101 IPDevPath
->RemoteIpAddress
.Addr
[8],
1102 IPDevPath
->RemoteIpAddress
.Addr
[9],
1103 IPDevPath
->RemoteIpAddress
.Addr
[10],
1104 IPDevPath
->RemoteIpAddress
.Addr
[11],
1105 IPDevPath
->RemoteIpAddress
.Addr
[12],
1106 IPDevPath
->RemoteIpAddress
.Addr
[13],
1107 IPDevPath
->RemoteIpAddress
.Addr
[14],
1108 IPDevPath
->RemoteIpAddress
.Addr
[15],
1109 IPDevPath
->Protocol
? L
"TCP" : L
"UDP",
1110 (IPDevPath
->StaticIpAddress
== TRUE
) ? L
"Static" : L
"DHCP",
1111 IPDevPath
->LocalIpAddress
.Addr
[0],
1112 IPDevPath
->LocalIpAddress
.Addr
[1],
1113 IPDevPath
->LocalIpAddress
.Addr
[2],
1114 IPDevPath
->LocalIpAddress
.Addr
[3],
1115 IPDevPath
->LocalIpAddress
.Addr
[4],
1116 IPDevPath
->LocalIpAddress
.Addr
[5],
1117 IPDevPath
->LocalIpAddress
.Addr
[6],
1118 IPDevPath
->LocalIpAddress
.Addr
[7],
1119 IPDevPath
->LocalIpAddress
.Addr
[8],
1120 IPDevPath
->LocalIpAddress
.Addr
[9],
1121 IPDevPath
->LocalIpAddress
.Addr
[10],
1122 IPDevPath
->LocalIpAddress
.Addr
[11],
1123 IPDevPath
->LocalIpAddress
.Addr
[12],
1124 IPDevPath
->LocalIpAddress
.Addr
[13],
1125 IPDevPath
->LocalIpAddress
.Addr
[14],
1126 IPDevPath
->LocalIpAddress
.Addr
[15]
1131 Converts an Infini Band device path structure to its string representative.
1133 @param Str The string representative of input device.
1134 @param DevPath The input device path structure.
1135 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1136 of the display node is used, where applicable. If DisplayOnly
1137 is FALSE, then the longer text representation of the display node
1139 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1140 representation for a device node can be used, where applicable.
1144 DevPathToTextInfiniBand (
1145 IN OUT POOL_PRINT
*Str
,
1147 IN BOOLEAN DisplayOnly
,
1148 IN BOOLEAN AllowShortcuts
1151 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1153 InfiniBand
= DevPath
;
1156 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1157 InfiniBand
->ResourceFlags
,
1158 InfiniBand
->PortGid
,
1159 InfiniBand
->ServiceId
,
1160 InfiniBand
->TargetPortId
,
1161 InfiniBand
->DeviceId
1166 Converts a UART device path structure to its string representative.
1168 @param Str The string representative of input device.
1169 @param DevPath The input device path structure.
1170 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1171 of the display node is used, where applicable. If DisplayOnly
1172 is FALSE, then the longer text representation of the display node
1174 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1175 representation for a device node can be used, where applicable.
1180 IN OUT POOL_PRINT
*Str
,
1182 IN BOOLEAN DisplayOnly
,
1183 IN BOOLEAN AllowShortcuts
1186 UART_DEVICE_PATH
*Uart
;
1190 switch (Uart
->Parity
) {
1220 if (Uart
->BaudRate
== 0) {
1221 CatPrint (Str
, L
"Uart(DEFAULT,");
1223 CatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1226 if (Uart
->DataBits
== 0) {
1227 CatPrint (Str
, L
"DEFAULT,");
1229 CatPrint (Str
, L
"%d,", Uart
->DataBits
);
1232 CatPrint (Str
, L
"%c,", Parity
);
1234 switch (Uart
->StopBits
) {
1236 CatPrint (Str
, L
"D)");
1240 CatPrint (Str
, L
"1)");
1244 CatPrint (Str
, L
"1.5)");
1248 CatPrint (Str
, L
"2)");
1252 CatPrint (Str
, L
"x)");
1258 Converts an iSCSI device path structure to its string representative.
1260 @param Str The string representative of input device.
1261 @param DevPath The input device path structure.
1262 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1263 of the display node is used, where applicable. If DisplayOnly
1264 is FALSE, then the longer text representation of the display node
1266 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1267 representation for a device node can be used, where applicable.
1271 DevPathToTextiSCSI (
1272 IN OUT POOL_PRINT
*Str
,
1274 IN BOOLEAN DisplayOnly
,
1275 IN BOOLEAN AllowShortcuts
1278 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1281 ISCSIDevPath
= DevPath
;
1284 L
"iSCSI(%a,0x%x,0x%lx,",
1285 ISCSIDevPath
->iSCSITargetName
,
1286 ISCSIDevPath
->TargetPortalGroupTag
,
1290 Options
= ISCSIDevPath
->LoginOption
;
1291 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1292 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1293 if (((Options
>> 11) & 0x0001) != 0) {
1294 CatPrint (Str
, L
"%s,", L
"None");
1295 } else if (((Options
>> 12) & 0x0001) != 0) {
1296 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1298 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
1302 CatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1306 Converts a Hard drive device path structure to its string representative.
1308 @param Str The string representative of input device.
1309 @param DevPath The input device path structure.
1310 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1311 of the display node is used, where applicable. If DisplayOnly
1312 is FALSE, then the longer text representation of the display node
1314 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1315 representation for a device node can be used, where applicable.
1319 DevPathToTextHardDrive (
1320 IN OUT POOL_PRINT
*Str
,
1322 IN BOOLEAN DisplayOnly
,
1323 IN BOOLEAN AllowShortcuts
1326 HARDDRIVE_DEVICE_PATH
*Hd
;
1329 switch (Hd
->SignatureType
) {
1330 case SIGNATURE_TYPE_MBR
:
1333 L
"HD(%d,%s,0x%08x,",
1334 Hd
->PartitionNumber
,
1336 *((UINT32
*) (&(Hd
->Signature
[0])))
1340 case SIGNATURE_TYPE_GUID
:
1344 Hd
->PartitionNumber
,
1346 (EFI_GUID
*) &(Hd
->Signature
[0])
1354 Hd
->PartitionNumber
,
1360 CatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1364 Converts a CDROM device path structure to its string representative.
1366 @param Str The string representative of input device.
1367 @param DevPath The input device path structure.
1368 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1369 of the display node is used, where applicable. If DisplayOnly
1370 is FALSE, then the longer text representation of the display node
1372 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1373 representation for a device node can be used, where applicable.
1377 DevPathToTextCDROM (
1378 IN OUT POOL_PRINT
*Str
,
1380 IN BOOLEAN DisplayOnly
,
1381 IN BOOLEAN AllowShortcuts
1384 CDROM_DEVICE_PATH
*Cd
;
1388 CatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1392 CatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1396 Converts a File device path structure to its string representative.
1398 @param Str The string representative of input device.
1399 @param DevPath The input device path structure.
1400 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1401 of the display node is used, where applicable. If DisplayOnly
1402 is FALSE, then the longer text representation of the display node
1404 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1405 representation for a device node can be used, where applicable.
1409 DevPathToTextFilePath (
1410 IN OUT POOL_PRINT
*Str
,
1412 IN BOOLEAN DisplayOnly
,
1413 IN BOOLEAN AllowShortcuts
1416 FILEPATH_DEVICE_PATH
*Fp
;
1419 CatPrint (Str
, L
"%s", Fp
->PathName
);
1423 Converts a Media protocol device path structure to its string representative.
1425 @param Str The string representative of input device.
1426 @param DevPath The input device path structure.
1427 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1428 of the display node is used, where applicable. If DisplayOnly
1429 is FALSE, then the longer text representation of the display node
1431 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1432 representation for a device node can be used, where applicable.
1436 DevPathToTextMediaProtocol (
1437 IN OUT POOL_PRINT
*Str
,
1439 IN BOOLEAN DisplayOnly
,
1440 IN BOOLEAN AllowShortcuts
1443 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1445 MediaProt
= DevPath
;
1446 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1450 Converts a Firmware Volume device path structure to its string representative.
1452 @param Str The string representative of input device.
1453 @param DevPath The input device path structure.
1454 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1455 of the display node is used, where applicable. If DisplayOnly
1456 is FALSE, then the longer text representation of the display node
1458 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1459 representation for a device node can be used, where applicable.
1464 IN OUT POOL_PRINT
*Str
,
1466 IN BOOLEAN DisplayOnly
,
1467 IN BOOLEAN AllowShortcuts
1470 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1473 CatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1477 Converts a Firmware Volume File device path structure to its string representative.
1479 @param Str The string representative of input device.
1480 @param DevPath The input device path structure.
1481 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1482 of the display node is used, where applicable. If DisplayOnly
1483 is FALSE, then the longer text representation of the display node
1485 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1486 representation for a device node can be used, where applicable.
1490 DevPathToTextFvFile (
1491 IN OUT POOL_PRINT
*Str
,
1493 IN BOOLEAN DisplayOnly
,
1494 IN BOOLEAN AllowShortcuts
1497 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1500 CatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1504 Converts a BIOS Boot Specification device path structure to its string representative.
1506 @param Str The string representative of input device.
1507 @param DevPath The input device path structure.
1508 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1509 of the display node is used, where applicable. If DisplayOnly
1510 is FALSE, then the longer text representation of the display node
1512 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1513 representation for a device node can be used, where applicable.
1518 IN OUT POOL_PRINT
*Str
,
1520 IN BOOLEAN DisplayOnly
,
1521 IN BOOLEAN AllowShortcuts
1524 BBS_BBS_DEVICE_PATH
*Bbs
;
1528 switch (Bbs
->DeviceType
) {
1529 case BBS_TYPE_FLOPPY
:
1533 case BBS_TYPE_HARDDRIVE
:
1537 case BBS_TYPE_CDROM
:
1541 case BBS_TYPE_PCMCIA
:
1549 case BBS_TYPE_EMBEDDED_NETWORK
:
1559 CatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1561 CatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
1565 CatPrint (Str
, L
")");
1569 CatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
1573 Converts an End-of-Device-Path structure to its string representative.
1575 @param Str The string representative of input device.
1576 @param DevPath The input device path structure.
1577 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1578 of the display node is used, where applicable. If DisplayOnly
1579 is FALSE, then the longer text representation of the display node
1581 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1582 representation for a device node can be used, where applicable.
1586 DevPathToTextEndInstance (
1587 IN OUT POOL_PRINT
*Str
,
1589 IN BOOLEAN DisplayOnly
,
1590 IN BOOLEAN AllowShortcuts
1593 CatPrint (Str
, L
",");
1597 Converts an unknown device path structure to its string representative.
1599 @param Str The string representative of input device.
1600 @param DevPath The input device path structure.
1601 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1602 of the display node is used, where applicable. If DisplayOnly
1603 is FALSE, then the longer text representation of the display node
1605 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1606 representation for a device node can be used, where applicable.
1610 DevPathToTextNodeUnknown (
1611 IN OUT POOL_PRINT
*Str
,
1613 IN BOOLEAN DisplayOnly
,
1614 IN BOOLEAN AllowShortcuts
1617 CatPrint (Str
, L
"?");
1620 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
[] = {
1621 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
1622 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
1623 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
1624 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
1625 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
1626 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
1627 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
1628 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
1629 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
1630 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
1631 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
1632 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
1633 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
1634 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
1635 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
1636 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
1637 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
1638 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
1639 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
1640 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
1641 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
1642 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
1643 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
1644 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
1645 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
1646 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
1647 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
1648 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
1649 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1650 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
1651 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1652 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
1653 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
1654 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
1655 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
1660 Converts a device node to its string representation.
1662 @param DeviceNode A Pointer to the device node to be converted.
1663 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1664 of the display node is used, where applicable. If DisplayOnly
1665 is FALSE, then the longer text representation of the display node
1667 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1668 representation for a device node can be used, where applicable.
1670 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
1671 is NULL or there was insufficient memory.
1676 ConvertDeviceNodeToText (
1677 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
1678 IN BOOLEAN DisplayOnly
,
1679 IN BOOLEAN AllowShortcuts
1685 VOID (*DumpNode
)(POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1687 if (DeviceNode
== NULL
) {
1691 ZeroMem (&Str
, sizeof (Str
));
1694 // Process the device path node
1697 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
++) {
1698 if (DevicePathType (DeviceNode
) == DevPathToTextTable
[Index
].Type
&&
1699 DevicePathSubType (DeviceNode
) == DevPathToTextTable
[Index
].SubType
1701 DumpNode
= DevPathToTextTable
[Index
].Function
;
1706 // If not found, use a generic function
1708 if (DumpNode
== NULL
) {
1709 DumpNode
= DevPathToTextNodeUnknown
;
1715 DumpNode (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
1718 // Shrink pool used for string allocation
1720 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1721 Str
.Str
= ReallocatePool (NewSize
, NewSize
, Str
.Str
);
1722 ASSERT (Str
.Str
!= NULL
);
1723 Str
.Str
[Str
.Len
] = 0;
1728 Converts a device path to its text representation.
1730 @param DevicePath A Pointer to the device to be converted.
1731 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1732 of the display node is used, where applicable. If DisplayOnly
1733 is FALSE, then the longer text representation of the display node
1735 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1736 representation for a device node can be used, where applicable.
1738 @return A pointer to the allocated text representation of the device path or
1739 NULL if DeviceNode is NULL or there was insufficient memory.
1744 ConvertDevicePathToText (
1745 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
1746 IN BOOLEAN DisplayOnly
,
1747 IN BOOLEAN AllowShortcuts
1751 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1752 EFI_DEVICE_PATH_PROTOCOL
*AlignedDevPathNode
;
1755 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1757 if (DevicePath
== NULL
) {
1761 ZeroMem (&Str
, sizeof (Str
));
1764 // Process each device path node
1766 DevPathNode
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
1767 while (!IsDevicePathEnd (DevPathNode
)) {
1769 // Find the handler to dump this device path node
1772 for (Index
= 0; DevPathToTextTable
[Index
].Function
; Index
+= 1) {
1774 if (DevicePathType (DevPathNode
) == DevPathToTextTable
[Index
].Type
&&
1775 DevicePathSubType (DevPathNode
) == DevPathToTextTable
[Index
].SubType
1777 DumpNode
= DevPathToTextTable
[Index
].Function
;
1782 // If not found, use a generic function
1785 DumpNode
= DevPathToTextNodeUnknown
;
1788 // Put a path seperator in if needed
1790 if ((Str
.Len
!= 0) && DumpNode
!= DevPathToTextEndInstance
) {
1791 if (*(Str
.Str
+ Str
.Len
/ sizeof (CHAR16
) - 1) != L
',') {
1792 CatPrint (&Str
, L
"/");
1796 AlignedDevPathNode
= AllocateCopyPool (DevicePathNodeLength (DevPathNode
), DevPathNode
);
1798 // Print this node of the device path
1800 DumpNode (&Str
, AlignedDevPathNode
, DisplayOnly
, AllowShortcuts
);
1801 FreePool (AlignedDevPathNode
);
1804 // Next device path node
1806 DevPathNode
= NextDevicePathNode (DevPathNode
);
1809 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1810 Str
.Str
= ReallocatePool (NewSize
, NewSize
, Str
.Str
);
1811 ASSERT (Str
.Str
!= NULL
);
1812 Str
.Str
[Str
.Len
] = 0;