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 1394 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 F1394_DEVICE_PATH
*F1394DevPath
;
679 F1394DevPath
= DevPath
;
681 // Guid has format of IEEE-EUI64
683 CatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
687 Converts a USB device path structure to its string representative.
689 @param Str The string representative of input device.
690 @param DevPath The input device path structure.
691 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
692 of the display node is used, where applicable. If DisplayOnly
693 is FALSE, then the longer text representation of the display node
695 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
696 representation for a device node can be used, where applicable.
701 IN OUT POOL_PRINT
*Str
,
703 IN BOOLEAN DisplayOnly
,
704 IN BOOLEAN AllowShortcuts
707 USB_DEVICE_PATH
*Usb
;
710 CatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
714 Converts a USB WWID device path structure to its string representative.
716 @param Str The string representative of input device.
717 @param DevPath The input device path structure.
718 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
719 of the display node is used, where applicable. If DisplayOnly
720 is FALSE, then the longer text representation of the display node
722 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
723 representation for a device node can be used, where applicable.
727 DevPathToTextUsbWWID (
728 IN OUT POOL_PRINT
*Str
,
730 IN BOOLEAN DisplayOnly
,
731 IN BOOLEAN AllowShortcuts
734 USB_WWID_DEVICE_PATH
*UsbWWId
;
735 CHAR16
*SerialNumberStr
;
741 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
742 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
743 if (SerialNumberStr
[Length
- 1] != 0) {
745 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
747 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
748 ASSERT (NewStr
!= NULL
);
750 SerialNumberStr
= NewStr
;
755 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
758 UsbWWId
->InterfaceNumber
,
764 Converts a Logic Unit device path structure to its string representative.
766 @param Str The string representative of input device.
767 @param DevPath The input device path structure.
768 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
769 of the display node is used, where applicable. If DisplayOnly
770 is FALSE, then the longer text representation of the display node
772 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
773 representation for a device node can be used, where applicable.
777 DevPathToTextLogicalUnit (
778 IN OUT POOL_PRINT
*Str
,
780 IN BOOLEAN DisplayOnly
,
781 IN BOOLEAN AllowShortcuts
784 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
786 LogicalUnit
= DevPath
;
787 CatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
791 Converts a USB class device path structure to its string representative.
793 @param Str The string representative of input device.
794 @param DevPath The input device path structure.
795 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
796 of the display node is used, where applicable. If DisplayOnly
797 is FALSE, then the longer text representation of the display node
799 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
800 representation for a device node can be used, where applicable.
804 DevPathToTextUsbClass (
805 IN OUT POOL_PRINT
*Str
,
807 IN BOOLEAN DisplayOnly
,
808 IN BOOLEAN AllowShortcuts
811 USB_CLASS_DEVICE_PATH
*UsbClass
;
812 BOOLEAN IsKnownSubClass
;
817 IsKnownSubClass
= TRUE
;
818 switch (UsbClass
->DeviceClass
) {
819 case USB_CLASS_AUDIO
:
820 CatPrint (Str
, L
"UsbAudio");
823 case USB_CLASS_CDCCONTROL
:
824 CatPrint (Str
, L
"UsbCDCControl");
828 CatPrint (Str
, L
"UsbHID");
831 case USB_CLASS_IMAGE
:
832 CatPrint (Str
, L
"UsbImage");
835 case USB_CLASS_PRINTER
:
836 CatPrint (Str
, L
"UsbPrinter");
839 case USB_CLASS_MASS_STORAGE
:
840 CatPrint (Str
, L
"UsbMassStorage");
844 CatPrint (Str
, L
"UsbHub");
847 case USB_CLASS_CDCDATA
:
848 CatPrint (Str
, L
"UsbCDCData");
851 case USB_CLASS_SMART_CARD
:
852 CatPrint (Str
, L
"UsbSmartCard");
855 case USB_CLASS_VIDEO
:
856 CatPrint (Str
, L
"UsbVideo");
859 case USB_CLASS_DIAGNOSTIC
:
860 CatPrint (Str
, L
"UsbDiagnostic");
863 case USB_CLASS_WIRELESS
:
864 CatPrint (Str
, L
"UsbWireless");
868 IsKnownSubClass
= FALSE
;
872 if (IsKnownSubClass
) {
875 L
"(0x%x,0x%x,0x%x,0x%x)",
878 UsbClass
->DeviceSubClass
,
879 UsbClass
->DeviceProtocol
884 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
885 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
888 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
891 UsbClass
->DeviceProtocol
894 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
897 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
900 UsbClass
->DeviceProtocol
903 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
906 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
909 UsbClass
->DeviceProtocol
917 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
920 UsbClass
->DeviceClass
,
921 UsbClass
->DeviceSubClass
,
922 UsbClass
->DeviceProtocol
927 Converts a SATA device path structure to its string representative.
929 @param Str The string representative of input device.
930 @param DevPath The input device path structure.
931 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
932 of the display node is used, where applicable. If DisplayOnly
933 is FALSE, then the longer text representation of the display node
935 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
936 representation for a device node can be used, where applicable.
941 IN OUT POOL_PRINT
*Str
,
943 IN BOOLEAN DisplayOnly
,
944 IN BOOLEAN AllowShortcuts
947 SATA_DEVICE_PATH
*Sata
;
950 if ((Sata
->PortMultiplierPortNumber
& SATA_HBA_DIRECT_CONNECT_FLAG
) != 0) {
960 L
"Sata(0x%x,0x%x,0x%x)",
962 Sata
->PortMultiplierPortNumber
,
969 Converts a I20 device path structure to its string representative.
971 @param Str The string representative of input device.
972 @param DevPath The input device path structure.
973 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
974 of the display node is used, where applicable. If DisplayOnly
975 is FALSE, then the longer text representation of the display node
977 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
978 representation for a device node can be used, where applicable.
983 IN OUT POOL_PRINT
*Str
,
985 IN BOOLEAN DisplayOnly
,
986 IN BOOLEAN AllowShortcuts
989 I2O_DEVICE_PATH
*I2ODevPath
;
991 I2ODevPath
= DevPath
;
992 CatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
996 Converts a MAC address device path structure to its string representative.
998 @param Str The string representative of input device.
999 @param DevPath The input device path structure.
1000 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1001 of the display node is used, where applicable. If DisplayOnly
1002 is FALSE, then the longer text representation of the display node
1004 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1005 representation for a device node can be used, where applicable.
1009 DevPathToTextMacAddr (
1010 IN OUT POOL_PRINT
*Str
,
1012 IN BOOLEAN DisplayOnly
,
1013 IN BOOLEAN AllowShortcuts
1016 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1017 UINTN HwAddressSize
;
1020 MacDevPath
= DevPath
;
1022 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1023 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1027 CatPrint (Str
, L
"MAC(");
1029 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1030 CatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1033 CatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1037 Converts network protocol string to its text representation.
1039 @param Str The string representative of input device.
1040 @param Protocol The network protocol ID.
1044 CatNetworkProtocol (
1045 IN OUT POOL_PRINT
*Str
,
1049 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1050 CatPrint (Str
, L
"TCP");
1051 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1052 CatPrint (Str
, L
"UDP");
1054 CatPrint (Str
, L
"0x%x", Protocol
);
1059 Converts a IPv4 device path structure to its string representative.
1061 @param Str The string representative of input device.
1062 @param DevPath The input device path structure.
1063 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1064 of the display node is used, where applicable. If DisplayOnly
1065 is FALSE, then the longer text representation of the display node
1067 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1068 representation for a device node can be used, where applicable.
1073 IN OUT POOL_PRINT
*Str
,
1075 IN BOOLEAN DisplayOnly
,
1076 IN BOOLEAN AllowShortcuts
1079 IPv4_DEVICE_PATH
*IPDevPath
;
1081 IPDevPath
= DevPath
;
1085 L
"IPv4(%d.%d.%d.%d)",
1086 IPDevPath
->RemoteIpAddress
.Addr
[0],
1087 IPDevPath
->RemoteIpAddress
.Addr
[1],
1088 IPDevPath
->RemoteIpAddress
.Addr
[2],
1089 IPDevPath
->RemoteIpAddress
.Addr
[3]
1096 L
"IPv4(%d.%d.%d.%d,",
1097 IPDevPath
->RemoteIpAddress
.Addr
[0],
1098 IPDevPath
->RemoteIpAddress
.Addr
[1],
1099 IPDevPath
->RemoteIpAddress
.Addr
[2],
1100 IPDevPath
->RemoteIpAddress
.Addr
[3]
1103 CatNetworkProtocol (
1111 IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP",
1112 IPDevPath
->LocalIpAddress
.Addr
[0],
1113 IPDevPath
->LocalIpAddress
.Addr
[1],
1114 IPDevPath
->LocalIpAddress
.Addr
[2],
1115 IPDevPath
->LocalIpAddress
.Addr
[3]
1117 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1120 L
",%d.%d.%d.%d,%d.%d.%d.%d",
1121 IPDevPath
->GatewayIpAddress
.Addr
[0],
1122 IPDevPath
->GatewayIpAddress
.Addr
[1],
1123 IPDevPath
->GatewayIpAddress
.Addr
[2],
1124 IPDevPath
->GatewayIpAddress
.Addr
[3],
1125 IPDevPath
->SubnetMask
.Addr
[0],
1126 IPDevPath
->SubnetMask
.Addr
[1],
1127 IPDevPath
->SubnetMask
.Addr
[2],
1128 IPDevPath
->SubnetMask
.Addr
[3]
1131 CatPrint (Str
, L
")");
1135 Converts a IPv6 device path structure to its string representative.
1137 @param Str The string representative of input device.
1138 @param DevPath The input device path structure.
1139 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1140 of the display node is used, where applicable. If DisplayOnly
1141 is FALSE, then the longer text representation of the display node
1143 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1144 representation for a device node can be used, where applicable.
1149 IN OUT POOL_PRINT
*Str
,
1151 IN BOOLEAN DisplayOnly
,
1152 IN BOOLEAN AllowShortcuts
1155 IPv6_DEVICE_PATH
*IPDevPath
;
1157 IPDevPath
= DevPath
;
1161 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
1162 IPDevPath
->RemoteIpAddress
.Addr
[0],
1163 IPDevPath
->RemoteIpAddress
.Addr
[1],
1164 IPDevPath
->RemoteIpAddress
.Addr
[2],
1165 IPDevPath
->RemoteIpAddress
.Addr
[3],
1166 IPDevPath
->RemoteIpAddress
.Addr
[4],
1167 IPDevPath
->RemoteIpAddress
.Addr
[5],
1168 IPDevPath
->RemoteIpAddress
.Addr
[6],
1169 IPDevPath
->RemoteIpAddress
.Addr
[7],
1170 IPDevPath
->RemoteIpAddress
.Addr
[8],
1171 IPDevPath
->RemoteIpAddress
.Addr
[9],
1172 IPDevPath
->RemoteIpAddress
.Addr
[10],
1173 IPDevPath
->RemoteIpAddress
.Addr
[11],
1174 IPDevPath
->RemoteIpAddress
.Addr
[12],
1175 IPDevPath
->RemoteIpAddress
.Addr
[13],
1176 IPDevPath
->RemoteIpAddress
.Addr
[14],
1177 IPDevPath
->RemoteIpAddress
.Addr
[15]
1184 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,",
1185 IPDevPath
->RemoteIpAddress
.Addr
[0],
1186 IPDevPath
->RemoteIpAddress
.Addr
[1],
1187 IPDevPath
->RemoteIpAddress
.Addr
[2],
1188 IPDevPath
->RemoteIpAddress
.Addr
[3],
1189 IPDevPath
->RemoteIpAddress
.Addr
[4],
1190 IPDevPath
->RemoteIpAddress
.Addr
[5],
1191 IPDevPath
->RemoteIpAddress
.Addr
[6],
1192 IPDevPath
->RemoteIpAddress
.Addr
[7],
1193 IPDevPath
->RemoteIpAddress
.Addr
[8],
1194 IPDevPath
->RemoteIpAddress
.Addr
[9],
1195 IPDevPath
->RemoteIpAddress
.Addr
[10],
1196 IPDevPath
->RemoteIpAddress
.Addr
[11],
1197 IPDevPath
->RemoteIpAddress
.Addr
[12],
1198 IPDevPath
->RemoteIpAddress
.Addr
[13],
1199 IPDevPath
->RemoteIpAddress
.Addr
[14],
1200 IPDevPath
->RemoteIpAddress
.Addr
[15]
1203 CatNetworkProtocol (
1210 L
",%s,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
1211 IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP",
1212 IPDevPath
->LocalIpAddress
.Addr
[0],
1213 IPDevPath
->LocalIpAddress
.Addr
[1],
1214 IPDevPath
->LocalIpAddress
.Addr
[2],
1215 IPDevPath
->LocalIpAddress
.Addr
[3],
1216 IPDevPath
->LocalIpAddress
.Addr
[4],
1217 IPDevPath
->LocalIpAddress
.Addr
[5],
1218 IPDevPath
->LocalIpAddress
.Addr
[6],
1219 IPDevPath
->LocalIpAddress
.Addr
[7],
1220 IPDevPath
->LocalIpAddress
.Addr
[8],
1221 IPDevPath
->LocalIpAddress
.Addr
[9],
1222 IPDevPath
->LocalIpAddress
.Addr
[10],
1223 IPDevPath
->LocalIpAddress
.Addr
[11],
1224 IPDevPath
->LocalIpAddress
.Addr
[12],
1225 IPDevPath
->LocalIpAddress
.Addr
[13],
1226 IPDevPath
->LocalIpAddress
.Addr
[14],
1227 IPDevPath
->LocalIpAddress
.Addr
[15]
1232 Converts an Infini Band device path structure to its string representative.
1234 @param Str The string representative of input device.
1235 @param DevPath The input device path structure.
1236 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1237 of the display node is used, where applicable. If DisplayOnly
1238 is FALSE, then the longer text representation of the display node
1240 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1241 representation for a device node can be used, where applicable.
1245 DevPathToTextInfiniBand (
1246 IN OUT POOL_PRINT
*Str
,
1248 IN BOOLEAN DisplayOnly
,
1249 IN BOOLEAN AllowShortcuts
1252 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1254 InfiniBand
= DevPath
;
1257 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1258 InfiniBand
->ResourceFlags
,
1259 InfiniBand
->PortGid
,
1260 InfiniBand
->ServiceId
,
1261 InfiniBand
->TargetPortId
,
1262 InfiniBand
->DeviceId
1267 Converts a UART device path structure to its string representative.
1269 @param Str The string representative of input device.
1270 @param DevPath The input device path structure.
1271 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1272 of the display node is used, where applicable. If DisplayOnly
1273 is FALSE, then the longer text representation of the display node
1275 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1276 representation for a device node can be used, where applicable.
1281 IN OUT POOL_PRINT
*Str
,
1283 IN BOOLEAN DisplayOnly
,
1284 IN BOOLEAN AllowShortcuts
1287 UART_DEVICE_PATH
*Uart
;
1291 switch (Uart
->Parity
) {
1321 if (Uart
->BaudRate
== 0) {
1322 CatPrint (Str
, L
"Uart(DEFAULT,");
1324 CatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1327 if (Uart
->DataBits
== 0) {
1328 CatPrint (Str
, L
"DEFAULT,");
1330 CatPrint (Str
, L
"%d,", Uart
->DataBits
);
1333 CatPrint (Str
, L
"%c,", Parity
);
1335 switch (Uart
->StopBits
) {
1337 CatPrint (Str
, L
"D)");
1341 CatPrint (Str
, L
"1)");
1345 CatPrint (Str
, L
"1.5)");
1349 CatPrint (Str
, L
"2)");
1353 CatPrint (Str
, L
"x)");
1359 Converts an iSCSI device path structure to its string representative.
1361 @param Str The string representative of input device.
1362 @param DevPath The input device path structure.
1363 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1364 of the display node is used, where applicable. If DisplayOnly
1365 is FALSE, then the longer text representation of the display node
1367 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1368 representation for a device node can be used, where applicable.
1372 DevPathToTextiSCSI (
1373 IN OUT POOL_PRINT
*Str
,
1375 IN BOOLEAN DisplayOnly
,
1376 IN BOOLEAN AllowShortcuts
1379 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1382 ISCSIDevPath
= DevPath
;
1385 L
"iSCSI(%a,0x%x,0x%lx,",
1386 ISCSIDevPath
->TargetName
,
1387 ISCSIDevPath
->TargetPortalGroupTag
,
1391 Options
= ISCSIDevPath
->LoginOption
;
1392 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1393 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1394 if (((Options
>> 11) & 0x0001) != 0) {
1395 CatPrint (Str
, L
"%s,", L
"None");
1396 } else if (((Options
>> 12) & 0x0001) != 0) {
1397 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1399 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
1403 CatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1407 Converts a VLAN device path structure to its string representative.
1409 @param Str The string representative of input device.
1410 @param DevPath The input device path structure.
1411 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1412 of the display node is used, where applicable. If DisplayOnly
1413 is FALSE, then the longer text representation of the display node
1415 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1416 representation for a device node can be used, where applicable.
1421 IN OUT POOL_PRINT
*Str
,
1423 IN BOOLEAN DisplayOnly
,
1424 IN BOOLEAN AllowShortcuts
1427 VLAN_DEVICE_PATH
*Vlan
;
1430 CatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1434 Converts a Hard drive device path structure to its string representative.
1436 @param Str The string representative of input device.
1437 @param DevPath The input device path structure.
1438 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1439 of the display node is used, where applicable. If DisplayOnly
1440 is FALSE, then the longer text representation of the display node
1442 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1443 representation for a device node can be used, where applicable.
1447 DevPathToTextHardDrive (
1448 IN OUT POOL_PRINT
*Str
,
1450 IN BOOLEAN DisplayOnly
,
1451 IN BOOLEAN AllowShortcuts
1454 HARDDRIVE_DEVICE_PATH
*Hd
;
1457 switch (Hd
->SignatureType
) {
1458 case SIGNATURE_TYPE_MBR
:
1461 L
"HD(%d,%s,0x%08x,",
1462 Hd
->PartitionNumber
,
1464 *((UINT32
*) (&(Hd
->Signature
[0])))
1468 case SIGNATURE_TYPE_GUID
:
1472 Hd
->PartitionNumber
,
1474 (EFI_GUID
*) &(Hd
->Signature
[0])
1482 Hd
->PartitionNumber
,
1488 CatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1492 Converts a CDROM device path structure to its string representative.
1494 @param Str The string representative of input device.
1495 @param DevPath The input device path structure.
1496 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1497 of the display node is used, where applicable. If DisplayOnly
1498 is FALSE, then the longer text representation of the display node
1500 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1501 representation for a device node can be used, where applicable.
1505 DevPathToTextCDROM (
1506 IN OUT POOL_PRINT
*Str
,
1508 IN BOOLEAN DisplayOnly
,
1509 IN BOOLEAN AllowShortcuts
1512 CDROM_DEVICE_PATH
*Cd
;
1516 CatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1520 CatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1524 Converts a File device path structure to its string representative.
1526 @param Str The string representative of input device.
1527 @param DevPath The input device path structure.
1528 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1529 of the display node is used, where applicable. If DisplayOnly
1530 is FALSE, then the longer text representation of the display node
1532 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1533 representation for a device node can be used, where applicable.
1537 DevPathToTextFilePath (
1538 IN OUT POOL_PRINT
*Str
,
1540 IN BOOLEAN DisplayOnly
,
1541 IN BOOLEAN AllowShortcuts
1544 FILEPATH_DEVICE_PATH
*Fp
;
1547 CatPrint (Str
, L
"%s", Fp
->PathName
);
1551 Converts a Media protocol device path structure to its string representative.
1553 @param Str The string representative of input device.
1554 @param DevPath The input device path structure.
1555 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1556 of the display node is used, where applicable. If DisplayOnly
1557 is FALSE, then the longer text representation of the display node
1559 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1560 representation for a device node can be used, where applicable.
1564 DevPathToTextMediaProtocol (
1565 IN OUT POOL_PRINT
*Str
,
1567 IN BOOLEAN DisplayOnly
,
1568 IN BOOLEAN AllowShortcuts
1571 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1573 MediaProt
= DevPath
;
1574 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1578 Converts a Firmware Volume device path structure to its string representative.
1580 @param Str The string representative of input device.
1581 @param DevPath The input device path structure.
1582 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1583 of the display node is used, where applicable. If DisplayOnly
1584 is FALSE, then the longer text representation of the display node
1586 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1587 representation for a device node can be used, where applicable.
1592 IN OUT POOL_PRINT
*Str
,
1594 IN BOOLEAN DisplayOnly
,
1595 IN BOOLEAN AllowShortcuts
1598 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1601 CatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1605 Converts a Firmware Volume File device path structure to its string representative.
1607 @param Str The string representative of input device.
1608 @param DevPath The input device path structure.
1609 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1610 of the display node is used, where applicable. If DisplayOnly
1611 is FALSE, then the longer text representation of the display node
1613 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1614 representation for a device node can be used, where applicable.
1618 DevPathToTextFvFile (
1619 IN OUT POOL_PRINT
*Str
,
1621 IN BOOLEAN DisplayOnly
,
1622 IN BOOLEAN AllowShortcuts
1625 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1628 CatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1632 Converts a Relative Offset device path structure to its string representative.
1634 @param Str The string representative of input device.
1635 @param DevPath The input device path structure.
1636 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1637 of the display node is used, where applicable. If DisplayOnly
1638 is FALSE, then the longer text representation of the display node
1640 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1641 representation for a device node can be used, where applicable.
1645 DevPathRelativeOffsetRange (
1646 IN OUT POOL_PRINT
*Str
,
1648 IN BOOLEAN DisplayOnly
,
1649 IN BOOLEAN AllowShortcuts
1652 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1657 L
"Offset(0x%lx,0x%lx)",
1658 Offset
->StartingOffset
,
1659 Offset
->EndingOffset
1664 Converts a BIOS Boot Specification device path structure to its string representative.
1666 @param Str The string representative of input device.
1667 @param DevPath The input device path structure.
1668 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1669 of the display node is used, where applicable. If DisplayOnly
1670 is FALSE, then the longer text representation of the display node
1672 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1673 representation for a device node can be used, where applicable.
1678 IN OUT POOL_PRINT
*Str
,
1680 IN BOOLEAN DisplayOnly
,
1681 IN BOOLEAN AllowShortcuts
1684 BBS_BBS_DEVICE_PATH
*Bbs
;
1688 switch (Bbs
->DeviceType
) {
1689 case BBS_TYPE_FLOPPY
:
1693 case BBS_TYPE_HARDDRIVE
:
1697 case BBS_TYPE_CDROM
:
1701 case BBS_TYPE_PCMCIA
:
1709 case BBS_TYPE_EMBEDDED_NETWORK
:
1719 CatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1721 CatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
1725 CatPrint (Str
, L
")");
1729 CatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
1733 Converts an End-of-Device-Path structure to its string representative.
1735 @param Str The string representative of input device.
1736 @param DevPath The input device path structure.
1737 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1738 of the display node is used, where applicable. If DisplayOnly
1739 is FALSE, then the longer text representation of the display node
1741 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1742 representation for a device node can be used, where applicable.
1746 DevPathToTextEndInstance (
1747 IN OUT POOL_PRINT
*Str
,
1749 IN BOOLEAN DisplayOnly
,
1750 IN BOOLEAN AllowShortcuts
1753 CatPrint (Str
, L
",");
1757 Converts an unknown device path structure to its string representative.
1759 @param Str The string representative of input device.
1760 @param DevPath The input device path structure.
1761 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1762 of the display node is used, where applicable. If DisplayOnly
1763 is FALSE, then the longer text representation of the display node
1765 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1766 representation for a device node can be used, where applicable.
1770 DevPathToTextNodeUnknown (
1771 IN OUT POOL_PRINT
*Str
,
1773 IN BOOLEAN DisplayOnly
,
1774 IN BOOLEAN AllowShortcuts
1777 CatPrint (Str
, L
"?");
1780 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
[] = {
1781 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
1782 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
1783 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
1784 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
1785 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
1786 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
1787 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
1788 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
1789 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
1790 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
1791 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
1792 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
1793 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
1794 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
1795 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
1796 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
1797 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
1798 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
1799 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
1800 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
1801 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
1802 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
1803 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
1804 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
1805 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
1806 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
1807 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
1808 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
1809 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
1810 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
1811 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
1812 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1813 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
1814 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
1815 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
1816 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
1817 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
1822 Converts a device node to its string representation.
1824 @param DeviceNode A Pointer to the device node to be converted.
1825 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1826 of the display node is used, where applicable. If DisplayOnly
1827 is FALSE, then the longer text representation of the display node
1829 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1830 representation for a device node can be used, where applicable.
1832 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
1833 is NULL or there was insufficient memory.
1838 ConvertDeviceNodeToText (
1839 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
1840 IN BOOLEAN DisplayOnly
,
1841 IN BOOLEAN AllowShortcuts
1846 VOID (*DumpNode
)(POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1848 if (DeviceNode
== NULL
) {
1852 ZeroMem (&Str
, sizeof (Str
));
1855 // Process the device path node
1858 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
++) {
1859 if (DevicePathType (DeviceNode
) == DevPathToTextTable
[Index
].Type
&&
1860 DevicePathSubType (DeviceNode
) == DevPathToTextTable
[Index
].SubType
1862 DumpNode
= DevPathToTextTable
[Index
].Function
;
1867 // If not found, use a generic function
1869 if (DumpNode
== NULL
) {
1870 DumpNode
= DevPathToTextNodeUnknown
;
1876 DumpNode (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
1878 ASSERT (Str
.Str
!= NULL
);
1883 Converts a device path to its text representation.
1885 @param DevicePath A Pointer to the device to be converted.
1886 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1887 of the display node is used, where applicable. If DisplayOnly
1888 is FALSE, then the longer text representation of the display node
1890 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1891 representation for a device node can be used, where applicable.
1893 @return A pointer to the allocated text representation of the device path or
1894 NULL if DeviceNode is NULL or there was insufficient memory.
1899 ConvertDevicePathToText (
1900 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
1901 IN BOOLEAN DisplayOnly
,
1902 IN BOOLEAN AllowShortcuts
1906 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1907 EFI_DEVICE_PATH_PROTOCOL
*AlignedDevPathNode
;
1909 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1911 if (DevicePath
== NULL
) {
1915 ZeroMem (&Str
, sizeof (Str
));
1918 // Process each device path node
1920 DevPathNode
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
1921 while (!IsDevicePathEnd (DevPathNode
)) {
1923 // Find the handler to dump this device path node
1926 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
1928 if (DevicePathType (DevPathNode
) == DevPathToTextTable
[Index
].Type
&&
1929 DevicePathSubType (DevPathNode
) == DevPathToTextTable
[Index
].SubType
1931 DumpNode
= DevPathToTextTable
[Index
].Function
;
1936 // If not found, use a generic function
1939 DumpNode
= DevPathToTextNodeUnknown
;
1942 // Put a path separator in if needed
1944 if ((Str
.Length
!= 0) && (DumpNode
!= DevPathToTextEndInstance
)) {
1945 if (*(Str
.Str
+ Str
.Length
/ sizeof (CHAR16
) - 1) != L
',') {
1946 CatPrint (&Str
, L
"/");
1950 AlignedDevPathNode
= AllocateCopyPool (DevicePathNodeLength (DevPathNode
), DevPathNode
);
1952 // Print this node of the device path
1954 DumpNode (&Str
, AlignedDevPathNode
, DisplayOnly
, AllowShortcuts
);
1955 FreePool (AlignedDevPathNode
);
1958 // Next device path node
1960 DevPathNode
= NextDevicePathNode (DevPathNode
);
1963 if (Str
.Str
== NULL
) {
1964 return AllocateZeroPool (sizeof (CHAR16
));