2 DevicePathToText protocol as defined in the UEFI 2.0 specification.
4 Copyright (c) 2006 - 2011, 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) {
238 CatPrint (Str
, L
"NoTopology,0,0,0,");
239 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
243 ((Info
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
244 ((Info
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
245 ((Info
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
247 if ((Info
& 0x0f) == 1) {
248 CatPrint (Str
, L
"0,");
250 CatPrint (Str
, L
"0x%x,", (Info
>> 8) & 0xff);
253 CatPrint (Str
, L
"0,0,0,0,");
256 CatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
258 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
259 CatPrint (Str
, L
"DebugPort()");
265 case MEDIA_DEVICE_PATH
:
274 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
275 CatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
276 if (DataLength
!= 0) {
277 CatPrint (Str
, L
",");
278 for (Index
= 0; Index
< DataLength
; Index
++) {
279 CatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
283 CatPrint (Str
, L
")");
287 Converts a Controller device path structure to its string representative.
289 @param Str The string representative of input device.
290 @param DevPath The input device path structure.
291 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
292 of the display node is used, where applicable. If DisplayOnly
293 is FALSE, then the longer text representation of the display node
295 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
296 representation for a device node can be used, where applicable.
300 DevPathToTextController (
301 IN OUT POOL_PRINT
*Str
,
303 IN BOOLEAN DisplayOnly
,
304 IN BOOLEAN AllowShortcuts
307 CONTROLLER_DEVICE_PATH
*Controller
;
309 Controller
= DevPath
;
313 Controller
->ControllerNumber
318 Converts a ACPI device path structure to its string representative.
320 @param Str The string representative of input device.
321 @param DevPath The input device path structure.
322 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
323 of the display node is used, where applicable. If DisplayOnly
324 is FALSE, then the longer text representation of the display node
326 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
327 representation for a device node can be used, where applicable.
332 IN OUT POOL_PRINT
*Str
,
334 IN BOOLEAN DisplayOnly
,
335 IN BOOLEAN AllowShortcuts
338 ACPI_HID_DEVICE_PATH
*Acpi
;
341 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
342 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
344 CatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
348 CatPrint (Str
, L
"PcieRoot(0x%x)", Acpi
->UID
);
352 CatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
356 CatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
360 CatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
364 CatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
368 CatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
372 CatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
377 Converts EISA identification to string.
379 @param EisaId The input EISA identification.
380 @param Text A pointer to the output string.
392 //UnicodeSPrint ("%X", 0x0a03) => "0000000000000A03"
394 UnicodeSPrint (PnpIdStr
, 17 * 2, L
"%16X", EisaId
>> 16);
398 sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (CHAR16
) + sizeof (PnpIdStr
),
400 '@' + ((EisaId
>> 10) & 0x1f),
401 '@' + ((EisaId
>> 5) & 0x1f),
402 '@' + ((EisaId
>> 0) & 0x1f),
408 Converts a ACPI extended HID device path structure to its string representative.
410 @param Str The string representative of input device.
411 @param DevPath The input device path structure.
412 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
413 of the display node is used, where applicable. If DisplayOnly
414 is FALSE, then the longer text representation of the display node
416 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
417 representation for a device node can be used, where applicable.
421 DevPathToTextAcpiEx (
422 IN OUT POOL_PRINT
*Str
,
424 IN BOOLEAN DisplayOnly
,
425 IN BOOLEAN AllowShortcuts
428 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
436 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
437 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
438 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
440 EisaIdToText (AcpiEx
->HID
, HIDText
);
441 EisaIdToText (AcpiEx
->CID
, CIDText
);
443 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (AcpiEx
->UID
== 0)) {
449 L
"AcpiExp(%s,%s,%a)",
455 if (AllowShortcuts
) {
459 if (AcpiEx
->HID
== 0) {
460 CatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
462 CatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
465 if (AcpiEx
->UID
== 0) {
466 CatPrint (Str
, L
"%a,", UIDStr
);
468 CatPrint (Str
, L
"0x%x,", AcpiEx
->UID
);
471 if (AcpiEx
->CID
== 0) {
472 CatPrint (Str
, L
"%a)", CIDStr
);
474 CatPrint (Str
, L
"%s)", CIDText
);
479 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
492 Converts a ACPI address device path structure to its string representative.
494 @param Str The string representative of input device.
495 @param DevPath The input device path structure.
496 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
497 of the display node is used, where applicable. If DisplayOnly
498 is FALSE, then the longer text representation of the display node
500 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
501 representation for a device node can be used, where applicable.
505 DevPathToTextAcpiAdr (
506 IN OUT POOL_PRINT
*Str
,
508 IN BOOLEAN DisplayOnly
,
509 IN BOOLEAN AllowShortcuts
512 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
515 UINT16 AdditionalAdrCount
;
518 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
519 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
521 CatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
522 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
523 CatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
525 CatPrint (Str
, L
")");
529 Converts a ATAPI device path structure to its string representative.
531 @param Str The string representative of input device.
532 @param DevPath The input device path structure.
533 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
534 of the display node is used, where applicable. If DisplayOnly
535 is FALSE, then the longer text representation of the display node
537 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
538 representation for a device node can be used, where applicable.
543 IN OUT POOL_PRINT
*Str
,
545 IN BOOLEAN DisplayOnly
,
546 IN BOOLEAN AllowShortcuts
549 ATAPI_DEVICE_PATH
*Atapi
;
554 CatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
559 (Atapi
->PrimarySecondary
== 1) ? L
"Secondary" : L
"Primary",
560 (Atapi
->SlaveMaster
== 1) ? L
"Slave" : L
"Master",
567 Converts a SCSI device path structure to its string representative.
569 @param Str The string representative of input device.
570 @param DevPath The input device path structure.
571 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
572 of the display node is used, where applicable. If DisplayOnly
573 is FALSE, then the longer text representation of the display node
575 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
576 representation for a device node can be used, where applicable.
581 IN OUT POOL_PRINT
*Str
,
583 IN BOOLEAN DisplayOnly
,
584 IN BOOLEAN AllowShortcuts
587 SCSI_DEVICE_PATH
*Scsi
;
590 CatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
594 Converts a Fibre device path structure to its string representative.
596 @param Str The string representative of input device.
597 @param DevPath The input device path structure.
598 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
599 of the display node is used, where applicable. If DisplayOnly
600 is FALSE, then the longer text representation of the display node
602 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
603 representation for a device node can be used, where applicable.
608 IN OUT POOL_PRINT
*Str
,
610 IN BOOLEAN DisplayOnly
,
611 IN BOOLEAN AllowShortcuts
614 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
617 CatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
621 Converts a FibreEx device path structure to its string representative.
623 @param Str The string representative of input device.
624 @param DevPath The input device path structure.
625 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
626 of the display node is used, where applicable. If DisplayOnly
627 is FALSE, then the longer text representation of the display node
629 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
630 representation for a device node can be used, where applicable.
634 DevPathToTextFibreEx (
635 IN OUT POOL_PRINT
*Str
,
637 IN BOOLEAN DisplayOnly
,
638 IN BOOLEAN AllowShortcuts
641 FIBRECHANNELEX_DEVICE_PATH
*FibreEx
;
645 CatPrint (Str
, L
"FibreEx(0x");
646 for (Index
= 0; Index
< sizeof (FibreEx
->WWN
) / sizeof (FibreEx
->WWN
[0]); Index
++) {
647 CatPrint (Str
, L
"%02x", FibreEx
->WWN
[Index
]);
649 CatPrint (Str
, L
",0x");
650 for (Index
= 0; Index
< sizeof (FibreEx
->Lun
) / sizeof (FibreEx
->Lun
[0]); Index
++) {
651 CatPrint (Str
, L
"%02x", FibreEx
->Lun
[Index
]);
653 CatPrint (Str
, L
")");
657 Converts a Sas Ex device path structure to its string representative.
659 @param Str The string representative of input device.
660 @param DevPath The input device path structure.
661 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
662 of the display node is used, where applicable. If DisplayOnly
663 is FALSE, then the longer text representation of the display node
665 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
666 representation for a device node can be used, where applicable.
671 IN OUT POOL_PRINT
*Str
,
673 IN BOOLEAN DisplayOnly
,
674 IN BOOLEAN AllowShortcuts
677 SASEX_DEVICE_PATH
*SasEx
;
681 CatPrint (Str
, L
"SasEx(0x");
683 for (Index
= 0; Index
< sizeof (SasEx
->SasAddress
) / sizeof (SasEx
->SasAddress
[0]); Index
++) {
684 CatPrint (Str
, L
"%02x", SasEx
->SasAddress
[Index
]);
686 CatPrint (Str
, L
",0x");
687 for (Index
= 0; Index
< sizeof (SasEx
->Lun
) / sizeof (SasEx
->Lun
[0]); Index
++) {
688 CatPrint (Str
, L
"%02x", SasEx
->Lun
[Index
]);
690 CatPrint (Str
, L
",0x%x,", SasEx
->RelativeTargetPort
);
692 if ((SasEx
->DeviceTopology
& 0x0f) == 0) {
693 CatPrint (Str
, L
"NoTopology,0,0,0");
694 } else if (((SasEx
->DeviceTopology
& 0x0f) == 1) || ((SasEx
->DeviceTopology
& 0x0f) == 2)) {
698 ((SasEx
->DeviceTopology
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
699 ((SasEx
->DeviceTopology
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
700 ((SasEx
->DeviceTopology
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
702 if ((SasEx
->DeviceTopology
& 0x0f) == 1) {
703 CatPrint (Str
, L
"0");
705 CatPrint (Str
, L
"0x%x", (SasEx
->DeviceTopology
>> 8) & 0xff);
708 CatPrint (Str
, L
"0,0,0,0");
711 CatPrint (Str
, L
")");
717 Converts a 1394 device path structure to its string representative.
719 @param Str The string representative of input device.
720 @param DevPath The input device path structure.
721 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
722 of the display node is used, where applicable. If DisplayOnly
723 is FALSE, then the longer text representation of the display node
725 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
726 representation for a device node can be used, where applicable.
731 IN OUT POOL_PRINT
*Str
,
733 IN BOOLEAN DisplayOnly
,
734 IN BOOLEAN AllowShortcuts
737 F1394_DEVICE_PATH
*F1394DevPath
;
739 F1394DevPath
= DevPath
;
741 // Guid has format of IEEE-EUI64
743 CatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
747 Converts a USB device path structure to its string representative.
749 @param Str The string representative of input device.
750 @param DevPath The input device path structure.
751 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
752 of the display node is used, where applicable. If DisplayOnly
753 is FALSE, then the longer text representation of the display node
755 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
756 representation for a device node can be used, where applicable.
761 IN OUT POOL_PRINT
*Str
,
763 IN BOOLEAN DisplayOnly
,
764 IN BOOLEAN AllowShortcuts
767 USB_DEVICE_PATH
*Usb
;
770 CatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
774 Converts a USB WWID device path structure to its string representative.
776 @param Str The string representative of input device.
777 @param DevPath The input device path structure.
778 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
779 of the display node is used, where applicable. If DisplayOnly
780 is FALSE, then the longer text representation of the display node
782 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
783 representation for a device node can be used, where applicable.
787 DevPathToTextUsbWWID (
788 IN OUT POOL_PRINT
*Str
,
790 IN BOOLEAN DisplayOnly
,
791 IN BOOLEAN AllowShortcuts
794 USB_WWID_DEVICE_PATH
*UsbWWId
;
795 CHAR16
*SerialNumberStr
;
801 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
802 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
803 if (SerialNumberStr
[Length
- 1] != 0) {
805 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
807 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
808 ASSERT (NewStr
!= NULL
);
810 SerialNumberStr
= NewStr
;
815 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
818 UsbWWId
->InterfaceNumber
,
824 Converts a Logic Unit device path structure to its string representative.
826 @param Str The string representative of input device.
827 @param DevPath The input device path structure.
828 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
829 of the display node is used, where applicable. If DisplayOnly
830 is FALSE, then the longer text representation of the display node
832 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
833 representation for a device node can be used, where applicable.
837 DevPathToTextLogicalUnit (
838 IN OUT POOL_PRINT
*Str
,
840 IN BOOLEAN DisplayOnly
,
841 IN BOOLEAN AllowShortcuts
844 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
846 LogicalUnit
= DevPath
;
847 CatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
851 Converts a USB class device path structure to its string representative.
853 @param Str The string representative of input device.
854 @param DevPath The input device path structure.
855 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
856 of the display node is used, where applicable. If DisplayOnly
857 is FALSE, then the longer text representation of the display node
859 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
860 representation for a device node can be used, where applicable.
864 DevPathToTextUsbClass (
865 IN OUT POOL_PRINT
*Str
,
867 IN BOOLEAN DisplayOnly
,
868 IN BOOLEAN AllowShortcuts
871 USB_CLASS_DEVICE_PATH
*UsbClass
;
872 BOOLEAN IsKnownSubClass
;
877 IsKnownSubClass
= TRUE
;
878 switch (UsbClass
->DeviceClass
) {
879 case USB_CLASS_AUDIO
:
880 CatPrint (Str
, L
"UsbAudio");
883 case USB_CLASS_CDCCONTROL
:
884 CatPrint (Str
, L
"UsbCDCControl");
888 CatPrint (Str
, L
"UsbHID");
891 case USB_CLASS_IMAGE
:
892 CatPrint (Str
, L
"UsbImage");
895 case USB_CLASS_PRINTER
:
896 CatPrint (Str
, L
"UsbPrinter");
899 case USB_CLASS_MASS_STORAGE
:
900 CatPrint (Str
, L
"UsbMassStorage");
904 CatPrint (Str
, L
"UsbHub");
907 case USB_CLASS_CDCDATA
:
908 CatPrint (Str
, L
"UsbCDCData");
911 case USB_CLASS_SMART_CARD
:
912 CatPrint (Str
, L
"UsbSmartCard");
915 case USB_CLASS_VIDEO
:
916 CatPrint (Str
, L
"UsbVideo");
919 case USB_CLASS_DIAGNOSTIC
:
920 CatPrint (Str
, L
"UsbDiagnostic");
923 case USB_CLASS_WIRELESS
:
924 CatPrint (Str
, L
"UsbWireless");
928 IsKnownSubClass
= FALSE
;
932 if (IsKnownSubClass
) {
935 L
"(0x%x,0x%x,0x%x,0x%x)",
938 UsbClass
->DeviceSubClass
,
939 UsbClass
->DeviceProtocol
944 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
945 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
948 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
951 UsbClass
->DeviceProtocol
954 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
957 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
960 UsbClass
->DeviceProtocol
963 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
966 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
969 UsbClass
->DeviceProtocol
977 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
980 UsbClass
->DeviceClass
,
981 UsbClass
->DeviceSubClass
,
982 UsbClass
->DeviceProtocol
987 Converts a SATA device path structure to its string representative.
989 @param Str The string representative of input device.
990 @param DevPath The input device path structure.
991 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
992 of the display node is used, where applicable. If DisplayOnly
993 is FALSE, then the longer text representation of the display node
995 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
996 representation for a device node can be used, where applicable.
1001 IN OUT POOL_PRINT
*Str
,
1003 IN BOOLEAN DisplayOnly
,
1004 IN BOOLEAN AllowShortcuts
1007 SATA_DEVICE_PATH
*Sata
;
1010 if ((Sata
->PortMultiplierPortNumber
& SATA_HBA_DIRECT_CONNECT_FLAG
) != 0) {
1014 Sata
->HBAPortNumber
,
1020 L
"Sata(0x%x,0x%x,0x%x)",
1021 Sata
->HBAPortNumber
,
1022 Sata
->PortMultiplierPortNumber
,
1029 Converts a I20 device path structure to its string representative.
1031 @param Str The string representative of input device.
1032 @param DevPath The input device path structure.
1033 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1034 of the display node is used, where applicable. If DisplayOnly
1035 is FALSE, then the longer text representation of the display node
1037 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1038 representation for a device node can be used, where applicable.
1043 IN OUT POOL_PRINT
*Str
,
1045 IN BOOLEAN DisplayOnly
,
1046 IN BOOLEAN AllowShortcuts
1049 I2O_DEVICE_PATH
*I2ODevPath
;
1051 I2ODevPath
= DevPath
;
1052 CatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1056 Converts a MAC address device path structure to its string representative.
1058 @param Str The string representative of input device.
1059 @param DevPath The input device path structure.
1060 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1061 of the display node is used, where applicable. If DisplayOnly
1062 is FALSE, then the longer text representation of the display node
1064 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1065 representation for a device node can be used, where applicable.
1069 DevPathToTextMacAddr (
1070 IN OUT POOL_PRINT
*Str
,
1072 IN BOOLEAN DisplayOnly
,
1073 IN BOOLEAN AllowShortcuts
1076 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1077 UINTN HwAddressSize
;
1080 MacDevPath
= DevPath
;
1082 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1083 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1087 CatPrint (Str
, L
"MAC(");
1089 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1090 CatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1093 CatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1097 Converts network protocol string to its text representation.
1099 @param Str The string representative of input device.
1100 @param Protocol The network protocol ID.
1104 CatNetworkProtocol (
1105 IN OUT POOL_PRINT
*Str
,
1109 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1110 CatPrint (Str
, L
"TCP");
1111 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1112 CatPrint (Str
, L
"UDP");
1114 CatPrint (Str
, L
"0x%x", Protocol
);
1119 Converts a IPv4 device path structure to its string representative.
1121 @param Str The string representative of input device.
1122 @param DevPath The input device path structure.
1123 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1124 of the display node is used, where applicable. If DisplayOnly
1125 is FALSE, then the longer text representation of the display node
1127 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1128 representation for a device node can be used, where applicable.
1133 IN OUT POOL_PRINT
*Str
,
1135 IN BOOLEAN DisplayOnly
,
1136 IN BOOLEAN AllowShortcuts
1139 IPv4_DEVICE_PATH
*IPDevPath
;
1141 IPDevPath
= DevPath
;
1145 L
"IPv4(%d.%d.%d.%d)",
1146 IPDevPath
->RemoteIpAddress
.Addr
[0],
1147 IPDevPath
->RemoteIpAddress
.Addr
[1],
1148 IPDevPath
->RemoteIpAddress
.Addr
[2],
1149 IPDevPath
->RemoteIpAddress
.Addr
[3]
1156 L
"IPv4(%d.%d.%d.%d,",
1157 IPDevPath
->RemoteIpAddress
.Addr
[0],
1158 IPDevPath
->RemoteIpAddress
.Addr
[1],
1159 IPDevPath
->RemoteIpAddress
.Addr
[2],
1160 IPDevPath
->RemoteIpAddress
.Addr
[3]
1163 CatNetworkProtocol (
1171 IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP",
1172 IPDevPath
->LocalIpAddress
.Addr
[0],
1173 IPDevPath
->LocalIpAddress
.Addr
[1],
1174 IPDevPath
->LocalIpAddress
.Addr
[2],
1175 IPDevPath
->LocalIpAddress
.Addr
[3]
1177 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1180 L
",%d.%d.%d.%d,%d.%d.%d.%d",
1181 IPDevPath
->GatewayIpAddress
.Addr
[0],
1182 IPDevPath
->GatewayIpAddress
.Addr
[1],
1183 IPDevPath
->GatewayIpAddress
.Addr
[2],
1184 IPDevPath
->GatewayIpAddress
.Addr
[3],
1185 IPDevPath
->SubnetMask
.Addr
[0],
1186 IPDevPath
->SubnetMask
.Addr
[1],
1187 IPDevPath
->SubnetMask
.Addr
[2],
1188 IPDevPath
->SubnetMask
.Addr
[3]
1191 CatPrint (Str
, L
")");
1195 Converts a IPv6 device path structure to its string representative.
1197 @param Str The string representative of input device.
1198 @param DevPath The input device path structure.
1199 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1200 of the display node is used, where applicable. If DisplayOnly
1201 is FALSE, then the longer text representation of the display node
1203 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1204 representation for a device node can be used, where applicable.
1209 IN OUT POOL_PRINT
*Str
,
1211 IN BOOLEAN DisplayOnly
,
1212 IN BOOLEAN AllowShortcuts
1215 IPv6_DEVICE_PATH
*IPDevPath
;
1217 IPDevPath
= DevPath
;
1221 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
1222 IPDevPath
->RemoteIpAddress
.Addr
[0],
1223 IPDevPath
->RemoteIpAddress
.Addr
[1],
1224 IPDevPath
->RemoteIpAddress
.Addr
[2],
1225 IPDevPath
->RemoteIpAddress
.Addr
[3],
1226 IPDevPath
->RemoteIpAddress
.Addr
[4],
1227 IPDevPath
->RemoteIpAddress
.Addr
[5],
1228 IPDevPath
->RemoteIpAddress
.Addr
[6],
1229 IPDevPath
->RemoteIpAddress
.Addr
[7],
1230 IPDevPath
->RemoteIpAddress
.Addr
[8],
1231 IPDevPath
->RemoteIpAddress
.Addr
[9],
1232 IPDevPath
->RemoteIpAddress
.Addr
[10],
1233 IPDevPath
->RemoteIpAddress
.Addr
[11],
1234 IPDevPath
->RemoteIpAddress
.Addr
[12],
1235 IPDevPath
->RemoteIpAddress
.Addr
[13],
1236 IPDevPath
->RemoteIpAddress
.Addr
[14],
1237 IPDevPath
->RemoteIpAddress
.Addr
[15]
1244 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,",
1245 IPDevPath
->RemoteIpAddress
.Addr
[0],
1246 IPDevPath
->RemoteIpAddress
.Addr
[1],
1247 IPDevPath
->RemoteIpAddress
.Addr
[2],
1248 IPDevPath
->RemoteIpAddress
.Addr
[3],
1249 IPDevPath
->RemoteIpAddress
.Addr
[4],
1250 IPDevPath
->RemoteIpAddress
.Addr
[5],
1251 IPDevPath
->RemoteIpAddress
.Addr
[6],
1252 IPDevPath
->RemoteIpAddress
.Addr
[7],
1253 IPDevPath
->RemoteIpAddress
.Addr
[8],
1254 IPDevPath
->RemoteIpAddress
.Addr
[9],
1255 IPDevPath
->RemoteIpAddress
.Addr
[10],
1256 IPDevPath
->RemoteIpAddress
.Addr
[11],
1257 IPDevPath
->RemoteIpAddress
.Addr
[12],
1258 IPDevPath
->RemoteIpAddress
.Addr
[13],
1259 IPDevPath
->RemoteIpAddress
.Addr
[14],
1260 IPDevPath
->RemoteIpAddress
.Addr
[15]
1263 CatNetworkProtocol (
1268 switch (IPDevPath
->IpAddressOrigin
) {
1270 CatPrint (Str
, L
",Static");
1273 CatPrint (Str
, L
",StatelessAutoConfigure");
1276 CatPrint (Str
, L
",StatefulAutoConfigure");
1282 L
",%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1283 IPDevPath
->LocalIpAddress
.Addr
[0],
1284 IPDevPath
->LocalIpAddress
.Addr
[1],
1285 IPDevPath
->LocalIpAddress
.Addr
[2],
1286 IPDevPath
->LocalIpAddress
.Addr
[3],
1287 IPDevPath
->LocalIpAddress
.Addr
[4],
1288 IPDevPath
->LocalIpAddress
.Addr
[5],
1289 IPDevPath
->LocalIpAddress
.Addr
[6],
1290 IPDevPath
->LocalIpAddress
.Addr
[7],
1291 IPDevPath
->LocalIpAddress
.Addr
[8],
1292 IPDevPath
->LocalIpAddress
.Addr
[9],
1293 IPDevPath
->LocalIpAddress
.Addr
[10],
1294 IPDevPath
->LocalIpAddress
.Addr
[11],
1295 IPDevPath
->LocalIpAddress
.Addr
[12],
1296 IPDevPath
->LocalIpAddress
.Addr
[13],
1297 IPDevPath
->LocalIpAddress
.Addr
[14],
1298 IPDevPath
->LocalIpAddress
.Addr
[15]
1301 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1304 L
",0x%x,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1305 IPDevPath
->PrefixLength
,
1306 IPDevPath
->GatewayIpAddress
.Addr
[0],
1307 IPDevPath
->GatewayIpAddress
.Addr
[1],
1308 IPDevPath
->GatewayIpAddress
.Addr
[2],
1309 IPDevPath
->GatewayIpAddress
.Addr
[3],
1310 IPDevPath
->GatewayIpAddress
.Addr
[4],
1311 IPDevPath
->GatewayIpAddress
.Addr
[5],
1312 IPDevPath
->GatewayIpAddress
.Addr
[6],
1313 IPDevPath
->GatewayIpAddress
.Addr
[7],
1314 IPDevPath
->GatewayIpAddress
.Addr
[8],
1315 IPDevPath
->GatewayIpAddress
.Addr
[9],
1316 IPDevPath
->GatewayIpAddress
.Addr
[10],
1317 IPDevPath
->GatewayIpAddress
.Addr
[11],
1318 IPDevPath
->GatewayIpAddress
.Addr
[12],
1319 IPDevPath
->GatewayIpAddress
.Addr
[13],
1320 IPDevPath
->GatewayIpAddress
.Addr
[14],
1321 IPDevPath
->GatewayIpAddress
.Addr
[15]
1324 CatPrint (Str
, L
")");
1328 Converts an Infini Band device path structure to its string representative.
1330 @param Str The string representative of input device.
1331 @param DevPath The input device path structure.
1332 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1333 of the display node is used, where applicable. If DisplayOnly
1334 is FALSE, then the longer text representation of the display node
1336 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1337 representation for a device node can be used, where applicable.
1341 DevPathToTextInfiniBand (
1342 IN OUT POOL_PRINT
*Str
,
1344 IN BOOLEAN DisplayOnly
,
1345 IN BOOLEAN AllowShortcuts
1348 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1350 InfiniBand
= DevPath
;
1353 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1354 InfiniBand
->ResourceFlags
,
1355 InfiniBand
->PortGid
,
1356 InfiniBand
->ServiceId
,
1357 InfiniBand
->TargetPortId
,
1358 InfiniBand
->DeviceId
1363 Converts a UART device path structure to its string representative.
1365 @param Str The string representative of input device.
1366 @param DevPath The input device path structure.
1367 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1368 of the display node is used, where applicable. If DisplayOnly
1369 is FALSE, then the longer text representation of the display node
1371 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1372 representation for a device node can be used, where applicable.
1377 IN OUT POOL_PRINT
*Str
,
1379 IN BOOLEAN DisplayOnly
,
1380 IN BOOLEAN AllowShortcuts
1383 UART_DEVICE_PATH
*Uart
;
1387 switch (Uart
->Parity
) {
1417 if (Uart
->BaudRate
== 0) {
1418 CatPrint (Str
, L
"Uart(DEFAULT,");
1420 CatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1423 if (Uart
->DataBits
== 0) {
1424 CatPrint (Str
, L
"DEFAULT,");
1426 CatPrint (Str
, L
"%d,", Uart
->DataBits
);
1429 CatPrint (Str
, L
"%c,", Parity
);
1431 switch (Uart
->StopBits
) {
1433 CatPrint (Str
, L
"D)");
1437 CatPrint (Str
, L
"1)");
1441 CatPrint (Str
, L
"1.5)");
1445 CatPrint (Str
, L
"2)");
1449 CatPrint (Str
, L
"x)");
1455 Converts an iSCSI device path structure to its string representative.
1457 @param Str The string representative of input device.
1458 @param DevPath The input device path structure.
1459 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1460 of the display node is used, where applicable. If DisplayOnly
1461 is FALSE, then the longer text representation of the display node
1463 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1464 representation for a device node can be used, where applicable.
1468 DevPathToTextiSCSI (
1469 IN OUT POOL_PRINT
*Str
,
1471 IN BOOLEAN DisplayOnly
,
1472 IN BOOLEAN AllowShortcuts
1475 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1478 ISCSIDevPath
= DevPath
;
1481 L
"iSCSI(%a,0x%x,0x%lx,",
1482 ISCSIDevPath
->TargetName
,
1483 ISCSIDevPath
->TargetPortalGroupTag
,
1487 Options
= ISCSIDevPath
->LoginOption
;
1488 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1489 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1490 if (((Options
>> 11) & 0x0001) != 0) {
1491 CatPrint (Str
, L
"%s,", L
"None");
1492 } else if (((Options
>> 12) & 0x0001) != 0) {
1493 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1495 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
1499 CatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1503 Converts a VLAN device path structure to its string representative.
1505 @param Str The string representative of input device.
1506 @param DevPath The input device path structure.
1507 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1508 of the display node is used, where applicable. If DisplayOnly
1509 is FALSE, then the longer text representation of the display node
1511 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1512 representation for a device node can be used, where applicable.
1517 IN OUT POOL_PRINT
*Str
,
1519 IN BOOLEAN DisplayOnly
,
1520 IN BOOLEAN AllowShortcuts
1523 VLAN_DEVICE_PATH
*Vlan
;
1526 CatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1530 Converts a Hard drive device path structure to its string representative.
1532 @param Str The string representative of input device.
1533 @param DevPath The input device path structure.
1534 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1535 of the display node is used, where applicable. If DisplayOnly
1536 is FALSE, then the longer text representation of the display node
1538 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1539 representation for a device node can be used, where applicable.
1543 DevPathToTextHardDrive (
1544 IN OUT POOL_PRINT
*Str
,
1546 IN BOOLEAN DisplayOnly
,
1547 IN BOOLEAN AllowShortcuts
1550 HARDDRIVE_DEVICE_PATH
*Hd
;
1553 switch (Hd
->SignatureType
) {
1554 case SIGNATURE_TYPE_MBR
:
1557 L
"HD(%d,%s,0x%08x,",
1558 Hd
->PartitionNumber
,
1560 *((UINT32
*) (&(Hd
->Signature
[0])))
1564 case SIGNATURE_TYPE_GUID
:
1568 Hd
->PartitionNumber
,
1570 (EFI_GUID
*) &(Hd
->Signature
[0])
1578 Hd
->PartitionNumber
,
1584 CatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1588 Converts a CDROM device path structure to its string representative.
1590 @param Str The string representative of input device.
1591 @param DevPath The input device path structure.
1592 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1593 of the display node is used, where applicable. If DisplayOnly
1594 is FALSE, then the longer text representation of the display node
1596 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1597 representation for a device node can be used, where applicable.
1601 DevPathToTextCDROM (
1602 IN OUT POOL_PRINT
*Str
,
1604 IN BOOLEAN DisplayOnly
,
1605 IN BOOLEAN AllowShortcuts
1608 CDROM_DEVICE_PATH
*Cd
;
1612 CatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1616 CatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1620 Converts a File device path structure to its string representative.
1622 @param Str The string representative of input device.
1623 @param DevPath The input device path structure.
1624 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1625 of the display node is used, where applicable. If DisplayOnly
1626 is FALSE, then the longer text representation of the display node
1628 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1629 representation for a device node can be used, where applicable.
1633 DevPathToTextFilePath (
1634 IN OUT POOL_PRINT
*Str
,
1636 IN BOOLEAN DisplayOnly
,
1637 IN BOOLEAN AllowShortcuts
1640 FILEPATH_DEVICE_PATH
*Fp
;
1643 CatPrint (Str
, L
"%s", Fp
->PathName
);
1647 Converts a Media protocol device path structure to its string representative.
1649 @param Str The string representative of input device.
1650 @param DevPath The input device path structure.
1651 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1652 of the display node is used, where applicable. If DisplayOnly
1653 is FALSE, then the longer text representation of the display node
1655 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1656 representation for a device node can be used, where applicable.
1660 DevPathToTextMediaProtocol (
1661 IN OUT POOL_PRINT
*Str
,
1663 IN BOOLEAN DisplayOnly
,
1664 IN BOOLEAN AllowShortcuts
1667 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1669 MediaProt
= DevPath
;
1670 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1674 Converts a Firmware Volume device path structure to its string representative.
1676 @param Str The string representative of input device.
1677 @param DevPath The input device path structure.
1678 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1679 of the display node is used, where applicable. If DisplayOnly
1680 is FALSE, then the longer text representation of the display node
1682 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1683 representation for a device node can be used, where applicable.
1688 IN OUT POOL_PRINT
*Str
,
1690 IN BOOLEAN DisplayOnly
,
1691 IN BOOLEAN AllowShortcuts
1694 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1697 CatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1701 Converts a Firmware Volume File device path structure to its string representative.
1703 @param Str The string representative 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 DevPathToTextFvFile (
1715 IN OUT POOL_PRINT
*Str
,
1717 IN BOOLEAN DisplayOnly
,
1718 IN BOOLEAN AllowShortcuts
1721 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1724 CatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1728 Converts a Relative Offset device path structure to its string representative.
1730 @param Str The string representative of input device.
1731 @param DevPath The input device path structure.
1732 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1733 of the display node is used, where applicable. If DisplayOnly
1734 is FALSE, then the longer text representation of the display node
1736 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1737 representation for a device node can be used, where applicable.
1741 DevPathRelativeOffsetRange (
1742 IN OUT POOL_PRINT
*Str
,
1744 IN BOOLEAN DisplayOnly
,
1745 IN BOOLEAN AllowShortcuts
1748 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1753 L
"Offset(0x%lx,0x%lx)",
1754 Offset
->StartingOffset
,
1755 Offset
->EndingOffset
1760 Converts a BIOS Boot Specification device path structure to its string representative.
1762 @param Str The string representative of input device.
1763 @param DevPath The input device path structure.
1764 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1765 of the display node is used, where applicable. If DisplayOnly
1766 is FALSE, then the longer text representation of the display node
1768 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1769 representation for a device node can be used, where applicable.
1774 IN OUT POOL_PRINT
*Str
,
1776 IN BOOLEAN DisplayOnly
,
1777 IN BOOLEAN AllowShortcuts
1780 BBS_BBS_DEVICE_PATH
*Bbs
;
1784 switch (Bbs
->DeviceType
) {
1785 case BBS_TYPE_FLOPPY
:
1789 case BBS_TYPE_HARDDRIVE
:
1793 case BBS_TYPE_CDROM
:
1797 case BBS_TYPE_PCMCIA
:
1805 case BBS_TYPE_EMBEDDED_NETWORK
:
1815 CatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1817 CatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
1821 CatPrint (Str
, L
")");
1825 CatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
1829 Converts an End-of-Device-Path structure to its string representative.
1831 @param Str The string representative of input device.
1832 @param DevPath The input device path structure.
1833 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1834 of the display node is used, where applicable. If DisplayOnly
1835 is FALSE, then the longer text representation of the display node
1837 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1838 representation for a device node can be used, where applicable.
1842 DevPathToTextEndInstance (
1843 IN OUT POOL_PRINT
*Str
,
1845 IN BOOLEAN DisplayOnly
,
1846 IN BOOLEAN AllowShortcuts
1849 CatPrint (Str
, L
",");
1853 Converts an unknown device path structure to its string representative.
1855 @param Str The string representative of input device.
1856 @param DevPath The input device path structure.
1857 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1858 of the display node is used, where applicable. If DisplayOnly
1859 is FALSE, then the longer text representation of the display node
1861 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1862 representation for a device node can be used, where applicable.
1866 DevPathToTextNodeUnknown (
1867 IN OUT POOL_PRINT
*Str
,
1869 IN BOOLEAN DisplayOnly
,
1870 IN BOOLEAN AllowShortcuts
1873 CatPrint (Str
, L
"?");
1876 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
[] = {
1877 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
1878 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
1879 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
1880 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
1881 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
1882 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
1883 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
1884 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
1885 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
1886 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
1887 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
1888 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
1889 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
1890 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
1891 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
1892 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
1893 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
1894 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
1895 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
1896 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
1897 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
1898 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
1899 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
1900 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
1901 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
1902 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
1903 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
1904 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
1905 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
1906 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
1907 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
1908 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
1909 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1910 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
1911 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
1912 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
1913 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
1914 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
1919 Converts a device node to its string representation.
1921 @param DeviceNode A Pointer to the device node to be converted.
1922 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1923 of the display node is used, where applicable. If DisplayOnly
1924 is FALSE, then the longer text representation of the display node
1926 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1927 representation for a device node can be used, where applicable.
1929 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
1930 is NULL or there was insufficient memory.
1935 ConvertDeviceNodeToText (
1936 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
1937 IN BOOLEAN DisplayOnly
,
1938 IN BOOLEAN AllowShortcuts
1943 VOID (*DumpNode
)(POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1945 if (DeviceNode
== NULL
) {
1949 ZeroMem (&Str
, sizeof (Str
));
1952 // Process the device path node
1955 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
++) {
1956 if (DevicePathType (DeviceNode
) == DevPathToTextTable
[Index
].Type
&&
1957 DevicePathSubType (DeviceNode
) == DevPathToTextTable
[Index
].SubType
1959 DumpNode
= DevPathToTextTable
[Index
].Function
;
1964 // If not found, use a generic function
1966 if (DumpNode
== NULL
) {
1967 DumpNode
= DevPathToTextNodeUnknown
;
1973 DumpNode (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
1975 ASSERT (Str
.Str
!= NULL
);
1980 Converts a device path to its text representation.
1982 @param DevicePath A Pointer to the device to be converted.
1983 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1984 of the display node is used, where applicable. If DisplayOnly
1985 is FALSE, then the longer text representation of the display node
1987 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1988 representation for a device node can be used, where applicable.
1990 @return A pointer to the allocated text representation of the device path or
1991 NULL if DeviceNode is NULL or there was insufficient memory.
1996 ConvertDevicePathToText (
1997 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
1998 IN BOOLEAN DisplayOnly
,
1999 IN BOOLEAN AllowShortcuts
2003 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
2004 EFI_DEVICE_PATH_PROTOCOL
*AlignedDevPathNode
;
2006 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
2008 if (DevicePath
== NULL
) {
2012 ZeroMem (&Str
, sizeof (Str
));
2015 // Process each device path node
2017 DevPathNode
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
2018 while (!IsDevicePathEnd (DevPathNode
)) {
2020 // Find the handler to dump this device path node
2023 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
2025 if (DevicePathType (DevPathNode
) == DevPathToTextTable
[Index
].Type
&&
2026 DevicePathSubType (DevPathNode
) == DevPathToTextTable
[Index
].SubType
2028 DumpNode
= DevPathToTextTable
[Index
].Function
;
2033 // If not found, use a generic function
2036 DumpNode
= DevPathToTextNodeUnknown
;
2039 // Put a path separator in if needed
2041 if ((Str
.Length
!= 0) && (DumpNode
!= DevPathToTextEndInstance
)) {
2042 if (*(Str
.Str
+ Str
.Length
/ sizeof (CHAR16
) - 1) != L
',') {
2043 CatPrint (&Str
, L
"/");
2047 AlignedDevPathNode
= AllocateCopyPool (DevicePathNodeLength (DevPathNode
), DevPathNode
);
2049 // Print this node of the device path
2051 DumpNode (&Str
, AlignedDevPathNode
, DisplayOnly
, AllowShortcuts
);
2052 FreePool (AlignedDevPathNode
);
2055 // Next device path node
2057 DevPathNode
= NextDevicePathNode (DevPathNode
);
2060 if (Str
.Str
== NULL
) {
2061 return AllocateZeroPool (sizeof (CHAR16
));