2 DevicePathToText protocol as defined in the UEFI 2.0 specification.
4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
6 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
);
47 if ((Str
->Count
+ (Count
+ 1)) * sizeof (CHAR16
) > Str
->Capacity
) {
48 Str
->Capacity
= (Str
->Count
+ (Count
+ 1) * 2) * sizeof (CHAR16
);
49 Str
->Str
= ReallocatePool (
50 Str
->Count
* sizeof (CHAR16
),
54 ASSERT (Str
->Str
!= NULL
);
57 UnicodeVSPrint (&Str
->Str
[Str
->Count
], Str
->Capacity
- Str
->Count
* sizeof (CHAR16
), Fmt
, Args
);
65 Converts a PCI device path structure to its string representative.
67 @param Str The string representative of input device.
68 @param DevPath The input device path structure.
69 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
70 of the display node is used, where applicable. If DisplayOnly
71 is FALSE, then the longer text representation of the display node
73 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
74 representation for a device node can be used, where applicable.
79 IN OUT POOL_PRINT
*Str
,
81 IN BOOLEAN DisplayOnly
,
82 IN BOOLEAN AllowShortcuts
88 UefiDevicePathLibCatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
92 Converts a PC Card device path structure to its string representative.
94 @param Str The string representative of input device.
95 @param DevPath The input device path structure.
96 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
97 of the display node is used, where applicable. If DisplayOnly
98 is FALSE, then the longer text representation of the display node
100 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
101 representation for a device node can be used, where applicable.
105 DevPathToTextPccard (
106 IN OUT POOL_PRINT
*Str
,
108 IN BOOLEAN DisplayOnly
,
109 IN BOOLEAN AllowShortcuts
112 PCCARD_DEVICE_PATH
*Pccard
;
115 UefiDevicePathLibCatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
119 Converts a Memory Map device path structure to its string representative.
121 @param Str The string representative of input device.
122 @param DevPath The input device path structure.
123 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
124 of the display node is used, where applicable. If DisplayOnly
125 is FALSE, then the longer text representation of the display node
127 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
128 representation for a device node can be used, where applicable.
132 DevPathToTextMemMap (
133 IN OUT POOL_PRINT
*Str
,
135 IN BOOLEAN DisplayOnly
,
136 IN BOOLEAN AllowShortcuts
139 MEMMAP_DEVICE_PATH
*MemMap
;
142 UefiDevicePathLibCatPrint (
144 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
146 MemMap
->StartingAddress
,
147 MemMap
->EndingAddress
152 Converts a Vendor device path structure to its string representative.
154 @param Str The string representative of input device.
155 @param DevPath The input device path structure.
156 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
157 of the display node is used, where applicable. If DisplayOnly
158 is FALSE, then the longer text representation of the display node
160 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
161 representation for a device node can be used, where applicable.
165 DevPathToTextVendor (
166 IN OUT POOL_PRINT
*Str
,
168 IN BOOLEAN DisplayOnly
,
169 IN BOOLEAN AllowShortcuts
172 VENDOR_DEVICE_PATH
*Vendor
;
176 UINT32 FlowControlMap
;
179 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
180 switch (DevicePathType (&Vendor
->Header
)) {
181 case HARDWARE_DEVICE_PATH
:
185 case MESSAGING_DEVICE_PATH
:
187 if (AllowShortcuts
) {
188 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
189 UefiDevicePathLibCatPrint (Str
, L
"VenPcAnsi()");
191 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
192 UefiDevicePathLibCatPrint (Str
, L
"VenVt100()");
194 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
195 UefiDevicePathLibCatPrint (Str
, L
"VenVt100Plus()");
197 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
198 UefiDevicePathLibCatPrint (Str
, L
"VenUtf8()");
200 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
201 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
202 switch (FlowControlMap
& 0x00000003) {
204 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
208 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
212 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
220 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
221 UefiDevicePathLibCatPrint (
223 L
"SAS(0x%lx,0x%lx,0x%x,",
224 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
225 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
226 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
228 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
229 if (((Info
& 0x0f) == 0) && ((Info
& BIT7
) == 0)) {
230 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0,");
231 } else if (((Info
& 0x0f) <= 2) && ((Info
& BIT7
) == 0)) {
232 UefiDevicePathLibCatPrint (
235 ((Info
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
236 ((Info
& BIT5
) != 0) ? L
"External" : L
"Internal",
237 ((Info
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
239 if ((Info
& 0x0f) == 1) {
240 UefiDevicePathLibCatPrint (Str
, L
"0,");
243 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
245 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", ((Info
>> 8) & 0xff) + 1);
248 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0,", Info
);
251 UefiDevicePathLibCatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
253 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
254 UefiDevicePathLibCatPrint (Str
, L
"DebugPort()");
260 case MEDIA_DEVICE_PATH
:
269 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
270 UefiDevicePathLibCatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
271 if (DataLength
!= 0) {
272 UefiDevicePathLibCatPrint (Str
, L
",");
273 for (Index
= 0; Index
< DataLength
; Index
++) {
274 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
278 UefiDevicePathLibCatPrint (Str
, L
")");
282 Converts a Controller device path structure to its string representative.
284 @param Str The string representative of input device.
285 @param DevPath The input device path structure.
286 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
287 of the display node is used, where applicable. If DisplayOnly
288 is FALSE, then the longer text representation of the display node
290 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
291 representation for a device node can be used, where applicable.
295 DevPathToTextController (
296 IN OUT POOL_PRINT
*Str
,
298 IN BOOLEAN DisplayOnly
,
299 IN BOOLEAN AllowShortcuts
302 CONTROLLER_DEVICE_PATH
*Controller
;
304 Controller
= DevPath
;
305 UefiDevicePathLibCatPrint (
308 Controller
->ControllerNumber
313 Converts a BMC device path structure to its string representative.
315 @param Str The string representative of input device.
316 @param DevPath The input device path structure.
317 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
318 of the display node is used, where applicable. If DisplayOnly
319 is FALSE, then the longer text representation of the display node
321 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
322 representation for a device node can be used, where applicable.
327 IN OUT POOL_PRINT
*Str
,
329 IN BOOLEAN DisplayOnly
,
330 IN BOOLEAN AllowShortcuts
333 BMC_DEVICE_PATH
*Bmc
;
336 UefiDevicePathLibCatPrint (
340 ReadUnaligned64 ((UINT64
*) (&Bmc
->BaseAddress
))
345 Converts a ACPI device path structure to its string representative.
347 @param Str The string representative of input device.
348 @param DevPath The input device path structure.
349 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
350 of the display node is used, where applicable. If DisplayOnly
351 is FALSE, then the longer text representation of the display node
353 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
354 representation for a device node can be used, where applicable.
359 IN OUT POOL_PRINT
*Str
,
361 IN BOOLEAN DisplayOnly
,
362 IN BOOLEAN AllowShortcuts
365 ACPI_HID_DEVICE_PATH
*Acpi
;
368 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
369 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
371 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
375 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(0x%x)", Acpi
->UID
);
379 UefiDevicePathLibCatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
383 UefiDevicePathLibCatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
387 UefiDevicePathLibCatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
391 UefiDevicePathLibCatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
395 UefiDevicePathLibCatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
399 UefiDevicePathLibCatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
404 Converts a ACPI extended HID device path structure to its string representative.
406 @param Str The string representative of input device.
407 @param DevPath The input device path structure.
408 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
409 of the display node is used, where applicable. If DisplayOnly
410 is FALSE, then the longer text representation of the display node
412 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
413 representation for a device node can be used, where applicable.
417 DevPathToTextAcpiEx (
418 IN OUT POOL_PRINT
*Str
,
420 IN BOOLEAN DisplayOnly
,
421 IN BOOLEAN AllowShortcuts
424 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
432 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
433 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
434 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
437 if ((EISA_ID_TO_NUM (AcpiEx
->HID
) == 0x0A03) ||
438 (EISA_ID_TO_NUM (AcpiEx
->CID
) == 0x0A03 && EISA_ID_TO_NUM (AcpiEx
->HID
) != 0x0A08)) {
439 if (AcpiEx
->UID
== 0) {
440 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(%a)", UIDStr
);
442 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(0x%x)", AcpiEx
->UID
);
447 if (EISA_ID_TO_NUM (AcpiEx
->HID
) == 0x0A08 || EISA_ID_TO_NUM (AcpiEx
->CID
) == 0x0A08) {
448 if (AcpiEx
->UID
== 0) {
449 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(%a)", UIDStr
);
451 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(0x%x)", AcpiEx
->UID
);
458 // Converts EISA identification to string.
464 ((AcpiEx
->HID
>> 10) & 0x1f) + 'A' - 1,
465 ((AcpiEx
->HID
>> 5) & 0x1f) + 'A' - 1,
466 ((AcpiEx
->HID
>> 0) & 0x1f) + 'A' - 1,
467 (AcpiEx
->HID
>> 16) & 0xFFFF
473 ((AcpiEx
->CID
>> 10) & 0x1f) + 'A' - 1,
474 ((AcpiEx
->CID
>> 5) & 0x1f) + 'A' - 1,
475 ((AcpiEx
->CID
>> 0) & 0x1f) + 'A' - 1,
476 (AcpiEx
->CID
>> 16) & 0xFFFF
479 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (*UIDStr
!= '\0')) {
483 if (AcpiEx
->CID
== 0) {
484 UefiDevicePathLibCatPrint (
491 UefiDevicePathLibCatPrint (
493 L
"AcpiExp(%s,%s,%a)",
504 if (AcpiEx
->HID
== 0) {
505 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
507 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
510 if (AcpiEx
->CID
== 0) {
511 UefiDevicePathLibCatPrint (Str
, L
"%a,", CIDStr
);
513 UefiDevicePathLibCatPrint (Str
, L
"%s,", CIDText
);
516 if (AcpiEx
->UID
== 0) {
517 UefiDevicePathLibCatPrint (Str
, L
"%a)", UIDStr
);
519 UefiDevicePathLibCatPrint (Str
, L
"0x%x)", AcpiEx
->UID
);
522 UefiDevicePathLibCatPrint (
524 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
537 Converts a ACPI address device path structure to its string representative.
539 @param Str The string representative of input device.
540 @param DevPath The input device path structure.
541 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
542 of the display node is used, where applicable. If DisplayOnly
543 is FALSE, then the longer text representation of the display node
545 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
546 representation for a device node can be used, where applicable.
550 DevPathToTextAcpiAdr (
551 IN OUT POOL_PRINT
*Str
,
553 IN BOOLEAN DisplayOnly
,
554 IN BOOLEAN AllowShortcuts
557 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
560 UINT16 AdditionalAdrCount
;
563 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
564 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
566 UefiDevicePathLibCatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
567 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
568 UefiDevicePathLibCatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
570 UefiDevicePathLibCatPrint (Str
, L
")");
574 Converts a ATAPI device path structure to its string representative.
576 @param Str The string representative of input device.
577 @param DevPath The input device path structure.
578 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
579 of the display node is used, where applicable. If DisplayOnly
580 is FALSE, then the longer text representation of the display node
582 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
583 representation for a device node can be used, where applicable.
588 IN OUT POOL_PRINT
*Str
,
590 IN BOOLEAN DisplayOnly
,
591 IN BOOLEAN AllowShortcuts
594 ATAPI_DEVICE_PATH
*Atapi
;
599 UefiDevicePathLibCatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
601 UefiDevicePathLibCatPrint (
604 (Atapi
->PrimarySecondary
== 1) ? L
"Secondary" : L
"Primary",
605 (Atapi
->SlaveMaster
== 1) ? L
"Slave" : L
"Master",
612 Converts a SCSI device path structure to its string representative.
614 @param Str The string representative of input device.
615 @param DevPath The input device path structure.
616 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
617 of the display node is used, where applicable. If DisplayOnly
618 is FALSE, then the longer text representation of the display node
620 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
621 representation for a device node can be used, where applicable.
626 IN OUT POOL_PRINT
*Str
,
628 IN BOOLEAN DisplayOnly
,
629 IN BOOLEAN AllowShortcuts
632 SCSI_DEVICE_PATH
*Scsi
;
635 UefiDevicePathLibCatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
639 Converts a Fibre device path structure to its string representative.
641 @param Str The string representative of input device.
642 @param DevPath The input device path structure.
643 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
644 of the display node is used, where applicable. If DisplayOnly
645 is FALSE, then the longer text representation of the display node
647 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
648 representation for a device node can be used, where applicable.
653 IN OUT POOL_PRINT
*Str
,
655 IN BOOLEAN DisplayOnly
,
656 IN BOOLEAN AllowShortcuts
659 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
662 UefiDevicePathLibCatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
666 Converts a FibreEx device path structure to its string representative.
668 @param Str The string representative of input device.
669 @param DevPath The input device path structure.
670 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
671 of the display node is used, where applicable. If DisplayOnly
672 is FALSE, then the longer text representation of the display node
674 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
675 representation for a device node can be used, where applicable.
679 DevPathToTextFibreEx (
680 IN OUT POOL_PRINT
*Str
,
682 IN BOOLEAN DisplayOnly
,
683 IN BOOLEAN AllowShortcuts
686 FIBRECHANNELEX_DEVICE_PATH
*FibreEx
;
690 UefiDevicePathLibCatPrint (Str
, L
"FibreEx(0x");
691 for (Index
= 0; Index
< sizeof (FibreEx
->WWN
) / sizeof (FibreEx
->WWN
[0]); Index
++) {
692 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->WWN
[Index
]);
694 UefiDevicePathLibCatPrint (Str
, L
",0x");
695 for (Index
= 0; Index
< sizeof (FibreEx
->Lun
) / sizeof (FibreEx
->Lun
[0]); Index
++) {
696 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->Lun
[Index
]);
698 UefiDevicePathLibCatPrint (Str
, L
")");
702 Converts a Sas Ex device path structure to its string representative.
704 @param Str The string representative of input device.
705 @param DevPath The input device path structure.
706 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
707 of the display node is used, where applicable. If DisplayOnly
708 is FALSE, then the longer text representation of the display node
710 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
711 representation for a device node can be used, where applicable.
716 IN OUT POOL_PRINT
*Str
,
718 IN BOOLEAN DisplayOnly
,
719 IN BOOLEAN AllowShortcuts
722 SASEX_DEVICE_PATH
*SasEx
;
726 UefiDevicePathLibCatPrint (Str
, L
"SasEx(0x");
728 for (Index
= 0; Index
< sizeof (SasEx
->SasAddress
) / sizeof (SasEx
->SasAddress
[0]); Index
++) {
729 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->SasAddress
[Index
]);
731 UefiDevicePathLibCatPrint (Str
, L
",0x");
732 for (Index
= 0; Index
< sizeof (SasEx
->Lun
) / sizeof (SasEx
->Lun
[0]); Index
++) {
733 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->Lun
[Index
]);
735 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", SasEx
->RelativeTargetPort
);
737 if (((SasEx
->DeviceTopology
& 0x0f) == 0) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
738 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0");
739 } else if (((SasEx
->DeviceTopology
& 0x0f) <= 2) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
740 UefiDevicePathLibCatPrint (
743 ((SasEx
->DeviceTopology
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
744 ((SasEx
->DeviceTopology
& BIT5
) != 0) ? L
"External" : L
"Internal",
745 ((SasEx
->DeviceTopology
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
747 if ((SasEx
->DeviceTopology
& 0x0f) == 1) {
748 UefiDevicePathLibCatPrint (Str
, L
"0");
751 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
753 UefiDevicePathLibCatPrint (Str
, L
"0x%x", ((SasEx
->DeviceTopology
>> 8) & 0xff) + 1);
756 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0", SasEx
->DeviceTopology
);
759 UefiDevicePathLibCatPrint (Str
, L
")");
765 Converts a NVM Express Namespace device path structure to its string representative.
767 @param Str The string representative of input device.
768 @param DevPath The input device path structure.
769 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
770 of the display node is used, where applicable. If DisplayOnly
771 is FALSE, then the longer text representation of the display node
773 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
774 representation for a device node can be used, where applicable.
779 IN OUT POOL_PRINT
*Str
,
781 IN BOOLEAN DisplayOnly
,
782 IN BOOLEAN AllowShortcuts
785 NVME_NAMESPACE_DEVICE_PATH
*Nvme
;
789 Uuid
= (UINT8
*) &Nvme
->NamespaceUuid
;
790 UefiDevicePathLibCatPrint (
792 L
"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",
794 Uuid
[7], Uuid
[6], Uuid
[5], Uuid
[4],
795 Uuid
[3], Uuid
[2], Uuid
[1], Uuid
[0]
800 Converts a UFS device path structure to its string representative.
802 @param Str The string representative of input device.
803 @param DevPath The input device path structure.
804 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
805 of the display node is used, where applicable. If DisplayOnly
806 is FALSE, then the longer text representation of the display node
808 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
809 representation for a device node can be used, where applicable.
814 IN OUT POOL_PRINT
*Str
,
816 IN BOOLEAN DisplayOnly
,
817 IN BOOLEAN AllowShortcuts
820 UFS_DEVICE_PATH
*Ufs
;
823 UefiDevicePathLibCatPrint (Str
, L
"UFS(0x%x,0x%x)", Ufs
->Pun
, Ufs
->Lun
);
827 Converts a SD (Secure Digital) device path structure to its string representative.
829 @param Str The string representative of input device.
830 @param DevPath The input device path structure.
831 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
832 of the display node is used, where applicable. If DisplayOnly
833 is FALSE, then the longer text representation of the display node
835 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
836 representation for a device node can be used, where applicable.
841 IN OUT POOL_PRINT
*Str
,
843 IN BOOLEAN DisplayOnly
,
844 IN BOOLEAN AllowShortcuts
850 UefiDevicePathLibCatPrint (
858 Converts a EMMC (Embedded MMC) device path structure to its string representative.
860 @param Str The string representative of input device.
861 @param DevPath The input device path structure.
862 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
863 of the display node is used, where applicable. If DisplayOnly
864 is FALSE, then the longer text representation of the display node
866 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
867 representation for a device node can be used, where applicable.
872 IN OUT POOL_PRINT
*Str
,
874 IN BOOLEAN DisplayOnly
,
875 IN BOOLEAN AllowShortcuts
878 EMMC_DEVICE_PATH
*Emmc
;
881 UefiDevicePathLibCatPrint (
889 Converts a 1394 device path structure to its string representative.
891 @param Str The string representative of input device.
892 @param DevPath The input device path structure.
893 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
894 of the display node is used, where applicable. If DisplayOnly
895 is FALSE, then the longer text representation of the display node
897 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
898 representation for a device node can be used, where applicable.
903 IN OUT POOL_PRINT
*Str
,
905 IN BOOLEAN DisplayOnly
,
906 IN BOOLEAN AllowShortcuts
909 F1394_DEVICE_PATH
*F1394DevPath
;
911 F1394DevPath
= DevPath
;
913 // Guid has format of IEEE-EUI64
915 UefiDevicePathLibCatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
919 Converts a USB device path structure to its string representative.
921 @param Str The string representative of input device.
922 @param DevPath The input device path structure.
923 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
924 of the display node is used, where applicable. If DisplayOnly
925 is FALSE, then the longer text representation of the display node
927 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
928 representation for a device node can be used, where applicable.
933 IN OUT POOL_PRINT
*Str
,
935 IN BOOLEAN DisplayOnly
,
936 IN BOOLEAN AllowShortcuts
939 USB_DEVICE_PATH
*Usb
;
942 UefiDevicePathLibCatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
946 Converts a USB WWID device path structure to its string representative.
948 @param Str The string representative of input device.
949 @param DevPath The input device path structure.
950 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
951 of the display node is used, where applicable. If DisplayOnly
952 is FALSE, then the longer text representation of the display node
954 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
955 representation for a device node can be used, where applicable.
959 DevPathToTextUsbWWID (
960 IN OUT POOL_PRINT
*Str
,
962 IN BOOLEAN DisplayOnly
,
963 IN BOOLEAN AllowShortcuts
966 USB_WWID_DEVICE_PATH
*UsbWWId
;
967 CHAR16
*SerialNumberStr
;
973 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
974 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
975 if (Length
>= 1 && SerialNumberStr
[Length
- 1] != 0) {
977 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
979 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
980 ASSERT (NewStr
!= NULL
);
982 SerialNumberStr
= NewStr
;
985 UefiDevicePathLibCatPrint (
987 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
990 UsbWWId
->InterfaceNumber
,
996 Converts a Logic Unit device path structure to its string representative.
998 @param Str The string representative of input device.
999 @param DevPath The input device path structure.
1000 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1001 of the display node is used, where applicable. If DisplayOnly
1002 is FALSE, then the longer text representation of the display node
1004 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1005 representation for a device node can be used, where applicable.
1009 DevPathToTextLogicalUnit (
1010 IN OUT POOL_PRINT
*Str
,
1012 IN BOOLEAN DisplayOnly
,
1013 IN BOOLEAN AllowShortcuts
1016 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
1018 LogicalUnit
= DevPath
;
1019 UefiDevicePathLibCatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
1023 Converts a USB class device path structure to its string representative.
1025 @param Str The string representative of input device.
1026 @param DevPath The input device path structure.
1027 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1028 of the display node is used, where applicable. If DisplayOnly
1029 is FALSE, then the longer text representation of the display node
1031 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1032 representation for a device node can be used, where applicable.
1036 DevPathToTextUsbClass (
1037 IN OUT POOL_PRINT
*Str
,
1039 IN BOOLEAN DisplayOnly
,
1040 IN BOOLEAN AllowShortcuts
1043 USB_CLASS_DEVICE_PATH
*UsbClass
;
1044 BOOLEAN IsKnownSubClass
;
1049 IsKnownSubClass
= TRUE
;
1050 switch (UsbClass
->DeviceClass
) {
1051 case USB_CLASS_AUDIO
:
1052 UefiDevicePathLibCatPrint (Str
, L
"UsbAudio");
1055 case USB_CLASS_CDCCONTROL
:
1056 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCControl");
1060 UefiDevicePathLibCatPrint (Str
, L
"UsbHID");
1063 case USB_CLASS_IMAGE
:
1064 UefiDevicePathLibCatPrint (Str
, L
"UsbImage");
1067 case USB_CLASS_PRINTER
:
1068 UefiDevicePathLibCatPrint (Str
, L
"UsbPrinter");
1071 case USB_CLASS_MASS_STORAGE
:
1072 UefiDevicePathLibCatPrint (Str
, L
"UsbMassStorage");
1076 UefiDevicePathLibCatPrint (Str
, L
"UsbHub");
1079 case USB_CLASS_CDCDATA
:
1080 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCData");
1083 case USB_CLASS_SMART_CARD
:
1084 UefiDevicePathLibCatPrint (Str
, L
"UsbSmartCard");
1087 case USB_CLASS_VIDEO
:
1088 UefiDevicePathLibCatPrint (Str
, L
"UsbVideo");
1091 case USB_CLASS_DIAGNOSTIC
:
1092 UefiDevicePathLibCatPrint (Str
, L
"UsbDiagnostic");
1095 case USB_CLASS_WIRELESS
:
1096 UefiDevicePathLibCatPrint (Str
, L
"UsbWireless");
1100 IsKnownSubClass
= FALSE
;
1104 if (IsKnownSubClass
) {
1105 UefiDevicePathLibCatPrint (
1107 L
"(0x%x,0x%x,0x%x,0x%x)",
1109 UsbClass
->ProductId
,
1110 UsbClass
->DeviceSubClass
,
1111 UsbClass
->DeviceProtocol
1116 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
1117 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
1118 UefiDevicePathLibCatPrint (
1120 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
1122 UsbClass
->ProductId
,
1123 UsbClass
->DeviceProtocol
1126 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
1127 UefiDevicePathLibCatPrint (
1129 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
1131 UsbClass
->ProductId
,
1132 UsbClass
->DeviceProtocol
1135 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
1136 UefiDevicePathLibCatPrint (
1138 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
1140 UsbClass
->ProductId
,
1141 UsbClass
->DeviceProtocol
1147 UefiDevicePathLibCatPrint (
1149 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
1151 UsbClass
->ProductId
,
1152 UsbClass
->DeviceClass
,
1153 UsbClass
->DeviceSubClass
,
1154 UsbClass
->DeviceProtocol
1159 Converts a SATA device path structure to its string representative.
1161 @param Str The string representative of input device.
1162 @param DevPath The input device path structure.
1163 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1164 of the display node is used, where applicable. If DisplayOnly
1165 is FALSE, then the longer text representation of the display node
1167 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1168 representation for a device node can be used, where applicable.
1173 IN OUT POOL_PRINT
*Str
,
1175 IN BOOLEAN DisplayOnly
,
1176 IN BOOLEAN AllowShortcuts
1179 SATA_DEVICE_PATH
*Sata
;
1182 UefiDevicePathLibCatPrint (
1184 L
"Sata(0x%x,0x%x,0x%x)",
1185 Sata
->HBAPortNumber
,
1186 Sata
->PortMultiplierPortNumber
,
1192 Converts a I20 device path structure to its string representative.
1194 @param Str The string representative of input device.
1195 @param DevPath The input device path structure.
1196 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1197 of the display node is used, where applicable. If DisplayOnly
1198 is FALSE, then the longer text representation of the display node
1200 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1201 representation for a device node can be used, where applicable.
1206 IN OUT POOL_PRINT
*Str
,
1208 IN BOOLEAN DisplayOnly
,
1209 IN BOOLEAN AllowShortcuts
1212 I2O_DEVICE_PATH
*I2ODevPath
;
1214 I2ODevPath
= DevPath
;
1215 UefiDevicePathLibCatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1219 Converts a MAC address device path structure to its string representative.
1221 @param Str The string representative of input device.
1222 @param DevPath The input device path structure.
1223 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1224 of the display node is used, where applicable. If DisplayOnly
1225 is FALSE, then the longer text representation of the display node
1227 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1228 representation for a device node can be used, where applicable.
1232 DevPathToTextMacAddr (
1233 IN OUT POOL_PRINT
*Str
,
1235 IN BOOLEAN DisplayOnly
,
1236 IN BOOLEAN AllowShortcuts
1239 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1240 UINTN HwAddressSize
;
1243 MacDevPath
= DevPath
;
1245 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1246 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1250 UefiDevicePathLibCatPrint (Str
, L
"MAC(");
1252 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1253 UefiDevicePathLibCatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1256 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1260 Converts network protocol string to its text representation.
1262 @param Str The string representative of input device.
1263 @param Protocol The network protocol ID.
1267 CatNetworkProtocol (
1268 IN OUT POOL_PRINT
*Str
,
1272 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1273 UefiDevicePathLibCatPrint (Str
, L
"TCP");
1274 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1275 UefiDevicePathLibCatPrint (Str
, L
"UDP");
1277 UefiDevicePathLibCatPrint (Str
, L
"0x%x", Protocol
);
1282 Converts IP v4 address to its text representation.
1284 @param Str The string representative of input device.
1285 @param Address The IP v4 address.
1289 IN OUT POOL_PRINT
*Str
,
1290 IN EFI_IPv4_ADDRESS
*Address
1293 UefiDevicePathLibCatPrint (Str
, L
"%d.%d.%d.%d", Address
->Addr
[0], Address
->Addr
[1], Address
->Addr
[2], Address
->Addr
[3]);
1297 Converts IP v6 address to its text representation.
1299 @param Str The string representative of input device.
1300 @param Address The IP v6 address.
1304 IN OUT POOL_PRINT
*Str
,
1305 IN EFI_IPv6_ADDRESS
*Address
1308 UefiDevicePathLibCatPrint (
1309 Str
, L
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1310 Address
->Addr
[0], Address
->Addr
[1],
1311 Address
->Addr
[2], Address
->Addr
[3],
1312 Address
->Addr
[4], Address
->Addr
[5],
1313 Address
->Addr
[6], Address
->Addr
[7],
1314 Address
->Addr
[8], Address
->Addr
[9],
1315 Address
->Addr
[10], Address
->Addr
[11],
1316 Address
->Addr
[12], Address
->Addr
[13],
1317 Address
->Addr
[14], Address
->Addr
[15]
1322 Converts a IPv4 device path structure to its string representative.
1324 @param Str The string representative of input device.
1325 @param DevPath The input device path structure.
1326 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1327 of the display node is used, where applicable. If DisplayOnly
1328 is FALSE, then the longer text representation of the display node
1330 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1331 representation for a device node can be used, where applicable.
1336 IN OUT POOL_PRINT
*Str
,
1338 IN BOOLEAN DisplayOnly
,
1339 IN BOOLEAN AllowShortcuts
1342 IPv4_DEVICE_PATH
*IPDevPath
;
1344 IPDevPath
= DevPath
;
1345 UefiDevicePathLibCatPrint (Str
, L
"IPv4(");
1346 CatIPv4Address (Str
, &IPDevPath
->RemoteIpAddress
);
1349 UefiDevicePathLibCatPrint (Str
, L
")");
1353 UefiDevicePathLibCatPrint (Str
, L
",");
1354 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1356 UefiDevicePathLibCatPrint (Str
, L
",%s,", IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP");
1357 CatIPv4Address (Str
, &IPDevPath
->LocalIpAddress
);
1358 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1359 UefiDevicePathLibCatPrint (Str
, L
",");
1360 CatIPv4Address (Str
, &IPDevPath
->GatewayIpAddress
);
1361 UefiDevicePathLibCatPrint (Str
, L
",");
1362 CatIPv4Address (Str
, &IPDevPath
->SubnetMask
);
1364 UefiDevicePathLibCatPrint (Str
, L
")");
1368 Converts a IPv6 device path structure to its string representative.
1370 @param Str The string representative of input device.
1371 @param DevPath The input device path structure.
1372 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1373 of the display node is used, where applicable. If DisplayOnly
1374 is FALSE, then the longer text representation of the display node
1376 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1377 representation for a device node can be used, where applicable.
1382 IN OUT POOL_PRINT
*Str
,
1384 IN BOOLEAN DisplayOnly
,
1385 IN BOOLEAN AllowShortcuts
1388 IPv6_DEVICE_PATH
*IPDevPath
;
1390 IPDevPath
= DevPath
;
1391 UefiDevicePathLibCatPrint (Str
, L
"IPv6(");
1392 CatIPv6Address (Str
, &IPDevPath
->RemoteIpAddress
);
1394 UefiDevicePathLibCatPrint (Str
, L
")");
1398 UefiDevicePathLibCatPrint (Str
, L
",");
1399 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1401 switch (IPDevPath
->IpAddressOrigin
) {
1403 UefiDevicePathLibCatPrint (Str
, L
",Static,");
1406 UefiDevicePathLibCatPrint (Str
, L
",StatelessAutoConfigure,");
1409 UefiDevicePathLibCatPrint (Str
, L
",StatefulAutoConfigure,");
1413 CatIPv6Address (Str
, &IPDevPath
->LocalIpAddress
);
1415 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1416 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", IPDevPath
->PrefixLength
);
1417 CatIPv6Address (Str
, &IPDevPath
->GatewayIpAddress
);
1419 UefiDevicePathLibCatPrint (Str
, L
")");
1423 Converts an Infini Band device path structure to its string representative.
1425 @param Str The string representative of input device.
1426 @param DevPath The input device path structure.
1427 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1428 of the display node is used, where applicable. If DisplayOnly
1429 is FALSE, then the longer text representation of the display node
1431 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1432 representation for a device node can be used, where applicable.
1436 DevPathToTextInfiniBand (
1437 IN OUT POOL_PRINT
*Str
,
1439 IN BOOLEAN DisplayOnly
,
1440 IN BOOLEAN AllowShortcuts
1443 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1445 InfiniBand
= DevPath
;
1446 UefiDevicePathLibCatPrint (
1448 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1449 InfiniBand
->ResourceFlags
,
1450 InfiniBand
->PortGid
,
1451 InfiniBand
->ServiceId
,
1452 InfiniBand
->TargetPortId
,
1453 InfiniBand
->DeviceId
1458 Converts a UART device path structure to its string representative.
1460 @param Str The string representative of input device.
1461 @param DevPath The input device path structure.
1462 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1463 of the display node is used, where applicable. If DisplayOnly
1464 is FALSE, then the longer text representation of the display node
1466 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1467 representation for a device node can be used, where applicable.
1472 IN OUT POOL_PRINT
*Str
,
1474 IN BOOLEAN DisplayOnly
,
1475 IN BOOLEAN AllowShortcuts
1478 UART_DEVICE_PATH
*Uart
;
1482 switch (Uart
->Parity
) {
1512 if (Uart
->BaudRate
== 0) {
1513 UefiDevicePathLibCatPrint (Str
, L
"Uart(DEFAULT,");
1515 UefiDevicePathLibCatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1518 if (Uart
->DataBits
== 0) {
1519 UefiDevicePathLibCatPrint (Str
, L
"DEFAULT,");
1521 UefiDevicePathLibCatPrint (Str
, L
"%d,", Uart
->DataBits
);
1524 UefiDevicePathLibCatPrint (Str
, L
"%c,", Parity
);
1526 switch (Uart
->StopBits
) {
1528 UefiDevicePathLibCatPrint (Str
, L
"D)");
1532 UefiDevicePathLibCatPrint (Str
, L
"1)");
1536 UefiDevicePathLibCatPrint (Str
, L
"1.5)");
1540 UefiDevicePathLibCatPrint (Str
, L
"2)");
1544 UefiDevicePathLibCatPrint (Str
, L
"x)");
1550 Converts an iSCSI device path structure to its string representative.
1552 @param Str The string representative of input device.
1553 @param DevPath The input device path structure.
1554 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1555 of the display node is used, where applicable. If DisplayOnly
1556 is FALSE, then the longer text representation of the display node
1558 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1559 representation for a device node can be used, where applicable.
1563 DevPathToTextiSCSI (
1564 IN OUT POOL_PRINT
*Str
,
1566 IN BOOLEAN DisplayOnly
,
1567 IN BOOLEAN AllowShortcuts
1570 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1574 ISCSIDevPath
= DevPath
;
1575 UefiDevicePathLibCatPrint (
1577 L
"iSCSI(%a,0x%x,0x",
1578 ISCSIDevPath
->TargetName
,
1579 ISCSIDevPath
->TargetPortalGroupTag
1581 for (Index
= 0; Index
< sizeof (ISCSIDevPath
->Lun
) / sizeof (UINT8
); Index
++) {
1582 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*)&ISCSIDevPath
->Lun
)[Index
]);
1584 Options
= ISCSIDevPath
->LoginOption
;
1585 UefiDevicePathLibCatPrint (Str
, L
",%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1586 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1587 if (((Options
>> 11) & 0x0001) != 0) {
1588 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"None");
1589 } else if (((Options
>> 12) & 0x0001) != 0) {
1590 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1592 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_BI");
1596 UefiDevicePathLibCatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1600 Converts a VLAN device path structure to its string representative.
1602 @param Str The string representative of input device.
1603 @param DevPath The input device path structure.
1604 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1605 of the display node is used, where applicable. If DisplayOnly
1606 is FALSE, then the longer text representation of the display node
1608 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1609 representation for a device node can be used, where applicable.
1614 IN OUT POOL_PRINT
*Str
,
1616 IN BOOLEAN DisplayOnly
,
1617 IN BOOLEAN AllowShortcuts
1620 VLAN_DEVICE_PATH
*Vlan
;
1623 UefiDevicePathLibCatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1627 Converts a Bluetooth device path structure to its string representative.
1629 @param Str The string representative of input device.
1630 @param DevPath The input device path structure.
1631 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1632 of the display node is used, where applicable. If DisplayOnly
1633 is FALSE, then the longer text representation of the display node
1635 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1636 representation for a device node can be used, where applicable.
1640 DevPathToTextBluetooth (
1641 IN OUT POOL_PRINT
*Str
,
1643 IN BOOLEAN DisplayOnly
,
1644 IN BOOLEAN AllowShortcuts
1647 BLUETOOTH_DEVICE_PATH
*Bluetooth
;
1649 Bluetooth
= DevPath
;
1650 UefiDevicePathLibCatPrint (
1652 L
"Bluetooth(%02x%02x%02x%02x%02x%02x)",
1653 Bluetooth
->BD_ADDR
.Address
[0],
1654 Bluetooth
->BD_ADDR
.Address
[1],
1655 Bluetooth
->BD_ADDR
.Address
[2],
1656 Bluetooth
->BD_ADDR
.Address
[3],
1657 Bluetooth
->BD_ADDR
.Address
[4],
1658 Bluetooth
->BD_ADDR
.Address
[5]
1663 Converts a Wi-Fi device path structure to its string representative.
1665 @param Str The string representative of input device.
1666 @param DevPath The input device path structure.
1667 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1668 of the display node is used, where applicable. If DisplayOnly
1669 is FALSE, then the longer text representation of the display node
1671 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1672 representation for a device node can be used, where applicable.
1677 IN OUT POOL_PRINT
*Str
,
1679 IN BOOLEAN DisplayOnly
,
1680 IN BOOLEAN AllowShortcuts
1683 WIFI_DEVICE_PATH
*WiFi
;
1689 CopyMem (SSId
, WiFi
->SSId
, 32);
1691 UefiDevicePathLibCatPrint (Str
, L
"Wi-Fi(%a)", SSId
);
1695 Converts a Bluetooth device path structure to its string representative.
1697 @param Str The string representative of input device.
1698 @param DevPath The input device path structure.
1699 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1700 of the display node is used, where applicable. If DisplayOnly
1701 is FALSE, then the longer text representation of the display node
1703 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1704 representation for a device node can be used, where applicable.
1708 DevPathToTextBluetoothLE (
1709 IN OUT POOL_PRINT
*Str
,
1711 IN BOOLEAN DisplayOnly
,
1712 IN BOOLEAN AllowShortcuts
1715 BLUETOOTH_LE_DEVICE_PATH
*BluetoothLE
;
1717 BluetoothLE
= DevPath
;
1718 UefiDevicePathLibCatPrint (
1720 L
"BluetoothLE(%02x%02x%02x%02x%02x%02x,0x%02x)",
1721 BluetoothLE
->Address
.Address
[0],
1722 BluetoothLE
->Address
.Address
[1],
1723 BluetoothLE
->Address
.Address
[2],
1724 BluetoothLE
->Address
.Address
[3],
1725 BluetoothLE
->Address
.Address
[4],
1726 BluetoothLE
->Address
.Address
[5],
1727 BluetoothLE
->Address
.Type
1732 Converts a DNS device path structure to its string representative.
1734 @param Str The string representative of input device.
1735 @param DevPath The input device path structure.
1736 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1737 of the display node is used, where applicable. If DisplayOnly
1738 is FALSE, then the longer text representation of the display node
1740 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1741 representation for a device node can be used, where applicable.
1746 IN OUT POOL_PRINT
*Str
,
1748 IN BOOLEAN DisplayOnly
,
1749 IN BOOLEAN AllowShortcuts
1752 DNS_DEVICE_PATH
*DnsDevPath
;
1753 UINT32 DnsServerIpCount
;
1754 UINT32 DnsServerIpIndex
;
1756 DnsDevPath
= DevPath
;
1757 DnsServerIpCount
= (UINT32
) (DevicePathNodeLength(DnsDevPath
) - sizeof (EFI_DEVICE_PATH_PROTOCOL
) - sizeof (DnsDevPath
->IsIPv6
)) / sizeof (EFI_IP_ADDRESS
);
1759 UefiDevicePathLibCatPrint (Str
, L
"Dns(");
1761 for (DnsServerIpIndex
= 0; DnsServerIpIndex
< DnsServerIpCount
; DnsServerIpIndex
++) {
1762 if (DnsDevPath
->IsIPv6
== 0x00) {
1763 CatIPv4Address (Str
, &(DnsDevPath
->DnsServerIp
[DnsServerIpIndex
].v4
));
1765 CatIPv6Address (Str
, &(DnsDevPath
->DnsServerIp
[DnsServerIpIndex
].v6
));
1768 if (DnsServerIpIndex
< DnsServerIpCount
- 1) {
1769 UefiDevicePathLibCatPrint (Str
, L
",");
1773 UefiDevicePathLibCatPrint (Str
, L
")");
1777 Converts a URI device path structure to its string representative.
1779 @param Str The string representative of input device.
1780 @param DevPath The input device path structure.
1781 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1782 of the display node is used, where applicable. If DisplayOnly
1783 is FALSE, then the longer text representation of the display node
1785 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1786 representation for a device node can be used, where applicable.
1791 IN OUT POOL_PRINT
*Str
,
1793 IN BOOLEAN DisplayOnly
,
1794 IN BOOLEAN AllowShortcuts
1797 URI_DEVICE_PATH
*Uri
;
1802 // Uri in the device path may not be null terminated.
1805 UriLength
= DevicePathNodeLength (Uri
) - sizeof (URI_DEVICE_PATH
);
1806 UriStr
= AllocatePool (UriLength
+ 1);
1807 ASSERT (UriStr
!= NULL
);
1809 CopyMem (UriStr
, Uri
->Uri
, UriLength
);
1810 UriStr
[UriLength
] = '\0';
1811 UefiDevicePathLibCatPrint (Str
, L
"Uri(%a)", UriStr
);
1816 Converts a Hard drive device path structure to its string representative.
1818 @param Str The string representative of input device.
1819 @param DevPath The input device path structure.
1820 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1821 of the display node is used, where applicable. If DisplayOnly
1822 is FALSE, then the longer text representation of the display node
1824 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1825 representation for a device node can be used, where applicable.
1829 DevPathToTextHardDrive (
1830 IN OUT POOL_PRINT
*Str
,
1832 IN BOOLEAN DisplayOnly
,
1833 IN BOOLEAN AllowShortcuts
1836 HARDDRIVE_DEVICE_PATH
*Hd
;
1839 switch (Hd
->SignatureType
) {
1840 case SIGNATURE_TYPE_MBR
:
1841 UefiDevicePathLibCatPrint (
1843 L
"HD(%d,%s,0x%08x,",
1844 Hd
->PartitionNumber
,
1846 *((UINT32
*) (&(Hd
->Signature
[0])))
1850 case SIGNATURE_TYPE_GUID
:
1851 UefiDevicePathLibCatPrint (
1854 Hd
->PartitionNumber
,
1856 (EFI_GUID
*) &(Hd
->Signature
[0])
1861 UefiDevicePathLibCatPrint (
1864 Hd
->PartitionNumber
,
1870 UefiDevicePathLibCatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1874 Converts a CDROM device path structure to its string representative.
1876 @param Str The string representative of input device.
1877 @param DevPath The input device path structure.
1878 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1879 of the display node is used, where applicable. If DisplayOnly
1880 is FALSE, then the longer text representation of the display node
1882 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1883 representation for a device node can be used, where applicable.
1887 DevPathToTextCDROM (
1888 IN OUT POOL_PRINT
*Str
,
1890 IN BOOLEAN DisplayOnly
,
1891 IN BOOLEAN AllowShortcuts
1894 CDROM_DEVICE_PATH
*Cd
;
1898 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1902 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1906 Converts a File device path structure to its string representative.
1908 @param Str The string representative of input device.
1909 @param DevPath The input device path structure.
1910 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1911 of the display node is used, where applicable. If DisplayOnly
1912 is FALSE, then the longer text representation of the display node
1914 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1915 representation for a device node can be used, where applicable.
1919 DevPathToTextFilePath (
1920 IN OUT POOL_PRINT
*Str
,
1922 IN BOOLEAN DisplayOnly
,
1923 IN BOOLEAN AllowShortcuts
1926 FILEPATH_DEVICE_PATH
*Fp
;
1929 UefiDevicePathLibCatPrint (Str
, L
"%s", Fp
->PathName
);
1933 Converts a Media protocol device path structure to its string representative.
1935 @param Str The string representative of input device.
1936 @param DevPath The input device path structure.
1937 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1938 of the display node is used, where applicable. If DisplayOnly
1939 is FALSE, then the longer text representation of the display node
1941 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1942 representation for a device node can be used, where applicable.
1946 DevPathToTextMediaProtocol (
1947 IN OUT POOL_PRINT
*Str
,
1949 IN BOOLEAN DisplayOnly
,
1950 IN BOOLEAN AllowShortcuts
1953 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1955 MediaProt
= DevPath
;
1956 UefiDevicePathLibCatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1960 Converts a Firmware Volume device path structure to its string representative.
1962 @param Str The string representative of input device.
1963 @param DevPath The input device path structure.
1964 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1965 of the display node is used, where applicable. If DisplayOnly
1966 is FALSE, then the longer text representation of the display node
1968 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1969 representation for a device node can be used, where applicable.
1974 IN OUT POOL_PRINT
*Str
,
1976 IN BOOLEAN DisplayOnly
,
1977 IN BOOLEAN AllowShortcuts
1980 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1983 UefiDevicePathLibCatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1987 Converts a Firmware Volume File device path structure to its string representative.
1989 @param Str The string representative of input device.
1990 @param DevPath The input device path structure.
1991 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1992 of the display node is used, where applicable. If DisplayOnly
1993 is FALSE, then the longer text representation of the display node
1995 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1996 representation for a device node can be used, where applicable.
2000 DevPathToTextFvFile (
2001 IN OUT POOL_PRINT
*Str
,
2003 IN BOOLEAN DisplayOnly
,
2004 IN BOOLEAN AllowShortcuts
2007 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
2010 UefiDevicePathLibCatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
2014 Converts a Relative Offset device path structure to its string representative.
2016 @param Str The string representative of input device.
2017 @param DevPath The input device path structure.
2018 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2019 of the display node is used, where applicable. If DisplayOnly
2020 is FALSE, then the longer text representation of the display node
2022 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2023 representation for a device node can be used, where applicable.
2027 DevPathRelativeOffsetRange (
2028 IN OUT POOL_PRINT
*Str
,
2030 IN BOOLEAN DisplayOnly
,
2031 IN BOOLEAN AllowShortcuts
2034 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
2037 UefiDevicePathLibCatPrint (
2039 L
"Offset(0x%lx,0x%lx)",
2040 Offset
->StartingOffset
,
2041 Offset
->EndingOffset
2046 Converts a Ram Disk device path structure to its string representative.
2048 @param Str The string representative of input device.
2049 @param DevPath The input device path structure.
2050 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2051 of the display node is used, where applicable. If DisplayOnly
2052 is FALSE, then the longer text representation of the display node
2054 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2055 representation for a device node can be used, where applicable.
2059 DevPathToTextRamDisk (
2060 IN OUT POOL_PRINT
*Str
,
2062 IN BOOLEAN DisplayOnly
,
2063 IN BOOLEAN AllowShortcuts
2066 MEDIA_RAM_DISK_DEVICE_PATH
*RamDisk
;
2070 if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualDiskGuid
)) {
2071 UefiDevicePathLibCatPrint (
2073 L
"VirtualDisk(0x%lx,0x%lx,%d)",
2074 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2075 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2078 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualCdGuid
)) {
2079 UefiDevicePathLibCatPrint (
2081 L
"VirtualCD(0x%lx,0x%lx,%d)",
2082 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2083 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2086 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualDiskGuid
)) {
2087 UefiDevicePathLibCatPrint (
2089 L
"PersistentVirtualDisk(0x%lx,0x%lx,%d)",
2090 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2091 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2094 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualCdGuid
)) {
2095 UefiDevicePathLibCatPrint (
2097 L
"PersistentVirtualCD(0x%lx,0x%lx,%d)",
2098 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2099 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2103 UefiDevicePathLibCatPrint (
2105 L
"RamDisk(0x%lx,0x%lx,%d,%g)",
2106 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2107 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2115 Converts a BIOS Boot Specification device path structure to its string representative.
2117 @param Str The string representative of input device.
2118 @param DevPath The input device path structure.
2119 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2120 of the display node is used, where applicable. If DisplayOnly
2121 is FALSE, then the longer text representation of the display node
2123 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2124 representation for a device node can be used, where applicable.
2129 IN OUT POOL_PRINT
*Str
,
2131 IN BOOLEAN DisplayOnly
,
2132 IN BOOLEAN AllowShortcuts
2135 BBS_BBS_DEVICE_PATH
*Bbs
;
2139 switch (Bbs
->DeviceType
) {
2140 case BBS_TYPE_FLOPPY
:
2144 case BBS_TYPE_HARDDRIVE
:
2148 case BBS_TYPE_CDROM
:
2152 case BBS_TYPE_PCMCIA
:
2160 case BBS_TYPE_EMBEDDED_NETWORK
:
2170 UefiDevicePathLibCatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
2172 UefiDevicePathLibCatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
2176 UefiDevicePathLibCatPrint (Str
, L
")");
2180 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
2184 Converts an End-of-Device-Path structure to its string representative.
2186 @param Str The string representative of input device.
2187 @param DevPath The input device path structure.
2188 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2189 of the display node is used, where applicable. If DisplayOnly
2190 is FALSE, then the longer text representation of the display node
2192 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2193 representation for a device node can be used, where applicable.
2197 DevPathToTextEndInstance (
2198 IN OUT POOL_PRINT
*Str
,
2200 IN BOOLEAN DisplayOnly
,
2201 IN BOOLEAN AllowShortcuts
2204 UefiDevicePathLibCatPrint (Str
, L
",");
2207 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric
[] = {
2208 {HARDWARE_DEVICE_PATH
, L
"HardwarePath" },
2209 {ACPI_DEVICE_PATH
, L
"AcpiPath" },
2210 {MESSAGING_DEVICE_PATH
, L
"Msg" },
2211 {MEDIA_DEVICE_PATH
, L
"MediaPath" },
2212 {BBS_DEVICE_PATH
, L
"BbsPath" },
2217 Converts an unknown device path structure to its string representative.
2219 @param Str The string representative of input device.
2220 @param DevPath The input device path structure.
2221 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2222 of the display node is used, where applicable. If DisplayOnly
2223 is FALSE, then the longer text representation of the display node
2225 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2226 representation for a device node can be used, where applicable.
2230 DevPathToTextNodeGeneric (
2231 IN OUT POOL_PRINT
*Str
,
2233 IN BOOLEAN DisplayOnly
,
2234 IN BOOLEAN AllowShortcuts
2237 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2242 for (Index
= 0; mUefiDevicePathLibToTextTableGeneric
[Index
].Text
!= NULL
; Index
++) {
2243 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTableGeneric
[Index
].Type
) {
2248 if (mUefiDevicePathLibToTextTableGeneric
[Index
].Text
== NULL
) {
2250 // It's a node whose type cannot be recognized
2252 UefiDevicePathLibCatPrint (Str
, L
"Path(%d,%d", DevicePathType (Node
), DevicePathSubType (Node
));
2255 // It's a node whose type can be recognized
2257 UefiDevicePathLibCatPrint (Str
, L
"%s(%d", mUefiDevicePathLibToTextTableGeneric
[Index
].Text
, DevicePathSubType (Node
));
2260 Index
= sizeof (EFI_DEVICE_PATH_PROTOCOL
);
2261 if (Index
< DevicePathNodeLength (Node
)) {
2262 UefiDevicePathLibCatPrint (Str
, L
",");
2263 for (; Index
< DevicePathNodeLength (Node
); Index
++) {
2264 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*) Node
)[Index
]);
2268 UefiDevicePathLibCatPrint (Str
, L
")");
2271 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable
[] = {
2272 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
2273 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
2274 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
2275 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
2276 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
2277 {HARDWARE_DEVICE_PATH
, HW_BMC_DP
, DevPathToTextBmc
},
2278 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
2279 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
2280 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
2281 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
2282 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
2283 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
2284 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
2285 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
2286 {MESSAGING_DEVICE_PATH
, MSG_NVME_NAMESPACE_DP
, DevPathToTextNVMe
},
2287 {MESSAGING_DEVICE_PATH
, MSG_UFS_DP
, DevPathToTextUfs
},
2288 {MESSAGING_DEVICE_PATH
, MSG_SD_DP
, DevPathToTextSd
},
2289 {MESSAGING_DEVICE_PATH
, MSG_EMMC_DP
, DevPathToTextEmmc
},
2290 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
2291 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
2292 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
2293 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
2294 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
2295 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
2296 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
2297 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
2298 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
2299 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
2300 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
2301 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
2302 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
2303 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
2304 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
2305 {MESSAGING_DEVICE_PATH
, MSG_DNS_DP
, DevPathToTextDns
},
2306 {MESSAGING_DEVICE_PATH
, MSG_URI_DP
, DevPathToTextUri
},
2307 {MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_DP
, DevPathToTextBluetooth
},
2308 {MESSAGING_DEVICE_PATH
, MSG_WIFI_DP
, DevPathToTextWiFi
},
2309 {MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_LE_DP
, DevPathToTextBluetoothLE
},
2310 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
2311 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
2312 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
2313 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
2314 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
2315 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
2316 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
2317 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
2318 {MEDIA_DEVICE_PATH
, MEDIA_RAM_DISK_DP
, DevPathToTextRamDisk
},
2319 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
2320 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
2325 Converts a device node to its string representation.
2327 @param DeviceNode A Pointer to the device node to be converted.
2328 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2329 of the display node is used, where applicable. If DisplayOnly
2330 is FALSE, then the longer text representation of the display node
2332 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2333 representation for a device node can be used, where applicable.
2335 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
2336 is NULL or there was insufficient memory.
2341 UefiDevicePathLibConvertDeviceNodeToText (
2342 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
2343 IN BOOLEAN DisplayOnly
,
2344 IN BOOLEAN AllowShortcuts
2349 DEVICE_PATH_TO_TEXT ToText
;
2351 if (DeviceNode
== NULL
) {
2355 ZeroMem (&Str
, sizeof (Str
));
2358 // Process the device path node
2359 // If not found, use a generic function
2361 ToText
= DevPathToTextNodeGeneric
;
2362 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
++) {
2363 if (DevicePathType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2364 DevicePathSubType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2366 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2374 ToText (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
2376 ASSERT (Str
.Str
!= NULL
);
2381 Converts a device path to its text representation.
2383 @param DevicePath A Pointer to the device to be converted.
2384 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2385 of the display node is used, where applicable. If DisplayOnly
2386 is FALSE, then the longer text representation of the display node
2388 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2389 representation for a device node can be used, where applicable.
2391 @return A pointer to the allocated text representation of the device path or
2392 NULL if DeviceNode is NULL or there was insufficient memory.
2397 UefiDevicePathLibConvertDevicePathToText (
2398 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
2399 IN BOOLEAN DisplayOnly
,
2400 IN BOOLEAN AllowShortcuts
2404 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2405 EFI_DEVICE_PATH_PROTOCOL
*AlignedNode
;
2407 DEVICE_PATH_TO_TEXT ToText
;
2409 if (DevicePath
== NULL
) {
2413 ZeroMem (&Str
, sizeof (Str
));
2416 // Process each device path node
2418 Node
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
2419 while (!IsDevicePathEnd (Node
)) {
2421 // Find the handler to dump this device path node
2422 // If not found, use a generic function
2424 ToText
= DevPathToTextNodeGeneric
;
2425 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
2427 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2428 DevicePathSubType (Node
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2430 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2435 // Put a path separator in if needed
2437 if ((Str
.Count
!= 0) && (ToText
!= DevPathToTextEndInstance
)) {
2438 if (Str
.Str
[Str
.Count
] != L
',') {
2439 UefiDevicePathLibCatPrint (&Str
, L
"/");
2443 AlignedNode
= AllocateCopyPool (DevicePathNodeLength (Node
), Node
);
2445 // Print this node of the device path
2447 ToText (&Str
, AlignedNode
, DisplayOnly
, AllowShortcuts
);
2448 FreePool (AlignedNode
);
2451 // Next device path node
2453 Node
= NextDevicePathNode (Node
);
2456 if (Str
.Str
== NULL
) {
2457 return AllocateZeroPool (sizeof (CHAR16
));