2 DevicePathToText protocol as defined in the UEFI 2.0 specification.
4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "UefiDevicePathLib.h"
13 Concatenates a formatted unicode string to allocated pool. The caller must
14 free the resulting buffer.
16 @param Str Tracks the allocated pool, size in use, and
17 amount of pool allocated.
18 @param Fmt The format string
19 @param ... Variable arguments based on the format string.
21 @return Allocated buffer with the formatted string printed in it.
22 The caller must free the allocated buffer. The buffer
23 allocation is not packed.
28 UefiDevicePathLibCatPrint (
29 IN OUT POOL_PRINT
*Str
,
38 Count
= SPrintLength (Fmt
, Args
);
41 if ((Str
->Count
+ (Count
+ 1)) * sizeof (CHAR16
) > Str
->Capacity
) {
42 Str
->Capacity
= (Str
->Count
+ (Count
+ 1) * 2) * sizeof (CHAR16
);
43 Str
->Str
= ReallocatePool (
44 Str
->Count
* sizeof (CHAR16
),
48 ASSERT (Str
->Str
!= NULL
);
52 UnicodeVSPrint (&Str
->Str
[Str
->Count
], Str
->Capacity
- Str
->Count
* sizeof (CHAR16
), Fmt
, Args
);
60 Converts a PCI device path structure to its string representative.
62 @param Str The string representative of input device.
63 @param DevPath The input device path structure.
64 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
65 of the display node is used, where applicable. If DisplayOnly
66 is FALSE, then the longer text representation of the display node
68 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
69 representation for a device node can be used, where applicable.
74 IN OUT POOL_PRINT
*Str
,
76 IN BOOLEAN DisplayOnly
,
77 IN BOOLEAN AllowShortcuts
83 UefiDevicePathLibCatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
87 Converts a PC Card device path structure to its string representative.
89 @param Str The string representative of input device.
90 @param DevPath The input device path structure.
91 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
92 of the display node is used, where applicable. If DisplayOnly
93 is FALSE, then the longer text representation of the display node
95 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
96 representation for a device node can be used, where applicable.
100 DevPathToTextPccard (
101 IN OUT POOL_PRINT
*Str
,
103 IN BOOLEAN DisplayOnly
,
104 IN BOOLEAN AllowShortcuts
107 PCCARD_DEVICE_PATH
*Pccard
;
110 UefiDevicePathLibCatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
114 Converts a Memory Map device path structure to its string representative.
116 @param Str The string representative of input device.
117 @param DevPath The input device path structure.
118 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
119 of the display node is used, where applicable. If DisplayOnly
120 is FALSE, then the longer text representation of the display node
122 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
123 representation for a device node can be used, where applicable.
127 DevPathToTextMemMap (
128 IN OUT POOL_PRINT
*Str
,
130 IN BOOLEAN DisplayOnly
,
131 IN BOOLEAN AllowShortcuts
134 MEMMAP_DEVICE_PATH
*MemMap
;
137 UefiDevicePathLibCatPrint (
139 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
141 MemMap
->StartingAddress
,
142 MemMap
->EndingAddress
147 Converts a Vendor device path structure to its string representative.
149 @param Str The string representative of input device.
150 @param DevPath The input device path structure.
151 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
152 of the display node is used, where applicable. If DisplayOnly
153 is FALSE, then the longer text representation of the display node
155 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
156 representation for a device node can be used, where applicable.
160 DevPathToTextVendor (
161 IN OUT POOL_PRINT
*Str
,
163 IN BOOLEAN DisplayOnly
,
164 IN BOOLEAN AllowShortcuts
167 VENDOR_DEVICE_PATH
*Vendor
;
171 UINT32 FlowControlMap
;
174 Vendor
= (VENDOR_DEVICE_PATH
*)DevPath
;
175 switch (DevicePathType (&Vendor
->Header
)) {
176 case HARDWARE_DEVICE_PATH
:
180 case MESSAGING_DEVICE_PATH
:
182 if (AllowShortcuts
) {
183 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
184 UefiDevicePathLibCatPrint (Str
, L
"VenPcAnsi()");
186 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
187 UefiDevicePathLibCatPrint (Str
, L
"VenVt100()");
189 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
190 UefiDevicePathLibCatPrint (Str
, L
"VenVt100Plus()");
192 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
193 UefiDevicePathLibCatPrint (Str
, L
"VenUtf8()");
195 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
196 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*)Vendor
)->FlowControlMap
);
197 switch (FlowControlMap
& 0x00000003) {
199 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
203 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
207 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
215 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
216 UefiDevicePathLibCatPrint (
218 L
"SAS(0x%lx,0x%lx,0x%x,",
219 ((SAS_DEVICE_PATH
*)Vendor
)->SasAddress
,
220 ((SAS_DEVICE_PATH
*)Vendor
)->Lun
,
221 ((SAS_DEVICE_PATH
*)Vendor
)->RelativeTargetPort
223 Info
= (((SAS_DEVICE_PATH
*)Vendor
)->DeviceTopology
);
224 if (((Info
& 0x0f) == 0) && ((Info
& BIT7
) == 0)) {
225 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0,");
226 } else if (((Info
& 0x0f) <= 2) && ((Info
& BIT7
) == 0)) {
227 UefiDevicePathLibCatPrint (
230 ((Info
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
231 ((Info
& BIT5
) != 0) ? L
"External" : L
"Internal",
232 ((Info
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
234 if ((Info
& 0x0f) == 1) {
235 UefiDevicePathLibCatPrint (Str
, L
"0,");
238 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
240 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", ((Info
>> 8) & 0xff) + 1);
243 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0,", Info
);
246 UefiDevicePathLibCatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*)Vendor
)->Reserved
);
248 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
249 UefiDevicePathLibCatPrint (Str
, L
"DebugPort()");
256 case MEDIA_DEVICE_PATH
:
265 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
266 UefiDevicePathLibCatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
267 if (DataLength
!= 0) {
268 UefiDevicePathLibCatPrint (Str
, L
",");
269 for (Index
= 0; Index
< DataLength
; Index
++) {
270 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*)Vendor
)->VendorDefinedData
[Index
]);
274 UefiDevicePathLibCatPrint (Str
, L
")");
278 Converts a Controller device path structure to its string representative.
280 @param Str The string representative of input device.
281 @param DevPath The input device path structure.
282 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
283 of the display node is used, where applicable. If DisplayOnly
284 is FALSE, then the longer text representation of the display node
286 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
287 representation for a device node can be used, where applicable.
291 DevPathToTextController (
292 IN OUT POOL_PRINT
*Str
,
294 IN BOOLEAN DisplayOnly
,
295 IN BOOLEAN AllowShortcuts
298 CONTROLLER_DEVICE_PATH
*Controller
;
300 Controller
= DevPath
;
301 UefiDevicePathLibCatPrint (
304 Controller
->ControllerNumber
309 Converts a BMC device path structure to its string representative.
311 @param Str The string representative of input device.
312 @param DevPath The input device path structure.
313 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
314 of the display node is used, where applicable. If DisplayOnly
315 is FALSE, then the longer text representation of the display node
317 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
318 representation for a device node can be used, where applicable.
323 IN OUT POOL_PRINT
*Str
,
325 IN BOOLEAN DisplayOnly
,
326 IN BOOLEAN AllowShortcuts
329 BMC_DEVICE_PATH
*Bmc
;
332 UefiDevicePathLibCatPrint (
336 ReadUnaligned64 ((UINT64
*)(&Bmc
->BaseAddress
))
341 Converts a ACPI device path structure to its string representative.
343 @param Str The string representative of input device.
344 @param DevPath The input device path structure.
345 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
346 of the display node is used, where applicable. If DisplayOnly
347 is FALSE, then the longer text representation of the display node
349 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
350 representation for a device node can be used, where applicable.
355 IN OUT POOL_PRINT
*Str
,
357 IN BOOLEAN DisplayOnly
,
358 IN BOOLEAN AllowShortcuts
361 ACPI_HID_DEVICE_PATH
*Acpi
;
364 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
365 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
367 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
371 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(0x%x)", Acpi
->UID
);
375 UefiDevicePathLibCatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
379 UefiDevicePathLibCatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
383 UefiDevicePathLibCatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
387 UefiDevicePathLibCatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
391 UefiDevicePathLibCatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
395 UefiDevicePathLibCatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
400 Converts a ACPI extended HID device path structure to its string representative.
402 @param Str The string representative of input device.
403 @param DevPath The input device path structure.
404 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
405 of the display node is used, where applicable. If DisplayOnly
406 is FALSE, then the longer text representation of the display node
408 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
409 representation for a device node can be used, where applicable.
413 DevPathToTextAcpiEx (
414 IN OUT POOL_PRINT
*Str
,
416 IN BOOLEAN DisplayOnly
,
417 IN BOOLEAN AllowShortcuts
420 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
428 HIDStr
= (CHAR8
*)(((UINT8
*)AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
429 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
430 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
433 if ((EISA_ID_TO_NUM (AcpiEx
->HID
) == 0x0A03) ||
434 ((EISA_ID_TO_NUM (AcpiEx
->CID
) == 0x0A03) && (EISA_ID_TO_NUM (AcpiEx
->HID
) != 0x0A08)))
436 if (AcpiEx
->UID
== 0) {
437 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(%a)", UIDStr
);
439 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(0x%x)", AcpiEx
->UID
);
445 if ((EISA_ID_TO_NUM (AcpiEx
->HID
) == 0x0A08) || (EISA_ID_TO_NUM (AcpiEx
->CID
) == 0x0A08)) {
446 if (AcpiEx
->UID
== 0) {
447 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(%a)", UIDStr
);
449 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(0x%x)", AcpiEx
->UID
);
457 // Converts EISA identification to string.
463 ((AcpiEx
->HID
>> 10) & 0x1f) + 'A' - 1,
464 ((AcpiEx
->HID
>> 5) & 0x1f) + 'A' - 1,
465 ((AcpiEx
->HID
>> 0) & 0x1f) + 'A' - 1,
466 (AcpiEx
->HID
>> 16) & 0xFFFF
472 ((AcpiEx
->CID
>> 10) & 0x1f) + 'A' - 1,
473 ((AcpiEx
->CID
>> 5) & 0x1f) + 'A' - 1,
474 ((AcpiEx
->CID
>> 0) & 0x1f) + 'A' - 1,
475 (AcpiEx
->CID
>> 16) & 0xFFFF
478 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (*UIDStr
!= '\0')) {
482 if (AcpiEx
->CID
== 0) {
483 UefiDevicePathLibCatPrint (
490 UefiDevicePathLibCatPrint (
492 L
"AcpiExp(%s,%s,%a)",
503 if (AcpiEx
->HID
== 0) {
504 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
506 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
509 if (AcpiEx
->CID
== 0) {
510 UefiDevicePathLibCatPrint (Str
, L
"%a,", CIDStr
);
512 UefiDevicePathLibCatPrint (Str
, L
"%s,", CIDText
);
515 if (AcpiEx
->UID
== 0) {
516 UefiDevicePathLibCatPrint (Str
, L
"%a)", UIDStr
);
518 UefiDevicePathLibCatPrint (Str
, L
"0x%x)", AcpiEx
->UID
);
521 UefiDevicePathLibCatPrint (
523 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
536 Converts a ACPI address device path structure to its string representative.
538 @param Str The string representative of input device.
539 @param DevPath The input device path structure.
540 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
541 of the display node is used, where applicable. If DisplayOnly
542 is FALSE, then the longer text representation of the display node
544 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
545 representation for a device node can be used, where applicable.
549 DevPathToTextAcpiAdr (
550 IN OUT POOL_PRINT
*Str
,
552 IN BOOLEAN DisplayOnly
,
553 IN BOOLEAN AllowShortcuts
556 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
559 UINT16 AdditionalAdrCount
;
562 Length
= (UINT16
)DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*)AcpiAdr
);
563 AdditionalAdrCount
= (UINT16
)((Length
- 8) / 4);
565 UefiDevicePathLibCatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
566 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
567 UefiDevicePathLibCatPrint (Str
, L
",0x%x", *(UINT32
*)((UINT8
*)AcpiAdr
+ 8 + Index
* 4));
570 UefiDevicePathLibCatPrint (Str
, L
")");
574 Converts a ATAPI device path structure to its string representative.
576 @param Str The string representative of input device.
577 @param DevPath The input device path structure.
578 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
579 of the display node is used, where applicable. If DisplayOnly
580 is FALSE, then the longer text representation of the display node
582 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
583 representation for a device node can be used, where applicable.
588 IN OUT POOL_PRINT
*Str
,
590 IN BOOLEAN DisplayOnly
,
591 IN BOOLEAN AllowShortcuts
594 ATAPI_DEVICE_PATH
*Atapi
;
599 UefiDevicePathLibCatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
601 UefiDevicePathLibCatPrint (
604 (Atapi
->PrimarySecondary
== 1) ? L
"Secondary" : L
"Primary",
605 (Atapi
->SlaveMaster
== 1) ? L
"Slave" : L
"Master",
612 Converts a SCSI device path structure to its string representative.
614 @param Str The string representative of input device.
615 @param DevPath The input device path structure.
616 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
617 of the display node is used, where applicable. If DisplayOnly
618 is FALSE, then the longer text representation of the display node
620 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
621 representation for a device node can be used, where applicable.
626 IN OUT POOL_PRINT
*Str
,
628 IN BOOLEAN DisplayOnly
,
629 IN BOOLEAN AllowShortcuts
632 SCSI_DEVICE_PATH
*Scsi
;
635 UefiDevicePathLibCatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
639 Converts a Fibre device path structure to its string representative.
641 @param Str The string representative of input device.
642 @param DevPath The input device path structure.
643 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
644 of the display node is used, where applicable. If DisplayOnly
645 is FALSE, then the longer text representation of the display node
647 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
648 representation for a device node can be used, where applicable.
653 IN OUT POOL_PRINT
*Str
,
655 IN BOOLEAN DisplayOnly
,
656 IN BOOLEAN AllowShortcuts
659 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
662 UefiDevicePathLibCatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
666 Converts a FibreEx device path structure to its string representative.
668 @param Str The string representative of input device.
669 @param DevPath The input device path structure.
670 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
671 of the display node is used, where applicable. If DisplayOnly
672 is FALSE, then the longer text representation of the display node
674 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
675 representation for a device node can be used, where applicable.
679 DevPathToTextFibreEx (
680 IN OUT POOL_PRINT
*Str
,
682 IN BOOLEAN DisplayOnly
,
683 IN BOOLEAN AllowShortcuts
686 FIBRECHANNELEX_DEVICE_PATH
*FibreEx
;
690 UefiDevicePathLibCatPrint (Str
, L
"FibreEx(0x");
691 for (Index
= 0; Index
< sizeof (FibreEx
->WWN
) / sizeof (FibreEx
->WWN
[0]); Index
++) {
692 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->WWN
[Index
]);
695 UefiDevicePathLibCatPrint (Str
, L
",0x");
696 for (Index
= 0; Index
< sizeof (FibreEx
->Lun
) / sizeof (FibreEx
->Lun
[0]); Index
++) {
697 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->Lun
[Index
]);
700 UefiDevicePathLibCatPrint (Str
, L
")");
704 Converts a Sas Ex device path structure to its string representative.
706 @param Str The string representative of input device.
707 @param DevPath The input device path structure.
708 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
709 of the display node is used, where applicable. If DisplayOnly
710 is FALSE, then the longer text representation of the display node
712 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
713 representation for a device node can be used, where applicable.
718 IN OUT POOL_PRINT
*Str
,
720 IN BOOLEAN DisplayOnly
,
721 IN BOOLEAN AllowShortcuts
724 SASEX_DEVICE_PATH
*SasEx
;
728 UefiDevicePathLibCatPrint (Str
, L
"SasEx(0x");
730 for (Index
= 0; Index
< sizeof (SasEx
->SasAddress
) / sizeof (SasEx
->SasAddress
[0]); Index
++) {
731 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->SasAddress
[Index
]);
734 UefiDevicePathLibCatPrint (Str
, L
",0x");
735 for (Index
= 0; Index
< sizeof (SasEx
->Lun
) / sizeof (SasEx
->Lun
[0]); Index
++) {
736 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->Lun
[Index
]);
739 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", SasEx
->RelativeTargetPort
);
741 if (((SasEx
->DeviceTopology
& 0x0f) == 0) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
742 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0");
743 } else if (((SasEx
->DeviceTopology
& 0x0f) <= 2) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
744 UefiDevicePathLibCatPrint (
747 ((SasEx
->DeviceTopology
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
748 ((SasEx
->DeviceTopology
& BIT5
) != 0) ? L
"External" : L
"Internal",
749 ((SasEx
->DeviceTopology
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
751 if ((SasEx
->DeviceTopology
& 0x0f) == 1) {
752 UefiDevicePathLibCatPrint (Str
, L
"0");
755 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
757 UefiDevicePathLibCatPrint (Str
, L
"0x%x", ((SasEx
->DeviceTopology
>> 8) & 0xff) + 1);
760 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0", SasEx
->DeviceTopology
);
763 UefiDevicePathLibCatPrint (Str
, L
")");
768 Converts a NVM Express Namespace device path structure to its string representative.
770 @param Str The string representative of input device.
771 @param DevPath The input device path structure.
772 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
773 of the display node is used, where applicable. If DisplayOnly
774 is FALSE, then the longer text representation of the display node
776 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
777 representation for a device node can be used, where applicable.
782 IN OUT POOL_PRINT
*Str
,
784 IN BOOLEAN DisplayOnly
,
785 IN BOOLEAN AllowShortcuts
788 NVME_NAMESPACE_DEVICE_PATH
*Nvme
;
792 Uuid
= (UINT8
*)&Nvme
->NamespaceUuid
;
793 UefiDevicePathLibCatPrint (
795 L
"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",
809 Converts a UFS device path structure to its string representative.
811 @param Str The string representative of input device.
812 @param DevPath The input device path structure.
813 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
814 of the display node is used, where applicable. If DisplayOnly
815 is FALSE, then the longer text representation of the display node
817 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
818 representation for a device node can be used, where applicable.
823 IN OUT POOL_PRINT
*Str
,
825 IN BOOLEAN DisplayOnly
,
826 IN BOOLEAN AllowShortcuts
829 UFS_DEVICE_PATH
*Ufs
;
832 UefiDevicePathLibCatPrint (Str
, L
"UFS(0x%x,0x%x)", Ufs
->Pun
, Ufs
->Lun
);
836 Converts a SD (Secure Digital) device path structure to its string representative.
838 @param Str The string representative of input device.
839 @param DevPath The input device path structure.
840 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
841 of the display node is used, where applicable. If DisplayOnly
842 is FALSE, then the longer text representation of the display node
844 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
845 representation for a device node can be used, where applicable.
850 IN OUT POOL_PRINT
*Str
,
852 IN BOOLEAN DisplayOnly
,
853 IN BOOLEAN AllowShortcuts
859 UefiDevicePathLibCatPrint (
867 Converts a EMMC (Embedded MMC) device path structure to its string representative.
869 @param Str The string representative of input device.
870 @param DevPath The input device path structure.
871 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
872 of the display node is used, where applicable. If DisplayOnly
873 is FALSE, then the longer text representation of the display node
875 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
876 representation for a device node can be used, where applicable.
881 IN OUT POOL_PRINT
*Str
,
883 IN BOOLEAN DisplayOnly
,
884 IN BOOLEAN AllowShortcuts
887 EMMC_DEVICE_PATH
*Emmc
;
890 UefiDevicePathLibCatPrint (
898 Converts a 1394 device path structure to its string representative.
900 @param Str The string representative of input device.
901 @param DevPath The input device path structure.
902 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
903 of the display node is used, where applicable. If DisplayOnly
904 is FALSE, then the longer text representation of the display node
906 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
907 representation for a device node can be used, where applicable.
912 IN OUT POOL_PRINT
*Str
,
914 IN BOOLEAN DisplayOnly
,
915 IN BOOLEAN AllowShortcuts
918 F1394_DEVICE_PATH
*F1394DevPath
;
920 F1394DevPath
= DevPath
;
922 // Guid has format of IEEE-EUI64
924 UefiDevicePathLibCatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
928 Converts a USB device path structure to its string representative.
930 @param Str The string representative of input device.
931 @param DevPath The input device path structure.
932 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
933 of the display node is used, where applicable. If DisplayOnly
934 is FALSE, then the longer text representation of the display node
936 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
937 representation for a device node can be used, where applicable.
942 IN OUT POOL_PRINT
*Str
,
944 IN BOOLEAN DisplayOnly
,
945 IN BOOLEAN AllowShortcuts
948 USB_DEVICE_PATH
*Usb
;
951 UefiDevicePathLibCatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
955 Converts a USB WWID device path structure to its string representative.
957 @param Str The string representative of input device.
958 @param DevPath The input device path structure.
959 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
960 of the display node is used, where applicable. If DisplayOnly
961 is FALSE, then the longer text representation of the display node
963 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
964 representation for a device node can be used, where applicable.
968 DevPathToTextUsbWWID (
969 IN OUT POOL_PRINT
*Str
,
971 IN BOOLEAN DisplayOnly
,
972 IN BOOLEAN AllowShortcuts
975 USB_WWID_DEVICE_PATH
*UsbWWId
;
976 CHAR16
*SerialNumberStr
;
982 SerialNumberStr
= (CHAR16
*)((UINT8
*)UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
983 Length
= (UINT16
)((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*)UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
984 if ((Length
>= 1) && (SerialNumberStr
[Length
- 1] != 0)) {
986 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
988 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
989 ASSERT (NewStr
!= NULL
);
991 SerialNumberStr
= NewStr
;
994 UefiDevicePathLibCatPrint (
996 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
999 UsbWWId
->InterfaceNumber
,
1005 Converts a Logic Unit device path structure to its string representative.
1007 @param Str The string representative of input device.
1008 @param DevPath The input device path structure.
1009 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1010 of the display node is used, where applicable. If DisplayOnly
1011 is FALSE, then the longer text representation of the display node
1013 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1014 representation for a device node can be used, where applicable.
1018 DevPathToTextLogicalUnit (
1019 IN OUT POOL_PRINT
*Str
,
1021 IN BOOLEAN DisplayOnly
,
1022 IN BOOLEAN AllowShortcuts
1025 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
1027 LogicalUnit
= DevPath
;
1028 UefiDevicePathLibCatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
1032 Converts a USB class device path structure to its string representative.
1034 @param Str The string representative of input device.
1035 @param DevPath The input device path structure.
1036 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1037 of the display node is used, where applicable. If DisplayOnly
1038 is FALSE, then the longer text representation of the display node
1040 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1041 representation for a device node can be used, where applicable.
1045 DevPathToTextUsbClass (
1046 IN OUT POOL_PRINT
*Str
,
1048 IN BOOLEAN DisplayOnly
,
1049 IN BOOLEAN AllowShortcuts
1052 USB_CLASS_DEVICE_PATH
*UsbClass
;
1053 BOOLEAN IsKnownSubClass
;
1057 IsKnownSubClass
= TRUE
;
1058 switch (UsbClass
->DeviceClass
) {
1059 case USB_CLASS_AUDIO
:
1060 UefiDevicePathLibCatPrint (Str
, L
"UsbAudio");
1063 case USB_CLASS_CDCCONTROL
:
1064 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCControl");
1068 UefiDevicePathLibCatPrint (Str
, L
"UsbHID");
1071 case USB_CLASS_IMAGE
:
1072 UefiDevicePathLibCatPrint (Str
, L
"UsbImage");
1075 case USB_CLASS_PRINTER
:
1076 UefiDevicePathLibCatPrint (Str
, L
"UsbPrinter");
1079 case USB_CLASS_MASS_STORAGE
:
1080 UefiDevicePathLibCatPrint (Str
, L
"UsbMassStorage");
1084 UefiDevicePathLibCatPrint (Str
, L
"UsbHub");
1087 case USB_CLASS_CDCDATA
:
1088 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCData");
1091 case USB_CLASS_SMART_CARD
:
1092 UefiDevicePathLibCatPrint (Str
, L
"UsbSmartCard");
1095 case USB_CLASS_VIDEO
:
1096 UefiDevicePathLibCatPrint (Str
, L
"UsbVideo");
1099 case USB_CLASS_DIAGNOSTIC
:
1100 UefiDevicePathLibCatPrint (Str
, L
"UsbDiagnostic");
1103 case USB_CLASS_WIRELESS
:
1104 UefiDevicePathLibCatPrint (Str
, L
"UsbWireless");
1108 IsKnownSubClass
= FALSE
;
1112 if (IsKnownSubClass
) {
1113 UefiDevicePathLibCatPrint (
1115 L
"(0x%x,0x%x,0x%x,0x%x)",
1117 UsbClass
->ProductId
,
1118 UsbClass
->DeviceSubClass
,
1119 UsbClass
->DeviceProtocol
1124 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
1125 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
1126 UefiDevicePathLibCatPrint (
1128 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
1130 UsbClass
->ProductId
,
1131 UsbClass
->DeviceProtocol
1134 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
1135 UefiDevicePathLibCatPrint (
1137 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
1139 UsbClass
->ProductId
,
1140 UsbClass
->DeviceProtocol
1143 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
1144 UefiDevicePathLibCatPrint (
1146 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
1148 UsbClass
->ProductId
,
1149 UsbClass
->DeviceProtocol
1155 UefiDevicePathLibCatPrint (
1157 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
1159 UsbClass
->ProductId
,
1160 UsbClass
->DeviceClass
,
1161 UsbClass
->DeviceSubClass
,
1162 UsbClass
->DeviceProtocol
1167 Converts a SATA device path structure to its string representative.
1169 @param Str The string representative of input device.
1170 @param DevPath The input device path structure.
1171 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1172 of the display node is used, where applicable. If DisplayOnly
1173 is FALSE, then the longer text representation of the display node
1175 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1176 representation for a device node can be used, where applicable.
1181 IN OUT POOL_PRINT
*Str
,
1183 IN BOOLEAN DisplayOnly
,
1184 IN BOOLEAN AllowShortcuts
1187 SATA_DEVICE_PATH
*Sata
;
1190 UefiDevicePathLibCatPrint (
1192 L
"Sata(0x%x,0x%x,0x%x)",
1193 Sata
->HBAPortNumber
,
1194 Sata
->PortMultiplierPortNumber
,
1200 Converts a I20 device path structure to its string representative.
1202 @param Str The string representative of input device.
1203 @param DevPath The input device path structure.
1204 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1205 of the display node is used, where applicable. If DisplayOnly
1206 is FALSE, then the longer text representation of the display node
1208 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1209 representation for a device node can be used, where applicable.
1214 IN OUT POOL_PRINT
*Str
,
1216 IN BOOLEAN DisplayOnly
,
1217 IN BOOLEAN AllowShortcuts
1220 I2O_DEVICE_PATH
*I2ODevPath
;
1222 I2ODevPath
= DevPath
;
1223 UefiDevicePathLibCatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1227 Converts a MAC address device path structure to its string representative.
1229 @param Str The string representative of input device.
1230 @param DevPath The input device path structure.
1231 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1232 of the display node is used, where applicable. If DisplayOnly
1233 is FALSE, then the longer text representation of the display node
1235 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1236 representation for a device node can be used, where applicable.
1240 DevPathToTextMacAddr (
1241 IN OUT POOL_PRINT
*Str
,
1243 IN BOOLEAN DisplayOnly
,
1244 IN BOOLEAN AllowShortcuts
1247 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1248 UINTN HwAddressSize
;
1251 MacDevPath
= DevPath
;
1253 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1254 if ((MacDevPath
->IfType
== 0x01) || (MacDevPath
->IfType
== 0x00)) {
1258 UefiDevicePathLibCatPrint (Str
, L
"MAC(");
1260 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1261 UefiDevicePathLibCatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1264 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1268 Converts network protocol string to its text representation.
1270 @param Str The string representative of input device.
1271 @param Protocol The network protocol ID.
1275 CatNetworkProtocol (
1276 IN OUT POOL_PRINT
*Str
,
1280 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1281 UefiDevicePathLibCatPrint (Str
, L
"TCP");
1282 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1283 UefiDevicePathLibCatPrint (Str
, L
"UDP");
1285 UefiDevicePathLibCatPrint (Str
, L
"0x%x", Protocol
);
1290 Converts IP v4 address to its text representation.
1292 @param Str The string representative of input device.
1293 @param Address The IP v4 address.
1297 IN OUT POOL_PRINT
*Str
,
1298 IN EFI_IPv4_ADDRESS
*Address
1301 UefiDevicePathLibCatPrint (Str
, L
"%d.%d.%d.%d", Address
->Addr
[0], Address
->Addr
[1], Address
->Addr
[2], Address
->Addr
[3]);
1305 Converts IP v6 address to its text representation.
1307 @param Str The string representative of input device.
1308 @param Address The IP v6 address.
1312 IN OUT POOL_PRINT
*Str
,
1313 IN EFI_IPv6_ADDRESS
*Address
1316 UefiDevicePathLibCatPrint (
1318 L
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1339 Converts a IPv4 device path structure to its string representative.
1341 @param Str The string representative of input device.
1342 @param DevPath The input device path structure.
1343 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1344 of the display node is used, where applicable. If DisplayOnly
1345 is FALSE, then the longer text representation of the display node
1347 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1348 representation for a device node can be used, where applicable.
1353 IN OUT POOL_PRINT
*Str
,
1355 IN BOOLEAN DisplayOnly
,
1356 IN BOOLEAN AllowShortcuts
1359 IPv4_DEVICE_PATH
*IPDevPath
;
1361 IPDevPath
= DevPath
;
1362 UefiDevicePathLibCatPrint (Str
, L
"IPv4(");
1363 CatIPv4Address (Str
, &IPDevPath
->RemoteIpAddress
);
1366 UefiDevicePathLibCatPrint (Str
, L
")");
1370 UefiDevicePathLibCatPrint (Str
, L
",");
1371 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1373 UefiDevicePathLibCatPrint (Str
, L
",%s,", IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP");
1374 CatIPv4Address (Str
, &IPDevPath
->LocalIpAddress
);
1375 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1376 UefiDevicePathLibCatPrint (Str
, L
",");
1377 CatIPv4Address (Str
, &IPDevPath
->GatewayIpAddress
);
1378 UefiDevicePathLibCatPrint (Str
, L
",");
1379 CatIPv4Address (Str
, &IPDevPath
->SubnetMask
);
1382 UefiDevicePathLibCatPrint (Str
, L
")");
1386 Converts a IPv6 device path structure to its string representative.
1388 @param Str The string representative of input device.
1389 @param DevPath The input device path structure.
1390 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1391 of the display node is used, where applicable. If DisplayOnly
1392 is FALSE, then the longer text representation of the display node
1394 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1395 representation for a device node can be used, where applicable.
1400 IN OUT POOL_PRINT
*Str
,
1402 IN BOOLEAN DisplayOnly
,
1403 IN BOOLEAN AllowShortcuts
1406 IPv6_DEVICE_PATH
*IPDevPath
;
1408 IPDevPath
= DevPath
;
1409 UefiDevicePathLibCatPrint (Str
, L
"IPv6(");
1410 CatIPv6Address (Str
, &IPDevPath
->RemoteIpAddress
);
1412 UefiDevicePathLibCatPrint (Str
, L
")");
1416 UefiDevicePathLibCatPrint (Str
, L
",");
1417 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1419 switch (IPDevPath
->IpAddressOrigin
) {
1421 UefiDevicePathLibCatPrint (Str
, L
",Static,");
1424 UefiDevicePathLibCatPrint (Str
, L
",StatelessAutoConfigure,");
1427 UefiDevicePathLibCatPrint (Str
, L
",StatefulAutoConfigure,");
1431 CatIPv6Address (Str
, &IPDevPath
->LocalIpAddress
);
1433 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1434 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", IPDevPath
->PrefixLength
);
1435 CatIPv6Address (Str
, &IPDevPath
->GatewayIpAddress
);
1438 UefiDevicePathLibCatPrint (Str
, L
")");
1442 Converts an Infini Band device path structure to its string representative.
1444 @param Str The string representative of input device.
1445 @param DevPath The input device path structure.
1446 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1447 of the display node is used, where applicable. If DisplayOnly
1448 is FALSE, then the longer text representation of the display node
1450 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1451 representation for a device node can be used, where applicable.
1455 DevPathToTextInfiniBand (
1456 IN OUT POOL_PRINT
*Str
,
1458 IN BOOLEAN DisplayOnly
,
1459 IN BOOLEAN AllowShortcuts
1462 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1464 InfiniBand
= DevPath
;
1465 UefiDevicePathLibCatPrint (
1467 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1468 InfiniBand
->ResourceFlags
,
1469 InfiniBand
->PortGid
,
1470 InfiniBand
->ServiceId
,
1471 InfiniBand
->TargetPortId
,
1472 InfiniBand
->DeviceId
1477 Converts a UART device path structure to its string representative.
1479 @param Str The string representative of input device.
1480 @param DevPath The input device path structure.
1481 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1482 of the display node is used, where applicable. If DisplayOnly
1483 is FALSE, then the longer text representation of the display node
1485 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1486 representation for a device node can be used, where applicable.
1491 IN OUT POOL_PRINT
*Str
,
1493 IN BOOLEAN DisplayOnly
,
1494 IN BOOLEAN AllowShortcuts
1497 UART_DEVICE_PATH
*Uart
;
1501 switch (Uart
->Parity
) {
1531 if (Uart
->BaudRate
== 0) {
1532 UefiDevicePathLibCatPrint (Str
, L
"Uart(DEFAULT,");
1534 UefiDevicePathLibCatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1537 if (Uart
->DataBits
== 0) {
1538 UefiDevicePathLibCatPrint (Str
, L
"DEFAULT,");
1540 UefiDevicePathLibCatPrint (Str
, L
"%d,", Uart
->DataBits
);
1543 UefiDevicePathLibCatPrint (Str
, L
"%c,", Parity
);
1545 switch (Uart
->StopBits
) {
1547 UefiDevicePathLibCatPrint (Str
, L
"D)");
1551 UefiDevicePathLibCatPrint (Str
, L
"1)");
1555 UefiDevicePathLibCatPrint (Str
, L
"1.5)");
1559 UefiDevicePathLibCatPrint (Str
, L
"2)");
1563 UefiDevicePathLibCatPrint (Str
, L
"x)");
1569 Converts an iSCSI device path structure to its string representative.
1571 @param Str The string representative of input device.
1572 @param DevPath The input device path structure.
1573 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1574 of the display node is used, where applicable. If DisplayOnly
1575 is FALSE, then the longer text representation of the display node
1577 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1578 representation for a device node can be used, where applicable.
1582 DevPathToTextiSCSI (
1583 IN OUT POOL_PRINT
*Str
,
1585 IN BOOLEAN DisplayOnly
,
1586 IN BOOLEAN AllowShortcuts
1589 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1593 ISCSIDevPath
= DevPath
;
1594 UefiDevicePathLibCatPrint (
1596 L
"iSCSI(%a,0x%x,0x",
1597 ISCSIDevPath
->TargetName
,
1598 ISCSIDevPath
->TargetPortalGroupTag
1600 for (Index
= 0; Index
< sizeof (ISCSIDevPath
->Lun
) / sizeof (UINT8
); Index
++) {
1601 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*)&ISCSIDevPath
->Lun
)[Index
]);
1604 Options
= ISCSIDevPath
->LoginOption
;
1605 UefiDevicePathLibCatPrint (Str
, L
",%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1606 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1607 if (((Options
>> 11) & 0x0001) != 0) {
1608 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"None");
1609 } else if (((Options
>> 12) & 0x0001) != 0) {
1610 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1612 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_BI");
1615 UefiDevicePathLibCatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1619 Converts a VLAN device path structure to its string representative.
1621 @param Str The string representative of input device.
1622 @param DevPath The input device path structure.
1623 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1624 of the display node is used, where applicable. If DisplayOnly
1625 is FALSE, then the longer text representation of the display node
1627 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1628 representation for a device node can be used, where applicable.
1633 IN OUT POOL_PRINT
*Str
,
1635 IN BOOLEAN DisplayOnly
,
1636 IN BOOLEAN AllowShortcuts
1639 VLAN_DEVICE_PATH
*Vlan
;
1642 UefiDevicePathLibCatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1646 Converts a Bluetooth device path structure to its string representative.
1648 @param Str The string representative of input device.
1649 @param DevPath The input device path structure.
1650 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1651 of the display node is used, where applicable. If DisplayOnly
1652 is FALSE, then the longer text representation of the display node
1654 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1655 representation for a device node can be used, where applicable.
1659 DevPathToTextBluetooth (
1660 IN OUT POOL_PRINT
*Str
,
1662 IN BOOLEAN DisplayOnly
,
1663 IN BOOLEAN AllowShortcuts
1666 BLUETOOTH_DEVICE_PATH
*Bluetooth
;
1668 Bluetooth
= DevPath
;
1669 UefiDevicePathLibCatPrint (
1671 L
"Bluetooth(%02x%02x%02x%02x%02x%02x)",
1672 Bluetooth
->BD_ADDR
.Address
[0],
1673 Bluetooth
->BD_ADDR
.Address
[1],
1674 Bluetooth
->BD_ADDR
.Address
[2],
1675 Bluetooth
->BD_ADDR
.Address
[3],
1676 Bluetooth
->BD_ADDR
.Address
[4],
1677 Bluetooth
->BD_ADDR
.Address
[5]
1682 Converts a Wi-Fi device path structure to its string representative.
1684 @param Str The string representative of input device.
1685 @param DevPath The input device path structure.
1686 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1687 of the display node is used, where applicable. If DisplayOnly
1688 is FALSE, then the longer text representation of the display node
1690 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1691 representation for a device node can be used, where applicable.
1696 IN OUT POOL_PRINT
*Str
,
1698 IN BOOLEAN DisplayOnly
,
1699 IN BOOLEAN AllowShortcuts
1702 WIFI_DEVICE_PATH
*WiFi
;
1708 CopyMem (SSId
, WiFi
->SSId
, 32);
1710 UefiDevicePathLibCatPrint (Str
, L
"Wi-Fi(%a)", SSId
);
1714 Converts a Bluetooth device path structure to its string representative.
1716 @param Str The string representative of input device.
1717 @param DevPath The input device path structure.
1718 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1719 of the display node is used, where applicable. If DisplayOnly
1720 is FALSE, then the longer text representation of the display node
1722 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1723 representation for a device node can be used, where applicable.
1727 DevPathToTextBluetoothLE (
1728 IN OUT POOL_PRINT
*Str
,
1730 IN BOOLEAN DisplayOnly
,
1731 IN BOOLEAN AllowShortcuts
1734 BLUETOOTH_LE_DEVICE_PATH
*BluetoothLE
;
1736 BluetoothLE
= DevPath
;
1737 UefiDevicePathLibCatPrint (
1739 L
"BluetoothLE(%02x%02x%02x%02x%02x%02x,0x%02x)",
1740 BluetoothLE
->Address
.Address
[0],
1741 BluetoothLE
->Address
.Address
[1],
1742 BluetoothLE
->Address
.Address
[2],
1743 BluetoothLE
->Address
.Address
[3],
1744 BluetoothLE
->Address
.Address
[4],
1745 BluetoothLE
->Address
.Address
[5],
1746 BluetoothLE
->Address
.Type
1751 Converts a DNS device path structure to its string representative.
1753 @param Str The string representative of input device.
1754 @param DevPath The input device path structure.
1755 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1756 of the display node is used, where applicable. If DisplayOnly
1757 is FALSE, then the longer text representation of the display node
1759 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1760 representation for a device node can be used, where applicable.
1765 IN OUT POOL_PRINT
*Str
,
1767 IN BOOLEAN DisplayOnly
,
1768 IN BOOLEAN AllowShortcuts
1771 DNS_DEVICE_PATH
*DnsDevPath
;
1772 UINT32 DnsServerIpCount
;
1773 UINT32 DnsServerIpIndex
;
1775 DnsDevPath
= DevPath
;
1776 DnsServerIpCount
= (UINT32
)(DevicePathNodeLength (DnsDevPath
) - sizeof (EFI_DEVICE_PATH_PROTOCOL
) - sizeof (DnsDevPath
->IsIPv6
)) / sizeof (EFI_IP_ADDRESS
);
1778 UefiDevicePathLibCatPrint (Str
, L
"Dns(");
1780 for (DnsServerIpIndex
= 0; DnsServerIpIndex
< DnsServerIpCount
; DnsServerIpIndex
++) {
1781 if (DnsDevPath
->IsIPv6
== 0x00) {
1782 CatIPv4Address (Str
, &(DnsDevPath
->DnsServerIp
[DnsServerIpIndex
].v4
));
1784 CatIPv6Address (Str
, &(DnsDevPath
->DnsServerIp
[DnsServerIpIndex
].v6
));
1787 if (DnsServerIpIndex
< DnsServerIpCount
- 1) {
1788 UefiDevicePathLibCatPrint (Str
, L
",");
1792 UefiDevicePathLibCatPrint (Str
, L
")");
1796 Converts a URI device path structure to its string representative.
1798 @param Str The string representative of input device.
1799 @param DevPath The input device path structure.
1800 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1801 of the display node is used, where applicable. If DisplayOnly
1802 is FALSE, then the longer text representation of the display node
1804 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1805 representation for a device node can be used, where applicable.
1810 IN OUT POOL_PRINT
*Str
,
1812 IN BOOLEAN DisplayOnly
,
1813 IN BOOLEAN AllowShortcuts
1816 URI_DEVICE_PATH
*Uri
;
1821 // Uri in the device path may not be null terminated.
1824 UriLength
= DevicePathNodeLength (Uri
) - sizeof (URI_DEVICE_PATH
);
1825 UriStr
= AllocatePool (UriLength
+ 1);
1826 ASSERT (UriStr
!= NULL
);
1828 CopyMem (UriStr
, Uri
->Uri
, UriLength
);
1829 UriStr
[UriLength
] = '\0';
1830 UefiDevicePathLibCatPrint (Str
, L
"Uri(%a)", UriStr
);
1835 Converts a Hard drive device path structure to its string representative.
1837 @param Str The string representative of input device.
1838 @param DevPath The input device path structure.
1839 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1840 of the display node is used, where applicable. If DisplayOnly
1841 is FALSE, then the longer text representation of the display node
1843 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1844 representation for a device node can be used, where applicable.
1848 DevPathToTextHardDrive (
1849 IN OUT POOL_PRINT
*Str
,
1851 IN BOOLEAN DisplayOnly
,
1852 IN BOOLEAN AllowShortcuts
1855 HARDDRIVE_DEVICE_PATH
*Hd
;
1858 switch (Hd
->SignatureType
) {
1859 case SIGNATURE_TYPE_MBR
:
1860 UefiDevicePathLibCatPrint (
1862 L
"HD(%d,%s,0x%08x,",
1863 Hd
->PartitionNumber
,
1865 *((UINT32
*)(&(Hd
->Signature
[0])))
1869 case SIGNATURE_TYPE_GUID
:
1870 UefiDevicePathLibCatPrint (
1873 Hd
->PartitionNumber
,
1875 (EFI_GUID
*)&(Hd
->Signature
[0])
1880 UefiDevicePathLibCatPrint (
1883 Hd
->PartitionNumber
,
1889 UefiDevicePathLibCatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1893 Converts a CDROM device path structure to its string representative.
1895 @param Str The string representative of input device.
1896 @param DevPath The input device path structure.
1897 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1898 of the display node is used, where applicable. If DisplayOnly
1899 is FALSE, then the longer text representation of the display node
1901 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1902 representation for a device node can be used, where applicable.
1906 DevPathToTextCDROM (
1907 IN OUT POOL_PRINT
*Str
,
1909 IN BOOLEAN DisplayOnly
,
1910 IN BOOLEAN AllowShortcuts
1913 CDROM_DEVICE_PATH
*Cd
;
1917 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1921 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1925 Converts a File device path structure to its string representative.
1927 @param Str The string representative of input device.
1928 @param DevPath The input device path structure.
1929 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1930 of the display node is used, where applicable. If DisplayOnly
1931 is FALSE, then the longer text representation of the display node
1933 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1934 representation for a device node can be used, where applicable.
1938 DevPathToTextFilePath (
1939 IN OUT POOL_PRINT
*Str
,
1941 IN BOOLEAN DisplayOnly
,
1942 IN BOOLEAN AllowShortcuts
1945 FILEPATH_DEVICE_PATH
*Fp
;
1948 UefiDevicePathLibCatPrint (Str
, L
"%s", Fp
->PathName
);
1952 Converts a Media protocol device path structure to its string representative.
1954 @param Str The string representative of input device.
1955 @param DevPath The input device path structure.
1956 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1957 of the display node is used, where applicable. If DisplayOnly
1958 is FALSE, then the longer text representation of the display node
1960 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1961 representation for a device node can be used, where applicable.
1965 DevPathToTextMediaProtocol (
1966 IN OUT POOL_PRINT
*Str
,
1968 IN BOOLEAN DisplayOnly
,
1969 IN BOOLEAN AllowShortcuts
1972 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1974 MediaProt
= DevPath
;
1975 UefiDevicePathLibCatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1979 Converts a Firmware Volume device path structure to its string representative.
1981 @param Str The string representative of input device.
1982 @param DevPath The input device path structure.
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.
1993 IN OUT POOL_PRINT
*Str
,
1995 IN BOOLEAN DisplayOnly
,
1996 IN BOOLEAN AllowShortcuts
1999 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
2002 UefiDevicePathLibCatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
2006 Converts a Firmware Volume File device path structure to its string representative.
2008 @param Str The string representative of input device.
2009 @param DevPath The input device path structure.
2010 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2011 of the display node is used, where applicable. If DisplayOnly
2012 is FALSE, then the longer text representation of the display node
2014 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2015 representation for a device node can be used, where applicable.
2019 DevPathToTextFvFile (
2020 IN OUT POOL_PRINT
*Str
,
2022 IN BOOLEAN DisplayOnly
,
2023 IN BOOLEAN AllowShortcuts
2026 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
2029 UefiDevicePathLibCatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
2033 Converts a Relative Offset device path structure to its string representative.
2035 @param Str The string representative of input device.
2036 @param DevPath The input device path structure.
2037 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2038 of the display node is used, where applicable. If DisplayOnly
2039 is FALSE, then the longer text representation of the display node
2041 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2042 representation for a device node can be used, where applicable.
2046 DevPathRelativeOffsetRange (
2047 IN OUT POOL_PRINT
*Str
,
2049 IN BOOLEAN DisplayOnly
,
2050 IN BOOLEAN AllowShortcuts
2053 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
2056 UefiDevicePathLibCatPrint (
2058 L
"Offset(0x%lx,0x%lx)",
2059 Offset
->StartingOffset
,
2060 Offset
->EndingOffset
2065 Converts a Ram Disk device path structure to its string representative.
2067 @param Str The string representative of input device.
2068 @param DevPath The input device path structure.
2069 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2070 of the display node is used, where applicable. If DisplayOnly
2071 is FALSE, then the longer text representation of the display node
2073 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2074 representation for a device node can be used, where applicable.
2078 DevPathToTextRamDisk (
2079 IN OUT POOL_PRINT
*Str
,
2081 IN BOOLEAN DisplayOnly
,
2082 IN BOOLEAN AllowShortcuts
2085 MEDIA_RAM_DISK_DEVICE_PATH
*RamDisk
;
2089 if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualDiskGuid
)) {
2090 UefiDevicePathLibCatPrint (
2092 L
"VirtualDisk(0x%lx,0x%lx,%d)",
2093 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2094 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2097 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualCdGuid
)) {
2098 UefiDevicePathLibCatPrint (
2100 L
"VirtualCD(0x%lx,0x%lx,%d)",
2101 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2102 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2105 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualDiskGuid
)) {
2106 UefiDevicePathLibCatPrint (
2108 L
"PersistentVirtualDisk(0x%lx,0x%lx,%d)",
2109 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2110 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2113 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualCdGuid
)) {
2114 UefiDevicePathLibCatPrint (
2116 L
"PersistentVirtualCD(0x%lx,0x%lx,%d)",
2117 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2118 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2122 UefiDevicePathLibCatPrint (
2124 L
"RamDisk(0x%lx,0x%lx,%d,%g)",
2125 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2126 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2134 Converts a BIOS Boot Specification device path structure to its string representative.
2136 @param Str The string representative of input device.
2137 @param DevPath The input device path structure.
2138 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2139 of the display node is used, where applicable. If DisplayOnly
2140 is FALSE, then the longer text representation of the display node
2142 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2143 representation for a device node can be used, where applicable.
2148 IN OUT POOL_PRINT
*Str
,
2150 IN BOOLEAN DisplayOnly
,
2151 IN BOOLEAN AllowShortcuts
2154 BBS_BBS_DEVICE_PATH
*Bbs
;
2158 switch (Bbs
->DeviceType
) {
2159 case BBS_TYPE_FLOPPY
:
2163 case BBS_TYPE_HARDDRIVE
:
2167 case BBS_TYPE_CDROM
:
2171 case BBS_TYPE_PCMCIA
:
2179 case BBS_TYPE_EMBEDDED_NETWORK
:
2189 UefiDevicePathLibCatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
2191 UefiDevicePathLibCatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
2195 UefiDevicePathLibCatPrint (Str
, L
")");
2199 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
2203 Converts an End-of-Device-Path structure to its string representative.
2205 @param Str The string representative of input device.
2206 @param DevPath The input device path structure.
2207 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2208 of the display node is used, where applicable. If DisplayOnly
2209 is FALSE, then the longer text representation of the display node
2211 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2212 representation for a device node can be used, where applicable.
2216 DevPathToTextEndInstance (
2217 IN OUT POOL_PRINT
*Str
,
2219 IN BOOLEAN DisplayOnly
,
2220 IN BOOLEAN AllowShortcuts
2223 UefiDevicePathLibCatPrint (Str
, L
",");
2226 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric
[] = {
2227 { HARDWARE_DEVICE_PATH
, L
"HardwarePath" },
2228 { ACPI_DEVICE_PATH
, L
"AcpiPath" },
2229 { MESSAGING_DEVICE_PATH
, L
"Msg" },
2230 { MEDIA_DEVICE_PATH
, L
"MediaPath" },
2231 { BBS_DEVICE_PATH
, L
"BbsPath" },
2236 Converts an unknown device path structure to its string representative.
2238 @param Str The string representative of input device.
2239 @param DevPath The input device path structure.
2240 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2241 of the display node is used, where applicable. If DisplayOnly
2242 is FALSE, then the longer text representation of the display node
2244 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2245 representation for a device node can be used, where applicable.
2249 DevPathToTextNodeGeneric (
2250 IN OUT POOL_PRINT
*Str
,
2252 IN BOOLEAN DisplayOnly
,
2253 IN BOOLEAN AllowShortcuts
2256 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2261 for (Index
= 0; mUefiDevicePathLibToTextTableGeneric
[Index
].Text
!= NULL
; Index
++) {
2262 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTableGeneric
[Index
].Type
) {
2267 if (mUefiDevicePathLibToTextTableGeneric
[Index
].Text
== NULL
) {
2269 // It's a node whose type cannot be recognized
2271 UefiDevicePathLibCatPrint (Str
, L
"Path(%d,%d", DevicePathType (Node
), DevicePathSubType (Node
));
2274 // It's a node whose type can be recognized
2276 UefiDevicePathLibCatPrint (Str
, L
"%s(%d", mUefiDevicePathLibToTextTableGeneric
[Index
].Text
, DevicePathSubType (Node
));
2279 Index
= sizeof (EFI_DEVICE_PATH_PROTOCOL
);
2280 if (Index
< DevicePathNodeLength (Node
)) {
2281 UefiDevicePathLibCatPrint (Str
, L
",");
2282 for ( ; Index
< DevicePathNodeLength (Node
); Index
++) {
2283 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*)Node
)[Index
]);
2287 UefiDevicePathLibCatPrint (Str
, L
")");
2290 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable
[] = {
2291 { HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
2292 { HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
2293 { HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
2294 { HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
2295 { HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
2296 { HARDWARE_DEVICE_PATH
, HW_BMC_DP
, DevPathToTextBmc
},
2297 { ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
2298 { ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
2299 { ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
2300 { MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
2301 { MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
2302 { MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
2303 { MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
2304 { MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
2305 { MESSAGING_DEVICE_PATH
, MSG_NVME_NAMESPACE_DP
, DevPathToTextNVMe
},
2306 { MESSAGING_DEVICE_PATH
, MSG_UFS_DP
, DevPathToTextUfs
},
2307 { MESSAGING_DEVICE_PATH
, MSG_SD_DP
, DevPathToTextSd
},
2308 { MESSAGING_DEVICE_PATH
, MSG_EMMC_DP
, DevPathToTextEmmc
},
2309 { MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
2310 { MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
2311 { MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
2312 { MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
2313 { MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
2314 { MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
2315 { MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
2316 { MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
2317 { MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
2318 { MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
2319 { MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
2320 { MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
2321 { MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
2322 { MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
2323 { MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
2324 { MESSAGING_DEVICE_PATH
, MSG_DNS_DP
, DevPathToTextDns
},
2325 { MESSAGING_DEVICE_PATH
, MSG_URI_DP
, DevPathToTextUri
},
2326 { MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_DP
, DevPathToTextBluetooth
},
2327 { MESSAGING_DEVICE_PATH
, MSG_WIFI_DP
, DevPathToTextWiFi
},
2328 { MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_LE_DP
, DevPathToTextBluetoothLE
},
2329 { MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
2330 { MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
2331 { MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
2332 { MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
2333 { MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
2334 { MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
2335 { MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
2336 { MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
2337 { MEDIA_DEVICE_PATH
, MEDIA_RAM_DISK_DP
, DevPathToTextRamDisk
},
2338 { BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
2339 { END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
2344 Converts a device node to its string representation.
2346 @param DeviceNode A Pointer to the device node to be converted.
2347 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2348 of the display node is used, where applicable. If DisplayOnly
2349 is FALSE, then the longer text representation of the display node
2351 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2352 representation for a device node can be used, where applicable.
2354 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
2355 is NULL or there was insufficient memory.
2360 UefiDevicePathLibConvertDeviceNodeToText (
2361 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
2362 IN BOOLEAN DisplayOnly
,
2363 IN BOOLEAN AllowShortcuts
2368 DEVICE_PATH_TO_TEXT ToText
;
2370 if (DeviceNode
== NULL
) {
2374 ZeroMem (&Str
, sizeof (Str
));
2377 // Process the device path node
2378 // If not found, use a generic function
2380 ToText
= DevPathToTextNodeGeneric
;
2381 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
++) {
2382 if ((DevicePathType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].Type
) &&
2383 (DevicePathSubType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].SubType
)
2386 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2394 ToText (&Str
, (VOID
*)DeviceNode
, DisplayOnly
, AllowShortcuts
);
2396 ASSERT (Str
.Str
!= NULL
);
2401 Converts a device path to its text representation.
2403 @param DevicePath A Pointer to the device to be converted.
2404 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2405 of the display node is used, where applicable. If DisplayOnly
2406 is FALSE, then the longer text representation of the display node
2408 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2409 representation for a device node can be used, where applicable.
2411 @return A pointer to the allocated text representation of the device path or
2412 NULL if DeviceNode is NULL or there was insufficient memory.
2417 UefiDevicePathLibConvertDevicePathToText (
2418 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
2419 IN BOOLEAN DisplayOnly
,
2420 IN BOOLEAN AllowShortcuts
2424 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2425 EFI_DEVICE_PATH_PROTOCOL
*AlignedNode
;
2427 DEVICE_PATH_TO_TEXT ToText
;
2429 if (DevicePath
== NULL
) {
2433 ZeroMem (&Str
, sizeof (Str
));
2436 // Process each device path node
2438 Node
= (EFI_DEVICE_PATH_PROTOCOL
*)DevicePath
;
2439 while (!IsDevicePathEnd (Node
)) {
2441 // Find the handler to dump this device path node
2442 // If not found, use a generic function
2444 ToText
= DevPathToTextNodeGeneric
;
2445 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
2446 if ((DevicePathType (Node
) == mUefiDevicePathLibToTextTable
[Index
].Type
) &&
2447 (DevicePathSubType (Node
) == mUefiDevicePathLibToTextTable
[Index
].SubType
)
2450 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2456 // Put a path separator in if needed
2458 if ((Str
.Count
!= 0) && (ToText
!= DevPathToTextEndInstance
)) {
2459 if (Str
.Str
[Str
.Count
] != L
',') {
2460 UefiDevicePathLibCatPrint (&Str
, L
"/");
2464 AlignedNode
= AllocateCopyPool (DevicePathNodeLength (Node
), Node
);
2466 // Print this node of the device path
2468 ToText (&Str
, AlignedNode
, DisplayOnly
, AllowShortcuts
);
2469 FreePool (AlignedNode
);
2472 // Next device path node
2474 Node
= NextDevicePathNode (Node
);
2477 if (Str
.Str
== NULL
) {
2478 return AllocateZeroPool (sizeof (CHAR16
));