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 - 2015, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "UefiDevicePathLib.h"
19 Concatenates a formatted unicode string to allocated pool. The caller must
20 free the resulting buffer.
22 @param Str Tracks the allocated pool, size in use, and
23 amount of pool allocated.
24 @param Fmt The format string
25 @param ... Variable arguments based on the format string.
27 @return Allocated buffer with the formatted string printed in it.
28 The caller must free the allocated buffer. The buffer
29 allocation is not packed.
34 UefiDevicePathLibCatPrint (
35 IN OUT POOL_PRINT
*Str
,
44 Count
= SPrintLength (Fmt
, Args
);
46 if ((Str
->Count
+ (Count
+ 1)) * sizeof (CHAR16
) > Str
->Capacity
) {
47 Str
->Capacity
= (Str
->Count
+ (Count
+ 1) * 2) * sizeof (CHAR16
);
48 Str
->Str
= ReallocatePool (
49 Str
->Count
* sizeof (CHAR16
),
53 ASSERT (Str
->Str
!= NULL
);
55 UnicodeVSPrint (&Str
->Str
[Str
->Count
], Str
->Capacity
- Str
->Count
* sizeof (CHAR16
), Fmt
, Args
);
63 Converts a PCI device path structure to its string representative.
65 @param Str The string representative of input device.
66 @param DevPath The input device path structure.
67 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
68 of the display node is used, where applicable. If DisplayOnly
69 is FALSE, then the longer text representation of the display node
71 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
72 representation for a device node can be used, where applicable.
77 IN OUT POOL_PRINT
*Str
,
79 IN BOOLEAN DisplayOnly
,
80 IN BOOLEAN AllowShortcuts
86 UefiDevicePathLibCatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
90 Converts a PC Card device path structure to its string representative.
92 @param Str The string representative of input device.
93 @param DevPath The input device path structure.
94 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
95 of the display node is used, where applicable. If DisplayOnly
96 is FALSE, then the longer text representation of the display node
98 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
99 representation for a device node can be used, where applicable.
103 DevPathToTextPccard (
104 IN OUT POOL_PRINT
*Str
,
106 IN BOOLEAN DisplayOnly
,
107 IN BOOLEAN AllowShortcuts
110 PCCARD_DEVICE_PATH
*Pccard
;
113 UefiDevicePathLibCatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
117 Converts a Memory Map device path structure to its string representative.
119 @param Str The string representative of input device.
120 @param DevPath The input device path structure.
121 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
122 of the display node is used, where applicable. If DisplayOnly
123 is FALSE, then the longer text representation of the display node
125 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
126 representation for a device node can be used, where applicable.
130 DevPathToTextMemMap (
131 IN OUT POOL_PRINT
*Str
,
133 IN BOOLEAN DisplayOnly
,
134 IN BOOLEAN AllowShortcuts
137 MEMMAP_DEVICE_PATH
*MemMap
;
140 UefiDevicePathLibCatPrint (
142 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
144 MemMap
->StartingAddress
,
145 MemMap
->EndingAddress
150 Converts a Vendor device path structure to its string representative.
152 @param Str The string representative of input device.
153 @param DevPath The input device path structure.
154 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
155 of the display node is used, where applicable. If DisplayOnly
156 is FALSE, then the longer text representation of the display node
158 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
159 representation for a device node can be used, where applicable.
163 DevPathToTextVendor (
164 IN OUT POOL_PRINT
*Str
,
166 IN BOOLEAN DisplayOnly
,
167 IN BOOLEAN AllowShortcuts
170 VENDOR_DEVICE_PATH
*Vendor
;
174 UINT32 FlowControlMap
;
177 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
178 switch (DevicePathType (&Vendor
->Header
)) {
179 case HARDWARE_DEVICE_PATH
:
183 case MESSAGING_DEVICE_PATH
:
185 if (AllowShortcuts
) {
186 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
187 UefiDevicePathLibCatPrint (Str
, L
"VenPcAnsi()");
189 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
190 UefiDevicePathLibCatPrint (Str
, L
"VenVt100()");
192 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
193 UefiDevicePathLibCatPrint (Str
, L
"VenVt100Plus()");
195 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
196 UefiDevicePathLibCatPrint (Str
, L
"VenUft8()");
198 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
199 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
200 switch (FlowControlMap
& 0x00000003) {
202 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
206 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
210 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
218 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
219 UefiDevicePathLibCatPrint (
221 L
"SAS(0x%lx,0x%lx,0x%x,",
222 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
223 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
224 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
226 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
227 if (((Info
& 0x0f) == 0) && ((Info
& BIT7
) == 0)) {
228 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0,");
229 } else if (((Info
& 0x0f) <= 2) && ((Info
& BIT7
) == 0)) {
230 UefiDevicePathLibCatPrint (
233 ((Info
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
234 ((Info
& BIT5
) != 0) ? L
"External" : L
"Internal",
235 ((Info
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
237 if ((Info
& 0x0f) == 1) {
238 UefiDevicePathLibCatPrint (Str
, L
"0,");
241 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
243 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", ((Info
>> 8) & 0xff) + 1);
246 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0,", Info
);
249 UefiDevicePathLibCatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
251 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
252 UefiDevicePathLibCatPrint (Str
, L
"DebugPort()");
258 case MEDIA_DEVICE_PATH
:
267 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
268 UefiDevicePathLibCatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
269 if (DataLength
!= 0) {
270 UefiDevicePathLibCatPrint (Str
, L
",");
271 for (Index
= 0; Index
< DataLength
; Index
++) {
272 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
276 UefiDevicePathLibCatPrint (Str
, L
")");
280 Converts a Controller device path structure to its string representative.
282 @param Str The string representative of input device.
283 @param DevPath The input device path structure.
284 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
285 of the display node is used, where applicable. If DisplayOnly
286 is FALSE, then the longer text representation of the display node
288 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
289 representation for a device node can be used, where applicable.
293 DevPathToTextController (
294 IN OUT POOL_PRINT
*Str
,
296 IN BOOLEAN DisplayOnly
,
297 IN BOOLEAN AllowShortcuts
300 CONTROLLER_DEVICE_PATH
*Controller
;
302 Controller
= DevPath
;
303 UefiDevicePathLibCatPrint (
306 Controller
->ControllerNumber
311 Converts a BMC device path structure to its string representative.
313 @param Str The string representative of input device.
314 @param DevPath The input device path structure.
315 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
316 of the display node is used, where applicable. If DisplayOnly
317 is FALSE, then the longer text representation of the display node
319 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
320 representation for a device node can be used, where applicable.
325 IN OUT POOL_PRINT
*Str
,
327 IN BOOLEAN DisplayOnly
,
328 IN BOOLEAN AllowShortcuts
331 BMC_DEVICE_PATH
*Bmc
;
334 UefiDevicePathLibCatPrint (
338 ReadUnaligned64 ((UINT64
*) (&Bmc
->BaseAddress
))
343 Converts a ACPI device path structure to its string representative.
345 @param Str The string representative of input device.
346 @param DevPath The input device path structure.
347 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
348 of the display node is used, where applicable. If DisplayOnly
349 is FALSE, then the longer text representation of the display node
351 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
352 representation for a device node can be used, where applicable.
357 IN OUT POOL_PRINT
*Str
,
359 IN BOOLEAN DisplayOnly
,
360 IN BOOLEAN AllowShortcuts
363 ACPI_HID_DEVICE_PATH
*Acpi
;
366 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
367 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
369 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
373 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(0x%x)", Acpi
->UID
);
377 UefiDevicePathLibCatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
381 UefiDevicePathLibCatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
385 UefiDevicePathLibCatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
389 UefiDevicePathLibCatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
393 UefiDevicePathLibCatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
397 UefiDevicePathLibCatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
402 Converts a ACPI extended HID device path structure to its string representative.
404 @param Str The string representative of input device.
405 @param DevPath The input device path structure.
406 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
407 of the display node is used, where applicable. If DisplayOnly
408 is FALSE, then the longer text representation of the display node
410 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
411 representation for a device node can be used, where applicable.
415 DevPathToTextAcpiEx (
416 IN OUT POOL_PRINT
*Str
,
418 IN BOOLEAN DisplayOnly
,
419 IN BOOLEAN AllowShortcuts
422 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
430 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
431 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
432 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
435 // Converts EISA identification to string.
441 ((AcpiEx
->HID
>> 10) & 0x1f) + 'A' - 1,
442 ((AcpiEx
->HID
>> 5) & 0x1f) + 'A' - 1,
443 ((AcpiEx
->HID
>> 0) & 0x1f) + 'A' - 1,
444 (AcpiEx
->HID
>> 16) & 0xFFFF
450 ((AcpiEx
->CID
>> 10) & 0x1f) + 'A' - 1,
451 ((AcpiEx
->CID
>> 5) & 0x1f) + 'A' - 1,
452 ((AcpiEx
->CID
>> 0) & 0x1f) + 'A' - 1,
453 (AcpiEx
->CID
>> 16) & 0xFFFF
456 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (AcpiEx
->UID
== 0)) {
460 UefiDevicePathLibCatPrint (
462 L
"AcpiExp(%s,%s,%a)",
468 if (AllowShortcuts
) {
472 if (AcpiEx
->HID
== 0) {
473 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
475 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
478 if (AcpiEx
->UID
== 0) {
479 UefiDevicePathLibCatPrint (Str
, L
"%a,", UIDStr
);
481 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", AcpiEx
->UID
);
484 if (AcpiEx
->CID
== 0) {
485 UefiDevicePathLibCatPrint (Str
, L
"%a)", CIDStr
);
487 UefiDevicePathLibCatPrint (Str
, L
"%s)", CIDText
);
490 UefiDevicePathLibCatPrint (
492 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
505 Converts a ACPI address device path structure to its string representative.
507 @param Str The string representative of input device.
508 @param DevPath The input device path structure.
509 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
510 of the display node is used, where applicable. If DisplayOnly
511 is FALSE, then the longer text representation of the display node
513 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
514 representation for a device node can be used, where applicable.
518 DevPathToTextAcpiAdr (
519 IN OUT POOL_PRINT
*Str
,
521 IN BOOLEAN DisplayOnly
,
522 IN BOOLEAN AllowShortcuts
525 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
528 UINT16 AdditionalAdrCount
;
531 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
532 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
534 UefiDevicePathLibCatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
535 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
536 UefiDevicePathLibCatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
538 UefiDevicePathLibCatPrint (Str
, L
")");
542 Converts a ATAPI device path structure to its string representative.
544 @param Str The string representative of input device.
545 @param DevPath The input device path structure.
546 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
547 of the display node is used, where applicable. If DisplayOnly
548 is FALSE, then the longer text representation of the display node
550 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
551 representation for a device node can be used, where applicable.
556 IN OUT POOL_PRINT
*Str
,
558 IN BOOLEAN DisplayOnly
,
559 IN BOOLEAN AllowShortcuts
562 ATAPI_DEVICE_PATH
*Atapi
;
567 UefiDevicePathLibCatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
569 UefiDevicePathLibCatPrint (
572 (Atapi
->PrimarySecondary
== 1) ? L
"Secondary" : L
"Primary",
573 (Atapi
->SlaveMaster
== 1) ? L
"Slave" : L
"Master",
580 Converts a SCSI device path structure to its string representative.
582 @param Str The string representative of input device.
583 @param DevPath The input device path structure.
584 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
585 of the display node is used, where applicable. If DisplayOnly
586 is FALSE, then the longer text representation of the display node
588 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
589 representation for a device node can be used, where applicable.
594 IN OUT POOL_PRINT
*Str
,
596 IN BOOLEAN DisplayOnly
,
597 IN BOOLEAN AllowShortcuts
600 SCSI_DEVICE_PATH
*Scsi
;
603 UefiDevicePathLibCatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
607 Converts a Fibre device path structure to its string representative.
609 @param Str The string representative of input device.
610 @param DevPath The input device path structure.
611 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
612 of the display node is used, where applicable. If DisplayOnly
613 is FALSE, then the longer text representation of the display node
615 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
616 representation for a device node can be used, where applicable.
621 IN OUT POOL_PRINT
*Str
,
623 IN BOOLEAN DisplayOnly
,
624 IN BOOLEAN AllowShortcuts
627 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
630 UefiDevicePathLibCatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
634 Converts a FibreEx device path structure to its string representative.
636 @param Str The string representative of input device.
637 @param DevPath The input device path structure.
638 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
639 of the display node is used, where applicable. If DisplayOnly
640 is FALSE, then the longer text representation of the display node
642 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
643 representation for a device node can be used, where applicable.
647 DevPathToTextFibreEx (
648 IN OUT POOL_PRINT
*Str
,
650 IN BOOLEAN DisplayOnly
,
651 IN BOOLEAN AllowShortcuts
654 FIBRECHANNELEX_DEVICE_PATH
*FibreEx
;
658 UefiDevicePathLibCatPrint (Str
, L
"FibreEx(0x");
659 for (Index
= 0; Index
< sizeof (FibreEx
->WWN
) / sizeof (FibreEx
->WWN
[0]); Index
++) {
660 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->WWN
[Index
]);
662 UefiDevicePathLibCatPrint (Str
, L
",0x");
663 for (Index
= 0; Index
< sizeof (FibreEx
->Lun
) / sizeof (FibreEx
->Lun
[0]); Index
++) {
664 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->Lun
[Index
]);
666 UefiDevicePathLibCatPrint (Str
, L
")");
670 Converts a Sas Ex device path structure to its string representative.
672 @param Str The string representative of input device.
673 @param DevPath The input device path structure.
674 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
675 of the display node is used, where applicable. If DisplayOnly
676 is FALSE, then the longer text representation of the display node
678 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
679 representation for a device node can be used, where applicable.
684 IN OUT POOL_PRINT
*Str
,
686 IN BOOLEAN DisplayOnly
,
687 IN BOOLEAN AllowShortcuts
690 SASEX_DEVICE_PATH
*SasEx
;
694 UefiDevicePathLibCatPrint (Str
, L
"SasEx(0x");
696 for (Index
= 0; Index
< sizeof (SasEx
->SasAddress
) / sizeof (SasEx
->SasAddress
[0]); Index
++) {
697 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->SasAddress
[Index
]);
699 UefiDevicePathLibCatPrint (Str
, L
",0x");
700 for (Index
= 0; Index
< sizeof (SasEx
->Lun
) / sizeof (SasEx
->Lun
[0]); Index
++) {
701 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->Lun
[Index
]);
703 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", SasEx
->RelativeTargetPort
);
705 if (((SasEx
->DeviceTopology
& 0x0f) == 0) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
706 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0");
707 } else if (((SasEx
->DeviceTopology
& 0x0f) <= 2) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
708 UefiDevicePathLibCatPrint (
711 ((SasEx
->DeviceTopology
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
712 ((SasEx
->DeviceTopology
& BIT5
) != 0) ? L
"External" : L
"Internal",
713 ((SasEx
->DeviceTopology
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
715 if ((SasEx
->DeviceTopology
& 0x0f) == 1) {
716 UefiDevicePathLibCatPrint (Str
, L
"0");
719 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
721 UefiDevicePathLibCatPrint (Str
, L
"0x%x", ((SasEx
->DeviceTopology
>> 8) & 0xff) + 1);
724 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0", SasEx
->DeviceTopology
);
727 UefiDevicePathLibCatPrint (Str
, L
")");
733 Converts a NVM Express Namespace device path structure to its string representative.
735 @param Str The string representative of input device.
736 @param DevPath The input device path structure.
737 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
738 of the display node is used, where applicable. If DisplayOnly
739 is FALSE, then the longer text representation of the display node
741 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
742 representation for a device node can be used, where applicable.
747 IN OUT POOL_PRINT
*Str
,
749 IN BOOLEAN DisplayOnly
,
750 IN BOOLEAN AllowShortcuts
753 NVME_NAMESPACE_DEVICE_PATH
*Nvme
;
757 Uuid
= (UINT8
*) &Nvme
->NamespaceUuid
;
758 UefiDevicePathLibCatPrint (
760 L
"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",
762 Uuid
[7], Uuid
[6], Uuid
[5], Uuid
[4],
763 Uuid
[3], Uuid
[2], Uuid
[1], Uuid
[0]
768 Converts a UFS 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 UFS_DEVICE_PATH
*Ufs
;
791 UefiDevicePathLibCatPrint (Str
, L
"UFS(0x%x,0x%x)", Ufs
->Pun
, Ufs
->Lun
);
795 Converts a SD (Secure Digital) device path structure to its string representative.
797 @param Str The string representative of input device.
798 @param DevPath The input device path structure.
799 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
800 of the display node is used, where applicable. If DisplayOnly
801 is FALSE, then the longer text representation of the display node
803 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
804 representation for a device node can be used, where applicable.
809 IN OUT POOL_PRINT
*Str
,
811 IN BOOLEAN DisplayOnly
,
812 IN BOOLEAN AllowShortcuts
818 UefiDevicePathLibCatPrint (
826 Converts a 1394 device path structure to its string representative.
828 @param Str The string representative of input device.
829 @param DevPath The input device path structure.
830 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
831 of the display node is used, where applicable. If DisplayOnly
832 is FALSE, then the longer text representation of the display node
834 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
835 representation for a device node can be used, where applicable.
840 IN OUT POOL_PRINT
*Str
,
842 IN BOOLEAN DisplayOnly
,
843 IN BOOLEAN AllowShortcuts
846 F1394_DEVICE_PATH
*F1394DevPath
;
848 F1394DevPath
= DevPath
;
850 // Guid has format of IEEE-EUI64
852 UefiDevicePathLibCatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
856 Converts a USB device path structure to its string representative.
858 @param Str The string representative of input device.
859 @param DevPath The input device path structure.
860 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
861 of the display node is used, where applicable. If DisplayOnly
862 is FALSE, then the longer text representation of the display node
864 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
865 representation for a device node can be used, where applicable.
870 IN OUT POOL_PRINT
*Str
,
872 IN BOOLEAN DisplayOnly
,
873 IN BOOLEAN AllowShortcuts
876 USB_DEVICE_PATH
*Usb
;
879 UefiDevicePathLibCatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
883 Converts a USB WWID device path structure to its string representative.
885 @param Str The string representative of input device.
886 @param DevPath The input device path structure.
887 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
888 of the display node is used, where applicable. If DisplayOnly
889 is FALSE, then the longer text representation of the display node
891 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
892 representation for a device node can be used, where applicable.
896 DevPathToTextUsbWWID (
897 IN OUT POOL_PRINT
*Str
,
899 IN BOOLEAN DisplayOnly
,
900 IN BOOLEAN AllowShortcuts
903 USB_WWID_DEVICE_PATH
*UsbWWId
;
904 CHAR16
*SerialNumberStr
;
910 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
911 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
912 if (SerialNumberStr
[Length
- 1] != 0) {
914 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
916 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
917 ASSERT (NewStr
!= NULL
);
919 SerialNumberStr
= NewStr
;
922 UefiDevicePathLibCatPrint (
924 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
927 UsbWWId
->InterfaceNumber
,
933 Converts a Logic Unit device path structure to its string representative.
935 @param Str The string representative of input device.
936 @param DevPath The input device path structure.
937 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
938 of the display node is used, where applicable. If DisplayOnly
939 is FALSE, then the longer text representation of the display node
941 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
942 representation for a device node can be used, where applicable.
946 DevPathToTextLogicalUnit (
947 IN OUT POOL_PRINT
*Str
,
949 IN BOOLEAN DisplayOnly
,
950 IN BOOLEAN AllowShortcuts
953 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
955 LogicalUnit
= DevPath
;
956 UefiDevicePathLibCatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
960 Converts a USB class device path structure to its string representative.
962 @param Str The string representative of input device.
963 @param DevPath The input device path structure.
964 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
965 of the display node is used, where applicable. If DisplayOnly
966 is FALSE, then the longer text representation of the display node
968 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
969 representation for a device node can be used, where applicable.
973 DevPathToTextUsbClass (
974 IN OUT POOL_PRINT
*Str
,
976 IN BOOLEAN DisplayOnly
,
977 IN BOOLEAN AllowShortcuts
980 USB_CLASS_DEVICE_PATH
*UsbClass
;
981 BOOLEAN IsKnownSubClass
;
986 IsKnownSubClass
= TRUE
;
987 switch (UsbClass
->DeviceClass
) {
988 case USB_CLASS_AUDIO
:
989 UefiDevicePathLibCatPrint (Str
, L
"UsbAudio");
992 case USB_CLASS_CDCCONTROL
:
993 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCControl");
997 UefiDevicePathLibCatPrint (Str
, L
"UsbHID");
1000 case USB_CLASS_IMAGE
:
1001 UefiDevicePathLibCatPrint (Str
, L
"UsbImage");
1004 case USB_CLASS_PRINTER
:
1005 UefiDevicePathLibCatPrint (Str
, L
"UsbPrinter");
1008 case USB_CLASS_MASS_STORAGE
:
1009 UefiDevicePathLibCatPrint (Str
, L
"UsbMassStorage");
1013 UefiDevicePathLibCatPrint (Str
, L
"UsbHub");
1016 case USB_CLASS_CDCDATA
:
1017 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCData");
1020 case USB_CLASS_SMART_CARD
:
1021 UefiDevicePathLibCatPrint (Str
, L
"UsbSmartCard");
1024 case USB_CLASS_VIDEO
:
1025 UefiDevicePathLibCatPrint (Str
, L
"UsbVideo");
1028 case USB_CLASS_DIAGNOSTIC
:
1029 UefiDevicePathLibCatPrint (Str
, L
"UsbDiagnostic");
1032 case USB_CLASS_WIRELESS
:
1033 UefiDevicePathLibCatPrint (Str
, L
"UsbWireless");
1037 IsKnownSubClass
= FALSE
;
1041 if (IsKnownSubClass
) {
1042 UefiDevicePathLibCatPrint (
1044 L
"(0x%x,0x%x,0x%x,0x%x)",
1046 UsbClass
->ProductId
,
1047 UsbClass
->DeviceSubClass
,
1048 UsbClass
->DeviceProtocol
1053 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
1054 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
1055 UefiDevicePathLibCatPrint (
1057 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
1059 UsbClass
->ProductId
,
1060 UsbClass
->DeviceProtocol
1063 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
1064 UefiDevicePathLibCatPrint (
1066 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
1068 UsbClass
->ProductId
,
1069 UsbClass
->DeviceProtocol
1072 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
1073 UefiDevicePathLibCatPrint (
1075 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
1077 UsbClass
->ProductId
,
1078 UsbClass
->DeviceProtocol
1084 UefiDevicePathLibCatPrint (
1086 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
1088 UsbClass
->ProductId
,
1089 UsbClass
->DeviceClass
,
1090 UsbClass
->DeviceSubClass
,
1091 UsbClass
->DeviceProtocol
1096 Converts a SATA device path structure to its string representative.
1098 @param Str The string representative of input device.
1099 @param DevPath The input device path structure.
1100 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1101 of the display node is used, where applicable. If DisplayOnly
1102 is FALSE, then the longer text representation of the display node
1104 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1105 representation for a device node can be used, where applicable.
1110 IN OUT POOL_PRINT
*Str
,
1112 IN BOOLEAN DisplayOnly
,
1113 IN BOOLEAN AllowShortcuts
1116 SATA_DEVICE_PATH
*Sata
;
1119 UefiDevicePathLibCatPrint (
1121 L
"Sata(0x%x,0x%x,0x%x)",
1122 Sata
->HBAPortNumber
,
1123 Sata
->PortMultiplierPortNumber
,
1129 Converts a I20 device path structure to its string representative.
1131 @param Str The string representative of input device.
1132 @param DevPath The input device path structure.
1133 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1134 of the display node is used, where applicable. If DisplayOnly
1135 is FALSE, then the longer text representation of the display node
1137 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1138 representation for a device node can be used, where applicable.
1143 IN OUT POOL_PRINT
*Str
,
1145 IN BOOLEAN DisplayOnly
,
1146 IN BOOLEAN AllowShortcuts
1149 I2O_DEVICE_PATH
*I2ODevPath
;
1151 I2ODevPath
= DevPath
;
1152 UefiDevicePathLibCatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1156 Converts a MAC address device path structure to its string representative.
1158 @param Str The string representative of input device.
1159 @param DevPath The input device path structure.
1160 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1161 of the display node is used, where applicable. If DisplayOnly
1162 is FALSE, then the longer text representation of the display node
1164 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1165 representation for a device node can be used, where applicable.
1169 DevPathToTextMacAddr (
1170 IN OUT POOL_PRINT
*Str
,
1172 IN BOOLEAN DisplayOnly
,
1173 IN BOOLEAN AllowShortcuts
1176 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1177 UINTN HwAddressSize
;
1180 MacDevPath
= DevPath
;
1182 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1183 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1187 UefiDevicePathLibCatPrint (Str
, L
"MAC(");
1189 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1190 UefiDevicePathLibCatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1193 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1197 Converts network protocol string to its text representation.
1199 @param Str The string representative of input device.
1200 @param Protocol The network protocol ID.
1204 CatNetworkProtocol (
1205 IN OUT POOL_PRINT
*Str
,
1209 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1210 UefiDevicePathLibCatPrint (Str
, L
"TCP");
1211 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1212 UefiDevicePathLibCatPrint (Str
, L
"UDP");
1214 UefiDevicePathLibCatPrint (Str
, L
"0x%x", Protocol
);
1219 Converts IP v4 address to its text representation.
1221 @param Str The string representative of input device.
1222 @param Address The IP v4 address.
1226 IN OUT POOL_PRINT
*Str
,
1227 IN EFI_IPv4_ADDRESS
*Address
1230 UefiDevicePathLibCatPrint (Str
, L
"%d.%d.%d.%d", Address
->Addr
[0], Address
->Addr
[1], Address
->Addr
[2], Address
->Addr
[3]);
1234 Converts IP v6 address to its text representation.
1236 @param Str The string representative of input device.
1237 @param Address The IP v6 address.
1241 IN OUT POOL_PRINT
*Str
,
1242 IN EFI_IPv6_ADDRESS
*Address
1245 UefiDevicePathLibCatPrint (
1246 Str
, L
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1247 Address
->Addr
[0], Address
->Addr
[1],
1248 Address
->Addr
[2], Address
->Addr
[3],
1249 Address
->Addr
[4], Address
->Addr
[5],
1250 Address
->Addr
[6], Address
->Addr
[7],
1251 Address
->Addr
[8], Address
->Addr
[9],
1252 Address
->Addr
[10], Address
->Addr
[11],
1253 Address
->Addr
[12], Address
->Addr
[13],
1254 Address
->Addr
[14], Address
->Addr
[15]
1259 Converts a IPv4 device path structure to its string representative.
1261 @param Str The string representative of input device.
1262 @param DevPath The input device path structure.
1263 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1264 of the display node is used, where applicable. If DisplayOnly
1265 is FALSE, then the longer text representation of the display node
1267 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1268 representation for a device node can be used, where applicable.
1273 IN OUT POOL_PRINT
*Str
,
1275 IN BOOLEAN DisplayOnly
,
1276 IN BOOLEAN AllowShortcuts
1279 IPv4_DEVICE_PATH
*IPDevPath
;
1281 IPDevPath
= DevPath
;
1282 UefiDevicePathLibCatPrint (Str
, L
"IPv4(");
1283 CatIPv4Address (Str
, &IPDevPath
->RemoteIpAddress
);
1286 UefiDevicePathLibCatPrint (Str
, L
")");
1290 UefiDevicePathLibCatPrint (Str
, L
",");
1291 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1293 UefiDevicePathLibCatPrint (Str
, L
",%s,", IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP");
1294 CatIPv4Address (Str
, &IPDevPath
->LocalIpAddress
);
1295 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1296 UefiDevicePathLibCatPrint (Str
, L
",");
1297 CatIPv4Address (Str
, &IPDevPath
->GatewayIpAddress
);
1298 UefiDevicePathLibCatPrint (Str
, L
",");
1299 CatIPv4Address (Str
, &IPDevPath
->SubnetMask
);
1301 UefiDevicePathLibCatPrint (Str
, L
")");
1305 Converts a IPv6 device path structure to its string representative.
1307 @param Str The string representative of input device.
1308 @param DevPath The input device path structure.
1309 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1310 of the display node is used, where applicable. If DisplayOnly
1311 is FALSE, then the longer text representation of the display node
1313 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1314 representation for a device node can be used, where applicable.
1319 IN OUT POOL_PRINT
*Str
,
1321 IN BOOLEAN DisplayOnly
,
1322 IN BOOLEAN AllowShortcuts
1325 IPv6_DEVICE_PATH
*IPDevPath
;
1327 IPDevPath
= DevPath
;
1328 UefiDevicePathLibCatPrint (Str
, L
"IPv6(");
1329 CatIPv6Address (Str
, &IPDevPath
->RemoteIpAddress
);
1331 UefiDevicePathLibCatPrint (Str
, L
")");
1335 UefiDevicePathLibCatPrint (Str
, L
",");
1336 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1338 switch (IPDevPath
->IpAddressOrigin
) {
1340 UefiDevicePathLibCatPrint (Str
, L
",Static,");
1343 UefiDevicePathLibCatPrint (Str
, L
",StatelessAutoConfigure,");
1346 UefiDevicePathLibCatPrint (Str
, L
",StatefulAutoConfigure,");
1350 CatIPv6Address (Str
, &IPDevPath
->LocalIpAddress
);
1352 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1353 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", IPDevPath
->PrefixLength
);
1354 CatIPv6Address (Str
, &IPDevPath
->GatewayIpAddress
);
1356 UefiDevicePathLibCatPrint (Str
, L
")");
1360 Converts an Infini Band device path structure to its string representative.
1362 @param Str The string representative of input device.
1363 @param DevPath The input device path structure.
1364 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1365 of the display node is used, where applicable. If DisplayOnly
1366 is FALSE, then the longer text representation of the display node
1368 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1369 representation for a device node can be used, where applicable.
1373 DevPathToTextInfiniBand (
1374 IN OUT POOL_PRINT
*Str
,
1376 IN BOOLEAN DisplayOnly
,
1377 IN BOOLEAN AllowShortcuts
1380 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1382 InfiniBand
= DevPath
;
1383 UefiDevicePathLibCatPrint (
1385 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1386 InfiniBand
->ResourceFlags
,
1387 InfiniBand
->PortGid
,
1388 InfiniBand
->ServiceId
,
1389 InfiniBand
->TargetPortId
,
1390 InfiniBand
->DeviceId
1395 Converts a UART device path structure to its string representative.
1397 @param Str The string representative of input device.
1398 @param DevPath The input device path structure.
1399 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1400 of the display node is used, where applicable. If DisplayOnly
1401 is FALSE, then the longer text representation of the display node
1403 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1404 representation for a device node can be used, where applicable.
1409 IN OUT POOL_PRINT
*Str
,
1411 IN BOOLEAN DisplayOnly
,
1412 IN BOOLEAN AllowShortcuts
1415 UART_DEVICE_PATH
*Uart
;
1419 switch (Uart
->Parity
) {
1449 if (Uart
->BaudRate
== 0) {
1450 UefiDevicePathLibCatPrint (Str
, L
"Uart(DEFAULT,");
1452 UefiDevicePathLibCatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1455 if (Uart
->DataBits
== 0) {
1456 UefiDevicePathLibCatPrint (Str
, L
"DEFAULT,");
1458 UefiDevicePathLibCatPrint (Str
, L
"%d,", Uart
->DataBits
);
1461 UefiDevicePathLibCatPrint (Str
, L
"%c,", Parity
);
1463 switch (Uart
->StopBits
) {
1465 UefiDevicePathLibCatPrint (Str
, L
"D)");
1469 UefiDevicePathLibCatPrint (Str
, L
"1)");
1473 UefiDevicePathLibCatPrint (Str
, L
"1.5)");
1477 UefiDevicePathLibCatPrint (Str
, L
"2)");
1481 UefiDevicePathLibCatPrint (Str
, L
"x)");
1487 Converts an iSCSI device path structure to its string representative.
1489 @param Str The string representative of input device.
1490 @param DevPath The input device path structure.
1491 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1492 of the display node is used, where applicable. If DisplayOnly
1493 is FALSE, then the longer text representation of the display node
1495 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1496 representation for a device node can be used, where applicable.
1500 DevPathToTextiSCSI (
1501 IN OUT POOL_PRINT
*Str
,
1503 IN BOOLEAN DisplayOnly
,
1504 IN BOOLEAN AllowShortcuts
1507 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1510 ISCSIDevPath
= DevPath
;
1511 UefiDevicePathLibCatPrint (
1513 L
"iSCSI(%a,0x%x,0x%lx,",
1514 ISCSIDevPath
->TargetName
,
1515 ISCSIDevPath
->TargetPortalGroupTag
,
1519 Options
= ISCSIDevPath
->LoginOption
;
1520 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1521 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1522 if (((Options
>> 11) & 0x0001) != 0) {
1523 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"None");
1524 } else if (((Options
>> 12) & 0x0001) != 0) {
1525 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1527 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_BI");
1531 UefiDevicePathLibCatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1535 Converts a VLAN device path structure to its string representative.
1537 @param Str The string representative of input device.
1538 @param DevPath The input device path structure.
1539 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1540 of the display node is used, where applicable. If DisplayOnly
1541 is FALSE, then the longer text representation of the display node
1543 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1544 representation for a device node can be used, where applicable.
1549 IN OUT POOL_PRINT
*Str
,
1551 IN BOOLEAN DisplayOnly
,
1552 IN BOOLEAN AllowShortcuts
1555 VLAN_DEVICE_PATH
*Vlan
;
1558 UefiDevicePathLibCatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1562 Converts a Bluetooth device path structure to its string representative.
1564 @param Str The string representative of input device.
1565 @param DevPath The input device path structure.
1566 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1567 of the display node is used, where applicable. If DisplayOnly
1568 is FALSE, then the longer text representation of the display node
1570 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1571 representation for a device node can be used, where applicable.
1575 DevPathToTextBluetooth (
1576 IN OUT POOL_PRINT
*Str
,
1578 IN BOOLEAN DisplayOnly
,
1579 IN BOOLEAN AllowShortcuts
1582 BLUETOOTH_DEVICE_PATH
*Bluetooth
;
1584 Bluetooth
= DevPath
;
1585 UefiDevicePathLibCatPrint (
1587 L
"Bluetooth(%02x%02x%02x%02x%02x%02x)",
1588 Bluetooth
->BD_ADDR
.Address
[5],
1589 Bluetooth
->BD_ADDR
.Address
[4],
1590 Bluetooth
->BD_ADDR
.Address
[3],
1591 Bluetooth
->BD_ADDR
.Address
[2],
1592 Bluetooth
->BD_ADDR
.Address
[1],
1593 Bluetooth
->BD_ADDR
.Address
[0]
1598 Converts a Wi-Fi device path structure to its string representative.
1600 @param Str The string representative of input device.
1601 @param DevPath The input device path structure.
1602 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1603 of the display node is used, where applicable. If DisplayOnly
1604 is FALSE, then the longer text representation of the display node
1606 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1607 representation for a device node can be used, where applicable.
1612 IN OUT POOL_PRINT
*Str
,
1614 IN BOOLEAN DisplayOnly
,
1615 IN BOOLEAN AllowShortcuts
1618 WIFI_DEVICE_PATH
*WiFi
;
1621 UefiDevicePathLibCatPrint (Str
, L
"WiFi(%a)", WiFi
->SSId
);
1625 Converts a URI device path structure to its string representative.
1627 @param Str The string representative of input device.
1628 @param DevPath The input device path structure.
1629 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1630 of the display node is used, where applicable. If DisplayOnly
1631 is FALSE, then the longer text representation of the display node
1633 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1634 representation for a device node can be used, where applicable.
1639 IN OUT POOL_PRINT
*Str
,
1641 IN BOOLEAN DisplayOnly
,
1642 IN BOOLEAN AllowShortcuts
1645 URI_DEVICE_PATH
*Uri
;
1650 // Uri in the device path may not be null terminated.
1653 UriLength
= DevicePathNodeLength (Uri
) - sizeof (URI_DEVICE_PATH
);
1654 UriStr
= AllocatePool (UriLength
+ 1);
1655 ASSERT (UriStr
!= NULL
);
1657 CopyMem (UriStr
, Uri
->Uri
, UriLength
);
1658 UriStr
[UriLength
] = '\0';
1659 UefiDevicePathLibCatPrint (Str
, L
"Uri(%a)", UriStr
);
1664 Converts a Hard drive device path structure to its string representative.
1666 @param Str The string representative of input device.
1667 @param DevPath The input device path structure.
1668 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1669 of the display node is used, where applicable. If DisplayOnly
1670 is FALSE, then the longer text representation of the display node
1672 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1673 representation for a device node can be used, where applicable.
1677 DevPathToTextHardDrive (
1678 IN OUT POOL_PRINT
*Str
,
1680 IN BOOLEAN DisplayOnly
,
1681 IN BOOLEAN AllowShortcuts
1684 HARDDRIVE_DEVICE_PATH
*Hd
;
1687 switch (Hd
->SignatureType
) {
1688 case SIGNATURE_TYPE_MBR
:
1689 UefiDevicePathLibCatPrint (
1691 L
"HD(%d,%s,0x%08x,",
1692 Hd
->PartitionNumber
,
1694 *((UINT32
*) (&(Hd
->Signature
[0])))
1698 case SIGNATURE_TYPE_GUID
:
1699 UefiDevicePathLibCatPrint (
1702 Hd
->PartitionNumber
,
1704 (EFI_GUID
*) &(Hd
->Signature
[0])
1709 UefiDevicePathLibCatPrint (
1712 Hd
->PartitionNumber
,
1718 UefiDevicePathLibCatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1722 Converts a CDROM device path structure to its string representative.
1724 @param Str The string representative of input device.
1725 @param DevPath The input device path structure.
1726 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1727 of the display node is used, where applicable. If DisplayOnly
1728 is FALSE, then the longer text representation of the display node
1730 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1731 representation for a device node can be used, where applicable.
1735 DevPathToTextCDROM (
1736 IN OUT POOL_PRINT
*Str
,
1738 IN BOOLEAN DisplayOnly
,
1739 IN BOOLEAN AllowShortcuts
1742 CDROM_DEVICE_PATH
*Cd
;
1746 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1750 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1754 Converts a File device path structure to its string representative.
1756 @param Str The string representative of input device.
1757 @param DevPath The input device path structure.
1758 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1759 of the display node is used, where applicable. If DisplayOnly
1760 is FALSE, then the longer text representation of the display node
1762 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1763 representation for a device node can be used, where applicable.
1767 DevPathToTextFilePath (
1768 IN OUT POOL_PRINT
*Str
,
1770 IN BOOLEAN DisplayOnly
,
1771 IN BOOLEAN AllowShortcuts
1774 FILEPATH_DEVICE_PATH
*Fp
;
1777 UefiDevicePathLibCatPrint (Str
, L
"%s", Fp
->PathName
);
1781 Converts a Media protocol device path structure to its string representative.
1783 @param Str The string representative of input device.
1784 @param DevPath The input device path structure.
1785 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1786 of the display node is used, where applicable. If DisplayOnly
1787 is FALSE, then the longer text representation of the display node
1789 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1790 representation for a device node can be used, where applicable.
1794 DevPathToTextMediaProtocol (
1795 IN OUT POOL_PRINT
*Str
,
1797 IN BOOLEAN DisplayOnly
,
1798 IN BOOLEAN AllowShortcuts
1801 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1803 MediaProt
= DevPath
;
1804 UefiDevicePathLibCatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1808 Converts a Firmware Volume device path structure to its string representative.
1810 @param Str The string representative of input device.
1811 @param DevPath The input device path structure.
1812 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1813 of the display node is used, where applicable. If DisplayOnly
1814 is FALSE, then the longer text representation of the display node
1816 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1817 representation for a device node can be used, where applicable.
1822 IN OUT POOL_PRINT
*Str
,
1824 IN BOOLEAN DisplayOnly
,
1825 IN BOOLEAN AllowShortcuts
1828 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1831 UefiDevicePathLibCatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1835 Converts a Firmware Volume File 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 DevPathToTextFvFile (
1849 IN OUT POOL_PRINT
*Str
,
1851 IN BOOLEAN DisplayOnly
,
1852 IN BOOLEAN AllowShortcuts
1855 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1858 UefiDevicePathLibCatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1862 Converts a Relative Offset device path structure to its string representative.
1864 @param Str The string representative of input device.
1865 @param DevPath The input device path structure.
1866 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1867 of the display node is used, where applicable. If DisplayOnly
1868 is FALSE, then the longer text representation of the display node
1870 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1871 representation for a device node can be used, where applicable.
1875 DevPathRelativeOffsetRange (
1876 IN OUT POOL_PRINT
*Str
,
1878 IN BOOLEAN DisplayOnly
,
1879 IN BOOLEAN AllowShortcuts
1882 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1885 UefiDevicePathLibCatPrint (
1887 L
"Offset(0x%lx,0x%lx)",
1888 Offset
->StartingOffset
,
1889 Offset
->EndingOffset
1894 Converts a Ram Disk device path structure to its string representative.
1896 @param Str The string representative of input device.
1897 @param DevPath The input device path structure.
1898 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1899 of the display node is used, where applicable. If DisplayOnly
1900 is FALSE, then the longer text representation of the display node
1902 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1903 representation for a device node can be used, where applicable.
1907 DevPathToTextRamDisk (
1908 IN OUT POOL_PRINT
*Str
,
1910 IN BOOLEAN DisplayOnly
,
1911 IN BOOLEAN AllowShortcuts
1914 MEDIA_RAM_DISK_DEVICE_PATH
*RamDisk
;
1918 if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualDiskGuid
)) {
1919 UefiDevicePathLibCatPrint (
1921 L
"VirtualDisk(0x%lx,0x%lx,%d)",
1922 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1923 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1926 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualCdGuid
)) {
1927 UefiDevicePathLibCatPrint (
1929 L
"VirtualCD(0x%lx,0x%lx,%d)",
1930 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1931 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1934 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualDiskGuid
)) {
1935 UefiDevicePathLibCatPrint (
1937 L
"PersistentVirtualDisk(0x%lx,0x%lx,%d)",
1938 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1939 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1942 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualCdGuid
)) {
1943 UefiDevicePathLibCatPrint (
1945 L
"PersistentVirtualCD(0x%lx,0x%lx,%d)",
1946 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1947 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1951 UefiDevicePathLibCatPrint (
1953 L
"RamDisk(0x%lx,0x%lx,%d,%g)",
1954 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1955 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1963 Converts a BIOS Boot Specification device path structure to its string representative.
1965 @param Str The string representative of input device.
1966 @param DevPath The input device path structure.
1967 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1968 of the display node is used, where applicable. If DisplayOnly
1969 is FALSE, then the longer text representation of the display node
1971 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1972 representation for a device node can be used, where applicable.
1977 IN OUT POOL_PRINT
*Str
,
1979 IN BOOLEAN DisplayOnly
,
1980 IN BOOLEAN AllowShortcuts
1983 BBS_BBS_DEVICE_PATH
*Bbs
;
1987 switch (Bbs
->DeviceType
) {
1988 case BBS_TYPE_FLOPPY
:
1992 case BBS_TYPE_HARDDRIVE
:
1996 case BBS_TYPE_CDROM
:
2000 case BBS_TYPE_PCMCIA
:
2008 case BBS_TYPE_EMBEDDED_NETWORK
:
2018 UefiDevicePathLibCatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
2020 UefiDevicePathLibCatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
2024 UefiDevicePathLibCatPrint (Str
, L
")");
2028 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
2032 Converts an End-of-Device-Path structure to its string representative.
2034 @param Str The string representative of input device.
2035 @param DevPath The input device path structure.
2036 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2037 of the display node is used, where applicable. If DisplayOnly
2038 is FALSE, then the longer text representation of the display node
2040 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2041 representation for a device node can be used, where applicable.
2045 DevPathToTextEndInstance (
2046 IN OUT POOL_PRINT
*Str
,
2048 IN BOOLEAN DisplayOnly
,
2049 IN BOOLEAN AllowShortcuts
2052 UefiDevicePathLibCatPrint (Str
, L
",");
2055 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric
[] = {
2056 {HARDWARE_DEVICE_PATH
, L
"HardwarePath" },
2057 {ACPI_DEVICE_PATH
, L
"AcpiPath" },
2058 {MESSAGING_DEVICE_PATH
, L
"Msg" },
2059 {MEDIA_DEVICE_PATH
, L
"MediaPath" },
2060 {BBS_DEVICE_PATH
, L
"BbsPath" },
2065 Converts an unknown 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 DevPathToTextNodeGeneric (
2079 IN OUT POOL_PRINT
*Str
,
2081 IN BOOLEAN DisplayOnly
,
2082 IN BOOLEAN AllowShortcuts
2085 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2090 for (Index
= 0; mUefiDevicePathLibToTextTableGeneric
[Index
].Text
!= NULL
; Index
++) {
2091 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTableGeneric
[Index
].Type
) {
2096 if (mUefiDevicePathLibToTextTableGeneric
[Index
].Text
== NULL
) {
2098 // It's a node whose type cannot be recognized
2100 UefiDevicePathLibCatPrint (Str
, L
"Path(%d,%d", DevicePathType (Node
), DevicePathSubType (Node
));
2103 // It's a node whose type can be recognized
2105 UefiDevicePathLibCatPrint (Str
, L
"%s(%d", mUefiDevicePathLibToTextTableGeneric
[Index
].Text
, DevicePathSubType (Node
));
2108 Index
= sizeof (EFI_DEVICE_PATH_PROTOCOL
);
2109 if (Index
< DevicePathNodeLength (Node
)) {
2110 UefiDevicePathLibCatPrint (Str
, L
",");
2111 for (; Index
< DevicePathNodeLength (Node
); Index
++) {
2112 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*) Node
)[Index
]);
2116 UefiDevicePathLibCatPrint (Str
, L
")");
2119 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable
[] = {
2120 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
2121 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
2122 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
2123 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
2124 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
2125 {HARDWARE_DEVICE_PATH
, HW_BMC_DP
, DevPathToTextBmc
},
2126 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
2127 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
2128 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
2129 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
2130 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
2131 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
2132 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
2133 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
2134 {MESSAGING_DEVICE_PATH
, MSG_NVME_NAMESPACE_DP
, DevPathToTextNVMe
},
2135 {MESSAGING_DEVICE_PATH
, MSG_UFS_DP
, DevPathToTextUfs
},
2136 {MESSAGING_DEVICE_PATH
, MSG_SD_DP
, DevPathToTextSd
},
2137 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
2138 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
2139 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
2140 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
2141 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
2142 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
2143 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
2144 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
2145 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
2146 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
2147 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
2148 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
2149 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
2150 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
2151 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
2152 {MESSAGING_DEVICE_PATH
, MSG_URI_DP
, DevPathToTextUri
},
2153 {MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_DP
, DevPathToTextBluetooth
},
2154 {MESSAGING_DEVICE_PATH
, MSG_WIFI_DP
, DevPathToTextWiFi
},
2155 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
2156 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
2157 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
2158 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
2159 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
2160 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
2161 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
2162 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
2163 {MEDIA_DEVICE_PATH
, MEDIA_RAM_DISK_DP
, DevPathToTextRamDisk
},
2164 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
2165 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
2170 Converts a device node to its string representation.
2172 @param DeviceNode A Pointer to the device node to be converted.
2173 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2174 of the display node is used, where applicable. If DisplayOnly
2175 is FALSE, then the longer text representation of the display node
2177 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2178 representation for a device node can be used, where applicable.
2180 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
2181 is NULL or there was insufficient memory.
2186 UefiDevicePathLibConvertDeviceNodeToText (
2187 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
2188 IN BOOLEAN DisplayOnly
,
2189 IN BOOLEAN AllowShortcuts
2194 DEVICE_PATH_TO_TEXT ToText
;
2196 if (DeviceNode
== NULL
) {
2200 ZeroMem (&Str
, sizeof (Str
));
2203 // Process the device path node
2204 // If not found, use a generic function
2206 ToText
= DevPathToTextNodeGeneric
;
2207 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
++) {
2208 if (DevicePathType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2209 DevicePathSubType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2211 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2219 ToText (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
2221 ASSERT (Str
.Str
!= NULL
);
2226 Converts a device path to its text representation.
2228 @param DevicePath A Pointer to the device to be converted.
2229 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2230 of the display node is used, where applicable. If DisplayOnly
2231 is FALSE, then the longer text representation of the display node
2233 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2234 representation for a device node can be used, where applicable.
2236 @return A pointer to the allocated text representation of the device path or
2237 NULL if DeviceNode is NULL or there was insufficient memory.
2242 UefiDevicePathLibConvertDevicePathToText (
2243 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
2244 IN BOOLEAN DisplayOnly
,
2245 IN BOOLEAN AllowShortcuts
2249 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2250 EFI_DEVICE_PATH_PROTOCOL
*AlignedNode
;
2252 DEVICE_PATH_TO_TEXT ToText
;
2254 if (DevicePath
== NULL
) {
2258 ZeroMem (&Str
, sizeof (Str
));
2261 // Process each device path node
2263 Node
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
2264 while (!IsDevicePathEnd (Node
)) {
2266 // Find the handler to dump this device path node
2267 // If not found, use a generic function
2269 ToText
= DevPathToTextNodeGeneric
;
2270 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
2272 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2273 DevicePathSubType (Node
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2275 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2280 // Put a path separator in if needed
2282 if ((Str
.Count
!= 0) && (ToText
!= DevPathToTextEndInstance
)) {
2283 if (Str
.Str
[Str
.Count
] != L
',') {
2284 UefiDevicePathLibCatPrint (&Str
, L
"/");
2288 AlignedNode
= AllocateCopyPool (DevicePathNodeLength (Node
), Node
);
2290 // Print this node of the device path
2292 ToText (&Str
, AlignedNode
, DisplayOnly
, AllowShortcuts
);
2293 FreePool (AlignedNode
);
2296 // Next device path node
2298 Node
= NextDevicePathNode (Node
);
2301 if (Str
.Str
== NULL
) {
2302 return AllocateZeroPool (sizeof (CHAR16
));