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 EMMC (Embedded MMC) 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 EMMC_DEVICE_PATH
*Emmc
;
849 UefiDevicePathLibCatPrint (
857 Converts a 1394 device path structure to its string representative.
859 @param Str The string representative of input device.
860 @param DevPath The input device path structure.
861 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
862 of the display node is used, where applicable. If DisplayOnly
863 is FALSE, then the longer text representation of the display node
865 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
866 representation for a device node can be used, where applicable.
871 IN OUT POOL_PRINT
*Str
,
873 IN BOOLEAN DisplayOnly
,
874 IN BOOLEAN AllowShortcuts
877 F1394_DEVICE_PATH
*F1394DevPath
;
879 F1394DevPath
= DevPath
;
881 // Guid has format of IEEE-EUI64
883 UefiDevicePathLibCatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
887 Converts a USB device path structure to its string representative.
889 @param Str The string representative of input device.
890 @param DevPath The input device path structure.
891 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
892 of the display node is used, where applicable. If DisplayOnly
893 is FALSE, then the longer text representation of the display node
895 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
896 representation for a device node can be used, where applicable.
901 IN OUT POOL_PRINT
*Str
,
903 IN BOOLEAN DisplayOnly
,
904 IN BOOLEAN AllowShortcuts
907 USB_DEVICE_PATH
*Usb
;
910 UefiDevicePathLibCatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
914 Converts a USB WWID device path structure to its string representative.
916 @param Str The string representative of input device.
917 @param DevPath The input device path structure.
918 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
919 of the display node is used, where applicable. If DisplayOnly
920 is FALSE, then the longer text representation of the display node
922 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
923 representation for a device node can be used, where applicable.
927 DevPathToTextUsbWWID (
928 IN OUT POOL_PRINT
*Str
,
930 IN BOOLEAN DisplayOnly
,
931 IN BOOLEAN AllowShortcuts
934 USB_WWID_DEVICE_PATH
*UsbWWId
;
935 CHAR16
*SerialNumberStr
;
941 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
942 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
943 if (SerialNumberStr
[Length
- 1] != 0) {
945 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
947 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
948 ASSERT (NewStr
!= NULL
);
950 SerialNumberStr
= NewStr
;
953 UefiDevicePathLibCatPrint (
955 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
958 UsbWWId
->InterfaceNumber
,
964 Converts a Logic Unit device path structure to its string representative.
966 @param Str The string representative of input device.
967 @param DevPath The input device path structure.
968 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
969 of the display node is used, where applicable. If DisplayOnly
970 is FALSE, then the longer text representation of the display node
972 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
973 representation for a device node can be used, where applicable.
977 DevPathToTextLogicalUnit (
978 IN OUT POOL_PRINT
*Str
,
980 IN BOOLEAN DisplayOnly
,
981 IN BOOLEAN AllowShortcuts
984 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
986 LogicalUnit
= DevPath
;
987 UefiDevicePathLibCatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
991 Converts a USB class device path structure to its string representative.
993 @param Str The string representative of input device.
994 @param DevPath The input device path structure.
995 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
996 of the display node is used, where applicable. If DisplayOnly
997 is FALSE, then the longer text representation of the display node
999 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1000 representation for a device node can be used, where applicable.
1004 DevPathToTextUsbClass (
1005 IN OUT POOL_PRINT
*Str
,
1007 IN BOOLEAN DisplayOnly
,
1008 IN BOOLEAN AllowShortcuts
1011 USB_CLASS_DEVICE_PATH
*UsbClass
;
1012 BOOLEAN IsKnownSubClass
;
1017 IsKnownSubClass
= TRUE
;
1018 switch (UsbClass
->DeviceClass
) {
1019 case USB_CLASS_AUDIO
:
1020 UefiDevicePathLibCatPrint (Str
, L
"UsbAudio");
1023 case USB_CLASS_CDCCONTROL
:
1024 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCControl");
1028 UefiDevicePathLibCatPrint (Str
, L
"UsbHID");
1031 case USB_CLASS_IMAGE
:
1032 UefiDevicePathLibCatPrint (Str
, L
"UsbImage");
1035 case USB_CLASS_PRINTER
:
1036 UefiDevicePathLibCatPrint (Str
, L
"UsbPrinter");
1039 case USB_CLASS_MASS_STORAGE
:
1040 UefiDevicePathLibCatPrint (Str
, L
"UsbMassStorage");
1044 UefiDevicePathLibCatPrint (Str
, L
"UsbHub");
1047 case USB_CLASS_CDCDATA
:
1048 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCData");
1051 case USB_CLASS_SMART_CARD
:
1052 UefiDevicePathLibCatPrint (Str
, L
"UsbSmartCard");
1055 case USB_CLASS_VIDEO
:
1056 UefiDevicePathLibCatPrint (Str
, L
"UsbVideo");
1059 case USB_CLASS_DIAGNOSTIC
:
1060 UefiDevicePathLibCatPrint (Str
, L
"UsbDiagnostic");
1063 case USB_CLASS_WIRELESS
:
1064 UefiDevicePathLibCatPrint (Str
, L
"UsbWireless");
1068 IsKnownSubClass
= FALSE
;
1072 if (IsKnownSubClass
) {
1073 UefiDevicePathLibCatPrint (
1075 L
"(0x%x,0x%x,0x%x,0x%x)",
1077 UsbClass
->ProductId
,
1078 UsbClass
->DeviceSubClass
,
1079 UsbClass
->DeviceProtocol
1084 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
1085 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
1086 UefiDevicePathLibCatPrint (
1088 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
1090 UsbClass
->ProductId
,
1091 UsbClass
->DeviceProtocol
1094 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
1095 UefiDevicePathLibCatPrint (
1097 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
1099 UsbClass
->ProductId
,
1100 UsbClass
->DeviceProtocol
1103 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
1104 UefiDevicePathLibCatPrint (
1106 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
1108 UsbClass
->ProductId
,
1109 UsbClass
->DeviceProtocol
1115 UefiDevicePathLibCatPrint (
1117 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
1119 UsbClass
->ProductId
,
1120 UsbClass
->DeviceClass
,
1121 UsbClass
->DeviceSubClass
,
1122 UsbClass
->DeviceProtocol
1127 Converts a SATA device path structure to its string representative.
1129 @param Str The string representative of input device.
1130 @param DevPath The input device path structure.
1131 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1132 of the display node is used, where applicable. If DisplayOnly
1133 is FALSE, then the longer text representation of the display node
1135 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1136 representation for a device node can be used, where applicable.
1141 IN OUT POOL_PRINT
*Str
,
1143 IN BOOLEAN DisplayOnly
,
1144 IN BOOLEAN AllowShortcuts
1147 SATA_DEVICE_PATH
*Sata
;
1150 UefiDevicePathLibCatPrint (
1152 L
"Sata(0x%x,0x%x,0x%x)",
1153 Sata
->HBAPortNumber
,
1154 Sata
->PortMultiplierPortNumber
,
1160 Converts a I20 device path structure to its string representative.
1162 @param Str The string representative of input device.
1163 @param DevPath The input device path structure.
1164 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1165 of the display node is used, where applicable. If DisplayOnly
1166 is FALSE, then the longer text representation of the display node
1168 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1169 representation for a device node can be used, where applicable.
1174 IN OUT POOL_PRINT
*Str
,
1176 IN BOOLEAN DisplayOnly
,
1177 IN BOOLEAN AllowShortcuts
1180 I2O_DEVICE_PATH
*I2ODevPath
;
1182 I2ODevPath
= DevPath
;
1183 UefiDevicePathLibCatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1187 Converts a MAC address device path structure to its string representative.
1189 @param Str The string representative of input device.
1190 @param DevPath The input device path structure.
1191 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1192 of the display node is used, where applicable. If DisplayOnly
1193 is FALSE, then the longer text representation of the display node
1195 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1196 representation for a device node can be used, where applicable.
1200 DevPathToTextMacAddr (
1201 IN OUT POOL_PRINT
*Str
,
1203 IN BOOLEAN DisplayOnly
,
1204 IN BOOLEAN AllowShortcuts
1207 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1208 UINTN HwAddressSize
;
1211 MacDevPath
= DevPath
;
1213 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1214 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1218 UefiDevicePathLibCatPrint (Str
, L
"MAC(");
1220 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1221 UefiDevicePathLibCatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1224 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1228 Converts network protocol string to its text representation.
1230 @param Str The string representative of input device.
1231 @param Protocol The network protocol ID.
1235 CatNetworkProtocol (
1236 IN OUT POOL_PRINT
*Str
,
1240 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1241 UefiDevicePathLibCatPrint (Str
, L
"TCP");
1242 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1243 UefiDevicePathLibCatPrint (Str
, L
"UDP");
1245 UefiDevicePathLibCatPrint (Str
, L
"0x%x", Protocol
);
1250 Converts IP v4 address to its text representation.
1252 @param Str The string representative of input device.
1253 @param Address The IP v4 address.
1257 IN OUT POOL_PRINT
*Str
,
1258 IN EFI_IPv4_ADDRESS
*Address
1261 UefiDevicePathLibCatPrint (Str
, L
"%d.%d.%d.%d", Address
->Addr
[0], Address
->Addr
[1], Address
->Addr
[2], Address
->Addr
[3]);
1265 Converts IP v6 address to its text representation.
1267 @param Str The string representative of input device.
1268 @param Address The IP v6 address.
1272 IN OUT POOL_PRINT
*Str
,
1273 IN EFI_IPv6_ADDRESS
*Address
1276 UefiDevicePathLibCatPrint (
1277 Str
, L
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1278 Address
->Addr
[0], Address
->Addr
[1],
1279 Address
->Addr
[2], Address
->Addr
[3],
1280 Address
->Addr
[4], Address
->Addr
[5],
1281 Address
->Addr
[6], Address
->Addr
[7],
1282 Address
->Addr
[8], Address
->Addr
[9],
1283 Address
->Addr
[10], Address
->Addr
[11],
1284 Address
->Addr
[12], Address
->Addr
[13],
1285 Address
->Addr
[14], Address
->Addr
[15]
1290 Converts a IPv4 device path structure to its string representative.
1292 @param Str The string representative of input device.
1293 @param DevPath The input device path structure.
1294 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1295 of the display node is used, where applicable. If DisplayOnly
1296 is FALSE, then the longer text representation of the display node
1298 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1299 representation for a device node can be used, where applicable.
1304 IN OUT POOL_PRINT
*Str
,
1306 IN BOOLEAN DisplayOnly
,
1307 IN BOOLEAN AllowShortcuts
1310 IPv4_DEVICE_PATH
*IPDevPath
;
1312 IPDevPath
= DevPath
;
1313 UefiDevicePathLibCatPrint (Str
, L
"IPv4(");
1314 CatIPv4Address (Str
, &IPDevPath
->RemoteIpAddress
);
1317 UefiDevicePathLibCatPrint (Str
, L
")");
1321 UefiDevicePathLibCatPrint (Str
, L
",");
1322 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1324 UefiDevicePathLibCatPrint (Str
, L
",%s,", IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP");
1325 CatIPv4Address (Str
, &IPDevPath
->LocalIpAddress
);
1326 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1327 UefiDevicePathLibCatPrint (Str
, L
",");
1328 CatIPv4Address (Str
, &IPDevPath
->GatewayIpAddress
);
1329 UefiDevicePathLibCatPrint (Str
, L
",");
1330 CatIPv4Address (Str
, &IPDevPath
->SubnetMask
);
1332 UefiDevicePathLibCatPrint (Str
, L
")");
1336 Converts a IPv6 device path structure to its string representative.
1338 @param Str The string representative of input device.
1339 @param DevPath The input device path structure.
1340 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1341 of the display node is used, where applicable. If DisplayOnly
1342 is FALSE, then the longer text representation of the display node
1344 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1345 representation for a device node can be used, where applicable.
1350 IN OUT POOL_PRINT
*Str
,
1352 IN BOOLEAN DisplayOnly
,
1353 IN BOOLEAN AllowShortcuts
1356 IPv6_DEVICE_PATH
*IPDevPath
;
1358 IPDevPath
= DevPath
;
1359 UefiDevicePathLibCatPrint (Str
, L
"IPv6(");
1360 CatIPv6Address (Str
, &IPDevPath
->RemoteIpAddress
);
1362 UefiDevicePathLibCatPrint (Str
, L
")");
1366 UefiDevicePathLibCatPrint (Str
, L
",");
1367 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1369 switch (IPDevPath
->IpAddressOrigin
) {
1371 UefiDevicePathLibCatPrint (Str
, L
",Static,");
1374 UefiDevicePathLibCatPrint (Str
, L
",StatelessAutoConfigure,");
1377 UefiDevicePathLibCatPrint (Str
, L
",StatefulAutoConfigure,");
1381 CatIPv6Address (Str
, &IPDevPath
->LocalIpAddress
);
1383 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1384 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", IPDevPath
->PrefixLength
);
1385 CatIPv6Address (Str
, &IPDevPath
->GatewayIpAddress
);
1387 UefiDevicePathLibCatPrint (Str
, L
")");
1391 Converts an Infini Band device path structure to its string representative.
1393 @param Str The string representative of input device.
1394 @param DevPath The input device path structure.
1395 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1396 of the display node is used, where applicable. If DisplayOnly
1397 is FALSE, then the longer text representation of the display node
1399 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1400 representation for a device node can be used, where applicable.
1404 DevPathToTextInfiniBand (
1405 IN OUT POOL_PRINT
*Str
,
1407 IN BOOLEAN DisplayOnly
,
1408 IN BOOLEAN AllowShortcuts
1411 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1413 InfiniBand
= DevPath
;
1414 UefiDevicePathLibCatPrint (
1416 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1417 InfiniBand
->ResourceFlags
,
1418 InfiniBand
->PortGid
,
1419 InfiniBand
->ServiceId
,
1420 InfiniBand
->TargetPortId
,
1421 InfiniBand
->DeviceId
1426 Converts a UART device path structure to its string representative.
1428 @param Str The string representative of input device.
1429 @param DevPath The input device path structure.
1430 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1431 of the display node is used, where applicable. If DisplayOnly
1432 is FALSE, then the longer text representation of the display node
1434 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1435 representation for a device node can be used, where applicable.
1440 IN OUT POOL_PRINT
*Str
,
1442 IN BOOLEAN DisplayOnly
,
1443 IN BOOLEAN AllowShortcuts
1446 UART_DEVICE_PATH
*Uart
;
1450 switch (Uart
->Parity
) {
1480 if (Uart
->BaudRate
== 0) {
1481 UefiDevicePathLibCatPrint (Str
, L
"Uart(DEFAULT,");
1483 UefiDevicePathLibCatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1486 if (Uart
->DataBits
== 0) {
1487 UefiDevicePathLibCatPrint (Str
, L
"DEFAULT,");
1489 UefiDevicePathLibCatPrint (Str
, L
"%d,", Uart
->DataBits
);
1492 UefiDevicePathLibCatPrint (Str
, L
"%c,", Parity
);
1494 switch (Uart
->StopBits
) {
1496 UefiDevicePathLibCatPrint (Str
, L
"D)");
1500 UefiDevicePathLibCatPrint (Str
, L
"1)");
1504 UefiDevicePathLibCatPrint (Str
, L
"1.5)");
1508 UefiDevicePathLibCatPrint (Str
, L
"2)");
1512 UefiDevicePathLibCatPrint (Str
, L
"x)");
1518 Converts an iSCSI device path structure to its string representative.
1520 @param Str The string representative of input device.
1521 @param DevPath The input device path structure.
1522 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1523 of the display node is used, where applicable. If DisplayOnly
1524 is FALSE, then the longer text representation of the display node
1526 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1527 representation for a device node can be used, where applicable.
1531 DevPathToTextiSCSI (
1532 IN OUT POOL_PRINT
*Str
,
1534 IN BOOLEAN DisplayOnly
,
1535 IN BOOLEAN AllowShortcuts
1538 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1541 ISCSIDevPath
= DevPath
;
1542 UefiDevicePathLibCatPrint (
1544 L
"iSCSI(%a,0x%x,0x%lx,",
1545 ISCSIDevPath
->TargetName
,
1546 ISCSIDevPath
->TargetPortalGroupTag
,
1550 Options
= ISCSIDevPath
->LoginOption
;
1551 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1552 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1553 if (((Options
>> 11) & 0x0001) != 0) {
1554 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"None");
1555 } else if (((Options
>> 12) & 0x0001) != 0) {
1556 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1558 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_BI");
1562 UefiDevicePathLibCatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1566 Converts a VLAN device path structure to its string representative.
1568 @param Str The string representative of input device.
1569 @param DevPath The input device path structure.
1570 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1571 of the display node is used, where applicable. If DisplayOnly
1572 is FALSE, then the longer text representation of the display node
1574 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1575 representation for a device node can be used, where applicable.
1580 IN OUT POOL_PRINT
*Str
,
1582 IN BOOLEAN DisplayOnly
,
1583 IN BOOLEAN AllowShortcuts
1586 VLAN_DEVICE_PATH
*Vlan
;
1589 UefiDevicePathLibCatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1593 Converts a Bluetooth device path structure to its string representative.
1595 @param Str The string representative of input device.
1596 @param DevPath The input device path structure.
1597 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1598 of the display node is used, where applicable. If DisplayOnly
1599 is FALSE, then the longer text representation of the display node
1601 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1602 representation for a device node can be used, where applicable.
1606 DevPathToTextBluetooth (
1607 IN OUT POOL_PRINT
*Str
,
1609 IN BOOLEAN DisplayOnly
,
1610 IN BOOLEAN AllowShortcuts
1613 BLUETOOTH_DEVICE_PATH
*Bluetooth
;
1615 Bluetooth
= DevPath
;
1616 UefiDevicePathLibCatPrint (
1618 L
"Bluetooth(%02x%02x%02x%02x%02x%02x)",
1619 Bluetooth
->BD_ADDR
.Address
[5],
1620 Bluetooth
->BD_ADDR
.Address
[4],
1621 Bluetooth
->BD_ADDR
.Address
[3],
1622 Bluetooth
->BD_ADDR
.Address
[2],
1623 Bluetooth
->BD_ADDR
.Address
[1],
1624 Bluetooth
->BD_ADDR
.Address
[0]
1629 Converts a Wi-Fi device path structure to its string representative.
1631 @param Str The string representative of input device.
1632 @param DevPath The input device path structure.
1633 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1634 of the display node is used, where applicable. If DisplayOnly
1635 is FALSE, then the longer text representation of the display node
1637 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1638 representation for a device node can be used, where applicable.
1643 IN OUT POOL_PRINT
*Str
,
1645 IN BOOLEAN DisplayOnly
,
1646 IN BOOLEAN AllowShortcuts
1649 WIFI_DEVICE_PATH
*WiFi
;
1655 CopyMem (SSId
, WiFi
->SSId
, 32);
1657 UefiDevicePathLibCatPrint (Str
, L
"Wi-Fi(%a)", SSId
);
1661 Converts a URI device path structure to its string representative.
1663 @param Str The string representative of input device.
1664 @param DevPath The input device path structure.
1665 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1666 of the display node is used, where applicable. If DisplayOnly
1667 is FALSE, then the longer text representation of the display node
1669 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1670 representation for a device node can be used, where applicable.
1675 IN OUT POOL_PRINT
*Str
,
1677 IN BOOLEAN DisplayOnly
,
1678 IN BOOLEAN AllowShortcuts
1681 URI_DEVICE_PATH
*Uri
;
1686 // Uri in the device path may not be null terminated.
1689 UriLength
= DevicePathNodeLength (Uri
) - sizeof (URI_DEVICE_PATH
);
1690 UriStr
= AllocatePool (UriLength
+ 1);
1691 ASSERT (UriStr
!= NULL
);
1693 CopyMem (UriStr
, Uri
->Uri
, UriLength
);
1694 UriStr
[UriLength
] = '\0';
1695 UefiDevicePathLibCatPrint (Str
, L
"Uri(%a)", UriStr
);
1700 Converts a Hard drive device path structure to its string representative.
1702 @param Str The string representative of input device.
1703 @param DevPath The input device path structure.
1704 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1705 of the display node is used, where applicable. If DisplayOnly
1706 is FALSE, then the longer text representation of the display node
1708 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1709 representation for a device node can be used, where applicable.
1713 DevPathToTextHardDrive (
1714 IN OUT POOL_PRINT
*Str
,
1716 IN BOOLEAN DisplayOnly
,
1717 IN BOOLEAN AllowShortcuts
1720 HARDDRIVE_DEVICE_PATH
*Hd
;
1723 switch (Hd
->SignatureType
) {
1724 case SIGNATURE_TYPE_MBR
:
1725 UefiDevicePathLibCatPrint (
1727 L
"HD(%d,%s,0x%08x,",
1728 Hd
->PartitionNumber
,
1730 *((UINT32
*) (&(Hd
->Signature
[0])))
1734 case SIGNATURE_TYPE_GUID
:
1735 UefiDevicePathLibCatPrint (
1738 Hd
->PartitionNumber
,
1740 (EFI_GUID
*) &(Hd
->Signature
[0])
1745 UefiDevicePathLibCatPrint (
1748 Hd
->PartitionNumber
,
1754 UefiDevicePathLibCatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1758 Converts a CDROM device path structure to its string representative.
1760 @param Str The string representative of input device.
1761 @param DevPath The input device path structure.
1762 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1763 of the display node is used, where applicable. If DisplayOnly
1764 is FALSE, then the longer text representation of the display node
1766 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1767 representation for a device node can be used, where applicable.
1771 DevPathToTextCDROM (
1772 IN OUT POOL_PRINT
*Str
,
1774 IN BOOLEAN DisplayOnly
,
1775 IN BOOLEAN AllowShortcuts
1778 CDROM_DEVICE_PATH
*Cd
;
1782 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1786 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1790 Converts a File device path structure to its string representative.
1792 @param Str The string representative of input device.
1793 @param DevPath The input device path structure.
1794 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1795 of the display node is used, where applicable. If DisplayOnly
1796 is FALSE, then the longer text representation of the display node
1798 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1799 representation for a device node can be used, where applicable.
1803 DevPathToTextFilePath (
1804 IN OUT POOL_PRINT
*Str
,
1806 IN BOOLEAN DisplayOnly
,
1807 IN BOOLEAN AllowShortcuts
1810 FILEPATH_DEVICE_PATH
*Fp
;
1813 UefiDevicePathLibCatPrint (Str
, L
"%s", Fp
->PathName
);
1817 Converts a Media protocol device path structure to its string representative.
1819 @param Str The string representative of input device.
1820 @param DevPath The input device path structure.
1821 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1822 of the display node is used, where applicable. If DisplayOnly
1823 is FALSE, then the longer text representation of the display node
1825 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1826 representation for a device node can be used, where applicable.
1830 DevPathToTextMediaProtocol (
1831 IN OUT POOL_PRINT
*Str
,
1833 IN BOOLEAN DisplayOnly
,
1834 IN BOOLEAN AllowShortcuts
1837 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1839 MediaProt
= DevPath
;
1840 UefiDevicePathLibCatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1844 Converts a Firmware Volume device path structure to its string representative.
1846 @param Str The string representative of input device.
1847 @param DevPath The input device path structure.
1848 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1849 of the display node is used, where applicable. If DisplayOnly
1850 is FALSE, then the longer text representation of the display node
1852 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1853 representation for a device node can be used, where applicable.
1858 IN OUT POOL_PRINT
*Str
,
1860 IN BOOLEAN DisplayOnly
,
1861 IN BOOLEAN AllowShortcuts
1864 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1867 UefiDevicePathLibCatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1871 Converts a Firmware Volume File device path structure to its string representative.
1873 @param Str The string representative of input device.
1874 @param DevPath The input device path structure.
1875 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1876 of the display node is used, where applicable. If DisplayOnly
1877 is FALSE, then the longer text representation of the display node
1879 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1880 representation for a device node can be used, where applicable.
1884 DevPathToTextFvFile (
1885 IN OUT POOL_PRINT
*Str
,
1887 IN BOOLEAN DisplayOnly
,
1888 IN BOOLEAN AllowShortcuts
1891 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1894 UefiDevicePathLibCatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1898 Converts a Relative Offset device path structure to its string representative.
1900 @param Str The string representative of input device.
1901 @param DevPath The input device path structure.
1902 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1903 of the display node is used, where applicable. If DisplayOnly
1904 is FALSE, then the longer text representation of the display node
1906 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1907 representation for a device node can be used, where applicable.
1911 DevPathRelativeOffsetRange (
1912 IN OUT POOL_PRINT
*Str
,
1914 IN BOOLEAN DisplayOnly
,
1915 IN BOOLEAN AllowShortcuts
1918 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1921 UefiDevicePathLibCatPrint (
1923 L
"Offset(0x%lx,0x%lx)",
1924 Offset
->StartingOffset
,
1925 Offset
->EndingOffset
1930 Converts a Ram Disk device path structure to its string representative.
1932 @param Str The string representative of input device.
1933 @param DevPath The input device path structure.
1934 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1935 of the display node is used, where applicable. If DisplayOnly
1936 is FALSE, then the longer text representation of the display node
1938 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1939 representation for a device node can be used, where applicable.
1943 DevPathToTextRamDisk (
1944 IN OUT POOL_PRINT
*Str
,
1946 IN BOOLEAN DisplayOnly
,
1947 IN BOOLEAN AllowShortcuts
1950 MEDIA_RAM_DISK_DEVICE_PATH
*RamDisk
;
1954 if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualDiskGuid
)) {
1955 UefiDevicePathLibCatPrint (
1957 L
"VirtualDisk(0x%lx,0x%lx,%d)",
1958 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1959 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1962 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualCdGuid
)) {
1963 UefiDevicePathLibCatPrint (
1965 L
"VirtualCD(0x%lx,0x%lx,%d)",
1966 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1967 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1970 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualDiskGuid
)) {
1971 UefiDevicePathLibCatPrint (
1973 L
"PersistentVirtualDisk(0x%lx,0x%lx,%d)",
1974 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1975 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1978 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualCdGuid
)) {
1979 UefiDevicePathLibCatPrint (
1981 L
"PersistentVirtualCD(0x%lx,0x%lx,%d)",
1982 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1983 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1987 UefiDevicePathLibCatPrint (
1989 L
"RamDisk(0x%lx,0x%lx,%d,%g)",
1990 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
1991 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
1999 Converts a BIOS Boot Specification device path structure to its string representative.
2001 @param Str The string representative of input device.
2002 @param DevPath The input device path structure.
2003 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2004 of the display node is used, where applicable. If DisplayOnly
2005 is FALSE, then the longer text representation of the display node
2007 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2008 representation for a device node can be used, where applicable.
2013 IN OUT POOL_PRINT
*Str
,
2015 IN BOOLEAN DisplayOnly
,
2016 IN BOOLEAN AllowShortcuts
2019 BBS_BBS_DEVICE_PATH
*Bbs
;
2023 switch (Bbs
->DeviceType
) {
2024 case BBS_TYPE_FLOPPY
:
2028 case BBS_TYPE_HARDDRIVE
:
2032 case BBS_TYPE_CDROM
:
2036 case BBS_TYPE_PCMCIA
:
2044 case BBS_TYPE_EMBEDDED_NETWORK
:
2054 UefiDevicePathLibCatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
2056 UefiDevicePathLibCatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
2060 UefiDevicePathLibCatPrint (Str
, L
")");
2064 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
2068 Converts an End-of-Device-Path structure to its string representative.
2070 @param Str The string representative of input device.
2071 @param DevPath The input device path structure.
2072 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2073 of the display node is used, where applicable. If DisplayOnly
2074 is FALSE, then the longer text representation of the display node
2076 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2077 representation for a device node can be used, where applicable.
2081 DevPathToTextEndInstance (
2082 IN OUT POOL_PRINT
*Str
,
2084 IN BOOLEAN DisplayOnly
,
2085 IN BOOLEAN AllowShortcuts
2088 UefiDevicePathLibCatPrint (Str
, L
",");
2091 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric
[] = {
2092 {HARDWARE_DEVICE_PATH
, L
"HardwarePath" },
2093 {ACPI_DEVICE_PATH
, L
"AcpiPath" },
2094 {MESSAGING_DEVICE_PATH
, L
"Msg" },
2095 {MEDIA_DEVICE_PATH
, L
"MediaPath" },
2096 {BBS_DEVICE_PATH
, L
"BbsPath" },
2101 Converts an unknown device path structure to its string representative.
2103 @param Str The string representative of input device.
2104 @param DevPath The input device path structure.
2105 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2106 of the display node is used, where applicable. If DisplayOnly
2107 is FALSE, then the longer text representation of the display node
2109 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2110 representation for a device node can be used, where applicable.
2114 DevPathToTextNodeGeneric (
2115 IN OUT POOL_PRINT
*Str
,
2117 IN BOOLEAN DisplayOnly
,
2118 IN BOOLEAN AllowShortcuts
2121 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2126 for (Index
= 0; mUefiDevicePathLibToTextTableGeneric
[Index
].Text
!= NULL
; Index
++) {
2127 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTableGeneric
[Index
].Type
) {
2132 if (mUefiDevicePathLibToTextTableGeneric
[Index
].Text
== NULL
) {
2134 // It's a node whose type cannot be recognized
2136 UefiDevicePathLibCatPrint (Str
, L
"Path(%d,%d", DevicePathType (Node
), DevicePathSubType (Node
));
2139 // It's a node whose type can be recognized
2141 UefiDevicePathLibCatPrint (Str
, L
"%s(%d", mUefiDevicePathLibToTextTableGeneric
[Index
].Text
, DevicePathSubType (Node
));
2144 Index
= sizeof (EFI_DEVICE_PATH_PROTOCOL
);
2145 if (Index
< DevicePathNodeLength (Node
)) {
2146 UefiDevicePathLibCatPrint (Str
, L
",");
2147 for (; Index
< DevicePathNodeLength (Node
); Index
++) {
2148 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*) Node
)[Index
]);
2152 UefiDevicePathLibCatPrint (Str
, L
")");
2155 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable
[] = {
2156 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
2157 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
2158 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
2159 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
2160 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
2161 {HARDWARE_DEVICE_PATH
, HW_BMC_DP
, DevPathToTextBmc
},
2162 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
2163 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
2164 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
2165 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
2166 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
2167 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
2168 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
2169 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
2170 {MESSAGING_DEVICE_PATH
, MSG_NVME_NAMESPACE_DP
, DevPathToTextNVMe
},
2171 {MESSAGING_DEVICE_PATH
, MSG_UFS_DP
, DevPathToTextUfs
},
2172 {MESSAGING_DEVICE_PATH
, MSG_SD_DP
, DevPathToTextSd
},
2173 {MESSAGING_DEVICE_PATH
, MSG_EMMC_DP
, DevPathToTextEmmc
},
2174 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
2175 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
2176 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
2177 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
2178 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
2179 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
2180 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
2181 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
2182 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
2183 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
2184 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
2185 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
2186 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
2187 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
2188 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
2189 {MESSAGING_DEVICE_PATH
, MSG_URI_DP
, DevPathToTextUri
},
2190 {MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_DP
, DevPathToTextBluetooth
},
2191 {MESSAGING_DEVICE_PATH
, MSG_WIFI_DP
, DevPathToTextWiFi
},
2192 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
2193 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
2194 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
2195 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
2196 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
2197 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
2198 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
2199 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
2200 {MEDIA_DEVICE_PATH
, MEDIA_RAM_DISK_DP
, DevPathToTextRamDisk
},
2201 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
2202 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
2207 Converts a device node to its string representation.
2209 @param DeviceNode A Pointer to the device node to be converted.
2210 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2211 of the display node is used, where applicable. If DisplayOnly
2212 is FALSE, then the longer text representation of the display node
2214 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2215 representation for a device node can be used, where applicable.
2217 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
2218 is NULL or there was insufficient memory.
2223 UefiDevicePathLibConvertDeviceNodeToText (
2224 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
2225 IN BOOLEAN DisplayOnly
,
2226 IN BOOLEAN AllowShortcuts
2231 DEVICE_PATH_TO_TEXT ToText
;
2233 if (DeviceNode
== NULL
) {
2237 ZeroMem (&Str
, sizeof (Str
));
2240 // Process the device path node
2241 // If not found, use a generic function
2243 ToText
= DevPathToTextNodeGeneric
;
2244 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
++) {
2245 if (DevicePathType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2246 DevicePathSubType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2248 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2256 ToText (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
2258 ASSERT (Str
.Str
!= NULL
);
2263 Converts a device path to its text representation.
2265 @param DevicePath A Pointer to the device to be converted.
2266 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2267 of the display node is used, where applicable. If DisplayOnly
2268 is FALSE, then the longer text representation of the display node
2270 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2271 representation for a device node can be used, where applicable.
2273 @return A pointer to the allocated text representation of the device path or
2274 NULL if DeviceNode is NULL or there was insufficient memory.
2279 UefiDevicePathLibConvertDevicePathToText (
2280 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
2281 IN BOOLEAN DisplayOnly
,
2282 IN BOOLEAN AllowShortcuts
2286 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2287 EFI_DEVICE_PATH_PROTOCOL
*AlignedNode
;
2289 DEVICE_PATH_TO_TEXT ToText
;
2291 if (DevicePath
== NULL
) {
2295 ZeroMem (&Str
, sizeof (Str
));
2298 // Process each device path node
2300 Node
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
2301 while (!IsDevicePathEnd (Node
)) {
2303 // Find the handler to dump this device path node
2304 // If not found, use a generic function
2306 ToText
= DevPathToTextNodeGeneric
;
2307 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
2309 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2310 DevicePathSubType (Node
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2312 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2317 // Put a path separator in if needed
2319 if ((Str
.Count
!= 0) && (ToText
!= DevPathToTextEndInstance
)) {
2320 if (Str
.Str
[Str
.Count
] != L
',') {
2321 UefiDevicePathLibCatPrint (&Str
, L
"/");
2325 AlignedNode
= AllocateCopyPool (DevicePathNodeLength (Node
), Node
);
2327 // Print this node of the device path
2329 ToText (&Str
, AlignedNode
, DisplayOnly
, AllowShortcuts
);
2330 FreePool (AlignedNode
);
2333 // Next device path node
2335 Node
= NextDevicePathNode (Node
);
2338 if (Str
.Str
== NULL
) {
2339 return AllocateZeroPool (sizeof (CHAR16
));