2 DevicePathToText protocol as defined in the UEFI 2.0 specification.
4 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "DevicePath.h"
18 Concatenates a formatted unicode string to allocated pool. The caller must
19 free the resulting buffer.
21 @param Str Tracks the allocated pool, size in use, and
22 amount of pool allocated.
23 @param Fmt The format string
24 @param ... Variable arguments based on the format string.
26 @return Allocated buffer with the formatted string printed in it.
27 The caller must free the allocated buffer. The buffer
28 allocation is not packed.
34 IN OUT POOL_PRINT
*Str
,
43 AppendStr
= AllocateZeroPool (0x1000);
44 ASSERT (AppendStr
!= NULL
);
47 AppendCount
= UnicodeVSPrint (AppendStr
, 0x1000, Fmt
, Args
);
50 if (Str
->Length
+ AppendCount
* sizeof (CHAR16
) > Str
->Capacity
) {
51 Str
->Capacity
= Str
->Length
+ (AppendCount
+ 1) * sizeof (CHAR16
) * 2;
52 Str
->Str
= ReallocatePool (
57 ASSERT (Str
->Str
!= NULL
);
60 if (Str
->Length
== 0) {
61 StrCpy (Str
->Str
, AppendStr
);
62 Str
->Length
= (AppendCount
+ 1) * sizeof (CHAR16
);
64 StrCat (Str
->Str
, AppendStr
);
65 Str
->Length
+= AppendCount
* sizeof (CHAR16
);
73 Converts a PCI device path structure to its string representative.
75 @param Str The string representative of input device.
76 @param DevPath The input device path structure.
77 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
78 of the display node is used, where applicable. If DisplayOnly
79 is FALSE, then the longer text representation of the display node
81 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
82 representation for a device node can be used, where applicable.
87 IN OUT POOL_PRINT
*Str
,
89 IN BOOLEAN DisplayOnly
,
90 IN BOOLEAN AllowShortcuts
96 CatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
100 Converts a PC Card device path structure to its string representative.
102 @param Str The string representative of input device.
103 @param DevPath The input device path structure.
104 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
105 of the display node is used, where applicable. If DisplayOnly
106 is FALSE, then the longer text representation of the display node
108 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
109 representation for a device node can be used, where applicable.
113 DevPathToTextPccard (
114 IN OUT POOL_PRINT
*Str
,
116 IN BOOLEAN DisplayOnly
,
117 IN BOOLEAN AllowShortcuts
120 PCCARD_DEVICE_PATH
*Pccard
;
123 CatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
127 Converts a Memory Map device path structure to its string representative.
129 @param Str The string representative of input device.
130 @param DevPath The input device path structure.
131 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
132 of the display node is used, where applicable. If DisplayOnly
133 is FALSE, then the longer text representation of the display node
135 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
136 representation for a device node can be used, where applicable.
140 DevPathToTextMemMap (
141 IN OUT POOL_PRINT
*Str
,
143 IN BOOLEAN DisplayOnly
,
144 IN BOOLEAN AllowShortcuts
147 MEMMAP_DEVICE_PATH
*MemMap
;
152 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
154 MemMap
->StartingAddress
,
155 MemMap
->EndingAddress
160 Converts a Vendor device path structure to its string representative.
162 @param Str The string representative of input device.
163 @param DevPath The input device path structure.
164 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
165 of the display node is used, where applicable. If DisplayOnly
166 is FALSE, then the longer text representation of the display node
168 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
169 representation for a device node can be used, where applicable.
173 DevPathToTextVendor (
174 IN OUT POOL_PRINT
*Str
,
176 IN BOOLEAN DisplayOnly
,
177 IN BOOLEAN AllowShortcuts
180 VENDOR_DEVICE_PATH
*Vendor
;
184 UINT32 FlowControlMap
;
187 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
188 switch (DevicePathType (&Vendor
->Header
)) {
189 case HARDWARE_DEVICE_PATH
:
193 case MESSAGING_DEVICE_PATH
:
195 if (AllowShortcuts
) {
196 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
197 CatPrint (Str
, L
"VenPcAnsi()");
199 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
200 CatPrint (Str
, L
"VenVt100()");
202 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
203 CatPrint (Str
, L
"VenVt100Plus()");
205 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
206 CatPrint (Str
, L
"VenUft8()");
208 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
209 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
210 switch (FlowControlMap
& 0x00000003) {
212 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
216 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
220 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
228 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
231 L
"SAS(0x%lx,0x%lx,0x%x,",
232 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
233 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
234 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
236 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
237 if (((Info
& 0x0f) == 0) && ((Info
& BIT7
) == 0)) {
238 CatPrint (Str
, L
"NoTopology,0,0,0,");
239 } else if (((Info
& 0x0f) <= 2) && ((Info
& BIT7
) == 0)) {
243 ((Info
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
244 ((Info
& BIT5
) != 0) ? L
"External" : L
"Internal",
245 ((Info
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
247 if ((Info
& 0x0f) == 1) {
248 CatPrint (Str
, L
"0,");
251 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
253 CatPrint (Str
, L
"0x%x,", ((Info
>> 8) & 0xff) + 1);
256 CatPrint (Str
, L
"0x%x,0,0,0,", Info
);
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
"PcieRoot(0x%x)", Acpi
->UID
);
355 CatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
359 CatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
363 CatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
367 CatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
371 CatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
375 CatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
380 Converts EISA identification to string.
382 @param EisaId The input EISA identification.
383 @param Text A pointer to the output string.
395 //UnicodeSPrint ("%X", 0x0a03) => "0000000000000A03"
397 UnicodeSPrint (PnpIdStr
, 17 * 2, L
"%16X", EisaId
>> 16);
401 sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (PnpIdStr
),
403 '@' + ((EisaId
>> 10) & 0x1f),
404 '@' + ((EisaId
>> 5) & 0x1f),
405 '@' + ((EisaId
>> 0) & 0x1f),
411 Converts a ACPI extended HID device path structure to its string representative.
413 @param Str The string representative of input device.
414 @param DevPath The input device path structure.
415 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
416 of the display node is used, where applicable. If DisplayOnly
417 is FALSE, then the longer text representation of the display node
419 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
420 representation for a device node can be used, where applicable.
424 DevPathToTextAcpiEx (
425 IN OUT POOL_PRINT
*Str
,
427 IN BOOLEAN DisplayOnly
,
428 IN BOOLEAN AllowShortcuts
431 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
439 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
440 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
441 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
443 EisaIdToText (AcpiEx
->HID
, HIDText
);
444 EisaIdToText (AcpiEx
->CID
, CIDText
);
446 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (AcpiEx
->UID
== 0)) {
452 L
"AcpiExp(%s,%s,%a)",
458 if (AllowShortcuts
) {
462 if (AcpiEx
->HID
== 0) {
463 CatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
465 CatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
468 if (AcpiEx
->UID
== 0) {
469 CatPrint (Str
, L
"%a,", UIDStr
);
471 CatPrint (Str
, L
"0x%x,", AcpiEx
->UID
);
474 if (AcpiEx
->CID
== 0) {
475 CatPrint (Str
, L
"%a)", CIDStr
);
477 CatPrint (Str
, L
"%s)", CIDText
);
482 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
495 Converts a ACPI address device path structure to its string representative.
497 @param Str The string representative of input device.
498 @param DevPath The input device path structure.
499 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
500 of the display node is used, where applicable. If DisplayOnly
501 is FALSE, then the longer text representation of the display node
503 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
504 representation for a device node can be used, where applicable.
508 DevPathToTextAcpiAdr (
509 IN OUT POOL_PRINT
*Str
,
511 IN BOOLEAN DisplayOnly
,
512 IN BOOLEAN AllowShortcuts
515 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
518 UINT16 AdditionalAdrCount
;
521 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
522 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
524 CatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
525 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
526 CatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
528 CatPrint (Str
, L
")");
532 Converts a ATAPI device path structure to its string representative.
534 @param Str The string representative of input device.
535 @param DevPath The input device path structure.
536 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
537 of the display node is used, where applicable. If DisplayOnly
538 is FALSE, then the longer text representation of the display node
540 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
541 representation for a device node can be used, where applicable.
546 IN OUT POOL_PRINT
*Str
,
548 IN BOOLEAN DisplayOnly
,
549 IN BOOLEAN AllowShortcuts
552 ATAPI_DEVICE_PATH
*Atapi
;
557 CatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
562 (Atapi
->PrimarySecondary
== 1) ? L
"Secondary" : L
"Primary",
563 (Atapi
->SlaveMaster
== 1) ? L
"Slave" : L
"Master",
570 Converts a SCSI device path structure to its string representative.
572 @param Str The string representative of input device.
573 @param DevPath The input device path structure.
574 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
575 of the display node is used, where applicable. If DisplayOnly
576 is FALSE, then the longer text representation of the display node
578 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
579 representation for a device node can be used, where applicable.
584 IN OUT POOL_PRINT
*Str
,
586 IN BOOLEAN DisplayOnly
,
587 IN BOOLEAN AllowShortcuts
590 SCSI_DEVICE_PATH
*Scsi
;
593 CatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
597 Converts a Fibre device path structure to its string representative.
599 @param Str The string representative of input device.
600 @param DevPath The input device path structure.
601 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
602 of the display node is used, where applicable. If DisplayOnly
603 is FALSE, then the longer text representation of the display node
605 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
606 representation for a device node can be used, where applicable.
611 IN OUT POOL_PRINT
*Str
,
613 IN BOOLEAN DisplayOnly
,
614 IN BOOLEAN AllowShortcuts
617 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
620 CatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
624 Converts a FibreEx device path structure to its string representative.
626 @param Str The string representative of input device.
627 @param DevPath The input device path structure.
628 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
629 of the display node is used, where applicable. If DisplayOnly
630 is FALSE, then the longer text representation of the display node
632 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
633 representation for a device node can be used, where applicable.
637 DevPathToTextFibreEx (
638 IN OUT POOL_PRINT
*Str
,
640 IN BOOLEAN DisplayOnly
,
641 IN BOOLEAN AllowShortcuts
644 FIBRECHANNELEX_DEVICE_PATH
*FibreEx
;
648 CatPrint (Str
, L
"FibreEx(0x");
649 for (Index
= 0; Index
< sizeof (FibreEx
->WWN
) / sizeof (FibreEx
->WWN
[0]); Index
++) {
650 CatPrint (Str
, L
"%02x", FibreEx
->WWN
[Index
]);
652 CatPrint (Str
, L
",0x");
653 for (Index
= 0; Index
< sizeof (FibreEx
->Lun
) / sizeof (FibreEx
->Lun
[0]); Index
++) {
654 CatPrint (Str
, L
"%02x", FibreEx
->Lun
[Index
]);
656 CatPrint (Str
, L
")");
660 Converts a Sas Ex device path structure to its string representative.
662 @param Str The string representative of input device.
663 @param DevPath The input device path structure.
664 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
665 of the display node is used, where applicable. If DisplayOnly
666 is FALSE, then the longer text representation of the display node
668 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
669 representation for a device node can be used, where applicable.
674 IN OUT POOL_PRINT
*Str
,
676 IN BOOLEAN DisplayOnly
,
677 IN BOOLEAN AllowShortcuts
680 SASEX_DEVICE_PATH
*SasEx
;
684 CatPrint (Str
, L
"SasEx(0x");
686 for (Index
= 0; Index
< sizeof (SasEx
->SasAddress
) / sizeof (SasEx
->SasAddress
[0]); Index
++) {
687 CatPrint (Str
, L
"%02x", SasEx
->SasAddress
[Index
]);
689 CatPrint (Str
, L
",0x");
690 for (Index
= 0; Index
< sizeof (SasEx
->Lun
) / sizeof (SasEx
->Lun
[0]); Index
++) {
691 CatPrint (Str
, L
"%02x", SasEx
->Lun
[Index
]);
693 CatPrint (Str
, L
",0x%x,", SasEx
->RelativeTargetPort
);
695 if (((SasEx
->DeviceTopology
& 0x0f) == 0) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
696 CatPrint (Str
, L
"NoTopology,0,0,0");
697 } else if (((SasEx
->DeviceTopology
& 0x0f) <= 2) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
701 ((SasEx
->DeviceTopology
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
702 ((SasEx
->DeviceTopology
& BIT5
) != 0) ? L
"External" : L
"Internal",
703 ((SasEx
->DeviceTopology
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
705 if ((SasEx
->DeviceTopology
& 0x0f) == 1) {
706 CatPrint (Str
, L
"0");
709 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
711 CatPrint (Str
, L
"0x%x", ((SasEx
->DeviceTopology
>> 8) & 0xff) + 1);
714 CatPrint (Str
, L
"0x%x,0,0,0", SasEx
->DeviceTopology
);
717 CatPrint (Str
, L
")");
723 Converts a 1394 device path structure to its string representative.
725 @param Str The string representative of input device.
726 @param DevPath The input device path structure.
727 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
728 of the display node is used, where applicable. If DisplayOnly
729 is FALSE, then the longer text representation of the display node
731 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
732 representation for a device node can be used, where applicable.
737 IN OUT POOL_PRINT
*Str
,
739 IN BOOLEAN DisplayOnly
,
740 IN BOOLEAN AllowShortcuts
743 F1394_DEVICE_PATH
*F1394DevPath
;
745 F1394DevPath
= DevPath
;
747 // Guid has format of IEEE-EUI64
749 CatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
753 Converts a USB device path structure to its string representative.
755 @param Str The string representative of input device.
756 @param DevPath The input device path structure.
757 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
758 of the display node is used, where applicable. If DisplayOnly
759 is FALSE, then the longer text representation of the display node
761 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
762 representation for a device node can be used, where applicable.
767 IN OUT POOL_PRINT
*Str
,
769 IN BOOLEAN DisplayOnly
,
770 IN BOOLEAN AllowShortcuts
773 USB_DEVICE_PATH
*Usb
;
776 CatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
780 Converts a USB WWID device path structure to its string representative.
782 @param Str The string representative of input device.
783 @param DevPath The input device path structure.
784 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
785 of the display node is used, where applicable. If DisplayOnly
786 is FALSE, then the longer text representation of the display node
788 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
789 representation for a device node can be used, where applicable.
793 DevPathToTextUsbWWID (
794 IN OUT POOL_PRINT
*Str
,
796 IN BOOLEAN DisplayOnly
,
797 IN BOOLEAN AllowShortcuts
800 USB_WWID_DEVICE_PATH
*UsbWWId
;
801 CHAR16
*SerialNumberStr
;
807 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
808 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
809 if (SerialNumberStr
[Length
- 1] != 0) {
811 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
813 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
814 ASSERT (NewStr
!= NULL
);
816 SerialNumberStr
= NewStr
;
821 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
824 UsbWWId
->InterfaceNumber
,
830 Converts a Logic Unit device path structure to its string representative.
832 @param Str The string representative of input device.
833 @param DevPath The input device path structure.
834 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
835 of the display node is used, where applicable. If DisplayOnly
836 is FALSE, then the longer text representation of the display node
838 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
839 representation for a device node can be used, where applicable.
843 DevPathToTextLogicalUnit (
844 IN OUT POOL_PRINT
*Str
,
846 IN BOOLEAN DisplayOnly
,
847 IN BOOLEAN AllowShortcuts
850 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
852 LogicalUnit
= DevPath
;
853 CatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
857 Converts a USB class device path structure to its string representative.
859 @param Str The string representative of input device.
860 @param DevPath The input device path structure.
861 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
862 of the display node is used, where applicable. If DisplayOnly
863 is FALSE, then the longer text representation of the display node
865 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
866 representation for a device node can be used, where applicable.
870 DevPathToTextUsbClass (
871 IN OUT POOL_PRINT
*Str
,
873 IN BOOLEAN DisplayOnly
,
874 IN BOOLEAN AllowShortcuts
877 USB_CLASS_DEVICE_PATH
*UsbClass
;
878 BOOLEAN IsKnownSubClass
;
883 IsKnownSubClass
= TRUE
;
884 switch (UsbClass
->DeviceClass
) {
885 case USB_CLASS_AUDIO
:
886 CatPrint (Str
, L
"UsbAudio");
889 case USB_CLASS_CDCCONTROL
:
890 CatPrint (Str
, L
"UsbCDCControl");
894 CatPrint (Str
, L
"UsbHID");
897 case USB_CLASS_IMAGE
:
898 CatPrint (Str
, L
"UsbImage");
901 case USB_CLASS_PRINTER
:
902 CatPrint (Str
, L
"UsbPrinter");
905 case USB_CLASS_MASS_STORAGE
:
906 CatPrint (Str
, L
"UsbMassStorage");
910 CatPrint (Str
, L
"UsbHub");
913 case USB_CLASS_CDCDATA
:
914 CatPrint (Str
, L
"UsbCDCData");
917 case USB_CLASS_SMART_CARD
:
918 CatPrint (Str
, L
"UsbSmartCard");
921 case USB_CLASS_VIDEO
:
922 CatPrint (Str
, L
"UsbVideo");
925 case USB_CLASS_DIAGNOSTIC
:
926 CatPrint (Str
, L
"UsbDiagnostic");
929 case USB_CLASS_WIRELESS
:
930 CatPrint (Str
, L
"UsbWireless");
934 IsKnownSubClass
= FALSE
;
938 if (IsKnownSubClass
) {
941 L
"(0x%x,0x%x,0x%x,0x%x)",
944 UsbClass
->DeviceSubClass
,
945 UsbClass
->DeviceProtocol
950 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
951 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
954 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
957 UsbClass
->DeviceProtocol
960 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
963 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
966 UsbClass
->DeviceProtocol
969 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
972 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
975 UsbClass
->DeviceProtocol
983 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
986 UsbClass
->DeviceClass
,
987 UsbClass
->DeviceSubClass
,
988 UsbClass
->DeviceProtocol
993 Converts a SATA device path structure to its string representative.
995 @param Str The string representative of input device.
996 @param DevPath The input device path structure.
997 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
998 of the display node is used, where applicable. If DisplayOnly
999 is FALSE, then the longer text representation of the display node
1001 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1002 representation for a device node can be used, where applicable.
1007 IN OUT POOL_PRINT
*Str
,
1009 IN BOOLEAN DisplayOnly
,
1010 IN BOOLEAN AllowShortcuts
1013 SATA_DEVICE_PATH
*Sata
;
1016 if ((Sata
->PortMultiplierPortNumber
& SATA_HBA_DIRECT_CONNECT_FLAG
) != 0) {
1020 Sata
->HBAPortNumber
,
1026 L
"Sata(0x%x,0x%x,0x%x)",
1027 Sata
->HBAPortNumber
,
1028 Sata
->PortMultiplierPortNumber
,
1035 Converts a I20 device path structure to its string representative.
1037 @param Str The string representative of input device.
1038 @param DevPath The input device path structure.
1039 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1040 of the display node is used, where applicable. If DisplayOnly
1041 is FALSE, then the longer text representation of the display node
1043 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1044 representation for a device node can be used, where applicable.
1049 IN OUT POOL_PRINT
*Str
,
1051 IN BOOLEAN DisplayOnly
,
1052 IN BOOLEAN AllowShortcuts
1055 I2O_DEVICE_PATH
*I2ODevPath
;
1057 I2ODevPath
= DevPath
;
1058 CatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1062 Converts a MAC address device path structure to its string representative.
1064 @param Str The string representative of input device.
1065 @param DevPath The input device path structure.
1066 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1067 of the display node is used, where applicable. If DisplayOnly
1068 is FALSE, then the longer text representation of the display node
1070 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1071 representation for a device node can be used, where applicable.
1075 DevPathToTextMacAddr (
1076 IN OUT POOL_PRINT
*Str
,
1078 IN BOOLEAN DisplayOnly
,
1079 IN BOOLEAN AllowShortcuts
1082 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1083 UINTN HwAddressSize
;
1086 MacDevPath
= DevPath
;
1088 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1089 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1093 CatPrint (Str
, L
"MAC(");
1095 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1096 CatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1099 CatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1103 Converts network protocol string to its text representation.
1105 @param Str The string representative of input device.
1106 @param Protocol The network protocol ID.
1110 CatNetworkProtocol (
1111 IN OUT POOL_PRINT
*Str
,
1115 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1116 CatPrint (Str
, L
"TCP");
1117 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1118 CatPrint (Str
, L
"UDP");
1120 CatPrint (Str
, L
"0x%x", Protocol
);
1125 Converts a IPv4 device path structure to its string representative.
1127 @param Str The string representative of input device.
1128 @param DevPath The input device path structure.
1129 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1130 of the display node is used, where applicable. If DisplayOnly
1131 is FALSE, then the longer text representation of the display node
1133 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1134 representation for a device node can be used, where applicable.
1139 IN OUT POOL_PRINT
*Str
,
1141 IN BOOLEAN DisplayOnly
,
1142 IN BOOLEAN AllowShortcuts
1145 IPv4_DEVICE_PATH
*IPDevPath
;
1147 IPDevPath
= DevPath
;
1151 L
"IPv4(%d.%d.%d.%d)",
1152 IPDevPath
->RemoteIpAddress
.Addr
[0],
1153 IPDevPath
->RemoteIpAddress
.Addr
[1],
1154 IPDevPath
->RemoteIpAddress
.Addr
[2],
1155 IPDevPath
->RemoteIpAddress
.Addr
[3]
1162 L
"IPv4(%d.%d.%d.%d,",
1163 IPDevPath
->RemoteIpAddress
.Addr
[0],
1164 IPDevPath
->RemoteIpAddress
.Addr
[1],
1165 IPDevPath
->RemoteIpAddress
.Addr
[2],
1166 IPDevPath
->RemoteIpAddress
.Addr
[3]
1169 CatNetworkProtocol (
1177 IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP",
1178 IPDevPath
->LocalIpAddress
.Addr
[0],
1179 IPDevPath
->LocalIpAddress
.Addr
[1],
1180 IPDevPath
->LocalIpAddress
.Addr
[2],
1181 IPDevPath
->LocalIpAddress
.Addr
[3]
1183 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1186 L
",%d.%d.%d.%d,%d.%d.%d.%d",
1187 IPDevPath
->GatewayIpAddress
.Addr
[0],
1188 IPDevPath
->GatewayIpAddress
.Addr
[1],
1189 IPDevPath
->GatewayIpAddress
.Addr
[2],
1190 IPDevPath
->GatewayIpAddress
.Addr
[3],
1191 IPDevPath
->SubnetMask
.Addr
[0],
1192 IPDevPath
->SubnetMask
.Addr
[1],
1193 IPDevPath
->SubnetMask
.Addr
[2],
1194 IPDevPath
->SubnetMask
.Addr
[3]
1197 CatPrint (Str
, L
")");
1201 Converts a IPv6 device path structure to its string representative.
1203 @param Str The string representative of input device.
1204 @param DevPath The input device path structure.
1205 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1206 of the display node is used, where applicable. If DisplayOnly
1207 is FALSE, then the longer text representation of the display node
1209 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1210 representation for a device node can be used, where applicable.
1215 IN OUT POOL_PRINT
*Str
,
1217 IN BOOLEAN DisplayOnly
,
1218 IN BOOLEAN AllowShortcuts
1221 IPv6_DEVICE_PATH
*IPDevPath
;
1223 IPDevPath
= DevPath
;
1227 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
1228 IPDevPath
->RemoteIpAddress
.Addr
[0],
1229 IPDevPath
->RemoteIpAddress
.Addr
[1],
1230 IPDevPath
->RemoteIpAddress
.Addr
[2],
1231 IPDevPath
->RemoteIpAddress
.Addr
[3],
1232 IPDevPath
->RemoteIpAddress
.Addr
[4],
1233 IPDevPath
->RemoteIpAddress
.Addr
[5],
1234 IPDevPath
->RemoteIpAddress
.Addr
[6],
1235 IPDevPath
->RemoteIpAddress
.Addr
[7],
1236 IPDevPath
->RemoteIpAddress
.Addr
[8],
1237 IPDevPath
->RemoteIpAddress
.Addr
[9],
1238 IPDevPath
->RemoteIpAddress
.Addr
[10],
1239 IPDevPath
->RemoteIpAddress
.Addr
[11],
1240 IPDevPath
->RemoteIpAddress
.Addr
[12],
1241 IPDevPath
->RemoteIpAddress
.Addr
[13],
1242 IPDevPath
->RemoteIpAddress
.Addr
[14],
1243 IPDevPath
->RemoteIpAddress
.Addr
[15]
1250 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,",
1251 IPDevPath
->RemoteIpAddress
.Addr
[0],
1252 IPDevPath
->RemoteIpAddress
.Addr
[1],
1253 IPDevPath
->RemoteIpAddress
.Addr
[2],
1254 IPDevPath
->RemoteIpAddress
.Addr
[3],
1255 IPDevPath
->RemoteIpAddress
.Addr
[4],
1256 IPDevPath
->RemoteIpAddress
.Addr
[5],
1257 IPDevPath
->RemoteIpAddress
.Addr
[6],
1258 IPDevPath
->RemoteIpAddress
.Addr
[7],
1259 IPDevPath
->RemoteIpAddress
.Addr
[8],
1260 IPDevPath
->RemoteIpAddress
.Addr
[9],
1261 IPDevPath
->RemoteIpAddress
.Addr
[10],
1262 IPDevPath
->RemoteIpAddress
.Addr
[11],
1263 IPDevPath
->RemoteIpAddress
.Addr
[12],
1264 IPDevPath
->RemoteIpAddress
.Addr
[13],
1265 IPDevPath
->RemoteIpAddress
.Addr
[14],
1266 IPDevPath
->RemoteIpAddress
.Addr
[15]
1269 CatNetworkProtocol (
1274 switch (IPDevPath
->IpAddressOrigin
) {
1276 CatPrint (Str
, L
",Static");
1279 CatPrint (Str
, L
",StatelessAutoConfigure");
1282 CatPrint (Str
, L
",StatefulAutoConfigure");
1288 L
",%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1289 IPDevPath
->LocalIpAddress
.Addr
[0],
1290 IPDevPath
->LocalIpAddress
.Addr
[1],
1291 IPDevPath
->LocalIpAddress
.Addr
[2],
1292 IPDevPath
->LocalIpAddress
.Addr
[3],
1293 IPDevPath
->LocalIpAddress
.Addr
[4],
1294 IPDevPath
->LocalIpAddress
.Addr
[5],
1295 IPDevPath
->LocalIpAddress
.Addr
[6],
1296 IPDevPath
->LocalIpAddress
.Addr
[7],
1297 IPDevPath
->LocalIpAddress
.Addr
[8],
1298 IPDevPath
->LocalIpAddress
.Addr
[9],
1299 IPDevPath
->LocalIpAddress
.Addr
[10],
1300 IPDevPath
->LocalIpAddress
.Addr
[11],
1301 IPDevPath
->LocalIpAddress
.Addr
[12],
1302 IPDevPath
->LocalIpAddress
.Addr
[13],
1303 IPDevPath
->LocalIpAddress
.Addr
[14],
1304 IPDevPath
->LocalIpAddress
.Addr
[15]
1307 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1310 L
",0x%x,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1311 IPDevPath
->PrefixLength
,
1312 IPDevPath
->GatewayIpAddress
.Addr
[0],
1313 IPDevPath
->GatewayIpAddress
.Addr
[1],
1314 IPDevPath
->GatewayIpAddress
.Addr
[2],
1315 IPDevPath
->GatewayIpAddress
.Addr
[3],
1316 IPDevPath
->GatewayIpAddress
.Addr
[4],
1317 IPDevPath
->GatewayIpAddress
.Addr
[5],
1318 IPDevPath
->GatewayIpAddress
.Addr
[6],
1319 IPDevPath
->GatewayIpAddress
.Addr
[7],
1320 IPDevPath
->GatewayIpAddress
.Addr
[8],
1321 IPDevPath
->GatewayIpAddress
.Addr
[9],
1322 IPDevPath
->GatewayIpAddress
.Addr
[10],
1323 IPDevPath
->GatewayIpAddress
.Addr
[11],
1324 IPDevPath
->GatewayIpAddress
.Addr
[12],
1325 IPDevPath
->GatewayIpAddress
.Addr
[13],
1326 IPDevPath
->GatewayIpAddress
.Addr
[14],
1327 IPDevPath
->GatewayIpAddress
.Addr
[15]
1330 CatPrint (Str
, L
")");
1334 Converts an Infini Band device path structure to its string representative.
1336 @param Str The string representative of input device.
1337 @param DevPath The input device path structure.
1338 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1339 of the display node is used, where applicable. If DisplayOnly
1340 is FALSE, then the longer text representation of the display node
1342 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1343 representation for a device node can be used, where applicable.
1347 DevPathToTextInfiniBand (
1348 IN OUT POOL_PRINT
*Str
,
1350 IN BOOLEAN DisplayOnly
,
1351 IN BOOLEAN AllowShortcuts
1354 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1356 InfiniBand
= DevPath
;
1359 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1360 InfiniBand
->ResourceFlags
,
1361 InfiniBand
->PortGid
,
1362 InfiniBand
->ServiceId
,
1363 InfiniBand
->TargetPortId
,
1364 InfiniBand
->DeviceId
1369 Converts a UART device path structure to its string representative.
1371 @param Str The string representative of input device.
1372 @param DevPath The input device path structure.
1373 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1374 of the display node is used, where applicable. If DisplayOnly
1375 is FALSE, then the longer text representation of the display node
1377 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1378 representation for a device node can be used, where applicable.
1383 IN OUT POOL_PRINT
*Str
,
1385 IN BOOLEAN DisplayOnly
,
1386 IN BOOLEAN AllowShortcuts
1389 UART_DEVICE_PATH
*Uart
;
1393 switch (Uart
->Parity
) {
1423 if (Uart
->BaudRate
== 0) {
1424 CatPrint (Str
, L
"Uart(DEFAULT,");
1426 CatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1429 if (Uart
->DataBits
== 0) {
1430 CatPrint (Str
, L
"DEFAULT,");
1432 CatPrint (Str
, L
"%d,", Uart
->DataBits
);
1435 CatPrint (Str
, L
"%c,", Parity
);
1437 switch (Uart
->StopBits
) {
1439 CatPrint (Str
, L
"D)");
1443 CatPrint (Str
, L
"1)");
1447 CatPrint (Str
, L
"1.5)");
1451 CatPrint (Str
, L
"2)");
1455 CatPrint (Str
, L
"x)");
1461 Converts an iSCSI device path structure to its string representative.
1463 @param Str The string representative of input device.
1464 @param DevPath The input device path structure.
1465 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1466 of the display node is used, where applicable. If DisplayOnly
1467 is FALSE, then the longer text representation of the display node
1469 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1470 representation for a device node can be used, where applicable.
1474 DevPathToTextiSCSI (
1475 IN OUT POOL_PRINT
*Str
,
1477 IN BOOLEAN DisplayOnly
,
1478 IN BOOLEAN AllowShortcuts
1481 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1484 ISCSIDevPath
= DevPath
;
1487 L
"iSCSI(%a,0x%x,0x%lx,",
1488 ISCSIDevPath
->TargetName
,
1489 ISCSIDevPath
->TargetPortalGroupTag
,
1493 Options
= ISCSIDevPath
->LoginOption
;
1494 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1495 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1496 if (((Options
>> 11) & 0x0001) != 0) {
1497 CatPrint (Str
, L
"%s,", L
"None");
1498 } else if (((Options
>> 12) & 0x0001) != 0) {
1499 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1501 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
1505 CatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1509 Converts a VLAN device path structure to its string representative.
1511 @param Str The string representative of input device.
1512 @param DevPath The input device path structure.
1513 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1514 of the display node is used, where applicable. If DisplayOnly
1515 is FALSE, then the longer text representation of the display node
1517 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1518 representation for a device node can be used, where applicable.
1523 IN OUT POOL_PRINT
*Str
,
1525 IN BOOLEAN DisplayOnly
,
1526 IN BOOLEAN AllowShortcuts
1529 VLAN_DEVICE_PATH
*Vlan
;
1532 CatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1536 Converts a Hard drive device path structure to its string representative.
1538 @param Str The string representative of input device.
1539 @param DevPath The input device path structure.
1540 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1541 of the display node is used, where applicable. If DisplayOnly
1542 is FALSE, then the longer text representation of the display node
1544 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1545 representation for a device node can be used, where applicable.
1549 DevPathToTextHardDrive (
1550 IN OUT POOL_PRINT
*Str
,
1552 IN BOOLEAN DisplayOnly
,
1553 IN BOOLEAN AllowShortcuts
1556 HARDDRIVE_DEVICE_PATH
*Hd
;
1559 switch (Hd
->SignatureType
) {
1560 case SIGNATURE_TYPE_MBR
:
1563 L
"HD(%d,%s,0x%08x,",
1564 Hd
->PartitionNumber
,
1566 *((UINT32
*) (&(Hd
->Signature
[0])))
1570 case SIGNATURE_TYPE_GUID
:
1574 Hd
->PartitionNumber
,
1576 (EFI_GUID
*) &(Hd
->Signature
[0])
1584 Hd
->PartitionNumber
,
1590 CatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1594 Converts a CDROM device path structure to its string representative.
1596 @param Str The string representative of input device.
1597 @param DevPath The input device path structure.
1598 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1599 of the display node is used, where applicable. If DisplayOnly
1600 is FALSE, then the longer text representation of the display node
1602 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1603 representation for a device node can be used, where applicable.
1607 DevPathToTextCDROM (
1608 IN OUT POOL_PRINT
*Str
,
1610 IN BOOLEAN DisplayOnly
,
1611 IN BOOLEAN AllowShortcuts
1614 CDROM_DEVICE_PATH
*Cd
;
1618 CatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1622 CatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1626 Converts a File device path structure to its string representative.
1628 @param Str The string representative of input device.
1629 @param DevPath The input device path structure.
1630 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1631 of the display node is used, where applicable. If DisplayOnly
1632 is FALSE, then the longer text representation of the display node
1634 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1635 representation for a device node can be used, where applicable.
1639 DevPathToTextFilePath (
1640 IN OUT POOL_PRINT
*Str
,
1642 IN BOOLEAN DisplayOnly
,
1643 IN BOOLEAN AllowShortcuts
1646 FILEPATH_DEVICE_PATH
*Fp
;
1649 CatPrint (Str
, L
"%s", Fp
->PathName
);
1653 Converts a Media protocol device path structure to its string representative.
1655 @param Str The string representative of input device.
1656 @param DevPath The input device path structure.
1657 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1658 of the display node is used, where applicable. If DisplayOnly
1659 is FALSE, then the longer text representation of the display node
1661 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1662 representation for a device node can be used, where applicable.
1666 DevPathToTextMediaProtocol (
1667 IN OUT POOL_PRINT
*Str
,
1669 IN BOOLEAN DisplayOnly
,
1670 IN BOOLEAN AllowShortcuts
1673 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1675 MediaProt
= DevPath
;
1676 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1680 Converts a Firmware Volume device path structure to its string representative.
1682 @param Str The string representative of input device.
1683 @param DevPath The input device path structure.
1684 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1685 of the display node is used, where applicable. If DisplayOnly
1686 is FALSE, then the longer text representation of the display node
1688 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1689 representation for a device node can be used, where applicable.
1694 IN OUT POOL_PRINT
*Str
,
1696 IN BOOLEAN DisplayOnly
,
1697 IN BOOLEAN AllowShortcuts
1700 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1703 CatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1707 Converts a Firmware Volume File device path structure to its string representative.
1709 @param Str The string representative of input device.
1710 @param DevPath The input device path structure.
1711 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1712 of the display node is used, where applicable. If DisplayOnly
1713 is FALSE, then the longer text representation of the display node
1715 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1716 representation for a device node can be used, where applicable.
1720 DevPathToTextFvFile (
1721 IN OUT POOL_PRINT
*Str
,
1723 IN BOOLEAN DisplayOnly
,
1724 IN BOOLEAN AllowShortcuts
1727 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1730 CatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1734 Converts a Relative Offset device path structure to its string representative.
1736 @param Str The string representative of input device.
1737 @param DevPath The input device path structure.
1738 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1739 of the display node is used, where applicable. If DisplayOnly
1740 is FALSE, then the longer text representation of the display node
1742 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1743 representation for a device node can be used, where applicable.
1747 DevPathRelativeOffsetRange (
1748 IN OUT POOL_PRINT
*Str
,
1750 IN BOOLEAN DisplayOnly
,
1751 IN BOOLEAN AllowShortcuts
1754 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1759 L
"Offset(0x%lx,0x%lx)",
1760 Offset
->StartingOffset
,
1761 Offset
->EndingOffset
1766 Converts a BIOS Boot Specification device path structure to its string representative.
1768 @param Str The string representative of input device.
1769 @param DevPath The input device path structure.
1770 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1771 of the display node is used, where applicable. If DisplayOnly
1772 is FALSE, then the longer text representation of the display node
1774 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1775 representation for a device node can be used, where applicable.
1780 IN OUT POOL_PRINT
*Str
,
1782 IN BOOLEAN DisplayOnly
,
1783 IN BOOLEAN AllowShortcuts
1786 BBS_BBS_DEVICE_PATH
*Bbs
;
1790 switch (Bbs
->DeviceType
) {
1791 case BBS_TYPE_FLOPPY
:
1795 case BBS_TYPE_HARDDRIVE
:
1799 case BBS_TYPE_CDROM
:
1803 case BBS_TYPE_PCMCIA
:
1811 case BBS_TYPE_EMBEDDED_NETWORK
:
1821 CatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1823 CatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
1827 CatPrint (Str
, L
")");
1831 CatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
1835 Converts an End-of-Device-Path structure to its string representative.
1837 @param Str The string representative of input device.
1838 @param DevPath The input device path structure.
1839 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1840 of the display node is used, where applicable. If DisplayOnly
1841 is FALSE, then the longer text representation of the display node
1843 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1844 representation for a device node can be used, where applicable.
1848 DevPathToTextEndInstance (
1849 IN OUT POOL_PRINT
*Str
,
1851 IN BOOLEAN DisplayOnly
,
1852 IN BOOLEAN AllowShortcuts
1855 CatPrint (Str
, L
",");
1859 Converts an unknown device path structure to its string representative.
1861 @param Str The string representative of input device.
1862 @param DevPath The input device path structure.
1863 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1864 of the display node is used, where applicable. If DisplayOnly
1865 is FALSE, then the longer text representation of the display node
1867 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1868 representation for a device node can be used, where applicable.
1872 DevPathToTextNodeUnknown (
1873 IN OUT POOL_PRINT
*Str
,
1875 IN BOOLEAN DisplayOnly
,
1876 IN BOOLEAN AllowShortcuts
1879 CatPrint (Str
, L
"?");
1882 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
[] = {
1883 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
1884 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
1885 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
1886 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
1887 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
1888 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
1889 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
1890 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
1891 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
1892 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
1893 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
1894 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
1895 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
1896 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
1897 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
1898 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
1899 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
1900 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
1901 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
1902 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
1903 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
1904 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
1905 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
1906 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
1907 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
1908 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
1909 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
1910 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
1911 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
1912 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
1913 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
1914 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
1915 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1916 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
1917 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
1918 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
1919 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
1920 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
1925 Converts a device node to its string representation.
1927 @param DeviceNode A Pointer to the device node to be converted.
1928 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1929 of the display node is used, where applicable. If DisplayOnly
1930 is FALSE, then the longer text representation of the display node
1932 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1933 representation for a device node can be used, where applicable.
1935 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
1936 is NULL or there was insufficient memory.
1941 ConvertDeviceNodeToText (
1942 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
1943 IN BOOLEAN DisplayOnly
,
1944 IN BOOLEAN AllowShortcuts
1949 VOID (*DumpNode
)(POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1951 if (DeviceNode
== NULL
) {
1955 ZeroMem (&Str
, sizeof (Str
));
1958 // Process the device path node
1961 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
++) {
1962 if (DevicePathType (DeviceNode
) == DevPathToTextTable
[Index
].Type
&&
1963 DevicePathSubType (DeviceNode
) == DevPathToTextTable
[Index
].SubType
1965 DumpNode
= DevPathToTextTable
[Index
].Function
;
1970 // If not found, use a generic function
1972 if (DumpNode
== NULL
) {
1973 DumpNode
= DevPathToTextNodeUnknown
;
1979 DumpNode (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
1981 ASSERT (Str
.Str
!= NULL
);
1986 Converts a device path to its text representation.
1988 @param DevicePath A Pointer to the device to be converted.
1989 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1990 of the display node is used, where applicable. If DisplayOnly
1991 is FALSE, then the longer text representation of the display node
1993 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1994 representation for a device node can be used, where applicable.
1996 @return A pointer to the allocated text representation of the device path or
1997 NULL if DeviceNode is NULL or there was insufficient memory.
2002 ConvertDevicePathToText (
2003 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
2004 IN BOOLEAN DisplayOnly
,
2005 IN BOOLEAN AllowShortcuts
2009 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
2010 EFI_DEVICE_PATH_PROTOCOL
*AlignedDevPathNode
;
2012 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
2014 if (DevicePath
== NULL
) {
2018 ZeroMem (&Str
, sizeof (Str
));
2021 // Process each device path node
2023 DevPathNode
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
2024 while (!IsDevicePathEnd (DevPathNode
)) {
2026 // Find the handler to dump this device path node
2029 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
2031 if (DevicePathType (DevPathNode
) == DevPathToTextTable
[Index
].Type
&&
2032 DevicePathSubType (DevPathNode
) == DevPathToTextTable
[Index
].SubType
2034 DumpNode
= DevPathToTextTable
[Index
].Function
;
2039 // If not found, use a generic function
2042 DumpNode
= DevPathToTextNodeUnknown
;
2045 // Put a path separator in if needed
2047 if ((Str
.Length
!= 0) && (DumpNode
!= DevPathToTextEndInstance
)) {
2048 if (*(Str
.Str
+ Str
.Length
/ sizeof (CHAR16
) - 1) != L
',') {
2049 CatPrint (&Str
, L
"/");
2053 AlignedDevPathNode
= AllocateCopyPool (DevicePathNodeLength (DevPathNode
), DevPathNode
);
2055 // Print this node of the device path
2057 DumpNode (&Str
, AlignedDevPathNode
, DisplayOnly
, AllowShortcuts
);
2058 FreePool (AlignedDevPathNode
);
2061 // Next device path node
2063 DevPathNode
= NextDevicePathNode (DevPathNode
);
2066 if (Str
.Str
== NULL
) {
2067 return AllocateZeroPool (sizeof (CHAR16
));