2 DevicePathToText protocol as defined in the UEFI 2.0 specification.
4 Copyright (c) 2013 - 2015, 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 "UefiDevicePathLib.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.
33 UefiDevicePathLibCatPrint (
34 IN OUT POOL_PRINT
*Str
,
43 Count
= SPrintLength (Fmt
, Args
);
45 if ((Str
->Count
+ (Count
+ 1)) * sizeof (CHAR16
) > Str
->Capacity
) {
46 Str
->Capacity
= (Str
->Count
+ (Count
+ 1) * 2) * sizeof (CHAR16
);
47 Str
->Str
= ReallocatePool (
48 Str
->Count
* sizeof (CHAR16
),
52 ASSERT (Str
->Str
!= NULL
);
54 UnicodeVSPrint (&Str
->Str
[Str
->Count
], Str
->Capacity
- Str
->Count
* sizeof (CHAR16
), Fmt
, Args
);
62 Converts a PCI device path structure to its string representative.
64 @param Str The string representative of input device.
65 @param DevPath The input device path structure.
66 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
67 of the display node is used, where applicable. If DisplayOnly
68 is FALSE, then the longer text representation of the display node
70 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
71 representation for a device node can be used, where applicable.
76 IN OUT POOL_PRINT
*Str
,
78 IN BOOLEAN DisplayOnly
,
79 IN BOOLEAN AllowShortcuts
85 UefiDevicePathLibCatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
89 Converts a PC Card device path structure to its string representative.
91 @param Str The string representative of input device.
92 @param DevPath The input device path structure.
93 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
94 of the display node is used, where applicable. If DisplayOnly
95 is FALSE, then the longer text representation of the display node
97 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
98 representation for a device node can be used, where applicable.
102 DevPathToTextPccard (
103 IN OUT POOL_PRINT
*Str
,
105 IN BOOLEAN DisplayOnly
,
106 IN BOOLEAN AllowShortcuts
109 PCCARD_DEVICE_PATH
*Pccard
;
112 UefiDevicePathLibCatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
116 Converts a Memory Map device path structure to its string representative.
118 @param Str The string representative of input device.
119 @param DevPath The input device path structure.
120 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
121 of the display node is used, where applicable. If DisplayOnly
122 is FALSE, then the longer text representation of the display node
124 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
125 representation for a device node can be used, where applicable.
129 DevPathToTextMemMap (
130 IN OUT POOL_PRINT
*Str
,
132 IN BOOLEAN DisplayOnly
,
133 IN BOOLEAN AllowShortcuts
136 MEMMAP_DEVICE_PATH
*MemMap
;
139 UefiDevicePathLibCatPrint (
141 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
143 MemMap
->StartingAddress
,
144 MemMap
->EndingAddress
149 Converts a Vendor device path structure to its string representative.
151 @param Str The string representative of input device.
152 @param DevPath The input device path structure.
153 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
154 of the display node is used, where applicable. If DisplayOnly
155 is FALSE, then the longer text representation of the display node
157 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
158 representation for a device node can be used, where applicable.
162 DevPathToTextVendor (
163 IN OUT POOL_PRINT
*Str
,
165 IN BOOLEAN DisplayOnly
,
166 IN BOOLEAN AllowShortcuts
169 VENDOR_DEVICE_PATH
*Vendor
;
173 UINT32 FlowControlMap
;
176 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
177 switch (DevicePathType (&Vendor
->Header
)) {
178 case HARDWARE_DEVICE_PATH
:
182 case MESSAGING_DEVICE_PATH
:
184 if (AllowShortcuts
) {
185 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
186 UefiDevicePathLibCatPrint (Str
, L
"VenPcAnsi()");
188 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
189 UefiDevicePathLibCatPrint (Str
, L
"VenVt100()");
191 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
192 UefiDevicePathLibCatPrint (Str
, L
"VenVt100Plus()");
194 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
195 UefiDevicePathLibCatPrint (Str
, L
"VenUft8()");
197 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
198 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
199 switch (FlowControlMap
& 0x00000003) {
201 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
205 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
209 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
217 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
218 UefiDevicePathLibCatPrint (
220 L
"SAS(0x%lx,0x%lx,0x%x,",
221 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
222 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
223 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
225 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
226 if (((Info
& 0x0f) == 0) && ((Info
& BIT7
) == 0)) {
227 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0,");
228 } else if (((Info
& 0x0f) <= 2) && ((Info
& BIT7
) == 0)) {
229 UefiDevicePathLibCatPrint (
232 ((Info
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
233 ((Info
& BIT5
) != 0) ? L
"External" : L
"Internal",
234 ((Info
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
236 if ((Info
& 0x0f) == 1) {
237 UefiDevicePathLibCatPrint (Str
, L
"0,");
240 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
242 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", ((Info
>> 8) & 0xff) + 1);
245 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0,", Info
);
248 UefiDevicePathLibCatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
250 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
251 UefiDevicePathLibCatPrint (Str
, L
"DebugPort()");
257 case MEDIA_DEVICE_PATH
:
266 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
267 UefiDevicePathLibCatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
268 if (DataLength
!= 0) {
269 UefiDevicePathLibCatPrint (Str
, L
",");
270 for (Index
= 0; Index
< DataLength
; Index
++) {
271 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
275 UefiDevicePathLibCatPrint (Str
, L
")");
279 Converts a Controller device path structure to its string representative.
281 @param Str The string representative of input device.
282 @param DevPath The input device path structure.
283 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
284 of the display node is used, where applicable. If DisplayOnly
285 is FALSE, then the longer text representation of the display node
287 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
288 representation for a device node can be used, where applicable.
292 DevPathToTextController (
293 IN OUT POOL_PRINT
*Str
,
295 IN BOOLEAN DisplayOnly
,
296 IN BOOLEAN AllowShortcuts
299 CONTROLLER_DEVICE_PATH
*Controller
;
301 Controller
= DevPath
;
302 UefiDevicePathLibCatPrint (
305 Controller
->ControllerNumber
310 Converts a BMC device path structure to its string representative.
312 @param Str The string representative of input device.
313 @param DevPath The input device path structure.
314 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
315 of the display node is used, where applicable. If DisplayOnly
316 is FALSE, then the longer text representation of the display node
318 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
319 representation for a device node can be used, where applicable.
324 IN OUT POOL_PRINT
*Str
,
326 IN BOOLEAN DisplayOnly
,
327 IN BOOLEAN AllowShortcuts
330 BMC_DEVICE_PATH
*Bmc
;
333 UefiDevicePathLibCatPrint (
337 ReadUnaligned64 ((UINT64
*) (&Bmc
->BaseAddress
))
342 Converts a ACPI device path structure to its string representative.
344 @param Str The string representative of input device.
345 @param DevPath The input device path structure.
346 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
347 of the display node is used, where applicable. If DisplayOnly
348 is FALSE, then the longer text representation of the display node
350 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
351 representation for a device node can be used, where applicable.
356 IN OUT POOL_PRINT
*Str
,
358 IN BOOLEAN DisplayOnly
,
359 IN BOOLEAN AllowShortcuts
362 ACPI_HID_DEVICE_PATH
*Acpi
;
365 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
366 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
368 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
372 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(0x%x)", Acpi
->UID
);
376 UefiDevicePathLibCatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
380 UefiDevicePathLibCatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
384 UefiDevicePathLibCatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
388 UefiDevicePathLibCatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
392 UefiDevicePathLibCatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
396 UefiDevicePathLibCatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
401 Converts a ACPI extended HID device path structure to its string representative.
403 @param Str The string representative of input device.
404 @param DevPath The input device path structure.
405 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
406 of the display node is used, where applicable. If DisplayOnly
407 is FALSE, then the longer text representation of the display node
409 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
410 representation for a device node can be used, where applicable.
414 DevPathToTextAcpiEx (
415 IN OUT POOL_PRINT
*Str
,
417 IN BOOLEAN DisplayOnly
,
418 IN BOOLEAN AllowShortcuts
421 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
429 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
430 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
431 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
434 // Converts EISA identification to string.
440 ((AcpiEx
->HID
>> 10) & 0x1f) + 'A' - 1,
441 ((AcpiEx
->HID
>> 5) & 0x1f) + 'A' - 1,
442 ((AcpiEx
->HID
>> 0) & 0x1f) + 'A' - 1,
443 (AcpiEx
->HID
>> 16) & 0xFFFF
449 ((AcpiEx
->CID
>> 10) & 0x1f) + 'A' - 1,
450 ((AcpiEx
->CID
>> 5) & 0x1f) + 'A' - 1,
451 ((AcpiEx
->CID
>> 0) & 0x1f) + 'A' - 1,
452 (AcpiEx
->CID
>> 16) & 0xFFFF
455 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (AcpiEx
->UID
== 0)) {
459 UefiDevicePathLibCatPrint (
461 L
"AcpiExp(%s,%s,%a)",
467 if (AllowShortcuts
) {
471 if (AcpiEx
->HID
== 0) {
472 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
474 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
477 if (AcpiEx
->UID
== 0) {
478 UefiDevicePathLibCatPrint (Str
, L
"%a,", UIDStr
);
480 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", AcpiEx
->UID
);
483 if (AcpiEx
->CID
== 0) {
484 UefiDevicePathLibCatPrint (Str
, L
"%a)", CIDStr
);
486 UefiDevicePathLibCatPrint (Str
, L
"%s)", CIDText
);
489 UefiDevicePathLibCatPrint (
491 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
504 Converts a ACPI address device path structure to its string representative.
506 @param Str The string representative of input device.
507 @param DevPath The input device path structure.
508 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
509 of the display node is used, where applicable. If DisplayOnly
510 is FALSE, then the longer text representation of the display node
512 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
513 representation for a device node can be used, where applicable.
517 DevPathToTextAcpiAdr (
518 IN OUT POOL_PRINT
*Str
,
520 IN BOOLEAN DisplayOnly
,
521 IN BOOLEAN AllowShortcuts
524 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
527 UINT16 AdditionalAdrCount
;
530 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
531 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
533 UefiDevicePathLibCatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
534 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
535 UefiDevicePathLibCatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
537 UefiDevicePathLibCatPrint (Str
, L
")");
541 Converts a ATAPI device path structure to its string representative.
543 @param Str The string representative of input device.
544 @param DevPath The input device path structure.
545 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
546 of the display node is used, where applicable. If DisplayOnly
547 is FALSE, then the longer text representation of the display node
549 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
550 representation for a device node can be used, where applicable.
555 IN OUT POOL_PRINT
*Str
,
557 IN BOOLEAN DisplayOnly
,
558 IN BOOLEAN AllowShortcuts
561 ATAPI_DEVICE_PATH
*Atapi
;
566 UefiDevicePathLibCatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
568 UefiDevicePathLibCatPrint (
571 (Atapi
->PrimarySecondary
== 1) ? L
"Secondary" : L
"Primary",
572 (Atapi
->SlaveMaster
== 1) ? L
"Slave" : L
"Master",
579 Converts a SCSI device path structure to its string representative.
581 @param Str The string representative of input device.
582 @param DevPath The input device path structure.
583 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
584 of the display node is used, where applicable. If DisplayOnly
585 is FALSE, then the longer text representation of the display node
587 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
588 representation for a device node can be used, where applicable.
593 IN OUT POOL_PRINT
*Str
,
595 IN BOOLEAN DisplayOnly
,
596 IN BOOLEAN AllowShortcuts
599 SCSI_DEVICE_PATH
*Scsi
;
602 UefiDevicePathLibCatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
606 Converts a Fibre device path structure to its string representative.
608 @param Str The string representative of input device.
609 @param DevPath The input device path structure.
610 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
611 of the display node is used, where applicable. If DisplayOnly
612 is FALSE, then the longer text representation of the display node
614 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
615 representation for a device node can be used, where applicable.
620 IN OUT POOL_PRINT
*Str
,
622 IN BOOLEAN DisplayOnly
,
623 IN BOOLEAN AllowShortcuts
626 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
629 UefiDevicePathLibCatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
633 Converts a FibreEx device path structure to its string representative.
635 @param Str The string representative of input device.
636 @param DevPath The input device path structure.
637 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
638 of the display node is used, where applicable. If DisplayOnly
639 is FALSE, then the longer text representation of the display node
641 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
642 representation for a device node can be used, where applicable.
646 DevPathToTextFibreEx (
647 IN OUT POOL_PRINT
*Str
,
649 IN BOOLEAN DisplayOnly
,
650 IN BOOLEAN AllowShortcuts
653 FIBRECHANNELEX_DEVICE_PATH
*FibreEx
;
657 UefiDevicePathLibCatPrint (Str
, L
"FibreEx(0x");
658 for (Index
= 0; Index
< sizeof (FibreEx
->WWN
) / sizeof (FibreEx
->WWN
[0]); Index
++) {
659 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->WWN
[Index
]);
661 UefiDevicePathLibCatPrint (Str
, L
",0x");
662 for (Index
= 0; Index
< sizeof (FibreEx
->Lun
) / sizeof (FibreEx
->Lun
[0]); Index
++) {
663 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->Lun
[Index
]);
665 UefiDevicePathLibCatPrint (Str
, L
")");
669 Converts a Sas Ex device path structure to its string representative.
671 @param Str The string representative of input device.
672 @param DevPath The input device path structure.
673 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
674 of the display node is used, where applicable. If DisplayOnly
675 is FALSE, then the longer text representation of the display node
677 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
678 representation for a device node can be used, where applicable.
683 IN OUT POOL_PRINT
*Str
,
685 IN BOOLEAN DisplayOnly
,
686 IN BOOLEAN AllowShortcuts
689 SASEX_DEVICE_PATH
*SasEx
;
693 UefiDevicePathLibCatPrint (Str
, L
"SasEx(0x");
695 for (Index
= 0; Index
< sizeof (SasEx
->SasAddress
) / sizeof (SasEx
->SasAddress
[0]); Index
++) {
696 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->SasAddress
[Index
]);
698 UefiDevicePathLibCatPrint (Str
, L
",0x");
699 for (Index
= 0; Index
< sizeof (SasEx
->Lun
) / sizeof (SasEx
->Lun
[0]); Index
++) {
700 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->Lun
[Index
]);
702 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", SasEx
->RelativeTargetPort
);
704 if (((SasEx
->DeviceTopology
& 0x0f) == 0) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
705 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0");
706 } else if (((SasEx
->DeviceTopology
& 0x0f) <= 2) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
707 UefiDevicePathLibCatPrint (
710 ((SasEx
->DeviceTopology
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
711 ((SasEx
->DeviceTopology
& BIT5
) != 0) ? L
"External" : L
"Internal",
712 ((SasEx
->DeviceTopology
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
714 if ((SasEx
->DeviceTopology
& 0x0f) == 1) {
715 UefiDevicePathLibCatPrint (Str
, L
"0");
718 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
720 UefiDevicePathLibCatPrint (Str
, L
"0x%x", ((SasEx
->DeviceTopology
>> 8) & 0xff) + 1);
723 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0", SasEx
->DeviceTopology
);
726 UefiDevicePathLibCatPrint (Str
, L
")");
732 Converts a NVM Express Namespace device path structure to its string representative.
734 @param Str The string representative of input device.
735 @param DevPath The input device path structure.
736 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
737 of the display node is used, where applicable. If DisplayOnly
738 is FALSE, then the longer text representation of the display node
740 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
741 representation for a device node can be used, where applicable.
746 IN OUT POOL_PRINT
*Str
,
748 IN BOOLEAN DisplayOnly
,
749 IN BOOLEAN AllowShortcuts
752 NVME_NAMESPACE_DEVICE_PATH
*Nvme
;
756 Uuid
= (UINT8
*) &Nvme
->NamespaceUuid
;
757 UefiDevicePathLibCatPrint (
759 L
"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",
761 Uuid
[7], Uuid
[6], Uuid
[5], Uuid
[4],
762 Uuid
[3], Uuid
[2], Uuid
[1], Uuid
[0]
767 Converts a UFS device path structure to its string representative.
769 @param Str The string representative of input device.
770 @param DevPath The input device path structure.
771 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
772 of the display node is used, where applicable. If DisplayOnly
773 is FALSE, then the longer text representation of the display node
775 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
776 representation for a device node can be used, where applicable.
781 IN OUT POOL_PRINT
*Str
,
783 IN BOOLEAN DisplayOnly
,
784 IN BOOLEAN AllowShortcuts
787 UFS_DEVICE_PATH
*Ufs
;
790 UefiDevicePathLibCatPrint (Str
, L
"UFS(0x%x,0x%x)", Ufs
->Pun
, Ufs
->Lun
);
794 Converts a SD (Secure Digital) device path structure to its string representative.
796 @param Str The string representative of input device.
797 @param DevPath The input device path structure.
798 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
799 of the display node is used, where applicable. If DisplayOnly
800 is FALSE, then the longer text representation of the display node
802 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
803 representation for a device node can be used, where applicable.
808 IN OUT POOL_PRINT
*Str
,
810 IN BOOLEAN DisplayOnly
,
811 IN BOOLEAN AllowShortcuts
817 UefiDevicePathLibCatPrint (
825 Converts a 1394 device path structure to its string representative.
827 @param Str The string representative of input device.
828 @param DevPath The input device path structure.
829 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
830 of the display node is used, where applicable. If DisplayOnly
831 is FALSE, then the longer text representation of the display node
833 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
834 representation for a device node can be used, where applicable.
839 IN OUT POOL_PRINT
*Str
,
841 IN BOOLEAN DisplayOnly
,
842 IN BOOLEAN AllowShortcuts
845 F1394_DEVICE_PATH
*F1394DevPath
;
847 F1394DevPath
= DevPath
;
849 // Guid has format of IEEE-EUI64
851 UefiDevicePathLibCatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
855 Converts a USB device path structure to its string representative.
857 @param Str The string representative of input device.
858 @param DevPath The input device path structure.
859 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
860 of the display node is used, where applicable. If DisplayOnly
861 is FALSE, then the longer text representation of the display node
863 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
864 representation for a device node can be used, where applicable.
869 IN OUT POOL_PRINT
*Str
,
871 IN BOOLEAN DisplayOnly
,
872 IN BOOLEAN AllowShortcuts
875 USB_DEVICE_PATH
*Usb
;
878 UefiDevicePathLibCatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
882 Converts a USB WWID device path structure to its string representative.
884 @param Str The string representative of input device.
885 @param DevPath The input device path structure.
886 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
887 of the display node is used, where applicable. If DisplayOnly
888 is FALSE, then the longer text representation of the display node
890 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
891 representation for a device node can be used, where applicable.
895 DevPathToTextUsbWWID (
896 IN OUT POOL_PRINT
*Str
,
898 IN BOOLEAN DisplayOnly
,
899 IN BOOLEAN AllowShortcuts
902 USB_WWID_DEVICE_PATH
*UsbWWId
;
903 CHAR16
*SerialNumberStr
;
909 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
910 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
911 if (SerialNumberStr
[Length
- 1] != 0) {
913 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
915 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
916 ASSERT (NewStr
!= NULL
);
918 SerialNumberStr
= NewStr
;
921 UefiDevicePathLibCatPrint (
923 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
926 UsbWWId
->InterfaceNumber
,
932 Converts a Logic Unit device path structure to its string representative.
934 @param Str The string representative of input device.
935 @param DevPath The input device path structure.
936 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
937 of the display node is used, where applicable. If DisplayOnly
938 is FALSE, then the longer text representation of the display node
940 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
941 representation for a device node can be used, where applicable.
945 DevPathToTextLogicalUnit (
946 IN OUT POOL_PRINT
*Str
,
948 IN BOOLEAN DisplayOnly
,
949 IN BOOLEAN AllowShortcuts
952 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
954 LogicalUnit
= DevPath
;
955 UefiDevicePathLibCatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
959 Converts a USB class device path structure to its string representative.
961 @param Str The string representative of input device.
962 @param DevPath The input device path structure.
963 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
964 of the display node is used, where applicable. If DisplayOnly
965 is FALSE, then the longer text representation of the display node
967 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
968 representation for a device node can be used, where applicable.
972 DevPathToTextUsbClass (
973 IN OUT POOL_PRINT
*Str
,
975 IN BOOLEAN DisplayOnly
,
976 IN BOOLEAN AllowShortcuts
979 USB_CLASS_DEVICE_PATH
*UsbClass
;
980 BOOLEAN IsKnownSubClass
;
985 IsKnownSubClass
= TRUE
;
986 switch (UsbClass
->DeviceClass
) {
987 case USB_CLASS_AUDIO
:
988 UefiDevicePathLibCatPrint (Str
, L
"UsbAudio");
991 case USB_CLASS_CDCCONTROL
:
992 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCControl");
996 UefiDevicePathLibCatPrint (Str
, L
"UsbHID");
999 case USB_CLASS_IMAGE
:
1000 UefiDevicePathLibCatPrint (Str
, L
"UsbImage");
1003 case USB_CLASS_PRINTER
:
1004 UefiDevicePathLibCatPrint (Str
, L
"UsbPrinter");
1007 case USB_CLASS_MASS_STORAGE
:
1008 UefiDevicePathLibCatPrint (Str
, L
"UsbMassStorage");
1012 UefiDevicePathLibCatPrint (Str
, L
"UsbHub");
1015 case USB_CLASS_CDCDATA
:
1016 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCData");
1019 case USB_CLASS_SMART_CARD
:
1020 UefiDevicePathLibCatPrint (Str
, L
"UsbSmartCard");
1023 case USB_CLASS_VIDEO
:
1024 UefiDevicePathLibCatPrint (Str
, L
"UsbVideo");
1027 case USB_CLASS_DIAGNOSTIC
:
1028 UefiDevicePathLibCatPrint (Str
, L
"UsbDiagnostic");
1031 case USB_CLASS_WIRELESS
:
1032 UefiDevicePathLibCatPrint (Str
, L
"UsbWireless");
1036 IsKnownSubClass
= FALSE
;
1040 if (IsKnownSubClass
) {
1041 UefiDevicePathLibCatPrint (
1043 L
"(0x%x,0x%x,0x%x,0x%x)",
1045 UsbClass
->ProductId
,
1046 UsbClass
->DeviceSubClass
,
1047 UsbClass
->DeviceProtocol
1052 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
1053 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
1054 UefiDevicePathLibCatPrint (
1056 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
1058 UsbClass
->ProductId
,
1059 UsbClass
->DeviceProtocol
1062 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
1063 UefiDevicePathLibCatPrint (
1065 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
1067 UsbClass
->ProductId
,
1068 UsbClass
->DeviceProtocol
1071 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
1072 UefiDevicePathLibCatPrint (
1074 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
1076 UsbClass
->ProductId
,
1077 UsbClass
->DeviceProtocol
1083 UefiDevicePathLibCatPrint (
1085 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
1087 UsbClass
->ProductId
,
1088 UsbClass
->DeviceClass
,
1089 UsbClass
->DeviceSubClass
,
1090 UsbClass
->DeviceProtocol
1095 Converts a SATA device path structure to its string representative.
1097 @param Str The string representative of input device.
1098 @param DevPath The input device path structure.
1099 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1100 of the display node is used, where applicable. If DisplayOnly
1101 is FALSE, then the longer text representation of the display node
1103 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1104 representation for a device node can be used, where applicable.
1109 IN OUT POOL_PRINT
*Str
,
1111 IN BOOLEAN DisplayOnly
,
1112 IN BOOLEAN AllowShortcuts
1115 SATA_DEVICE_PATH
*Sata
;
1118 UefiDevicePathLibCatPrint (
1120 L
"Sata(0x%x,0x%x,0x%x)",
1121 Sata
->HBAPortNumber
,
1122 Sata
->PortMultiplierPortNumber
,
1128 Converts a I20 device path structure to its string representative.
1130 @param Str The string representative of input device.
1131 @param DevPath The input device path structure.
1132 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1133 of the display node is used, where applicable. If DisplayOnly
1134 is FALSE, then the longer text representation of the display node
1136 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1137 representation for a device node can be used, where applicable.
1142 IN OUT POOL_PRINT
*Str
,
1144 IN BOOLEAN DisplayOnly
,
1145 IN BOOLEAN AllowShortcuts
1148 I2O_DEVICE_PATH
*I2ODevPath
;
1150 I2ODevPath
= DevPath
;
1151 UefiDevicePathLibCatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1155 Converts a MAC address device path structure to its string representative.
1157 @param Str The string representative of input device.
1158 @param DevPath The input device path structure.
1159 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1160 of the display node is used, where applicable. If DisplayOnly
1161 is FALSE, then the longer text representation of the display node
1163 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1164 representation for a device node can be used, where applicable.
1168 DevPathToTextMacAddr (
1169 IN OUT POOL_PRINT
*Str
,
1171 IN BOOLEAN DisplayOnly
,
1172 IN BOOLEAN AllowShortcuts
1175 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1176 UINTN HwAddressSize
;
1179 MacDevPath
= DevPath
;
1181 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1182 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1186 UefiDevicePathLibCatPrint (Str
, L
"MAC(");
1188 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1189 UefiDevicePathLibCatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1192 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1196 Converts network protocol string to its text representation.
1198 @param Str The string representative of input device.
1199 @param Protocol The network protocol ID.
1203 CatNetworkProtocol (
1204 IN OUT POOL_PRINT
*Str
,
1208 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1209 UefiDevicePathLibCatPrint (Str
, L
"TCP");
1210 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1211 UefiDevicePathLibCatPrint (Str
, L
"UDP");
1213 UefiDevicePathLibCatPrint (Str
, L
"0x%x", Protocol
);
1218 Converts IP v4 address to its text representation.
1220 @param Str The string representative of input device.
1221 @param Address The IP v4 address.
1225 IN OUT POOL_PRINT
*Str
,
1226 IN EFI_IPv4_ADDRESS
*Address
1229 UefiDevicePathLibCatPrint (Str
, L
"%d.%d.%d.%d", Address
->Addr
[0], Address
->Addr
[1], Address
->Addr
[2], Address
->Addr
[3]);
1233 Converts IP v6 address to its text representation.
1235 @param Str The string representative of input device.
1236 @param Address The IP v6 address.
1240 IN OUT POOL_PRINT
*Str
,
1241 IN EFI_IPv6_ADDRESS
*Address
1244 UefiDevicePathLibCatPrint (
1245 Str
, L
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1246 Address
->Addr
[0], Address
->Addr
[1],
1247 Address
->Addr
[2], Address
->Addr
[3],
1248 Address
->Addr
[4], Address
->Addr
[5],
1249 Address
->Addr
[6], Address
->Addr
[7],
1250 Address
->Addr
[8], Address
->Addr
[9],
1251 Address
->Addr
[10], Address
->Addr
[11],
1252 Address
->Addr
[12], Address
->Addr
[13],
1253 Address
->Addr
[14], Address
->Addr
[15]
1258 Converts a IPv4 device path structure to its string representative.
1260 @param Str The string representative of input device.
1261 @param DevPath The input device path structure.
1262 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1263 of the display node is used, where applicable. If DisplayOnly
1264 is FALSE, then the longer text representation of the display node
1266 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1267 representation for a device node can be used, where applicable.
1272 IN OUT POOL_PRINT
*Str
,
1274 IN BOOLEAN DisplayOnly
,
1275 IN BOOLEAN AllowShortcuts
1278 IPv4_DEVICE_PATH
*IPDevPath
;
1280 IPDevPath
= DevPath
;
1281 UefiDevicePathLibCatPrint (Str
, L
"IPv4(");
1282 CatIPv4Address (Str
, &IPDevPath
->RemoteIpAddress
);
1285 UefiDevicePathLibCatPrint (Str
, L
")");
1289 UefiDevicePathLibCatPrint (Str
, L
",");
1290 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1292 UefiDevicePathLibCatPrint (Str
, L
",%s,", IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP");
1293 CatIPv4Address (Str
, &IPDevPath
->LocalIpAddress
);
1294 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1295 UefiDevicePathLibCatPrint (Str
, L
",");
1296 CatIPv4Address (Str
, &IPDevPath
->GatewayIpAddress
);
1297 UefiDevicePathLibCatPrint (Str
, L
",");
1298 CatIPv4Address (Str
, &IPDevPath
->SubnetMask
);
1300 UefiDevicePathLibCatPrint (Str
, L
")");
1304 Converts a IPv6 device path structure to its string representative.
1306 @param Str The string representative of input device.
1307 @param DevPath The input device path structure.
1308 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1309 of the display node is used, where applicable. If DisplayOnly
1310 is FALSE, then the longer text representation of the display node
1312 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1313 representation for a device node can be used, where applicable.
1318 IN OUT POOL_PRINT
*Str
,
1320 IN BOOLEAN DisplayOnly
,
1321 IN BOOLEAN AllowShortcuts
1324 IPv6_DEVICE_PATH
*IPDevPath
;
1326 IPDevPath
= DevPath
;
1327 UefiDevicePathLibCatPrint (Str
, L
"IPv6(");
1328 CatIPv6Address (Str
, &IPDevPath
->RemoteIpAddress
);
1330 UefiDevicePathLibCatPrint (Str
, L
")");
1334 UefiDevicePathLibCatPrint (Str
, L
",");
1335 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1337 switch (IPDevPath
->IpAddressOrigin
) {
1339 UefiDevicePathLibCatPrint (Str
, L
",Static,");
1342 UefiDevicePathLibCatPrint (Str
, L
",StatelessAutoConfigure,");
1345 UefiDevicePathLibCatPrint (Str
, L
",StatefulAutoConfigure,");
1349 CatIPv6Address (Str
, &IPDevPath
->LocalIpAddress
);
1351 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1352 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", IPDevPath
->PrefixLength
);
1353 CatIPv6Address (Str
, &IPDevPath
->GatewayIpAddress
);
1355 UefiDevicePathLibCatPrint (Str
, L
")");
1359 Converts an Infini Band 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 DevPathToTextInfiniBand (
1373 IN OUT POOL_PRINT
*Str
,
1375 IN BOOLEAN DisplayOnly
,
1376 IN BOOLEAN AllowShortcuts
1379 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1381 InfiniBand
= DevPath
;
1382 UefiDevicePathLibCatPrint (
1384 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1385 InfiniBand
->ResourceFlags
,
1386 InfiniBand
->PortGid
,
1387 InfiniBand
->ServiceId
,
1388 InfiniBand
->TargetPortId
,
1389 InfiniBand
->DeviceId
1394 Converts a UART device path structure to its string representative.
1396 @param Str The string representative of input device.
1397 @param DevPath The input device path structure.
1398 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1399 of the display node is used, where applicable. If DisplayOnly
1400 is FALSE, then the longer text representation of the display node
1402 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1403 representation for a device node can be used, where applicable.
1408 IN OUT POOL_PRINT
*Str
,
1410 IN BOOLEAN DisplayOnly
,
1411 IN BOOLEAN AllowShortcuts
1414 UART_DEVICE_PATH
*Uart
;
1418 switch (Uart
->Parity
) {
1448 if (Uart
->BaudRate
== 0) {
1449 UefiDevicePathLibCatPrint (Str
, L
"Uart(DEFAULT,");
1451 UefiDevicePathLibCatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1454 if (Uart
->DataBits
== 0) {
1455 UefiDevicePathLibCatPrint (Str
, L
"DEFAULT,");
1457 UefiDevicePathLibCatPrint (Str
, L
"%d,", Uart
->DataBits
);
1460 UefiDevicePathLibCatPrint (Str
, L
"%c,", Parity
);
1462 switch (Uart
->StopBits
) {
1464 UefiDevicePathLibCatPrint (Str
, L
"D)");
1468 UefiDevicePathLibCatPrint (Str
, L
"1)");
1472 UefiDevicePathLibCatPrint (Str
, L
"1.5)");
1476 UefiDevicePathLibCatPrint (Str
, L
"2)");
1480 UefiDevicePathLibCatPrint (Str
, L
"x)");
1486 Converts an iSCSI device path structure to its string representative.
1488 @param Str The string representative of input device.
1489 @param DevPath The input device path structure.
1490 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1491 of the display node is used, where applicable. If DisplayOnly
1492 is FALSE, then the longer text representation of the display node
1494 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1495 representation for a device node can be used, where applicable.
1499 DevPathToTextiSCSI (
1500 IN OUT POOL_PRINT
*Str
,
1502 IN BOOLEAN DisplayOnly
,
1503 IN BOOLEAN AllowShortcuts
1506 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1509 ISCSIDevPath
= DevPath
;
1510 UefiDevicePathLibCatPrint (
1512 L
"iSCSI(%a,0x%x,0x%lx,",
1513 ISCSIDevPath
->TargetName
,
1514 ISCSIDevPath
->TargetPortalGroupTag
,
1518 Options
= ISCSIDevPath
->LoginOption
;
1519 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1520 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1521 if (((Options
>> 11) & 0x0001) != 0) {
1522 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"None");
1523 } else if (((Options
>> 12) & 0x0001) != 0) {
1524 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1526 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_BI");
1530 UefiDevicePathLibCatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1534 Converts a VLAN device path structure to its string representative.
1536 @param Str The string representative of input device.
1537 @param DevPath The input device path structure.
1538 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1539 of the display node is used, where applicable. If DisplayOnly
1540 is FALSE, then the longer text representation of the display node
1542 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1543 representation for a device node can be used, where applicable.
1548 IN OUT POOL_PRINT
*Str
,
1550 IN BOOLEAN DisplayOnly
,
1551 IN BOOLEAN AllowShortcuts
1554 VLAN_DEVICE_PATH
*Vlan
;
1557 UefiDevicePathLibCatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1561 Converts a Bluetooth device path structure to its string representative.
1563 @param Str The string representative of input device.
1564 @param DevPath The input device path structure.
1565 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1566 of the display node is used, where applicable. If DisplayOnly
1567 is FALSE, then the longer text representation of the display node
1569 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1570 representation for a device node can be used, where applicable.
1574 DevPathToTextBluetooth (
1575 IN OUT POOL_PRINT
*Str
,
1577 IN BOOLEAN DisplayOnly
,
1578 IN BOOLEAN AllowShortcuts
1581 BLUETOOTH_DEVICE_PATH
*Bluetooth
;
1583 Bluetooth
= DevPath
;
1584 UefiDevicePathLibCatPrint (
1586 L
"Bluetooth(%02x:%02x:%02x:%02x:%02x:%02x)",
1587 Bluetooth
->BD_ADDR
.Address
[5],
1588 Bluetooth
->BD_ADDR
.Address
[4],
1589 Bluetooth
->BD_ADDR
.Address
[3],
1590 Bluetooth
->BD_ADDR
.Address
[2],
1591 Bluetooth
->BD_ADDR
.Address
[1],
1592 Bluetooth
->BD_ADDR
.Address
[0]
1597 Converts a Wi-Fi device path structure to its string representative.
1599 @param Str The string representative of input device.
1600 @param DevPath The input device path structure.
1601 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1602 of the display node is used, where applicable. If DisplayOnly
1603 is FALSE, then the longer text representation of the display node
1605 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1606 representation for a device node can be used, where applicable.
1611 IN OUT POOL_PRINT
*Str
,
1613 IN BOOLEAN DisplayOnly
,
1614 IN BOOLEAN AllowShortcuts
1617 WIFI_DEVICE_PATH
*WiFi
;
1620 UefiDevicePathLibCatPrint (Str
, L
"WiFi(%a)", WiFi
->SSId
);
1624 Converts a URI device path structure to its string representative.
1626 @param Str The string representative of input device.
1627 @param DevPath The input device path structure.
1628 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1629 of the display node is used, where applicable. If DisplayOnly
1630 is FALSE, then the longer text representation of the display node
1632 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1633 representation for a device node can be used, where applicable.
1638 IN OUT POOL_PRINT
*Str
,
1640 IN BOOLEAN DisplayOnly
,
1641 IN BOOLEAN AllowShortcuts
1644 URI_DEVICE_PATH
*Uri
;
1649 // Uri in the device path may not be null terminated.
1652 UriLength
= DevicePathNodeLength (Uri
) - sizeof (URI_DEVICE_PATH
);
1653 UriStr
= AllocatePool (UriLength
+ 1);
1654 ASSERT (UriStr
!= NULL
);
1656 CopyMem (UriStr
, Uri
->Uri
, UriLength
);
1657 UriStr
[UriLength
] = '\0';
1658 UefiDevicePathLibCatPrint (Str
, L
"Uri(%a)", UriStr
);
1663 Converts a Hard drive device path structure to its string representative.
1665 @param Str The string representative of input device.
1666 @param DevPath The input device path structure.
1667 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1668 of the display node is used, where applicable. If DisplayOnly
1669 is FALSE, then the longer text representation of the display node
1671 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1672 representation for a device node can be used, where applicable.
1676 DevPathToTextHardDrive (
1677 IN OUT POOL_PRINT
*Str
,
1679 IN BOOLEAN DisplayOnly
,
1680 IN BOOLEAN AllowShortcuts
1683 HARDDRIVE_DEVICE_PATH
*Hd
;
1686 switch (Hd
->SignatureType
) {
1687 case SIGNATURE_TYPE_MBR
:
1688 UefiDevicePathLibCatPrint (
1690 L
"HD(%d,%s,0x%08x,",
1691 Hd
->PartitionNumber
,
1693 *((UINT32
*) (&(Hd
->Signature
[0])))
1697 case SIGNATURE_TYPE_GUID
:
1698 UefiDevicePathLibCatPrint (
1701 Hd
->PartitionNumber
,
1703 (EFI_GUID
*) &(Hd
->Signature
[0])
1708 UefiDevicePathLibCatPrint (
1711 Hd
->PartitionNumber
,
1717 UefiDevicePathLibCatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1721 Converts a CDROM device path structure to its string representative.
1723 @param Str The string representative of input device.
1724 @param DevPath The input device path structure.
1725 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1726 of the display node is used, where applicable. If DisplayOnly
1727 is FALSE, then the longer text representation of the display node
1729 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1730 representation for a device node can be used, where applicable.
1734 DevPathToTextCDROM (
1735 IN OUT POOL_PRINT
*Str
,
1737 IN BOOLEAN DisplayOnly
,
1738 IN BOOLEAN AllowShortcuts
1741 CDROM_DEVICE_PATH
*Cd
;
1745 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1749 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1753 Converts a File device path structure to its string representative.
1755 @param Str The string representative of input device.
1756 @param DevPath The input device path structure.
1757 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1758 of the display node is used, where applicable. If DisplayOnly
1759 is FALSE, then the longer text representation of the display node
1761 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1762 representation for a device node can be used, where applicable.
1766 DevPathToTextFilePath (
1767 IN OUT POOL_PRINT
*Str
,
1769 IN BOOLEAN DisplayOnly
,
1770 IN BOOLEAN AllowShortcuts
1773 FILEPATH_DEVICE_PATH
*Fp
;
1776 UefiDevicePathLibCatPrint (Str
, L
"%s", Fp
->PathName
);
1780 Converts a Media protocol device path structure to its string representative.
1782 @param Str The string representative of input device.
1783 @param DevPath The input device path structure.
1784 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1785 of the display node is used, where applicable. If DisplayOnly
1786 is FALSE, then the longer text representation of the display node
1788 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1789 representation for a device node can be used, where applicable.
1793 DevPathToTextMediaProtocol (
1794 IN OUT POOL_PRINT
*Str
,
1796 IN BOOLEAN DisplayOnly
,
1797 IN BOOLEAN AllowShortcuts
1800 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1802 MediaProt
= DevPath
;
1803 UefiDevicePathLibCatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1807 Converts a Firmware Volume device path structure to its string representative.
1809 @param Str The string representative of input device.
1810 @param DevPath The input device path structure.
1811 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1812 of the display node is used, where applicable. If DisplayOnly
1813 is FALSE, then the longer text representation of the display node
1815 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1816 representation for a device node can be used, where applicable.
1821 IN OUT POOL_PRINT
*Str
,
1823 IN BOOLEAN DisplayOnly
,
1824 IN BOOLEAN AllowShortcuts
1827 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1830 UefiDevicePathLibCatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1834 Converts a Firmware Volume File device path structure to its string representative.
1836 @param Str The string representative of input device.
1837 @param DevPath The input device path structure.
1838 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1839 of the display node is used, where applicable. If DisplayOnly
1840 is FALSE, then the longer text representation of the display node
1842 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1843 representation for a device node can be used, where applicable.
1847 DevPathToTextFvFile (
1848 IN OUT POOL_PRINT
*Str
,
1850 IN BOOLEAN DisplayOnly
,
1851 IN BOOLEAN AllowShortcuts
1854 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1857 UefiDevicePathLibCatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1861 Converts a Relative Offset device path structure to its string representative.
1863 @param Str The string representative of input device.
1864 @param DevPath The input device path structure.
1865 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1866 of the display node is used, where applicable. If DisplayOnly
1867 is FALSE, then the longer text representation of the display node
1869 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1870 representation for a device node can be used, where applicable.
1874 DevPathRelativeOffsetRange (
1875 IN OUT POOL_PRINT
*Str
,
1877 IN BOOLEAN DisplayOnly
,
1878 IN BOOLEAN AllowShortcuts
1881 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1884 UefiDevicePathLibCatPrint (
1886 L
"Offset(0x%lx,0x%lx)",
1887 Offset
->StartingOffset
,
1888 Offset
->EndingOffset
1893 Converts a Ram Disk 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 DevPathToTextRamDisk (
1907 IN OUT POOL_PRINT
*Str
,
1909 IN BOOLEAN DisplayOnly
,
1910 IN BOOLEAN AllowShortcuts
1913 MEDIA_RAM_DISK_DEVICE_PATH
*RamDisk
;
1917 if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualDiskGuid
)) {
1918 UefiDevicePathLibCatPrint (
1920 L
"VirtualDisk(0x%lx,0x%lx,%d)",
1921 RShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1922 RShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1925 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualCdGuid
)) {
1926 UefiDevicePathLibCatPrint (
1928 L
"VirtualCD(0x%lx,0x%lx,%d)",
1929 RShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1930 RShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1933 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualDiskGuid
)) {
1934 UefiDevicePathLibCatPrint (
1936 L
"PersistentVirtualDisk(0x%lx,0x%lx,%d)",
1937 RShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1938 RShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1941 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualCdGuid
)) {
1942 UefiDevicePathLibCatPrint (
1944 L
"PersistentVirtualCD(0x%lx,0x%lx,%d)",
1945 RShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1946 RShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1950 UefiDevicePathLibCatPrint (
1952 L
"RamDisk(0x%lx,0x%lx,%d,%g)",
1953 RShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1954 RShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1962 Converts a BIOS Boot Specification device path structure to its string representative.
1964 @param Str The string representative of input device.
1965 @param DevPath The input device path structure.
1966 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1967 of the display node is used, where applicable. If DisplayOnly
1968 is FALSE, then the longer text representation of the display node
1970 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1971 representation for a device node can be used, where applicable.
1976 IN OUT POOL_PRINT
*Str
,
1978 IN BOOLEAN DisplayOnly
,
1979 IN BOOLEAN AllowShortcuts
1982 BBS_BBS_DEVICE_PATH
*Bbs
;
1986 switch (Bbs
->DeviceType
) {
1987 case BBS_TYPE_FLOPPY
:
1991 case BBS_TYPE_HARDDRIVE
:
1995 case BBS_TYPE_CDROM
:
1999 case BBS_TYPE_PCMCIA
:
2007 case BBS_TYPE_EMBEDDED_NETWORK
:
2017 UefiDevicePathLibCatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
2019 UefiDevicePathLibCatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
2023 UefiDevicePathLibCatPrint (Str
, L
")");
2027 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
2031 Converts an End-of-Device-Path structure to its string representative.
2033 @param Str The string representative of input device.
2034 @param DevPath The input device path structure.
2035 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2036 of the display node is used, where applicable. If DisplayOnly
2037 is FALSE, then the longer text representation of the display node
2039 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2040 representation for a device node can be used, where applicable.
2044 DevPathToTextEndInstance (
2045 IN OUT POOL_PRINT
*Str
,
2047 IN BOOLEAN DisplayOnly
,
2048 IN BOOLEAN AllowShortcuts
2051 UefiDevicePathLibCatPrint (Str
, L
",");
2054 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric
[] = {
2055 {HARDWARE_DEVICE_PATH
, L
"HardwarePath" },
2056 {ACPI_DEVICE_PATH
, L
"AcpiPath" },
2057 {MESSAGING_DEVICE_PATH
, L
"Msg" },
2058 {MEDIA_DEVICE_PATH
, L
"MediaPath" },
2059 {BBS_DEVICE_PATH
, L
"BbsPath" },
2064 Converts an unknown device path structure to its string representative.
2066 @param Str The string representative of input device.
2067 @param DevPath The input device path structure.
2068 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2069 of the display node is used, where applicable. If DisplayOnly
2070 is FALSE, then the longer text representation of the display node
2072 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2073 representation for a device node can be used, where applicable.
2077 DevPathToTextNodeGeneric (
2078 IN OUT POOL_PRINT
*Str
,
2080 IN BOOLEAN DisplayOnly
,
2081 IN BOOLEAN AllowShortcuts
2084 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2089 for (Index
= 0; mUefiDevicePathLibToTextTableGeneric
[Index
].Text
!= NULL
; Index
++) {
2090 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTableGeneric
[Index
].Type
) {
2095 if (mUefiDevicePathLibToTextTableGeneric
[Index
].Text
== NULL
) {
2097 // It's a node whose type cannot be recognized
2099 UefiDevicePathLibCatPrint (Str
, L
"Path(%d,%d", DevicePathType (Node
), DevicePathSubType (Node
));
2102 // It's a node whose type can be recognized
2104 UefiDevicePathLibCatPrint (Str
, L
"%s(%d", mUefiDevicePathLibToTextTableGeneric
[Index
].Text
, DevicePathSubType (Node
));
2107 Index
= sizeof (EFI_DEVICE_PATH_PROTOCOL
);
2108 if (Index
< DevicePathNodeLength (Node
)) {
2109 UefiDevicePathLibCatPrint (Str
, L
",");
2110 for (; Index
< DevicePathNodeLength (Node
); Index
++) {
2111 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*) Node
)[Index
]);
2115 UefiDevicePathLibCatPrint (Str
, L
")");
2118 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable
[] = {
2119 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
2120 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
2121 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
2122 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
2123 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
2124 {HARDWARE_DEVICE_PATH
, HW_BMC_DP
, DevPathToTextBmc
},
2125 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
2126 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
2127 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
2128 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
2129 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
2130 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
2131 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
2132 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
2133 {MESSAGING_DEVICE_PATH
, MSG_NVME_NAMESPACE_DP
, DevPathToTextNVMe
},
2134 {MESSAGING_DEVICE_PATH
, MSG_UFS_DP
, DevPathToTextUfs
},
2135 {MESSAGING_DEVICE_PATH
, MSG_SD_DP
, DevPathToTextSd
},
2136 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
2137 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
2138 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
2139 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
2140 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
2141 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
2142 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
2143 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
2144 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
2145 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
2146 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
2147 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
2148 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
2149 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
2150 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
2151 {MESSAGING_DEVICE_PATH
, MSG_URI_DP
, DevPathToTextUri
},
2152 {MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_DP
, DevPathToTextBluetooth
},
2153 {MESSAGING_DEVICE_PATH
, MSG_WIFI_DP
, DevPathToTextWiFi
},
2154 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
2155 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
2156 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
2157 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
2158 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
2159 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
2160 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
2161 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
2162 {MEDIA_DEVICE_PATH
, MEDIA_RAM_DISK_DP
, DevPathToTextRamDisk
},
2163 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
2164 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
2169 Converts a device node to its string representation.
2171 @param DeviceNode A Pointer to the device node to be converted.
2172 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2173 of the display node is used, where applicable. If DisplayOnly
2174 is FALSE, then the longer text representation of the display node
2176 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2177 representation for a device node can be used, where applicable.
2179 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
2180 is NULL or there was insufficient memory.
2185 UefiDevicePathLibConvertDeviceNodeToText (
2186 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
2187 IN BOOLEAN DisplayOnly
,
2188 IN BOOLEAN AllowShortcuts
2193 DEVICE_PATH_TO_TEXT ToText
;
2195 if (DeviceNode
== NULL
) {
2199 ZeroMem (&Str
, sizeof (Str
));
2202 // Process the device path node
2203 // If not found, use a generic function
2205 ToText
= DevPathToTextNodeGeneric
;
2206 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
++) {
2207 if (DevicePathType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2208 DevicePathSubType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2210 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2218 ToText (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
2220 ASSERT (Str
.Str
!= NULL
);
2225 Converts a device path to its text representation.
2227 @param DevicePath A Pointer to the device to be converted.
2228 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2229 of the display node is used, where applicable. If DisplayOnly
2230 is FALSE, then the longer text representation of the display node
2232 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2233 representation for a device node can be used, where applicable.
2235 @return A pointer to the allocated text representation of the device path or
2236 NULL if DeviceNode is NULL or there was insufficient memory.
2241 UefiDevicePathLibConvertDevicePathToText (
2242 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
2243 IN BOOLEAN DisplayOnly
,
2244 IN BOOLEAN AllowShortcuts
2248 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2249 EFI_DEVICE_PATH_PROTOCOL
*AlignedNode
;
2251 DEVICE_PATH_TO_TEXT ToText
;
2253 if (DevicePath
== NULL
) {
2257 ZeroMem (&Str
, sizeof (Str
));
2260 // Process each device path node
2262 Node
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
2263 while (!IsDevicePathEnd (Node
)) {
2265 // Find the handler to dump this device path node
2266 // If not found, use a generic function
2268 ToText
= DevPathToTextNodeGeneric
;
2269 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
2271 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2272 DevicePathSubType (Node
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2274 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2279 // Put a path separator in if needed
2281 if ((Str
.Count
!= 0) && (ToText
!= DevPathToTextEndInstance
)) {
2282 if (Str
.Str
[Str
.Count
] != L
',') {
2283 UefiDevicePathLibCatPrint (&Str
, L
"/");
2287 AlignedNode
= AllocateCopyPool (DevicePathNodeLength (Node
), Node
);
2289 // Print this node of the device path
2291 ToText (&Str
, AlignedNode
, DisplayOnly
, AllowShortcuts
);
2292 FreePool (AlignedNode
);
2295 // Next device path node
2297 Node
= NextDevicePathNode (Node
);
2300 if (Str
.Str
== NULL
) {
2301 return AllocateZeroPool (sizeof (CHAR16
));