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 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "UefiDevicePathLib.h"
13 Concatenates a formatted unicode string to allocated pool. The caller must
14 free the resulting buffer.
16 @param Str Tracks the allocated pool, size in use, and
17 amount of pool allocated.
18 @param Fmt The format string
19 @param ... Variable arguments based on the format string.
21 @return Allocated buffer with the formatted string printed in it.
22 The caller must free the allocated buffer. The buffer
23 allocation is not packed.
28 UefiDevicePathLibCatPrint (
29 IN OUT POOL_PRINT
*Str
,
38 Count
= SPrintLength (Fmt
, Args
);
41 if ((Str
->Count
+ (Count
+ 1)) * sizeof (CHAR16
) > Str
->Capacity
) {
42 Str
->Capacity
= (Str
->Count
+ (Count
+ 1) * 2) * sizeof (CHAR16
);
43 Str
->Str
= ReallocatePool (
44 Str
->Count
* sizeof (CHAR16
),
48 ASSERT (Str
->Str
!= NULL
);
51 UnicodeVSPrint (&Str
->Str
[Str
->Count
], Str
->Capacity
- Str
->Count
* sizeof (CHAR16
), Fmt
, Args
);
59 Converts a PCI device path structure to its string representative.
61 @param Str The string representative of input device.
62 @param DevPath The input device path structure.
63 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
64 of the display node is used, where applicable. If DisplayOnly
65 is FALSE, then the longer text representation of the display node
67 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
68 representation for a device node can be used, where applicable.
73 IN OUT POOL_PRINT
*Str
,
75 IN BOOLEAN DisplayOnly
,
76 IN BOOLEAN AllowShortcuts
82 UefiDevicePathLibCatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
86 Converts a PC Card device path structure to its string representative.
88 @param Str The string representative of input device.
89 @param DevPath The input device path structure.
90 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
91 of the display node is used, where applicable. If DisplayOnly
92 is FALSE, then the longer text representation of the display node
94 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
95 representation for a device node can be used, where applicable.
100 IN OUT POOL_PRINT
*Str
,
102 IN BOOLEAN DisplayOnly
,
103 IN BOOLEAN AllowShortcuts
106 PCCARD_DEVICE_PATH
*Pccard
;
109 UefiDevicePathLibCatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
113 Converts a Memory Map device path structure to its string representative.
115 @param Str The string representative of input device.
116 @param DevPath The input device path structure.
117 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
118 of the display node is used, where applicable. If DisplayOnly
119 is FALSE, then the longer text representation of the display node
121 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
122 representation for a device node can be used, where applicable.
126 DevPathToTextMemMap (
127 IN OUT POOL_PRINT
*Str
,
129 IN BOOLEAN DisplayOnly
,
130 IN BOOLEAN AllowShortcuts
133 MEMMAP_DEVICE_PATH
*MemMap
;
136 UefiDevicePathLibCatPrint (
138 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
140 MemMap
->StartingAddress
,
141 MemMap
->EndingAddress
146 Converts a Vendor device path structure to its string representative.
148 @param Str The string representative of input device.
149 @param DevPath The input device path structure.
150 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
151 of the display node is used, where applicable. If DisplayOnly
152 is FALSE, then the longer text representation of the display node
154 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
155 representation for a device node can be used, where applicable.
159 DevPathToTextVendor (
160 IN OUT POOL_PRINT
*Str
,
162 IN BOOLEAN DisplayOnly
,
163 IN BOOLEAN AllowShortcuts
166 VENDOR_DEVICE_PATH
*Vendor
;
170 UINT32 FlowControlMap
;
173 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
174 switch (DevicePathType (&Vendor
->Header
)) {
175 case HARDWARE_DEVICE_PATH
:
179 case MESSAGING_DEVICE_PATH
:
181 if (AllowShortcuts
) {
182 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
183 UefiDevicePathLibCatPrint (Str
, L
"VenPcAnsi()");
185 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
186 UefiDevicePathLibCatPrint (Str
, L
"VenVt100()");
188 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
189 UefiDevicePathLibCatPrint (Str
, L
"VenVt100Plus()");
191 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
192 UefiDevicePathLibCatPrint (Str
, L
"VenUtf8()");
194 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
195 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
196 switch (FlowControlMap
& 0x00000003) {
198 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
202 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
206 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
214 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
215 UefiDevicePathLibCatPrint (
217 L
"SAS(0x%lx,0x%lx,0x%x,",
218 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
219 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
220 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
222 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
223 if (((Info
& 0x0f) == 0) && ((Info
& BIT7
) == 0)) {
224 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0,");
225 } else if (((Info
& 0x0f) <= 2) && ((Info
& BIT7
) == 0)) {
226 UefiDevicePathLibCatPrint (
229 ((Info
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
230 ((Info
& BIT5
) != 0) ? L
"External" : L
"Internal",
231 ((Info
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
233 if ((Info
& 0x0f) == 1) {
234 UefiDevicePathLibCatPrint (Str
, L
"0,");
237 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
239 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", ((Info
>> 8) & 0xff) + 1);
242 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0,", Info
);
245 UefiDevicePathLibCatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
247 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
248 UefiDevicePathLibCatPrint (Str
, L
"DebugPort()");
254 case MEDIA_DEVICE_PATH
:
263 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
264 UefiDevicePathLibCatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
265 if (DataLength
!= 0) {
266 UefiDevicePathLibCatPrint (Str
, L
",");
267 for (Index
= 0; Index
< DataLength
; Index
++) {
268 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
272 UefiDevicePathLibCatPrint (Str
, L
")");
276 Converts a Controller device path structure to its string representative.
278 @param Str The string representative of input device.
279 @param DevPath The input device path structure.
280 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
281 of the display node is used, where applicable. If DisplayOnly
282 is FALSE, then the longer text representation of the display node
284 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
285 representation for a device node can be used, where applicable.
289 DevPathToTextController (
290 IN OUT POOL_PRINT
*Str
,
292 IN BOOLEAN DisplayOnly
,
293 IN BOOLEAN AllowShortcuts
296 CONTROLLER_DEVICE_PATH
*Controller
;
298 Controller
= DevPath
;
299 UefiDevicePathLibCatPrint (
302 Controller
->ControllerNumber
307 Converts a BMC device path structure to its string representative.
309 @param Str The string representative of input device.
310 @param DevPath The input device path structure.
311 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
312 of the display node is used, where applicable. If DisplayOnly
313 is FALSE, then the longer text representation of the display node
315 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
316 representation for a device node can be used, where applicable.
321 IN OUT POOL_PRINT
*Str
,
323 IN BOOLEAN DisplayOnly
,
324 IN BOOLEAN AllowShortcuts
327 BMC_DEVICE_PATH
*Bmc
;
330 UefiDevicePathLibCatPrint (
334 ReadUnaligned64 ((UINT64
*) (&Bmc
->BaseAddress
))
339 Converts a ACPI device path structure to its string representative.
341 @param Str The string representative of input device.
342 @param DevPath The input device path structure.
343 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
344 of the display node is used, where applicable. If DisplayOnly
345 is FALSE, then the longer text representation of the display node
347 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
348 representation for a device node can be used, where applicable.
353 IN OUT POOL_PRINT
*Str
,
355 IN BOOLEAN DisplayOnly
,
356 IN BOOLEAN AllowShortcuts
359 ACPI_HID_DEVICE_PATH
*Acpi
;
362 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
363 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
365 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
369 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(0x%x)", Acpi
->UID
);
373 UefiDevicePathLibCatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
377 UefiDevicePathLibCatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
381 UefiDevicePathLibCatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
385 UefiDevicePathLibCatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
389 UefiDevicePathLibCatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
393 UefiDevicePathLibCatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
398 Converts a ACPI extended HID device path structure to its string representative.
400 @param Str The string representative of input device.
401 @param DevPath The input device path structure.
402 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
403 of the display node is used, where applicable. If DisplayOnly
404 is FALSE, then the longer text representation of the display node
406 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
407 representation for a device node can be used, where applicable.
411 DevPathToTextAcpiEx (
412 IN OUT POOL_PRINT
*Str
,
414 IN BOOLEAN DisplayOnly
,
415 IN BOOLEAN AllowShortcuts
418 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
426 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
427 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
428 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
431 if ((EISA_ID_TO_NUM (AcpiEx
->HID
) == 0x0A03) ||
432 (EISA_ID_TO_NUM (AcpiEx
->CID
) == 0x0A03 && EISA_ID_TO_NUM (AcpiEx
->HID
) != 0x0A08)) {
433 if (AcpiEx
->UID
== 0) {
434 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(%a)", UIDStr
);
436 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(0x%x)", AcpiEx
->UID
);
441 if (EISA_ID_TO_NUM (AcpiEx
->HID
) == 0x0A08 || EISA_ID_TO_NUM (AcpiEx
->CID
) == 0x0A08) {
442 if (AcpiEx
->UID
== 0) {
443 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(%a)", UIDStr
);
445 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(0x%x)", AcpiEx
->UID
);
452 // Converts EISA identification to string.
458 ((AcpiEx
->HID
>> 10) & 0x1f) + 'A' - 1,
459 ((AcpiEx
->HID
>> 5) & 0x1f) + 'A' - 1,
460 ((AcpiEx
->HID
>> 0) & 0x1f) + 'A' - 1,
461 (AcpiEx
->HID
>> 16) & 0xFFFF
467 ((AcpiEx
->CID
>> 10) & 0x1f) + 'A' - 1,
468 ((AcpiEx
->CID
>> 5) & 0x1f) + 'A' - 1,
469 ((AcpiEx
->CID
>> 0) & 0x1f) + 'A' - 1,
470 (AcpiEx
->CID
>> 16) & 0xFFFF
473 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (*UIDStr
!= '\0')) {
477 if (AcpiEx
->CID
== 0) {
478 UefiDevicePathLibCatPrint (
485 UefiDevicePathLibCatPrint (
487 L
"AcpiExp(%s,%s,%a)",
498 if (AcpiEx
->HID
== 0) {
499 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
501 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
504 if (AcpiEx
->CID
== 0) {
505 UefiDevicePathLibCatPrint (Str
, L
"%a,", CIDStr
);
507 UefiDevicePathLibCatPrint (Str
, L
"%s,", CIDText
);
510 if (AcpiEx
->UID
== 0) {
511 UefiDevicePathLibCatPrint (Str
, L
"%a)", UIDStr
);
513 UefiDevicePathLibCatPrint (Str
, L
"0x%x)", AcpiEx
->UID
);
516 UefiDevicePathLibCatPrint (
518 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
531 Converts a ACPI address device path structure to its string representative.
533 @param Str The string representative of input device.
534 @param DevPath The input device path structure.
535 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
536 of the display node is used, where applicable. If DisplayOnly
537 is FALSE, then the longer text representation of the display node
539 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
540 representation for a device node can be used, where applicable.
544 DevPathToTextAcpiAdr (
545 IN OUT POOL_PRINT
*Str
,
547 IN BOOLEAN DisplayOnly
,
548 IN BOOLEAN AllowShortcuts
551 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
554 UINT16 AdditionalAdrCount
;
557 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
558 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
560 UefiDevicePathLibCatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
561 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
562 UefiDevicePathLibCatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
564 UefiDevicePathLibCatPrint (Str
, L
")");
568 Converts a ATAPI device path structure to its string representative.
570 @param Str The string representative of input device.
571 @param DevPath The input device path structure.
572 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
573 of the display node is used, where applicable. If DisplayOnly
574 is FALSE, then the longer text representation of the display node
576 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
577 representation for a device node can be used, where applicable.
582 IN OUT POOL_PRINT
*Str
,
584 IN BOOLEAN DisplayOnly
,
585 IN BOOLEAN AllowShortcuts
588 ATAPI_DEVICE_PATH
*Atapi
;
593 UefiDevicePathLibCatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
595 UefiDevicePathLibCatPrint (
598 (Atapi
->PrimarySecondary
== 1) ? L
"Secondary" : L
"Primary",
599 (Atapi
->SlaveMaster
== 1) ? L
"Slave" : L
"Master",
606 Converts a SCSI device path structure to its string representative.
608 @param Str The string representative of input device.
609 @param DevPath The input device path structure.
610 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
611 of the display node is used, where applicable. If DisplayOnly
612 is FALSE, then the longer text representation of the display node
614 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
615 representation for a device node can be used, where applicable.
620 IN OUT POOL_PRINT
*Str
,
622 IN BOOLEAN DisplayOnly
,
623 IN BOOLEAN AllowShortcuts
626 SCSI_DEVICE_PATH
*Scsi
;
629 UefiDevicePathLibCatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
633 Converts a Fibre device path structure to its string representative.
635 @param Str The string representative of input device.
636 @param DevPath The input device path structure.
637 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
638 of the display node is used, where applicable. If DisplayOnly
639 is FALSE, then the longer text representation of the display node
641 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
642 representation for a device node can be used, where applicable.
647 IN OUT POOL_PRINT
*Str
,
649 IN BOOLEAN DisplayOnly
,
650 IN BOOLEAN AllowShortcuts
653 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
656 UefiDevicePathLibCatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
660 Converts a FibreEx device path structure to its string representative.
662 @param Str The string representative of input device.
663 @param DevPath The input device path structure.
664 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
665 of the display node is used, where applicable. If DisplayOnly
666 is FALSE, then the longer text representation of the display node
668 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
669 representation for a device node can be used, where applicable.
673 DevPathToTextFibreEx (
674 IN OUT POOL_PRINT
*Str
,
676 IN BOOLEAN DisplayOnly
,
677 IN BOOLEAN AllowShortcuts
680 FIBRECHANNELEX_DEVICE_PATH
*FibreEx
;
684 UefiDevicePathLibCatPrint (Str
, L
"FibreEx(0x");
685 for (Index
= 0; Index
< sizeof (FibreEx
->WWN
) / sizeof (FibreEx
->WWN
[0]); Index
++) {
686 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->WWN
[Index
]);
688 UefiDevicePathLibCatPrint (Str
, L
",0x");
689 for (Index
= 0; Index
< sizeof (FibreEx
->Lun
) / sizeof (FibreEx
->Lun
[0]); Index
++) {
690 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->Lun
[Index
]);
692 UefiDevicePathLibCatPrint (Str
, L
")");
696 Converts a Sas Ex device path structure to its string representative.
698 @param Str The string representative of input device.
699 @param DevPath The input device path structure.
700 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
701 of the display node is used, where applicable. If DisplayOnly
702 is FALSE, then the longer text representation of the display node
704 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
705 representation for a device node can be used, where applicable.
710 IN OUT POOL_PRINT
*Str
,
712 IN BOOLEAN DisplayOnly
,
713 IN BOOLEAN AllowShortcuts
716 SASEX_DEVICE_PATH
*SasEx
;
720 UefiDevicePathLibCatPrint (Str
, L
"SasEx(0x");
722 for (Index
= 0; Index
< sizeof (SasEx
->SasAddress
) / sizeof (SasEx
->SasAddress
[0]); Index
++) {
723 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->SasAddress
[Index
]);
725 UefiDevicePathLibCatPrint (Str
, L
",0x");
726 for (Index
= 0; Index
< sizeof (SasEx
->Lun
) / sizeof (SasEx
->Lun
[0]); Index
++) {
727 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->Lun
[Index
]);
729 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", SasEx
->RelativeTargetPort
);
731 if (((SasEx
->DeviceTopology
& 0x0f) == 0) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
732 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0");
733 } else if (((SasEx
->DeviceTopology
& 0x0f) <= 2) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
734 UefiDevicePathLibCatPrint (
737 ((SasEx
->DeviceTopology
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
738 ((SasEx
->DeviceTopology
& BIT5
) != 0) ? L
"External" : L
"Internal",
739 ((SasEx
->DeviceTopology
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
741 if ((SasEx
->DeviceTopology
& 0x0f) == 1) {
742 UefiDevicePathLibCatPrint (Str
, L
"0");
745 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
747 UefiDevicePathLibCatPrint (Str
, L
"0x%x", ((SasEx
->DeviceTopology
>> 8) & 0xff) + 1);
750 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0", SasEx
->DeviceTopology
);
753 UefiDevicePathLibCatPrint (Str
, L
")");
759 Converts a NVM Express Namespace device path structure to its string representative.
761 @param Str The string representative of input device.
762 @param DevPath The input device path structure.
763 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
764 of the display node is used, where applicable. If DisplayOnly
765 is FALSE, then the longer text representation of the display node
767 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
768 representation for a device node can be used, where applicable.
773 IN OUT POOL_PRINT
*Str
,
775 IN BOOLEAN DisplayOnly
,
776 IN BOOLEAN AllowShortcuts
779 NVME_NAMESPACE_DEVICE_PATH
*Nvme
;
783 Uuid
= (UINT8
*) &Nvme
->NamespaceUuid
;
784 UefiDevicePathLibCatPrint (
786 L
"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",
788 Uuid
[7], Uuid
[6], Uuid
[5], Uuid
[4],
789 Uuid
[3], Uuid
[2], Uuid
[1], Uuid
[0]
794 Converts a UFS device path structure to its string representative.
796 @param Str The string representative of input device.
797 @param DevPath The input device path structure.
798 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
799 of the display node is used, where applicable. If DisplayOnly
800 is FALSE, then the longer text representation of the display node
802 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
803 representation for a device node can be used, where applicable.
808 IN OUT POOL_PRINT
*Str
,
810 IN BOOLEAN DisplayOnly
,
811 IN BOOLEAN AllowShortcuts
814 UFS_DEVICE_PATH
*Ufs
;
817 UefiDevicePathLibCatPrint (Str
, L
"UFS(0x%x,0x%x)", Ufs
->Pun
, Ufs
->Lun
);
821 Converts a SD (Secure Digital) device path structure to its string representative.
823 @param Str The string representative of input device.
824 @param DevPath The input device path structure.
825 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
826 of the display node is used, where applicable. If DisplayOnly
827 is FALSE, then the longer text representation of the display node
829 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
830 representation for a device node can be used, where applicable.
835 IN OUT POOL_PRINT
*Str
,
837 IN BOOLEAN DisplayOnly
,
838 IN BOOLEAN AllowShortcuts
844 UefiDevicePathLibCatPrint (
852 Converts a EMMC (Embedded MMC) device path structure to its string representative.
854 @param Str The string representative of input device.
855 @param DevPath The input device path structure.
856 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
857 of the display node is used, where applicable. If DisplayOnly
858 is FALSE, then the longer text representation of the display node
860 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
861 representation for a device node can be used, where applicable.
866 IN OUT POOL_PRINT
*Str
,
868 IN BOOLEAN DisplayOnly
,
869 IN BOOLEAN AllowShortcuts
872 EMMC_DEVICE_PATH
*Emmc
;
875 UefiDevicePathLibCatPrint (
883 Converts a 1394 device path structure to its string representative.
885 @param Str The string representative of input device.
886 @param DevPath The input device path structure.
887 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
888 of the display node is used, where applicable. If DisplayOnly
889 is FALSE, then the longer text representation of the display node
891 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
892 representation for a device node can be used, where applicable.
897 IN OUT POOL_PRINT
*Str
,
899 IN BOOLEAN DisplayOnly
,
900 IN BOOLEAN AllowShortcuts
903 F1394_DEVICE_PATH
*F1394DevPath
;
905 F1394DevPath
= DevPath
;
907 // Guid has format of IEEE-EUI64
909 UefiDevicePathLibCatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
913 Converts a USB device path structure to its string representative.
915 @param Str The string representative of input device.
916 @param DevPath The input device path structure.
917 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
918 of the display node is used, where applicable. If DisplayOnly
919 is FALSE, then the longer text representation of the display node
921 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
922 representation for a device node can be used, where applicable.
927 IN OUT POOL_PRINT
*Str
,
929 IN BOOLEAN DisplayOnly
,
930 IN BOOLEAN AllowShortcuts
933 USB_DEVICE_PATH
*Usb
;
936 UefiDevicePathLibCatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
940 Converts a USB WWID device path structure to its string representative.
942 @param Str The string representative of input device.
943 @param DevPath The input device path structure.
944 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
945 of the display node is used, where applicable. If DisplayOnly
946 is FALSE, then the longer text representation of the display node
948 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
949 representation for a device node can be used, where applicable.
953 DevPathToTextUsbWWID (
954 IN OUT POOL_PRINT
*Str
,
956 IN BOOLEAN DisplayOnly
,
957 IN BOOLEAN AllowShortcuts
960 USB_WWID_DEVICE_PATH
*UsbWWId
;
961 CHAR16
*SerialNumberStr
;
967 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
968 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
969 if (Length
>= 1 && SerialNumberStr
[Length
- 1] != 0) {
971 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
973 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
974 ASSERT (NewStr
!= NULL
);
976 SerialNumberStr
= NewStr
;
979 UefiDevicePathLibCatPrint (
981 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
984 UsbWWId
->InterfaceNumber
,
990 Converts a Logic Unit device path structure to its string representative.
992 @param Str The string representative of input device.
993 @param DevPath The input device path structure.
994 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
995 of the display node is used, where applicable. If DisplayOnly
996 is FALSE, then the longer text representation of the display node
998 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
999 representation for a device node can be used, where applicable.
1003 DevPathToTextLogicalUnit (
1004 IN OUT POOL_PRINT
*Str
,
1006 IN BOOLEAN DisplayOnly
,
1007 IN BOOLEAN AllowShortcuts
1010 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
1012 LogicalUnit
= DevPath
;
1013 UefiDevicePathLibCatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
1017 Converts a USB class device path structure to its string representative.
1019 @param Str The string representative of input device.
1020 @param DevPath The input device path structure.
1021 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1022 of the display node is used, where applicable. If DisplayOnly
1023 is FALSE, then the longer text representation of the display node
1025 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1026 representation for a device node can be used, where applicable.
1030 DevPathToTextUsbClass (
1031 IN OUT POOL_PRINT
*Str
,
1033 IN BOOLEAN DisplayOnly
,
1034 IN BOOLEAN AllowShortcuts
1037 USB_CLASS_DEVICE_PATH
*UsbClass
;
1038 BOOLEAN IsKnownSubClass
;
1043 IsKnownSubClass
= TRUE
;
1044 switch (UsbClass
->DeviceClass
) {
1045 case USB_CLASS_AUDIO
:
1046 UefiDevicePathLibCatPrint (Str
, L
"UsbAudio");
1049 case USB_CLASS_CDCCONTROL
:
1050 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCControl");
1054 UefiDevicePathLibCatPrint (Str
, L
"UsbHID");
1057 case USB_CLASS_IMAGE
:
1058 UefiDevicePathLibCatPrint (Str
, L
"UsbImage");
1061 case USB_CLASS_PRINTER
:
1062 UefiDevicePathLibCatPrint (Str
, L
"UsbPrinter");
1065 case USB_CLASS_MASS_STORAGE
:
1066 UefiDevicePathLibCatPrint (Str
, L
"UsbMassStorage");
1070 UefiDevicePathLibCatPrint (Str
, L
"UsbHub");
1073 case USB_CLASS_CDCDATA
:
1074 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCData");
1077 case USB_CLASS_SMART_CARD
:
1078 UefiDevicePathLibCatPrint (Str
, L
"UsbSmartCard");
1081 case USB_CLASS_VIDEO
:
1082 UefiDevicePathLibCatPrint (Str
, L
"UsbVideo");
1085 case USB_CLASS_DIAGNOSTIC
:
1086 UefiDevicePathLibCatPrint (Str
, L
"UsbDiagnostic");
1089 case USB_CLASS_WIRELESS
:
1090 UefiDevicePathLibCatPrint (Str
, L
"UsbWireless");
1094 IsKnownSubClass
= FALSE
;
1098 if (IsKnownSubClass
) {
1099 UefiDevicePathLibCatPrint (
1101 L
"(0x%x,0x%x,0x%x,0x%x)",
1103 UsbClass
->ProductId
,
1104 UsbClass
->DeviceSubClass
,
1105 UsbClass
->DeviceProtocol
1110 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
1111 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
1112 UefiDevicePathLibCatPrint (
1114 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
1116 UsbClass
->ProductId
,
1117 UsbClass
->DeviceProtocol
1120 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
1121 UefiDevicePathLibCatPrint (
1123 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
1125 UsbClass
->ProductId
,
1126 UsbClass
->DeviceProtocol
1129 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
1130 UefiDevicePathLibCatPrint (
1132 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
1134 UsbClass
->ProductId
,
1135 UsbClass
->DeviceProtocol
1141 UefiDevicePathLibCatPrint (
1143 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
1145 UsbClass
->ProductId
,
1146 UsbClass
->DeviceClass
,
1147 UsbClass
->DeviceSubClass
,
1148 UsbClass
->DeviceProtocol
1153 Converts a SATA device path structure to its string representative.
1155 @param Str The string representative of input device.
1156 @param DevPath The input device path structure.
1157 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1158 of the display node is used, where applicable. If DisplayOnly
1159 is FALSE, then the longer text representation of the display node
1161 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1162 representation for a device node can be used, where applicable.
1167 IN OUT POOL_PRINT
*Str
,
1169 IN BOOLEAN DisplayOnly
,
1170 IN BOOLEAN AllowShortcuts
1173 SATA_DEVICE_PATH
*Sata
;
1176 UefiDevicePathLibCatPrint (
1178 L
"Sata(0x%x,0x%x,0x%x)",
1179 Sata
->HBAPortNumber
,
1180 Sata
->PortMultiplierPortNumber
,
1186 Converts a I20 device path structure to its string representative.
1188 @param Str The string representative of input device.
1189 @param DevPath The input device path structure.
1190 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1191 of the display node is used, where applicable. If DisplayOnly
1192 is FALSE, then the longer text representation of the display node
1194 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1195 representation for a device node can be used, where applicable.
1200 IN OUT POOL_PRINT
*Str
,
1202 IN BOOLEAN DisplayOnly
,
1203 IN BOOLEAN AllowShortcuts
1206 I2O_DEVICE_PATH
*I2ODevPath
;
1208 I2ODevPath
= DevPath
;
1209 UefiDevicePathLibCatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1213 Converts a MAC address device path structure to its string representative.
1215 @param Str The string representative of input device.
1216 @param DevPath The input device path structure.
1217 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1218 of the display node is used, where applicable. If DisplayOnly
1219 is FALSE, then the longer text representation of the display node
1221 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1222 representation for a device node can be used, where applicable.
1226 DevPathToTextMacAddr (
1227 IN OUT POOL_PRINT
*Str
,
1229 IN BOOLEAN DisplayOnly
,
1230 IN BOOLEAN AllowShortcuts
1233 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1234 UINTN HwAddressSize
;
1237 MacDevPath
= DevPath
;
1239 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1240 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1244 UefiDevicePathLibCatPrint (Str
, L
"MAC(");
1246 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1247 UefiDevicePathLibCatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1250 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1254 Converts network protocol string to its text representation.
1256 @param Str The string representative of input device.
1257 @param Protocol The network protocol ID.
1261 CatNetworkProtocol (
1262 IN OUT POOL_PRINT
*Str
,
1266 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1267 UefiDevicePathLibCatPrint (Str
, L
"TCP");
1268 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1269 UefiDevicePathLibCatPrint (Str
, L
"UDP");
1271 UefiDevicePathLibCatPrint (Str
, L
"0x%x", Protocol
);
1276 Converts IP v4 address to its text representation.
1278 @param Str The string representative of input device.
1279 @param Address The IP v4 address.
1283 IN OUT POOL_PRINT
*Str
,
1284 IN EFI_IPv4_ADDRESS
*Address
1287 UefiDevicePathLibCatPrint (Str
, L
"%d.%d.%d.%d", Address
->Addr
[0], Address
->Addr
[1], Address
->Addr
[2], Address
->Addr
[3]);
1291 Converts IP v6 address to its text representation.
1293 @param Str The string representative of input device.
1294 @param Address The IP v6 address.
1298 IN OUT POOL_PRINT
*Str
,
1299 IN EFI_IPv6_ADDRESS
*Address
1302 UefiDevicePathLibCatPrint (
1303 Str
, L
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1304 Address
->Addr
[0], Address
->Addr
[1],
1305 Address
->Addr
[2], Address
->Addr
[3],
1306 Address
->Addr
[4], Address
->Addr
[5],
1307 Address
->Addr
[6], Address
->Addr
[7],
1308 Address
->Addr
[8], Address
->Addr
[9],
1309 Address
->Addr
[10], Address
->Addr
[11],
1310 Address
->Addr
[12], Address
->Addr
[13],
1311 Address
->Addr
[14], Address
->Addr
[15]
1316 Converts a IPv4 device path structure to its string representative.
1318 @param Str The string representative of input device.
1319 @param DevPath The input device path structure.
1320 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1321 of the display node is used, where applicable. If DisplayOnly
1322 is FALSE, then the longer text representation of the display node
1324 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1325 representation for a device node can be used, where applicable.
1330 IN OUT POOL_PRINT
*Str
,
1332 IN BOOLEAN DisplayOnly
,
1333 IN BOOLEAN AllowShortcuts
1336 IPv4_DEVICE_PATH
*IPDevPath
;
1338 IPDevPath
= DevPath
;
1339 UefiDevicePathLibCatPrint (Str
, L
"IPv4(");
1340 CatIPv4Address (Str
, &IPDevPath
->RemoteIpAddress
);
1343 UefiDevicePathLibCatPrint (Str
, L
")");
1347 UefiDevicePathLibCatPrint (Str
, L
",");
1348 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1350 UefiDevicePathLibCatPrint (Str
, L
",%s,", IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP");
1351 CatIPv4Address (Str
, &IPDevPath
->LocalIpAddress
);
1352 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1353 UefiDevicePathLibCatPrint (Str
, L
",");
1354 CatIPv4Address (Str
, &IPDevPath
->GatewayIpAddress
);
1355 UefiDevicePathLibCatPrint (Str
, L
",");
1356 CatIPv4Address (Str
, &IPDevPath
->SubnetMask
);
1358 UefiDevicePathLibCatPrint (Str
, L
")");
1362 Converts a IPv6 device path structure to its string representative.
1364 @param Str The string representative of input device.
1365 @param DevPath The input device path structure.
1366 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1367 of the display node is used, where applicable. If DisplayOnly
1368 is FALSE, then the longer text representation of the display node
1370 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1371 representation for a device node can be used, where applicable.
1376 IN OUT POOL_PRINT
*Str
,
1378 IN BOOLEAN DisplayOnly
,
1379 IN BOOLEAN AllowShortcuts
1382 IPv6_DEVICE_PATH
*IPDevPath
;
1384 IPDevPath
= DevPath
;
1385 UefiDevicePathLibCatPrint (Str
, L
"IPv6(");
1386 CatIPv6Address (Str
, &IPDevPath
->RemoteIpAddress
);
1388 UefiDevicePathLibCatPrint (Str
, L
")");
1392 UefiDevicePathLibCatPrint (Str
, L
",");
1393 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1395 switch (IPDevPath
->IpAddressOrigin
) {
1397 UefiDevicePathLibCatPrint (Str
, L
",Static,");
1400 UefiDevicePathLibCatPrint (Str
, L
",StatelessAutoConfigure,");
1403 UefiDevicePathLibCatPrint (Str
, L
",StatefulAutoConfigure,");
1407 CatIPv6Address (Str
, &IPDevPath
->LocalIpAddress
);
1409 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1410 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", IPDevPath
->PrefixLength
);
1411 CatIPv6Address (Str
, &IPDevPath
->GatewayIpAddress
);
1413 UefiDevicePathLibCatPrint (Str
, L
")");
1417 Converts an Infini Band device path structure to its string representative.
1419 @param Str The string representative of input device.
1420 @param DevPath The input device path structure.
1421 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1422 of the display node is used, where applicable. If DisplayOnly
1423 is FALSE, then the longer text representation of the display node
1425 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1426 representation for a device node can be used, where applicable.
1430 DevPathToTextInfiniBand (
1431 IN OUT POOL_PRINT
*Str
,
1433 IN BOOLEAN DisplayOnly
,
1434 IN BOOLEAN AllowShortcuts
1437 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1439 InfiniBand
= DevPath
;
1440 UefiDevicePathLibCatPrint (
1442 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1443 InfiniBand
->ResourceFlags
,
1444 InfiniBand
->PortGid
,
1445 InfiniBand
->ServiceId
,
1446 InfiniBand
->TargetPortId
,
1447 InfiniBand
->DeviceId
1452 Converts a UART device path structure to its string representative.
1454 @param Str The string representative of input device.
1455 @param DevPath The input device path structure.
1456 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1457 of the display node is used, where applicable. If DisplayOnly
1458 is FALSE, then the longer text representation of the display node
1460 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1461 representation for a device node can be used, where applicable.
1466 IN OUT POOL_PRINT
*Str
,
1468 IN BOOLEAN DisplayOnly
,
1469 IN BOOLEAN AllowShortcuts
1472 UART_DEVICE_PATH
*Uart
;
1476 switch (Uart
->Parity
) {
1506 if (Uart
->BaudRate
== 0) {
1507 UefiDevicePathLibCatPrint (Str
, L
"Uart(DEFAULT,");
1509 UefiDevicePathLibCatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1512 if (Uart
->DataBits
== 0) {
1513 UefiDevicePathLibCatPrint (Str
, L
"DEFAULT,");
1515 UefiDevicePathLibCatPrint (Str
, L
"%d,", Uart
->DataBits
);
1518 UefiDevicePathLibCatPrint (Str
, L
"%c,", Parity
);
1520 switch (Uart
->StopBits
) {
1522 UefiDevicePathLibCatPrint (Str
, L
"D)");
1526 UefiDevicePathLibCatPrint (Str
, L
"1)");
1530 UefiDevicePathLibCatPrint (Str
, L
"1.5)");
1534 UefiDevicePathLibCatPrint (Str
, L
"2)");
1538 UefiDevicePathLibCatPrint (Str
, L
"x)");
1544 Converts an iSCSI device path structure to its string representative.
1546 @param Str The string representative of input device.
1547 @param DevPath The input device path structure.
1548 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1549 of the display node is used, where applicable. If DisplayOnly
1550 is FALSE, then the longer text representation of the display node
1552 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1553 representation for a device node can be used, where applicable.
1557 DevPathToTextiSCSI (
1558 IN OUT POOL_PRINT
*Str
,
1560 IN BOOLEAN DisplayOnly
,
1561 IN BOOLEAN AllowShortcuts
1564 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1568 ISCSIDevPath
= DevPath
;
1569 UefiDevicePathLibCatPrint (
1571 L
"iSCSI(%a,0x%x,0x",
1572 ISCSIDevPath
->TargetName
,
1573 ISCSIDevPath
->TargetPortalGroupTag
1575 for (Index
= 0; Index
< sizeof (ISCSIDevPath
->Lun
) / sizeof (UINT8
); Index
++) {
1576 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*)&ISCSIDevPath
->Lun
)[Index
]);
1578 Options
= ISCSIDevPath
->LoginOption
;
1579 UefiDevicePathLibCatPrint (Str
, L
",%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1580 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1581 if (((Options
>> 11) & 0x0001) != 0) {
1582 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"None");
1583 } else if (((Options
>> 12) & 0x0001) != 0) {
1584 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1586 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_BI");
1590 UefiDevicePathLibCatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1594 Converts a VLAN device path structure to its string representative.
1596 @param Str The string representative of input device.
1597 @param DevPath The input device path structure.
1598 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1599 of the display node is used, where applicable. If DisplayOnly
1600 is FALSE, then the longer text representation of the display node
1602 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1603 representation for a device node can be used, where applicable.
1608 IN OUT POOL_PRINT
*Str
,
1610 IN BOOLEAN DisplayOnly
,
1611 IN BOOLEAN AllowShortcuts
1614 VLAN_DEVICE_PATH
*Vlan
;
1617 UefiDevicePathLibCatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1621 Converts a Bluetooth device path structure to its string representative.
1623 @param Str The string representative of input device.
1624 @param DevPath The input device path structure.
1625 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1626 of the display node is used, where applicable. If DisplayOnly
1627 is FALSE, then the longer text representation of the display node
1629 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1630 representation for a device node can be used, where applicable.
1634 DevPathToTextBluetooth (
1635 IN OUT POOL_PRINT
*Str
,
1637 IN BOOLEAN DisplayOnly
,
1638 IN BOOLEAN AllowShortcuts
1641 BLUETOOTH_DEVICE_PATH
*Bluetooth
;
1643 Bluetooth
= DevPath
;
1644 UefiDevicePathLibCatPrint (
1646 L
"Bluetooth(%02x%02x%02x%02x%02x%02x)",
1647 Bluetooth
->BD_ADDR
.Address
[0],
1648 Bluetooth
->BD_ADDR
.Address
[1],
1649 Bluetooth
->BD_ADDR
.Address
[2],
1650 Bluetooth
->BD_ADDR
.Address
[3],
1651 Bluetooth
->BD_ADDR
.Address
[4],
1652 Bluetooth
->BD_ADDR
.Address
[5]
1657 Converts a Wi-Fi device path structure to its string representative.
1659 @param Str The string representative of input device.
1660 @param DevPath The input device path structure.
1661 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1662 of the display node is used, where applicable. If DisplayOnly
1663 is FALSE, then the longer text representation of the display node
1665 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1666 representation for a device node can be used, where applicable.
1671 IN OUT POOL_PRINT
*Str
,
1673 IN BOOLEAN DisplayOnly
,
1674 IN BOOLEAN AllowShortcuts
1677 WIFI_DEVICE_PATH
*WiFi
;
1683 CopyMem (SSId
, WiFi
->SSId
, 32);
1685 UefiDevicePathLibCatPrint (Str
, L
"Wi-Fi(%a)", SSId
);
1689 Converts a Bluetooth device path structure to its string representative.
1691 @param Str The string representative of input device.
1692 @param DevPath The input device path structure.
1693 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1694 of the display node is used, where applicable. If DisplayOnly
1695 is FALSE, then the longer text representation of the display node
1697 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1698 representation for a device node can be used, where applicable.
1702 DevPathToTextBluetoothLE (
1703 IN OUT POOL_PRINT
*Str
,
1705 IN BOOLEAN DisplayOnly
,
1706 IN BOOLEAN AllowShortcuts
1709 BLUETOOTH_LE_DEVICE_PATH
*BluetoothLE
;
1711 BluetoothLE
= DevPath
;
1712 UefiDevicePathLibCatPrint (
1714 L
"BluetoothLE(%02x%02x%02x%02x%02x%02x,0x%02x)",
1715 BluetoothLE
->Address
.Address
[0],
1716 BluetoothLE
->Address
.Address
[1],
1717 BluetoothLE
->Address
.Address
[2],
1718 BluetoothLE
->Address
.Address
[3],
1719 BluetoothLE
->Address
.Address
[4],
1720 BluetoothLE
->Address
.Address
[5],
1721 BluetoothLE
->Address
.Type
1726 Converts a DNS device path structure to its string representative.
1728 @param Str The string representative of input device.
1729 @param DevPath The input device path structure.
1730 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1731 of the display node is used, where applicable. If DisplayOnly
1732 is FALSE, then the longer text representation of the display node
1734 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1735 representation for a device node can be used, where applicable.
1740 IN OUT POOL_PRINT
*Str
,
1742 IN BOOLEAN DisplayOnly
,
1743 IN BOOLEAN AllowShortcuts
1746 DNS_DEVICE_PATH
*DnsDevPath
;
1747 UINT32 DnsServerIpCount
;
1748 UINT32 DnsServerIpIndex
;
1750 DnsDevPath
= DevPath
;
1751 DnsServerIpCount
= (UINT32
) (DevicePathNodeLength(DnsDevPath
) - sizeof (EFI_DEVICE_PATH_PROTOCOL
) - sizeof (DnsDevPath
->IsIPv6
)) / sizeof (EFI_IP_ADDRESS
);
1753 UefiDevicePathLibCatPrint (Str
, L
"Dns(");
1755 for (DnsServerIpIndex
= 0; DnsServerIpIndex
< DnsServerIpCount
; DnsServerIpIndex
++) {
1756 if (DnsDevPath
->IsIPv6
== 0x00) {
1757 CatIPv4Address (Str
, &(DnsDevPath
->DnsServerIp
[DnsServerIpIndex
].v4
));
1759 CatIPv6Address (Str
, &(DnsDevPath
->DnsServerIp
[DnsServerIpIndex
].v6
));
1762 if (DnsServerIpIndex
< DnsServerIpCount
- 1) {
1763 UefiDevicePathLibCatPrint (Str
, L
",");
1767 UefiDevicePathLibCatPrint (Str
, L
")");
1771 Converts a URI device path structure to its string representative.
1773 @param Str The string representative of input device.
1774 @param DevPath The input device path structure.
1775 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1776 of the display node is used, where applicable. If DisplayOnly
1777 is FALSE, then the longer text representation of the display node
1779 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1780 representation for a device node can be used, where applicable.
1785 IN OUT POOL_PRINT
*Str
,
1787 IN BOOLEAN DisplayOnly
,
1788 IN BOOLEAN AllowShortcuts
1791 URI_DEVICE_PATH
*Uri
;
1796 // Uri in the device path may not be null terminated.
1799 UriLength
= DevicePathNodeLength (Uri
) - sizeof (URI_DEVICE_PATH
);
1800 UriStr
= AllocatePool (UriLength
+ 1);
1801 ASSERT (UriStr
!= NULL
);
1803 CopyMem (UriStr
, Uri
->Uri
, UriLength
);
1804 UriStr
[UriLength
] = '\0';
1805 UefiDevicePathLibCatPrint (Str
, L
"Uri(%a)", UriStr
);
1810 Converts a Hard drive device path structure to its string representative.
1812 @param Str The string representative of input device.
1813 @param DevPath The input device path structure.
1814 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1815 of the display node is used, where applicable. If DisplayOnly
1816 is FALSE, then the longer text representation of the display node
1818 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1819 representation for a device node can be used, where applicable.
1823 DevPathToTextHardDrive (
1824 IN OUT POOL_PRINT
*Str
,
1826 IN BOOLEAN DisplayOnly
,
1827 IN BOOLEAN AllowShortcuts
1830 HARDDRIVE_DEVICE_PATH
*Hd
;
1833 switch (Hd
->SignatureType
) {
1834 case SIGNATURE_TYPE_MBR
:
1835 UefiDevicePathLibCatPrint (
1837 L
"HD(%d,%s,0x%08x,",
1838 Hd
->PartitionNumber
,
1840 *((UINT32
*) (&(Hd
->Signature
[0])))
1844 case SIGNATURE_TYPE_GUID
:
1845 UefiDevicePathLibCatPrint (
1848 Hd
->PartitionNumber
,
1850 (EFI_GUID
*) &(Hd
->Signature
[0])
1855 UefiDevicePathLibCatPrint (
1858 Hd
->PartitionNumber
,
1864 UefiDevicePathLibCatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1868 Converts a CDROM device path structure to its string representative.
1870 @param Str The string representative of input device.
1871 @param DevPath The input device path structure.
1872 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1873 of the display node is used, where applicable. If DisplayOnly
1874 is FALSE, then the longer text representation of the display node
1876 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1877 representation for a device node can be used, where applicable.
1881 DevPathToTextCDROM (
1882 IN OUT POOL_PRINT
*Str
,
1884 IN BOOLEAN DisplayOnly
,
1885 IN BOOLEAN AllowShortcuts
1888 CDROM_DEVICE_PATH
*Cd
;
1892 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1896 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1900 Converts a File device path structure to its string representative.
1902 @param Str The string representative of input device.
1903 @param DevPath The input device path structure.
1904 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1905 of the display node is used, where applicable. If DisplayOnly
1906 is FALSE, then the longer text representation of the display node
1908 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1909 representation for a device node can be used, where applicable.
1913 DevPathToTextFilePath (
1914 IN OUT POOL_PRINT
*Str
,
1916 IN BOOLEAN DisplayOnly
,
1917 IN BOOLEAN AllowShortcuts
1920 FILEPATH_DEVICE_PATH
*Fp
;
1923 UefiDevicePathLibCatPrint (Str
, L
"%s", Fp
->PathName
);
1927 Converts a Media protocol device path structure to its string representative.
1929 @param Str The string representative of input device.
1930 @param DevPath The input device path structure.
1931 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1932 of the display node is used, where applicable. If DisplayOnly
1933 is FALSE, then the longer text representation of the display node
1935 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1936 representation for a device node can be used, where applicable.
1940 DevPathToTextMediaProtocol (
1941 IN OUT POOL_PRINT
*Str
,
1943 IN BOOLEAN DisplayOnly
,
1944 IN BOOLEAN AllowShortcuts
1947 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1949 MediaProt
= DevPath
;
1950 UefiDevicePathLibCatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1954 Converts a Firmware Volume device path structure to its string representative.
1956 @param Str The string representative of input device.
1957 @param DevPath The input device path structure.
1958 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1959 of the display node is used, where applicable. If DisplayOnly
1960 is FALSE, then the longer text representation of the display node
1962 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1963 representation for a device node can be used, where applicable.
1968 IN OUT POOL_PRINT
*Str
,
1970 IN BOOLEAN DisplayOnly
,
1971 IN BOOLEAN AllowShortcuts
1974 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1977 UefiDevicePathLibCatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1981 Converts a Firmware Volume File device path structure to its string representative.
1983 @param Str The string representative of input device.
1984 @param DevPath The input device path structure.
1985 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1986 of the display node is used, where applicable. If DisplayOnly
1987 is FALSE, then the longer text representation of the display node
1989 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1990 representation for a device node can be used, where applicable.
1994 DevPathToTextFvFile (
1995 IN OUT POOL_PRINT
*Str
,
1997 IN BOOLEAN DisplayOnly
,
1998 IN BOOLEAN AllowShortcuts
2001 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
2004 UefiDevicePathLibCatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
2008 Converts a Relative Offset device path structure to its string representative.
2010 @param Str The string representative of input device.
2011 @param DevPath The input device path structure.
2012 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2013 of the display node is used, where applicable. If DisplayOnly
2014 is FALSE, then the longer text representation of the display node
2016 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2017 representation for a device node can be used, where applicable.
2021 DevPathRelativeOffsetRange (
2022 IN OUT POOL_PRINT
*Str
,
2024 IN BOOLEAN DisplayOnly
,
2025 IN BOOLEAN AllowShortcuts
2028 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
2031 UefiDevicePathLibCatPrint (
2033 L
"Offset(0x%lx,0x%lx)",
2034 Offset
->StartingOffset
,
2035 Offset
->EndingOffset
2040 Converts a Ram Disk device path structure to its string representative.
2042 @param Str The string representative of input device.
2043 @param DevPath The input device path structure.
2044 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2045 of the display node is used, where applicable. If DisplayOnly
2046 is FALSE, then the longer text representation of the display node
2048 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2049 representation for a device node can be used, where applicable.
2053 DevPathToTextRamDisk (
2054 IN OUT POOL_PRINT
*Str
,
2056 IN BOOLEAN DisplayOnly
,
2057 IN BOOLEAN AllowShortcuts
2060 MEDIA_RAM_DISK_DEVICE_PATH
*RamDisk
;
2064 if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualDiskGuid
)) {
2065 UefiDevicePathLibCatPrint (
2067 L
"VirtualDisk(0x%lx,0x%lx,%d)",
2068 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2069 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2072 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiVirtualCdGuid
)) {
2073 UefiDevicePathLibCatPrint (
2075 L
"VirtualCD(0x%lx,0x%lx,%d)",
2076 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2077 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2080 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualDiskGuid
)) {
2081 UefiDevicePathLibCatPrint (
2083 L
"PersistentVirtualDisk(0x%lx,0x%lx,%d)",
2084 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2085 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2088 } else if (CompareGuid (&RamDisk
->TypeGuid
, &gEfiPersistentVirtualCdGuid
)) {
2089 UefiDevicePathLibCatPrint (
2091 L
"PersistentVirtualCD(0x%lx,0x%lx,%d)",
2092 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2093 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2097 UefiDevicePathLibCatPrint (
2099 L
"RamDisk(0x%lx,0x%lx,%d,%g)",
2100 LShiftU64 ((UINT64
)RamDisk
->StartingAddr
[1], 32) | RamDisk
->StartingAddr
[0],
2101 LShiftU64 ((UINT64
)RamDisk
->EndingAddr
[1], 32) | RamDisk
->EndingAddr
[0],
2109 Converts a BIOS Boot Specification device path structure to its string representative.
2111 @param Str The string representative of input device.
2112 @param DevPath The input device path structure.
2113 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2114 of the display node is used, where applicable. If DisplayOnly
2115 is FALSE, then the longer text representation of the display node
2117 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2118 representation for a device node can be used, where applicable.
2123 IN OUT POOL_PRINT
*Str
,
2125 IN BOOLEAN DisplayOnly
,
2126 IN BOOLEAN AllowShortcuts
2129 BBS_BBS_DEVICE_PATH
*Bbs
;
2133 switch (Bbs
->DeviceType
) {
2134 case BBS_TYPE_FLOPPY
:
2138 case BBS_TYPE_HARDDRIVE
:
2142 case BBS_TYPE_CDROM
:
2146 case BBS_TYPE_PCMCIA
:
2154 case BBS_TYPE_EMBEDDED_NETWORK
:
2164 UefiDevicePathLibCatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
2166 UefiDevicePathLibCatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
2170 UefiDevicePathLibCatPrint (Str
, L
")");
2174 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
2178 Converts an End-of-Device-Path structure to its string representative.
2180 @param Str The string representative of input device.
2181 @param DevPath The input device path structure.
2182 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2183 of the display node is used, where applicable. If DisplayOnly
2184 is FALSE, then the longer text representation of the display node
2186 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2187 representation for a device node can be used, where applicable.
2191 DevPathToTextEndInstance (
2192 IN OUT POOL_PRINT
*Str
,
2194 IN BOOLEAN DisplayOnly
,
2195 IN BOOLEAN AllowShortcuts
2198 UefiDevicePathLibCatPrint (Str
, L
",");
2201 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric
[] = {
2202 {HARDWARE_DEVICE_PATH
, L
"HardwarePath" },
2203 {ACPI_DEVICE_PATH
, L
"AcpiPath" },
2204 {MESSAGING_DEVICE_PATH
, L
"Msg" },
2205 {MEDIA_DEVICE_PATH
, L
"MediaPath" },
2206 {BBS_DEVICE_PATH
, L
"BbsPath" },
2211 Converts an unknown device path structure to its string representative.
2213 @param Str The string representative of input device.
2214 @param DevPath The input device path structure.
2215 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2216 of the display node is used, where applicable. If DisplayOnly
2217 is FALSE, then the longer text representation of the display node
2219 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2220 representation for a device node can be used, where applicable.
2224 DevPathToTextNodeGeneric (
2225 IN OUT POOL_PRINT
*Str
,
2227 IN BOOLEAN DisplayOnly
,
2228 IN BOOLEAN AllowShortcuts
2231 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2236 for (Index
= 0; mUefiDevicePathLibToTextTableGeneric
[Index
].Text
!= NULL
; Index
++) {
2237 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTableGeneric
[Index
].Type
) {
2242 if (mUefiDevicePathLibToTextTableGeneric
[Index
].Text
== NULL
) {
2244 // It's a node whose type cannot be recognized
2246 UefiDevicePathLibCatPrint (Str
, L
"Path(%d,%d", DevicePathType (Node
), DevicePathSubType (Node
));
2249 // It's a node whose type can be recognized
2251 UefiDevicePathLibCatPrint (Str
, L
"%s(%d", mUefiDevicePathLibToTextTableGeneric
[Index
].Text
, DevicePathSubType (Node
));
2254 Index
= sizeof (EFI_DEVICE_PATH_PROTOCOL
);
2255 if (Index
< DevicePathNodeLength (Node
)) {
2256 UefiDevicePathLibCatPrint (Str
, L
",");
2257 for (; Index
< DevicePathNodeLength (Node
); Index
++) {
2258 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*) Node
)[Index
]);
2262 UefiDevicePathLibCatPrint (Str
, L
")");
2265 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable
[] = {
2266 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
2267 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
2268 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
2269 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
2270 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
2271 {HARDWARE_DEVICE_PATH
, HW_BMC_DP
, DevPathToTextBmc
},
2272 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
2273 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
2274 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
2275 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
2276 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
2277 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
2278 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
2279 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
2280 {MESSAGING_DEVICE_PATH
, MSG_NVME_NAMESPACE_DP
, DevPathToTextNVMe
},
2281 {MESSAGING_DEVICE_PATH
, MSG_UFS_DP
, DevPathToTextUfs
},
2282 {MESSAGING_DEVICE_PATH
, MSG_SD_DP
, DevPathToTextSd
},
2283 {MESSAGING_DEVICE_PATH
, MSG_EMMC_DP
, DevPathToTextEmmc
},
2284 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
2285 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
2286 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
2287 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
2288 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
2289 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
2290 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
2291 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
2292 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
2293 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
2294 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
2295 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
2296 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
2297 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
2298 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
2299 {MESSAGING_DEVICE_PATH
, MSG_DNS_DP
, DevPathToTextDns
},
2300 {MESSAGING_DEVICE_PATH
, MSG_URI_DP
, DevPathToTextUri
},
2301 {MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_DP
, DevPathToTextBluetooth
},
2302 {MESSAGING_DEVICE_PATH
, MSG_WIFI_DP
, DevPathToTextWiFi
},
2303 {MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_LE_DP
, DevPathToTextBluetoothLE
},
2304 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
2305 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
2306 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
2307 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
2308 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
2309 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
2310 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
2311 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
2312 {MEDIA_DEVICE_PATH
, MEDIA_RAM_DISK_DP
, DevPathToTextRamDisk
},
2313 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
2314 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
2319 Converts a device node to its string representation.
2321 @param DeviceNode A Pointer to the device node to be converted.
2322 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2323 of the display node is used, where applicable. If DisplayOnly
2324 is FALSE, then the longer text representation of the display node
2326 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2327 representation for a device node can be used, where applicable.
2329 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
2330 is NULL or there was insufficient memory.
2335 UefiDevicePathLibConvertDeviceNodeToText (
2336 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
2337 IN BOOLEAN DisplayOnly
,
2338 IN BOOLEAN AllowShortcuts
2343 DEVICE_PATH_TO_TEXT ToText
;
2345 if (DeviceNode
== NULL
) {
2349 ZeroMem (&Str
, sizeof (Str
));
2352 // Process the device path node
2353 // If not found, use a generic function
2355 ToText
= DevPathToTextNodeGeneric
;
2356 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
++) {
2357 if (DevicePathType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2358 DevicePathSubType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2360 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2368 ToText (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
2370 ASSERT (Str
.Str
!= NULL
);
2375 Converts a device path to its text representation.
2377 @param DevicePath A Pointer to the device to be converted.
2378 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2379 of the display node is used, where applicable. If DisplayOnly
2380 is FALSE, then the longer text representation of the display node
2382 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2383 representation for a device node can be used, where applicable.
2385 @return A pointer to the allocated text representation of the device path or
2386 NULL if DeviceNode is NULL or there was insufficient memory.
2391 UefiDevicePathLibConvertDevicePathToText (
2392 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
2393 IN BOOLEAN DisplayOnly
,
2394 IN BOOLEAN AllowShortcuts
2398 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2399 EFI_DEVICE_PATH_PROTOCOL
*AlignedNode
;
2401 DEVICE_PATH_TO_TEXT ToText
;
2403 if (DevicePath
== NULL
) {
2407 ZeroMem (&Str
, sizeof (Str
));
2410 // Process each device path node
2412 Node
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
2413 while (!IsDevicePathEnd (Node
)) {
2415 // Find the handler to dump this device path node
2416 // If not found, use a generic function
2418 ToText
= DevPathToTextNodeGeneric
;
2419 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
2421 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2422 DevicePathSubType (Node
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2424 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2429 // Put a path separator in if needed
2431 if ((Str
.Count
!= 0) && (ToText
!= DevPathToTextEndInstance
)) {
2432 if (Str
.Str
[Str
.Count
] != L
',') {
2433 UefiDevicePathLibCatPrint (&Str
, L
"/");
2437 AlignedNode
= AllocateCopyPool (DevicePathNodeLength (Node
), Node
);
2439 // Print this node of the device path
2441 ToText (&Str
, AlignedNode
, DisplayOnly
, AllowShortcuts
);
2442 FreePool (AlignedNode
);
2445 // Next device path node
2447 Node
= NextDevicePathNode (Node
);
2450 if (Str
.Str
== NULL
) {
2451 return AllocateZeroPool (sizeof (CHAR16
));