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
;
1624 CopyMem (SSId
, WiFi
->SSId
, 32);
1626 UefiDevicePathLibCatPrint (Str
, L
"Wi-Fi(%a)", SSId
);
1630 Converts a URI device path structure to its string representative.
1632 @param Str The string representative of input device.
1633 @param DevPath The input device path structure.
1634 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1635 of the display node is used, where applicable. If DisplayOnly
1636 is FALSE, then the longer text representation of the display node
1638 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1639 representation for a device node can be used, where applicable.
1644 IN OUT POOL_PRINT
*Str
,
1646 IN BOOLEAN DisplayOnly
,
1647 IN BOOLEAN AllowShortcuts
1650 URI_DEVICE_PATH
*Uri
;
1655 // Uri in the device path may not be null terminated.
1658 UriLength
= DevicePathNodeLength (Uri
) - sizeof (URI_DEVICE_PATH
);
1659 UriStr
= AllocatePool (UriLength
+ 1);
1660 ASSERT (UriStr
!= NULL
);
1662 CopyMem (UriStr
, Uri
->Uri
, UriLength
);
1663 UriStr
[UriLength
] = '\0';
1664 UefiDevicePathLibCatPrint (Str
, L
"Uri(%a)", UriStr
);
1669 Converts a Hard drive device path structure to its string representative.
1671 @param Str The string representative of input device.
1672 @param DevPath The input device path structure.
1673 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1674 of the display node is used, where applicable. If DisplayOnly
1675 is FALSE, then the longer text representation of the display node
1677 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1678 representation for a device node can be used, where applicable.
1682 DevPathToTextHardDrive (
1683 IN OUT POOL_PRINT
*Str
,
1685 IN BOOLEAN DisplayOnly
,
1686 IN BOOLEAN AllowShortcuts
1689 HARDDRIVE_DEVICE_PATH
*Hd
;
1692 switch (Hd
->SignatureType
) {
1693 case SIGNATURE_TYPE_MBR
:
1694 UefiDevicePathLibCatPrint (
1696 L
"HD(%d,%s,0x%08x,",
1697 Hd
->PartitionNumber
,
1699 *((UINT32
*) (&(Hd
->Signature
[0])))
1703 case SIGNATURE_TYPE_GUID
:
1704 UefiDevicePathLibCatPrint (
1707 Hd
->PartitionNumber
,
1709 (EFI_GUID
*) &(Hd
->Signature
[0])
1714 UefiDevicePathLibCatPrint (
1717 Hd
->PartitionNumber
,
1723 UefiDevicePathLibCatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1727 Converts a CDROM device path structure to its string representative.
1729 @param Str The string representative of input device.
1730 @param DevPath The input device path structure.
1731 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1732 of the display node is used, where applicable. If DisplayOnly
1733 is FALSE, then the longer text representation of the display node
1735 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1736 representation for a device node can be used, where applicable.
1740 DevPathToTextCDROM (
1741 IN OUT POOL_PRINT
*Str
,
1743 IN BOOLEAN DisplayOnly
,
1744 IN BOOLEAN AllowShortcuts
1747 CDROM_DEVICE_PATH
*Cd
;
1751 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1755 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1759 Converts a File device path structure to its string representative.
1761 @param Str The string representative of input device.
1762 @param DevPath The input device path structure.
1763 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1764 of the display node is used, where applicable. If DisplayOnly
1765 is FALSE, then the longer text representation of the display node
1767 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1768 representation for a device node can be used, where applicable.
1772 DevPathToTextFilePath (
1773 IN OUT POOL_PRINT
*Str
,
1775 IN BOOLEAN DisplayOnly
,
1776 IN BOOLEAN AllowShortcuts
1779 FILEPATH_DEVICE_PATH
*Fp
;
1782 UefiDevicePathLibCatPrint (Str
, L
"%s", Fp
->PathName
);
1786 Converts a Media protocol device path structure to its string representative.
1788 @param Str The string representative of input device.
1789 @param DevPath The input device path structure.
1790 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1791 of the display node is used, where applicable. If DisplayOnly
1792 is FALSE, then the longer text representation of the display node
1794 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1795 representation for a device node can be used, where applicable.
1799 DevPathToTextMediaProtocol (
1800 IN OUT POOL_PRINT
*Str
,
1802 IN BOOLEAN DisplayOnly
,
1803 IN BOOLEAN AllowShortcuts
1806 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1808 MediaProt
= DevPath
;
1809 UefiDevicePathLibCatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1813 Converts a Firmware Volume device path structure to its string representative.
1815 @param Str The string representative of input device.
1816 @param DevPath The input device path structure.
1817 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1818 of the display node is used, where applicable. If DisplayOnly
1819 is FALSE, then the longer text representation of the display node
1821 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1822 representation for a device node can be used, where applicable.
1827 IN OUT POOL_PRINT
*Str
,
1829 IN BOOLEAN DisplayOnly
,
1830 IN BOOLEAN AllowShortcuts
1833 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1836 UefiDevicePathLibCatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1840 Converts a Firmware Volume File device path structure to its string representative.
1842 @param Str The string representative of input device.
1843 @param DevPath The input device path structure.
1844 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1845 of the display node is used, where applicable. If DisplayOnly
1846 is FALSE, then the longer text representation of the display node
1848 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1849 representation for a device node can be used, where applicable.
1853 DevPathToTextFvFile (
1854 IN OUT POOL_PRINT
*Str
,
1856 IN BOOLEAN DisplayOnly
,
1857 IN BOOLEAN AllowShortcuts
1860 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1863 UefiDevicePathLibCatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1867 Converts a Relative Offset device path structure to its string representative.
1869 @param Str The string representative of input device.
1870 @param DevPath The input device path structure.
1871 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1872 of the display node is used, where applicable. If DisplayOnly
1873 is FALSE, then the longer text representation of the display node
1875 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1876 representation for a device node can be used, where applicable.
1880 DevPathRelativeOffsetRange (
1881 IN OUT POOL_PRINT
*Str
,
1883 IN BOOLEAN DisplayOnly
,
1884 IN BOOLEAN AllowShortcuts
1887 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1890 UefiDevicePathLibCatPrint (
1892 L
"Offset(0x%lx,0x%lx)",
1893 Offset
->StartingOffset
,
1894 Offset
->EndingOffset
1899 Converts a Ram Disk device path structure to its string representative.
1901 @param Str The string representative of input device.
1902 @param DevPath The input device path structure.
1903 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1904 of the display node is used, where applicable. If DisplayOnly
1905 is FALSE, then the longer text representation of the display node
1907 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1908 representation for a device node can be used, where applicable.
1912 DevPathToTextRamDisk (
1913 IN OUT POOL_PRINT
*Str
,
1915 IN BOOLEAN DisplayOnly
,
1916 IN BOOLEAN AllowShortcuts
1919 MEDIA_RAM_DISK_DEVICE_PATH
*RamDisk
;
1923 if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualDiskGuid
)) {
1924 UefiDevicePathLibCatPrint (
1926 L
"VirtualDisk(0x%lx,0x%lx,%d)",
1927 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1928 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1931 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualCdGuid
)) {
1932 UefiDevicePathLibCatPrint (
1934 L
"VirtualCD(0x%lx,0x%lx,%d)",
1935 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1936 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1939 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualDiskGuid
)) {
1940 UefiDevicePathLibCatPrint (
1942 L
"PersistentVirtualDisk(0x%lx,0x%lx,%d)",
1943 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1944 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1947 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualCdGuid
)) {
1948 UefiDevicePathLibCatPrint (
1950 L
"PersistentVirtualCD(0x%lx,0x%lx,%d)",
1951 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1952 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1956 UefiDevicePathLibCatPrint (
1958 L
"RamDisk(0x%lx,0x%lx,%d,%g)",
1959 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1960 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1968 Converts a BIOS Boot Specification device path structure to its string representative.
1970 @param Str The string representative of input device.
1971 @param DevPath The input device path structure.
1972 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1973 of the display node is used, where applicable. If DisplayOnly
1974 is FALSE, then the longer text representation of the display node
1976 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1977 representation for a device node can be used, where applicable.
1982 IN OUT POOL_PRINT
*Str
,
1984 IN BOOLEAN DisplayOnly
,
1985 IN BOOLEAN AllowShortcuts
1988 BBS_BBS_DEVICE_PATH
*Bbs
;
1992 switch (Bbs
->DeviceType
) {
1993 case BBS_TYPE_FLOPPY
:
1997 case BBS_TYPE_HARDDRIVE
:
2001 case BBS_TYPE_CDROM
:
2005 case BBS_TYPE_PCMCIA
:
2013 case BBS_TYPE_EMBEDDED_NETWORK
:
2023 UefiDevicePathLibCatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
2025 UefiDevicePathLibCatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
2029 UefiDevicePathLibCatPrint (Str
, L
")");
2033 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
2037 Converts an End-of-Device-Path structure to its string representative.
2039 @param Str The string representative of input device.
2040 @param DevPath The input device path structure.
2041 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2042 of the display node is used, where applicable. If DisplayOnly
2043 is FALSE, then the longer text representation of the display node
2045 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2046 representation for a device node can be used, where applicable.
2050 DevPathToTextEndInstance (
2051 IN OUT POOL_PRINT
*Str
,
2053 IN BOOLEAN DisplayOnly
,
2054 IN BOOLEAN AllowShortcuts
2057 UefiDevicePathLibCatPrint (Str
, L
",");
2060 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric
[] = {
2061 {HARDWARE_DEVICE_PATH
, L
"HardwarePath" },
2062 {ACPI_DEVICE_PATH
, L
"AcpiPath" },
2063 {MESSAGING_DEVICE_PATH
, L
"Msg" },
2064 {MEDIA_DEVICE_PATH
, L
"MediaPath" },
2065 {BBS_DEVICE_PATH
, L
"BbsPath" },
2070 Converts an unknown device path structure to its string representative.
2072 @param Str The string representative of input device.
2073 @param DevPath The input device path structure.
2074 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2075 of the display node is used, where applicable. If DisplayOnly
2076 is FALSE, then the longer text representation of the display node
2078 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2079 representation for a device node can be used, where applicable.
2083 DevPathToTextNodeGeneric (
2084 IN OUT POOL_PRINT
*Str
,
2086 IN BOOLEAN DisplayOnly
,
2087 IN BOOLEAN AllowShortcuts
2090 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2095 for (Index
= 0; mUefiDevicePathLibToTextTableGeneric
[Index
].Text
!= NULL
; Index
++) {
2096 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTableGeneric
[Index
].Type
) {
2101 if (mUefiDevicePathLibToTextTableGeneric
[Index
].Text
== NULL
) {
2103 // It's a node whose type cannot be recognized
2105 UefiDevicePathLibCatPrint (Str
, L
"Path(%d,%d", DevicePathType (Node
), DevicePathSubType (Node
));
2108 // It's a node whose type can be recognized
2110 UefiDevicePathLibCatPrint (Str
, L
"%s(%d", mUefiDevicePathLibToTextTableGeneric
[Index
].Text
, DevicePathSubType (Node
));
2113 Index
= sizeof (EFI_DEVICE_PATH_PROTOCOL
);
2114 if (Index
< DevicePathNodeLength (Node
)) {
2115 UefiDevicePathLibCatPrint (Str
, L
",");
2116 for (; Index
< DevicePathNodeLength (Node
); Index
++) {
2117 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*) Node
)[Index
]);
2121 UefiDevicePathLibCatPrint (Str
, L
")");
2124 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable
[] = {
2125 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
2126 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
2127 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
2128 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
2129 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
2130 {HARDWARE_DEVICE_PATH
, HW_BMC_DP
, DevPathToTextBmc
},
2131 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
2132 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
2133 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
2134 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
2135 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
2136 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
2137 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
2138 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
2139 {MESSAGING_DEVICE_PATH
, MSG_NVME_NAMESPACE_DP
, DevPathToTextNVMe
},
2140 {MESSAGING_DEVICE_PATH
, MSG_UFS_DP
, DevPathToTextUfs
},
2141 {MESSAGING_DEVICE_PATH
, MSG_SD_DP
, DevPathToTextSd
},
2142 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
2143 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
2144 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
2145 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
2146 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
2147 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
2148 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
2149 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
2150 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
2151 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
2152 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
2153 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
2154 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
2155 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
2156 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
2157 {MESSAGING_DEVICE_PATH
, MSG_URI_DP
, DevPathToTextUri
},
2158 {MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_DP
, DevPathToTextBluetooth
},
2159 {MESSAGING_DEVICE_PATH
, MSG_WIFI_DP
, DevPathToTextWiFi
},
2160 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
2161 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
2162 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
2163 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
2164 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
2165 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
2166 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
2167 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
2168 {MEDIA_DEVICE_PATH
, MEDIA_RAM_DISK_DP
, DevPathToTextRamDisk
},
2169 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
2170 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
2175 Converts a device node to its string representation.
2177 @param DeviceNode A Pointer to the device node to be converted.
2178 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2179 of the display node is used, where applicable. If DisplayOnly
2180 is FALSE, then the longer text representation of the display node
2182 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2183 representation for a device node can be used, where applicable.
2185 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
2186 is NULL or there was insufficient memory.
2191 UefiDevicePathLibConvertDeviceNodeToText (
2192 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
2193 IN BOOLEAN DisplayOnly
,
2194 IN BOOLEAN AllowShortcuts
2199 DEVICE_PATH_TO_TEXT ToText
;
2201 if (DeviceNode
== NULL
) {
2205 ZeroMem (&Str
, sizeof (Str
));
2208 // Process the device path node
2209 // If not found, use a generic function
2211 ToText
= DevPathToTextNodeGeneric
;
2212 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
++) {
2213 if (DevicePathType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2214 DevicePathSubType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2216 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2224 ToText (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
2226 ASSERT (Str
.Str
!= NULL
);
2231 Converts a device path to its text representation.
2233 @param DevicePath A Pointer to the device to be converted.
2234 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2235 of the display node is used, where applicable. If DisplayOnly
2236 is FALSE, then the longer text representation of the display node
2238 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2239 representation for a device node can be used, where applicable.
2241 @return A pointer to the allocated text representation of the device path or
2242 NULL if DeviceNode is NULL or there was insufficient memory.
2247 UefiDevicePathLibConvertDevicePathToText (
2248 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
2249 IN BOOLEAN DisplayOnly
,
2250 IN BOOLEAN AllowShortcuts
2254 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2255 EFI_DEVICE_PATH_PROTOCOL
*AlignedNode
;
2257 DEVICE_PATH_TO_TEXT ToText
;
2259 if (DevicePath
== NULL
) {
2263 ZeroMem (&Str
, sizeof (Str
));
2266 // Process each device path node
2268 Node
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
2269 while (!IsDevicePathEnd (Node
)) {
2271 // Find the handler to dump this device path node
2272 // If not found, use a generic function
2274 ToText
= DevPathToTextNodeGeneric
;
2275 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
2277 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2278 DevicePathSubType (Node
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2280 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2285 // Put a path separator in if needed
2287 if ((Str
.Count
!= 0) && (ToText
!= DevPathToTextEndInstance
)) {
2288 if (Str
.Str
[Str
.Count
] != L
',') {
2289 UefiDevicePathLibCatPrint (&Str
, L
"/");
2293 AlignedNode
= AllocateCopyPool (DevicePathNodeLength (Node
), Node
);
2295 // Print this node of the device path
2297 ToText (&Str
, AlignedNode
, DisplayOnly
, AllowShortcuts
);
2298 FreePool (AlignedNode
);
2301 // Next device path node
2303 Node
= NextDevicePathNode (Node
);
2306 if (Str
.Str
== NULL
) {
2307 return AllocateZeroPool (sizeof (CHAR16
));