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 Function unpacks a device path data structure so that all the nodes of a device path
19 are naturally aligned.
21 @param DevPath A pointer to a device path data structure
23 @return If the memory for the device path is successfully allocated, then a pointer to the
24 new device path is returned. Otherwise, NULL is returned.
27 EFI_DEVICE_PATH_PROTOCOL
*
29 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevPath
32 CONST EFI_DEVICE_PATH_PROTOCOL
*Src
;
33 EFI_DEVICE_PATH_PROTOCOL
*Dest
;
34 EFI_DEVICE_PATH_PROTOCOL
*NewPath
;
37 if (DevPath
== NULL
) {
41 // Walk device path and round sizes to valid boundries
46 Size
+= DevicePathNodeLength (Src
);
47 Size
+= ALIGN_SIZE (Size
);
49 if (IsDevicePathEnd (Src
)) {
53 Src
= (EFI_DEVICE_PATH_PROTOCOL
*) NextDevicePathNode (Src
);
56 // Allocate space for the unpacked path
58 NewPath
= AllocateZeroPool (Size
);
59 if (NewPath
!= NULL
) {
61 ASSERT (((UINTN
) NewPath
) % MIN_ALIGNMENT_SIZE
== 0);
69 Size
= DevicePathNodeLength (Src
);
70 CopyMem (Dest
, Src
, Size
);
71 Size
+= ALIGN_SIZE (Size
);
72 SetDevicePathNodeLength (Dest
, Size
);
73 Dest
->Type
|= EFI_DP_TYPE_UNPACKED
;
74 Dest
= (EFI_DEVICE_PATH_PROTOCOL
*) (((UINT8
*) Dest
) + Size
);
76 if (IsDevicePathEnd (Src
)) {
80 Src
= (EFI_DEVICE_PATH_PROTOCOL
*) NextDevicePathNode (Src
);
88 Adjusts the size of a previously allocated buffer.
90 @param OldPool A pointer to the buffer whose size is being adjusted.
91 @param OldSize The size of the current buffer.
92 @param NewSize The size of the new buffer.
94 @return A pointer to the new buffer or NULL if allocation fails.
108 NewPool
= AllocateZeroPool (NewSize
);
111 if (OldPool
!= NULL
) {
112 if (NewPool
!= NULL
) {
113 CopyMem (NewPool
, OldPool
, OldSize
< NewSize
? OldSize
: NewSize
);
123 Concatenates a formatted unicode string to allocated pool. The caller must
124 free the resulting buffer.
126 @param Str Tracks the allocated pool, size in use, and
127 amount of pool allocated.
128 @param Fmt The format string
129 @param ... Variable arguments based on the format string.
131 @return Allocated buffer with the formatted string printed in it.
132 The caller must free the allocated buffer. The buffer
133 allocation is not packed.
138 IN OUT POOL_PRINT
*Str
,
147 AppendStr
= AllocateZeroPool (0x1000);
148 if (AppendStr
== NULL
) {
152 VA_START (Args
, Fmt
);
153 UnicodeVSPrint (AppendStr
, 0x1000, Fmt
, Args
);
155 if (NULL
== Str
->Str
) {
156 Size
= StrSize (AppendStr
);
157 Str
->Str
= AllocateZeroPool (Size
);
158 ASSERT (Str
->Str
!= NULL
);
160 Size
= StrSize (AppendStr
) - sizeof (UINT16
);
161 Size
= Size
+ StrSize (Str
->Str
);
162 Str
->Str
= ReallocatePool (
167 ASSERT (Str
->Str
!= NULL
);
170 Str
->MaxLen
= MAX_CHAR
* sizeof (UINT16
);
171 if (Size
< Str
->MaxLen
) {
172 StrCat (Str
->Str
, AppendStr
);
173 Str
->Len
= Size
- sizeof (UINT16
);
176 FreePool (AppendStr
);
181 Converts a PCI device path structure to its string representive.
183 @param Str The string representive of input device.
184 @param DevPath The input device path structure.
185 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
186 of the display node is used, where applicable. If DisplayOnly
187 is FALSE, then the longer text representation of the display node
189 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
190 representation for a device node can be used, where applicable.
195 IN OUT POOL_PRINT
*Str
,
197 IN BOOLEAN DisplayOnly
,
198 IN BOOLEAN AllowShortcuts
201 PCI_DEVICE_PATH
*Pci
;
204 CatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
208 Converts a PC Card device path structure to its string representive.
210 @param Str The string representive of input device.
211 @param DevPath The input device path structure.
212 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
213 of the display node is used, where applicable. If DisplayOnly
214 is FALSE, then the longer text representation of the display node
216 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
217 representation for a device node can be used, where applicable.
221 DevPathToTextPccard (
222 IN OUT POOL_PRINT
*Str
,
224 IN BOOLEAN DisplayOnly
,
225 IN BOOLEAN AllowShortcuts
228 PCCARD_DEVICE_PATH
*Pccard
;
231 CatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
235 Converts a Memory Map device path structure to its string representive.
237 @param Str The string representive of input device.
238 @param DevPath The input device path structure.
239 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
240 of the display node is used, where applicable. If DisplayOnly
241 is FALSE, then the longer text representation of the display node
243 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
244 representation for a device node can be used, where applicable.
248 DevPathToTextMemMap (
249 IN OUT POOL_PRINT
*Str
,
251 IN BOOLEAN DisplayOnly
,
252 IN BOOLEAN AllowShortcuts
255 MEMMAP_DEVICE_PATH
*MemMap
;
260 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
262 MemMap
->StartingAddress
,
263 MemMap
->EndingAddress
268 Converts a Vendor device path structure to its string representive.
270 @param Str The string representive of input device.
271 @param DevPath The input device path structure.
272 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
273 of the display node is used, where applicable. If DisplayOnly
274 is FALSE, then the longer text representation of the display node
276 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
277 representation for a device node can be used, where applicable.
281 DevPathToTextVendor (
282 IN OUT POOL_PRINT
*Str
,
284 IN BOOLEAN DisplayOnly
,
285 IN BOOLEAN AllowShortcuts
288 VENDOR_DEVICE_PATH
*Vendor
;
292 UINT32 FlowControlMap
;
295 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
296 switch (DevicePathType (&Vendor
->Header
)) {
297 case HARDWARE_DEVICE_PATH
:
301 case MESSAGING_DEVICE_PATH
:
303 if (AllowShortcuts
) {
304 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
305 CatPrint (Str
, L
"VenPcAnsi()");
307 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
308 CatPrint (Str
, L
"VenVt100()");
310 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
311 CatPrint (Str
, L
"VenVt100Plus()");
313 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
314 CatPrint (Str
, L
"VenUft8()");
316 } else if (CompareGuid (&Vendor
->Guid
, &mEfiDevicePathMessagingUartFlowControlGuid
)) {
317 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
318 switch (FlowControlMap
& 0x00000003) {
320 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
324 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
328 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
336 } else if (CompareGuid (&Vendor
->Guid
, &mEfiDevicePathMessagingSASGuid
)) {
339 L
"SAS(0x%lx,0x%lx,0x%x,",
340 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
341 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
342 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
344 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
345 if ((Info
& 0x0f) == 0) {
346 CatPrint (Str
, L
"NoTopology,0,0,0,");
347 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
351 ((Info
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
352 ((Info
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
353 ((Info
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
355 if ((Info
& 0x0f) == 1) {
356 CatPrint (Str
, L
"0,");
358 CatPrint (Str
, L
"0x%x,", (Info
>> 8) & 0xff);
361 CatPrint (Str
, L
"0,0,0,0,");
364 CatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
366 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
367 CatPrint (Str
, L
"DebugPort()");
373 case MEDIA_DEVICE_PATH
:
382 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
383 CatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
384 if (DataLength
!= 0) {
385 CatPrint (Str
, L
",");
386 for (Index
= 0; Index
< DataLength
; Index
++) {
387 CatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
391 CatPrint (Str
, L
")");
395 Converts a Controller device path structure to its string representive.
397 @param Str The string representive of input device.
398 @param DevPath The input device path structure.
399 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
400 of the display node is used, where applicable. If DisplayOnly
401 is FALSE, then the longer text representation of the display node
403 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
404 representation for a device node can be used, where applicable.
408 DevPathToTextController (
409 IN OUT POOL_PRINT
*Str
,
411 IN BOOLEAN DisplayOnly
,
412 IN BOOLEAN AllowShortcuts
415 CONTROLLER_DEVICE_PATH
*Controller
;
417 Controller
= DevPath
;
421 Controller
->ControllerNumber
426 Converts a ACPI device path structure to its string representive.
428 @param Str The string representive of input device.
429 @param DevPath The input device path structure.
430 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
431 of the display node is used, where applicable. If DisplayOnly
432 is FALSE, then the longer text representation of the display node
434 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
435 representation for a device node can be used, where applicable.
440 IN OUT POOL_PRINT
*Str
,
442 IN BOOLEAN DisplayOnly
,
443 IN BOOLEAN AllowShortcuts
446 ACPI_HID_DEVICE_PATH
*Acpi
;
449 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
450 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
452 CatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
456 CatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
460 CatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
464 CatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
468 CatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
472 CatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
476 CatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
481 Converts EISA identification to string.
483 @param EisaId The input EISA identification.
484 @param Text A pointer to the output string.
496 //UnicodeSPrint ("%X", 0x0a03) => "0000000000000A03"
498 UnicodeSPrint (PnpIdStr
, 17 * 2, L
"%16X", EisaId
>> 16);
502 sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (PnpIdStr
),
504 '@' + ((EisaId
>> 10) & 0x1f),
505 '@' + ((EisaId
>> 5) & 0x1f),
506 '@' + ((EisaId
>> 0) & 0x1f),
512 Converts a ACPI extended HID device path structure to its string representive.
514 @param Str The string representive of input device.
515 @param DevPath The input device path structure.
516 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
517 of the display node is used, where applicable. If DisplayOnly
518 is FALSE, then the longer text representation of the display node
520 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
521 representation for a device node can be used, where applicable.
525 DevPathToTextAcpiEx (
526 IN OUT POOL_PRINT
*Str
,
528 IN BOOLEAN DisplayOnly
,
529 IN BOOLEAN AllowShortcuts
532 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
540 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
541 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
542 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
544 EisaIdToText (AcpiEx
->HID
, HIDText
);
545 EisaIdToText (AcpiEx
->CID
, CIDText
);
547 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (AcpiEx
->UID
== 0)) {
553 L
"AcpiExp(%s,%s,%a)",
559 if (AllowShortcuts
) {
563 if (AcpiEx
->HID
== 0) {
564 CatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
566 CatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
569 if (AcpiEx
->UID
== 0) {
570 CatPrint (Str
, L
"%a,", UIDStr
);
572 CatPrint (Str
, L
"0x%x,", AcpiEx
->UID
);
575 if (AcpiEx
->CID
== 0) {
576 CatPrint (Str
, L
"%a)", CIDStr
);
578 CatPrint (Str
, L
"%s)", CIDText
);
583 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
596 Converts a ACPI address device path structure to its string representive.
598 @param Str The string representive of input device.
599 @param DevPath The input device path structure.
600 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
601 of the display node is used, where applicable. If DisplayOnly
602 is FALSE, then the longer text representation of the display node
604 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
605 representation for a device node can be used, where applicable.
609 DevPathToTextAcpiAdr (
610 IN OUT POOL_PRINT
*Str
,
612 IN BOOLEAN DisplayOnly
,
613 IN BOOLEAN AllowShortcuts
616 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
619 UINT16 AdditionalAdrCount
;
622 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
623 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
625 CatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
626 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
627 CatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
629 CatPrint (Str
, L
")");
633 Converts a ATAPI device path structure to its string representive.
635 @param Str The string representive of input device.
636 @param DevPath The input device path structure.
637 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
638 of the display node is used, where applicable. If DisplayOnly
639 is FALSE, then the longer text representation of the display node
641 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
642 representation for a device node can be used, where applicable.
647 IN OUT POOL_PRINT
*Str
,
649 IN BOOLEAN DisplayOnly
,
650 IN BOOLEAN AllowShortcuts
653 ATAPI_DEVICE_PATH
*Atapi
;
658 CatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
663 Atapi
->PrimarySecondary
? L
"Secondary" : L
"Primary",
664 Atapi
->SlaveMaster
? L
"Slave" : L
"Master",
671 Converts a SCSI device path structure to its string representive.
673 @param Str The string representive of input device.
674 @param DevPath The input device path structure.
675 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
676 of the display node is used, where applicable. If DisplayOnly
677 is FALSE, then the longer text representation of the display node
679 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
680 representation for a device node can be used, where applicable.
685 IN OUT POOL_PRINT
*Str
,
687 IN BOOLEAN DisplayOnly
,
688 IN BOOLEAN AllowShortcuts
691 SCSI_DEVICE_PATH
*Scsi
;
694 CatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
698 Converts a Fibre device path structure to its string representive.
700 @param Str The string representive of input device.
701 @param DevPath The input device path structure.
702 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
703 of the display node is used, where applicable. If DisplayOnly
704 is FALSE, then the longer text representation of the display node
706 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
707 representation for a device node can be used, where applicable.
712 IN OUT POOL_PRINT
*Str
,
714 IN BOOLEAN DisplayOnly
,
715 IN BOOLEAN AllowShortcuts
718 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
721 CatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
725 Converts a 1394 device path structure to its string representive.
727 @param Str The string representive of input device.
728 @param DevPath The input device path structure.
729 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
730 of the display node is used, where applicable. If DisplayOnly
731 is FALSE, then the longer text representation of the display node
733 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
734 representation for a device node can be used, where applicable.
739 IN OUT POOL_PRINT
*Str
,
741 IN BOOLEAN DisplayOnly
,
742 IN BOOLEAN AllowShortcuts
745 F1394_DEVICE_PATH
*F1394DevPath
;
747 F1394DevPath
= DevPath
;
749 // Guid has format of IEEE-EUI64
751 CatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
755 Converts a USB device path structure to its string representive.
757 @param Str The string representive 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.
769 IN OUT POOL_PRINT
*Str
,
771 IN BOOLEAN DisplayOnly
,
772 IN BOOLEAN AllowShortcuts
775 USB_DEVICE_PATH
*Usb
;
778 CatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
782 Converts a USB WWID device path structure to its string representive.
784 @param Str The string representive of input device.
785 @param DevPath The input device path structure.
786 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
787 of the display node is used, where applicable. If DisplayOnly
788 is FALSE, then the longer text representation of the display node
790 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
791 representation for a device node can be used, where applicable.
795 DevPathToTextUsbWWID (
796 IN OUT POOL_PRINT
*Str
,
798 IN BOOLEAN DisplayOnly
,
799 IN BOOLEAN AllowShortcuts
802 USB_WWID_DEVICE_PATH
*UsbWWId
;
803 CHAR16
*SerialNumberStr
;
809 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
810 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
811 if (SerialNumberStr
[Length
- 1] != 0) {
813 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
815 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
817 SerialNumberStr
= NewStr
;
822 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
825 UsbWWId
->InterfaceNumber
,
831 Converts a Logic Unit device path structure to its string representive.
833 @param Str The string representive of input device.
834 @param DevPath The input device path structure.
835 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
836 of the display node is used, where applicable. If DisplayOnly
837 is FALSE, then the longer text representation of the display node
839 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
840 representation for a device node can be used, where applicable.
844 DevPathToTextLogicalUnit (
845 IN OUT POOL_PRINT
*Str
,
847 IN BOOLEAN DisplayOnly
,
848 IN BOOLEAN AllowShortcuts
851 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
853 LogicalUnit
= DevPath
;
854 CatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
858 Converts a USB class device path structure to its string representive.
860 @param Str The string representive of input device.
861 @param DevPath The input device path structure.
862 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
863 of the display node is used, where applicable. If DisplayOnly
864 is FALSE, then the longer text representation of the display node
866 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
867 representation for a device node can be used, where applicable.
871 DevPathToTextUsbClass (
872 IN OUT POOL_PRINT
*Str
,
874 IN BOOLEAN DisplayOnly
,
875 IN BOOLEAN AllowShortcuts
878 USB_CLASS_DEVICE_PATH
*UsbClass
;
879 BOOLEAN IsKnownSubClass
;
884 IsKnownSubClass
= TRUE
;
885 switch (UsbClass
->DeviceClass
) {
886 case USB_CLASS_AUDIO
:
887 CatPrint (Str
, L
"UsbAudio");
890 case USB_CLASS_CDCCONTROL
:
891 CatPrint (Str
, L
"UsbCDCControl");
895 CatPrint (Str
, L
"UsbHID");
898 case USB_CLASS_IMAGE
:
899 CatPrint (Str
, L
"UsbImage");
902 case USB_CLASS_PRINTER
:
903 CatPrint (Str
, L
"UsbPrinter");
906 case USB_CLASS_MASS_STORAGE
:
907 CatPrint (Str
, L
"UsbMassStorage");
911 CatPrint (Str
, L
"UsbHub");
914 case USB_CLASS_CDCDATA
:
915 CatPrint (Str
, L
"UsbCDCData");
918 case USB_CLASS_SMART_CARD
:
919 CatPrint (Str
, L
"UsbSmartCard");
922 case USB_CLASS_VIDEO
:
923 CatPrint (Str
, L
"UsbVideo");
926 case USB_CLASS_DIAGNOSTIC
:
927 CatPrint (Str
, L
"UsbDiagnostic");
930 case USB_CLASS_WIRELESS
:
931 CatPrint (Str
, L
"UsbWireless");
935 IsKnownSubClass
= FALSE
;
939 if (IsKnownSubClass
) {
942 L
"(0x%x,0x%x,0x%x,0x%x)",
945 UsbClass
->DeviceSubClass
,
946 UsbClass
->DeviceProtocol
951 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
952 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
955 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
958 UsbClass
->DeviceProtocol
961 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
964 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
967 UsbClass
->DeviceProtocol
970 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
973 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
976 UsbClass
->DeviceProtocol
984 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
987 UsbClass
->DeviceClass
,
988 UsbClass
->DeviceSubClass
,
989 UsbClass
->DeviceProtocol
994 Converts a SATA device path structure to its string representive.
996 @param Str The string representive of input device.
997 @param DevPath The input device path structure.
998 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
999 of the display node is used, where applicable. If DisplayOnly
1000 is FALSE, then the longer text representation of the display node
1002 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1003 representation for a device node can be used, where applicable.
1008 IN OUT POOL_PRINT
*Str
,
1010 IN BOOLEAN DisplayOnly
,
1011 IN BOOLEAN AllowShortcuts
1014 SATA_DEVICE_PATH
*Sata
;
1019 L
"Sata(0x%x,0x%x,0x%x)",
1020 (UINTN
) Sata
->HBAPortNumber
,
1021 (UINTN
) Sata
->PortMultiplierPortNumber
,
1027 Converts a I20 device path structure to its string representive.
1029 @param Str The string representive of input device.
1030 @param DevPath The input device path structure.
1031 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1032 of the display node is used, where applicable. If DisplayOnly
1033 is FALSE, then the longer text representation of the display node
1035 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1036 representation for a device node can be used, where applicable.
1041 IN OUT POOL_PRINT
*Str
,
1043 IN BOOLEAN DisplayOnly
,
1044 IN BOOLEAN AllowShortcuts
1047 I2O_DEVICE_PATH
*I2ODevPath
;
1049 I2ODevPath
= DevPath
;
1050 CatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1054 Converts a MAC address device path structure to its string representive.
1056 @param Str The string representive of input device.
1057 @param DevPath The input device path structure.
1058 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1059 of the display node is used, where applicable. If DisplayOnly
1060 is FALSE, then the longer text representation of the display node
1062 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1063 representation for a device node can be used, where applicable.
1067 DevPathToTextMacAddr (
1068 IN OUT POOL_PRINT
*Str
,
1070 IN BOOLEAN DisplayOnly
,
1071 IN BOOLEAN AllowShortcuts
1074 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1075 UINTN HwAddressSize
;
1078 MacDevPath
= DevPath
;
1080 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1081 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1085 CatPrint (Str
, L
"MAC(");
1087 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1088 CatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1091 CatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1095 Converts a IPv4 device path structure to its string representive.
1097 @param Str The string representive of input device.
1098 @param DevPath The input device path structure.
1099 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1100 of the display node is used, where applicable. If DisplayOnly
1101 is FALSE, then the longer text representation of the display node
1103 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1104 representation for a device node can be used, where applicable.
1109 IN OUT POOL_PRINT
*Str
,
1111 IN BOOLEAN DisplayOnly
,
1112 IN BOOLEAN AllowShortcuts
1115 IPv4_DEVICE_PATH
*IPDevPath
;
1117 IPDevPath
= DevPath
;
1121 L
"IPv4(%d.%d.%d.%d)",
1122 IPDevPath
->RemoteIpAddress
.Addr
[0],
1123 IPDevPath
->RemoteIpAddress
.Addr
[1],
1124 IPDevPath
->RemoteIpAddress
.Addr
[2],
1125 IPDevPath
->RemoteIpAddress
.Addr
[3]
1132 L
"IPv4(%d.%d.%d.%d,%s,%s,%d.%d.%d.%d)",
1133 IPDevPath
->RemoteIpAddress
.Addr
[0],
1134 IPDevPath
->RemoteIpAddress
.Addr
[1],
1135 IPDevPath
->RemoteIpAddress
.Addr
[2],
1136 IPDevPath
->RemoteIpAddress
.Addr
[3],
1137 IPDevPath
->Protocol
? L
"TCP" : L
"UDP",
1138 (IPDevPath
->StaticIpAddress
== TRUE
) ? L
"Static" : L
"DHCP",
1139 IPDevPath
->LocalIpAddress
.Addr
[0],
1140 IPDevPath
->LocalIpAddress
.Addr
[1],
1141 IPDevPath
->LocalIpAddress
.Addr
[2],
1142 IPDevPath
->LocalIpAddress
.Addr
[3]
1147 Converts a IPv6 device path structure to its string representive.
1149 @param Str The string representive of input device.
1150 @param DevPath The input device path structure.
1151 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1152 of the display node is used, where applicable. If DisplayOnly
1153 is FALSE, then the longer text representation of the display node
1155 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1156 representation for a device node can be used, where applicable.
1161 IN OUT POOL_PRINT
*Str
,
1163 IN BOOLEAN DisplayOnly
,
1164 IN BOOLEAN AllowShortcuts
1167 IPv6_DEVICE_PATH
*IPDevPath
;
1169 IPDevPath
= DevPath
;
1173 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
1174 IPDevPath
->RemoteIpAddress
.Addr
[0],
1175 IPDevPath
->RemoteIpAddress
.Addr
[1],
1176 IPDevPath
->RemoteIpAddress
.Addr
[2],
1177 IPDevPath
->RemoteIpAddress
.Addr
[3],
1178 IPDevPath
->RemoteIpAddress
.Addr
[4],
1179 IPDevPath
->RemoteIpAddress
.Addr
[5],
1180 IPDevPath
->RemoteIpAddress
.Addr
[6],
1181 IPDevPath
->RemoteIpAddress
.Addr
[7],
1182 IPDevPath
->RemoteIpAddress
.Addr
[8],
1183 IPDevPath
->RemoteIpAddress
.Addr
[9],
1184 IPDevPath
->RemoteIpAddress
.Addr
[10],
1185 IPDevPath
->RemoteIpAddress
.Addr
[11],
1186 IPDevPath
->RemoteIpAddress
.Addr
[12],
1187 IPDevPath
->RemoteIpAddress
.Addr
[13],
1188 IPDevPath
->RemoteIpAddress
.Addr
[14],
1189 IPDevPath
->RemoteIpAddress
.Addr
[15]
1196 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)",
1197 IPDevPath
->RemoteIpAddress
.Addr
[0],
1198 IPDevPath
->RemoteIpAddress
.Addr
[1],
1199 IPDevPath
->RemoteIpAddress
.Addr
[2],
1200 IPDevPath
->RemoteIpAddress
.Addr
[3],
1201 IPDevPath
->RemoteIpAddress
.Addr
[4],
1202 IPDevPath
->RemoteIpAddress
.Addr
[5],
1203 IPDevPath
->RemoteIpAddress
.Addr
[6],
1204 IPDevPath
->RemoteIpAddress
.Addr
[7],
1205 IPDevPath
->RemoteIpAddress
.Addr
[8],
1206 IPDevPath
->RemoteIpAddress
.Addr
[9],
1207 IPDevPath
->RemoteIpAddress
.Addr
[10],
1208 IPDevPath
->RemoteIpAddress
.Addr
[11],
1209 IPDevPath
->RemoteIpAddress
.Addr
[12],
1210 IPDevPath
->RemoteIpAddress
.Addr
[13],
1211 IPDevPath
->RemoteIpAddress
.Addr
[14],
1212 IPDevPath
->RemoteIpAddress
.Addr
[15],
1213 IPDevPath
->Protocol
? L
"TCP" : L
"UDP",
1214 (IPDevPath
->StaticIpAddress
== TRUE
) ? L
"Static" : L
"DHCP",
1215 IPDevPath
->LocalIpAddress
.Addr
[0],
1216 IPDevPath
->LocalIpAddress
.Addr
[1],
1217 IPDevPath
->LocalIpAddress
.Addr
[2],
1218 IPDevPath
->LocalIpAddress
.Addr
[3],
1219 IPDevPath
->LocalIpAddress
.Addr
[4],
1220 IPDevPath
->LocalIpAddress
.Addr
[5],
1221 IPDevPath
->LocalIpAddress
.Addr
[6],
1222 IPDevPath
->LocalIpAddress
.Addr
[7],
1223 IPDevPath
->LocalIpAddress
.Addr
[8],
1224 IPDevPath
->LocalIpAddress
.Addr
[9],
1225 IPDevPath
->LocalIpAddress
.Addr
[10],
1226 IPDevPath
->LocalIpAddress
.Addr
[11],
1227 IPDevPath
->LocalIpAddress
.Addr
[12],
1228 IPDevPath
->LocalIpAddress
.Addr
[13],
1229 IPDevPath
->LocalIpAddress
.Addr
[14],
1230 IPDevPath
->LocalIpAddress
.Addr
[15]
1235 Converts an Infini Band device path structure to its string representive.
1237 @param Str The string representive of input device.
1238 @param DevPath The input device path structure.
1239 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1240 of the display node is used, where applicable. If DisplayOnly
1241 is FALSE, then the longer text representation of the display node
1243 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1244 representation for a device node can be used, where applicable.
1248 DevPathToTextInfiniBand (
1249 IN OUT POOL_PRINT
*Str
,
1251 IN BOOLEAN DisplayOnly
,
1252 IN BOOLEAN AllowShortcuts
1255 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1257 InfiniBand
= DevPath
;
1260 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1261 InfiniBand
->ResourceFlags
,
1262 InfiniBand
->PortGid
,
1263 InfiniBand
->ServiceId
,
1264 InfiniBand
->TargetPortId
,
1265 InfiniBand
->DeviceId
1270 Converts a UART device path structure to its string representive.
1272 @param Str The string representive of input device.
1273 @param DevPath The input device path structure.
1274 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1275 of the display node is used, where applicable. If DisplayOnly
1276 is FALSE, then the longer text representation of the display node
1278 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1279 representation for a device node can be used, where applicable.
1284 IN OUT POOL_PRINT
*Str
,
1286 IN BOOLEAN DisplayOnly
,
1287 IN BOOLEAN AllowShortcuts
1290 UART_DEVICE_PATH
*Uart
;
1294 switch (Uart
->Parity
) {
1324 if (Uart
->BaudRate
== 0) {
1325 CatPrint (Str
, L
"Uart(DEFAULT,");
1327 CatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1330 if (Uart
->DataBits
== 0) {
1331 CatPrint (Str
, L
"DEFAULT,");
1333 CatPrint (Str
, L
"%d,", Uart
->DataBits
);
1336 CatPrint (Str
, L
"%c,", Parity
);
1338 switch (Uart
->StopBits
) {
1340 CatPrint (Str
, L
"D)");
1344 CatPrint (Str
, L
"1)");
1348 CatPrint (Str
, L
"1.5)");
1352 CatPrint (Str
, L
"2)");
1356 CatPrint (Str
, L
"x)");
1362 Converts an iSCSI device path structure to its string representive.
1364 @param Str The string representive of input device.
1365 @param DevPath The input device path structure.
1366 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1367 of the display node is used, where applicable. If DisplayOnly
1368 is FALSE, then the longer text representation of the display node
1370 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1371 representation for a device node can be used, where applicable.
1375 DevPathToTextiSCSI (
1376 IN OUT POOL_PRINT
*Str
,
1378 IN BOOLEAN DisplayOnly
,
1379 IN BOOLEAN AllowShortcuts
1382 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1385 ISCSIDevPath
= DevPath
;
1388 L
"iSCSI(%a,0x%x,0x%lx,",
1389 ISCSIDevPath
->iSCSITargetName
,
1390 ISCSIDevPath
->TargetPortalGroupTag
,
1394 Options
= ISCSIDevPath
->LoginOption
;
1395 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1396 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1397 if (((Options
>> 11) & 0x0001) != 0) {
1398 CatPrint (Str
, L
"%s,", L
"None");
1399 } else if (((Options
>> 12) & 0x0001) != 0) {
1400 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1402 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
1406 CatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1410 Converts a Hard drive device path structure to its string representive.
1412 @param Str The string representive of input device.
1413 @param DevPath The input device path structure.
1414 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1415 of the display node is used, where applicable. If DisplayOnly
1416 is FALSE, then the longer text representation of the display node
1418 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1419 representation for a device node can be used, where applicable.
1423 DevPathToTextHardDrive (
1424 IN OUT POOL_PRINT
*Str
,
1426 IN BOOLEAN DisplayOnly
,
1427 IN BOOLEAN AllowShortcuts
1430 HARDDRIVE_DEVICE_PATH
*Hd
;
1433 switch (Hd
->SignatureType
) {
1434 case SIGNATURE_TYPE_MBR
:
1437 L
"HD(%d,%s,0x%08x,",
1438 Hd
->PartitionNumber
,
1440 *((UINT32
*) (&(Hd
->Signature
[0])))
1444 case SIGNATURE_TYPE_GUID
:
1448 Hd
->PartitionNumber
,
1450 (EFI_GUID
*) &(Hd
->Signature
[0])
1458 Hd
->PartitionNumber
,
1464 CatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1468 Converts a CDROM device path structure to its string representive.
1470 @param Str The string representive of input device.
1471 @param DevPath The input device path structure.
1472 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1473 of the display node is used, where applicable. If DisplayOnly
1474 is FALSE, then the longer text representation of the display node
1476 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1477 representation for a device node can be used, where applicable.
1481 DevPathToTextCDROM (
1482 IN OUT POOL_PRINT
*Str
,
1484 IN BOOLEAN DisplayOnly
,
1485 IN BOOLEAN AllowShortcuts
1488 CDROM_DEVICE_PATH
*Cd
;
1492 CatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1496 CatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1500 Converts a File device path structure to its string representive.
1502 @param Str The string representive 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 DevPathToTextFilePath (
1514 IN OUT POOL_PRINT
*Str
,
1516 IN BOOLEAN DisplayOnly
,
1517 IN BOOLEAN AllowShortcuts
1520 FILEPATH_DEVICE_PATH
*Fp
;
1523 CatPrint (Str
, L
"%s", Fp
->PathName
);
1527 Converts a Media protocol device path structure to its string representive.
1529 @param Str The string representive 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.
1540 DevPathToTextMediaProtocol (
1541 IN OUT POOL_PRINT
*Str
,
1543 IN BOOLEAN DisplayOnly
,
1544 IN BOOLEAN AllowShortcuts
1547 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1549 MediaProt
= DevPath
;
1550 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1554 Converts a Firmware Volume device path structure to its string representive.
1556 @param Str The string representive 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.
1568 IN OUT POOL_PRINT
*Str
,
1570 IN BOOLEAN DisplayOnly
,
1571 IN BOOLEAN AllowShortcuts
1574 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1577 CatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1581 Converts a Firmware Volume File device path structure to its string representive.
1583 @param Str The string representive 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 DevPathToTextFvFile (
1595 IN OUT POOL_PRINT
*Str
,
1597 IN BOOLEAN DisplayOnly
,
1598 IN BOOLEAN AllowShortcuts
1601 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1604 CatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1608 Converts a BIOS Boot Specification device path structure to its string representive.
1610 @param Str The string representive of input device.
1611 @param DevPath The input device path structure.
1612 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1613 of the display node is used, where applicable. If DisplayOnly
1614 is FALSE, then the longer text representation of the display node
1616 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1617 representation for a device node can be used, where applicable.
1622 IN OUT POOL_PRINT
*Str
,
1624 IN BOOLEAN DisplayOnly
,
1625 IN BOOLEAN AllowShortcuts
1628 BBS_BBS_DEVICE_PATH
*Bbs
;
1632 switch (Bbs
->DeviceType
) {
1633 case BBS_TYPE_FLOPPY
:
1637 case BBS_TYPE_HARDDRIVE
:
1641 case BBS_TYPE_CDROM
:
1645 case BBS_TYPE_PCMCIA
:
1653 case BBS_TYPE_EMBEDDED_NETWORK
:
1663 CatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1665 CatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
1669 CatPrint (Str
, L
")");
1673 CatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
1677 Converts an End-of-Device-Path structure to its string representive.
1679 @param Str The string representive of input device.
1680 @param DevPath The input device path structure.
1681 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1682 of the display node is used, where applicable. If DisplayOnly
1683 is FALSE, then the longer text representation of the display node
1685 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1686 representation for a device node can be used, where applicable.
1690 DevPathToTextEndInstance (
1691 IN OUT POOL_PRINT
*Str
,
1693 IN BOOLEAN DisplayOnly
,
1694 IN BOOLEAN AllowShortcuts
1697 CatPrint (Str
, L
",");
1701 Converts an unknown device path structure to its string representive.
1703 @param Str The string representive of input device.
1704 @param DevPath The input device path structure.
1705 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1706 of the display node is used, where applicable. If DisplayOnly
1707 is FALSE, then the longer text representation of the display node
1709 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1710 representation for a device node can be used, where applicable.
1714 DevPathToTextNodeUnknown (
1715 IN OUT POOL_PRINT
*Str
,
1717 IN BOOLEAN DisplayOnly
,
1718 IN BOOLEAN AllowShortcuts
1721 CatPrint (Str
, L
"?");
1724 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
[] = {
1725 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
1726 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
1727 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
1728 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
1729 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
1730 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
1731 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
1732 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
1733 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
1734 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
1735 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
1736 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
1737 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
1738 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
1739 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
1740 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
1741 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
1742 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
1743 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
1744 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
1745 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
1746 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
1747 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
1748 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
1749 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
1750 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
1751 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
1752 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
1753 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1754 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
1755 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1756 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
1757 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
1758 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
1759 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
1764 Converts a device node to its string representation.
1766 @param DeviceNode A Pointer to the device node to be converted.
1767 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1768 of the display node is used, where applicable. If DisplayOnly
1769 is FALSE, then the longer text representation of the display node
1771 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1772 representation for a device node can be used, where applicable.
1774 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
1775 is NULL or there was insufficient memory.
1780 ConvertDeviceNodeToText (
1781 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
1782 IN BOOLEAN DisplayOnly
,
1783 IN BOOLEAN AllowShortcuts
1789 VOID (*DumpNode
)(POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1791 if (DeviceNode
== NULL
) {
1795 ZeroMem (&Str
, sizeof (Str
));
1798 // Process the device path node
1801 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
++) {
1802 if (DevicePathType (DeviceNode
) == DevPathToTextTable
[Index
].Type
&&
1803 DevicePathSubType (DeviceNode
) == DevPathToTextTable
[Index
].SubType
1805 DumpNode
= DevPathToTextTable
[Index
].Function
;
1810 // If not found, use a generic function
1812 if (DumpNode
== NULL
) {
1813 DumpNode
= DevPathToTextNodeUnknown
;
1819 DumpNode (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
1822 // Shrink pool used for string allocation
1824 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1825 Str
.Str
= ReallocatePool (Str
.Str
, NewSize
, NewSize
);
1826 ASSERT (Str
.Str
!= NULL
);
1827 Str
.Str
[Str
.Len
] = 0;
1832 Converts a device path to its text representation.
1834 @param DevicePath A Pointer to the device to be converted.
1835 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1836 of the display node is used, where applicable. If DisplayOnly
1837 is FALSE, then the longer text representation of the display node
1839 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1840 representation for a device node can be used, where applicable.
1842 @return A pointer to the allocated text representation of the device path or
1843 NULL if DeviceNode is NULL or there was insufficient memory.
1848 ConvertDevicePathToText (
1849 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
1850 IN BOOLEAN DisplayOnly
,
1851 IN BOOLEAN AllowShortcuts
1855 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1856 EFI_DEVICE_PATH_PROTOCOL
*UnpackDevPath
;
1859 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1861 if (DevicePath
== NULL
) {
1865 ZeroMem (&Str
, sizeof (Str
));
1868 // Unpacked the device path
1870 UnpackDevPath
= UnpackDevicePath ((EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
);
1871 ASSERT (UnpackDevPath
!= NULL
);
1874 // Process each device path node
1876 DevPathNode
= UnpackDevPath
;
1877 while (!IsDevicePathEnd (DevPathNode
)) {
1879 // Find the handler to dump this device path node
1882 for (Index
= 0; DevPathToTextTable
[Index
].Function
; 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 seperator 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 // Print this node of the device path
1908 DumpNode (&Str
, DevPathNode
, DisplayOnly
, AllowShortcuts
);
1911 // Next device path node
1913 DevPathNode
= NextDevicePathNode (DevPathNode
);
1916 // Shrink pool used for string allocation
1918 FreePool (UnpackDevPath
);
1920 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1921 Str
.Str
= ReallocatePool (Str
.Str
, NewSize
, NewSize
);
1922 ASSERT (Str
.Str
!= NULL
);
1923 Str
.Str
[Str
.Len
] = 0;