2 DevicePathToText protocol as defined in the UEFI 2.0 specification.
4 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "UefiDevicePathLib.h"
18 Concatenates a formatted unicode string to allocated pool. The caller must
19 free the resulting buffer.
21 @param Str Tracks the allocated pool, size in use, and
22 amount of pool allocated.
23 @param Fmt The format string
24 @param ... Variable arguments based on the format string.
26 @return Allocated buffer with the formatted string printed in it.
27 The caller must free the allocated buffer. The buffer
28 allocation is not packed.
33 UefiDevicePathLibCatPrint (
34 IN OUT POOL_PRINT
*Str
,
43 Count
= SPrintLength (Fmt
, Args
);
45 if ((Str
->Count
+ (Count
+ 1)) * sizeof (CHAR16
) > Str
->Capacity
) {
46 Str
->Capacity
= (Str
->Count
+ (Count
+ 1) * 2) * sizeof (CHAR16
);
47 Str
->Str
= ReallocatePool (
48 Str
->Count
* sizeof (CHAR16
),
52 ASSERT (Str
->Str
!= NULL
);
54 UnicodeVSPrint (&Str
->Str
[Str
->Count
], Str
->Capacity
- Str
->Count
* sizeof (CHAR16
), Fmt
, Args
);
62 Converts a PCI device path structure to its string representative.
64 @param Str The string representative of input device.
65 @param DevPath The input device path structure.
66 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
67 of the display node is used, where applicable. If DisplayOnly
68 is FALSE, then the longer text representation of the display node
70 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
71 representation for a device node can be used, where applicable.
76 IN OUT POOL_PRINT
*Str
,
78 IN BOOLEAN DisplayOnly
,
79 IN BOOLEAN AllowShortcuts
85 UefiDevicePathLibCatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
89 Converts a PC Card device path structure to its string representative.
91 @param Str The string representative of input device.
92 @param DevPath The input device path structure.
93 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
94 of the display node is used, where applicable. If DisplayOnly
95 is FALSE, then the longer text representation of the display node
97 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
98 representation for a device node can be used, where applicable.
102 DevPathToTextPccard (
103 IN OUT POOL_PRINT
*Str
,
105 IN BOOLEAN DisplayOnly
,
106 IN BOOLEAN AllowShortcuts
109 PCCARD_DEVICE_PATH
*Pccard
;
112 UefiDevicePathLibCatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
116 Converts a Memory Map device path structure to its string representative.
118 @param Str The string representative of input device.
119 @param DevPath The input device path structure.
120 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
121 of the display node is used, where applicable. If DisplayOnly
122 is FALSE, then the longer text representation of the display node
124 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
125 representation for a device node can be used, where applicable.
129 DevPathToTextMemMap (
130 IN OUT POOL_PRINT
*Str
,
132 IN BOOLEAN DisplayOnly
,
133 IN BOOLEAN AllowShortcuts
136 MEMMAP_DEVICE_PATH
*MemMap
;
139 UefiDevicePathLibCatPrint (
141 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
143 MemMap
->StartingAddress
,
144 MemMap
->EndingAddress
149 Converts a Vendor device path structure to its string representative.
151 @param Str The string representative of input device.
152 @param DevPath The input device path structure.
153 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
154 of the display node is used, where applicable. If DisplayOnly
155 is FALSE, then the longer text representation of the display node
157 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
158 representation for a device node can be used, where applicable.
162 DevPathToTextVendor (
163 IN OUT POOL_PRINT
*Str
,
165 IN BOOLEAN DisplayOnly
,
166 IN BOOLEAN AllowShortcuts
169 VENDOR_DEVICE_PATH
*Vendor
;
173 UINT32 FlowControlMap
;
176 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
177 switch (DevicePathType (&Vendor
->Header
)) {
178 case HARDWARE_DEVICE_PATH
:
182 case MESSAGING_DEVICE_PATH
:
184 if (AllowShortcuts
) {
185 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
186 UefiDevicePathLibCatPrint (Str
, L
"VenPcAnsi()");
188 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
189 UefiDevicePathLibCatPrint (Str
, L
"VenVt100()");
191 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
192 UefiDevicePathLibCatPrint (Str
, L
"VenVt100Plus()");
194 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
195 UefiDevicePathLibCatPrint (Str
, L
"VenUft8()");
197 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
198 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
199 switch (FlowControlMap
& 0x00000003) {
201 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
205 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
209 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
217 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
218 UefiDevicePathLibCatPrint (
220 L
"SAS(0x%lx,0x%lx,0x%x,",
221 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
222 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
223 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
225 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
226 if (((Info
& 0x0f) == 0) && ((Info
& BIT7
) == 0)) {
227 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0,");
228 } else if (((Info
& 0x0f) <= 2) && ((Info
& BIT7
) == 0)) {
229 UefiDevicePathLibCatPrint (
232 ((Info
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
233 ((Info
& BIT5
) != 0) ? L
"External" : L
"Internal",
234 ((Info
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
236 if ((Info
& 0x0f) == 1) {
237 UefiDevicePathLibCatPrint (Str
, L
"0,");
240 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
242 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", ((Info
>> 8) & 0xff) + 1);
245 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0,", Info
);
248 UefiDevicePathLibCatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
250 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
251 UefiDevicePathLibCatPrint (Str
, L
"DebugPort()");
257 case MEDIA_DEVICE_PATH
:
266 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
267 UefiDevicePathLibCatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
268 if (DataLength
!= 0) {
269 UefiDevicePathLibCatPrint (Str
, L
",");
270 for (Index
= 0; Index
< DataLength
; Index
++) {
271 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
275 UefiDevicePathLibCatPrint (Str
, L
")");
279 Converts a Controller device path structure to its string representative.
281 @param Str The string representative of input device.
282 @param DevPath The input device path structure.
283 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
284 of the display node is used, where applicable. If DisplayOnly
285 is FALSE, then the longer text representation of the display node
287 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
288 representation for a device node can be used, where applicable.
292 DevPathToTextController (
293 IN OUT POOL_PRINT
*Str
,
295 IN BOOLEAN DisplayOnly
,
296 IN BOOLEAN AllowShortcuts
299 CONTROLLER_DEVICE_PATH
*Controller
;
301 Controller
= DevPath
;
302 UefiDevicePathLibCatPrint (
305 Controller
->ControllerNumber
310 Converts a ACPI device path structure to its string representative.
312 @param Str The string representative of input device.
313 @param DevPath The input device path structure.
314 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
315 of the display node is used, where applicable. If DisplayOnly
316 is FALSE, then the longer text representation of the display node
318 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
319 representation for a device node can be used, where applicable.
324 IN OUT POOL_PRINT
*Str
,
326 IN BOOLEAN DisplayOnly
,
327 IN BOOLEAN AllowShortcuts
330 ACPI_HID_DEVICE_PATH
*Acpi
;
333 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
334 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
336 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
340 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(0x%x)", Acpi
->UID
);
344 UefiDevicePathLibCatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
348 UefiDevicePathLibCatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
352 UefiDevicePathLibCatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
356 UefiDevicePathLibCatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
360 UefiDevicePathLibCatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
364 UefiDevicePathLibCatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
369 Converts a ACPI extended HID device path structure to its string representative.
371 @param Str The string representative of input device.
372 @param DevPath The input device path structure.
373 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
374 of the display node is used, where applicable. If DisplayOnly
375 is FALSE, then the longer text representation of the display node
377 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
378 representation for a device node can be used, where applicable.
382 DevPathToTextAcpiEx (
383 IN OUT POOL_PRINT
*Str
,
385 IN BOOLEAN DisplayOnly
,
386 IN BOOLEAN AllowShortcuts
389 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
397 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
398 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
399 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
402 // Converts EISA identification to string.
408 ((AcpiEx
->HID
>> 10) & 0x1f) + 'A' - 1,
409 ((AcpiEx
->HID
>> 5) & 0x1f) + 'A' - 1,
410 ((AcpiEx
->HID
>> 0) & 0x1f) + 'A' - 1,
411 (AcpiEx
->HID
>> 16) & 0xFFFF
417 ((AcpiEx
->CID
>> 10) & 0x1f) + 'A' - 1,
418 ((AcpiEx
->CID
>> 5) & 0x1f) + 'A' - 1,
419 ((AcpiEx
->CID
>> 0) & 0x1f) + 'A' - 1,
420 (AcpiEx
->CID
>> 16) & 0xFFFF
423 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (AcpiEx
->UID
== 0)) {
427 UefiDevicePathLibCatPrint (
429 L
"AcpiExp(%s,%s,%a)",
435 if (AllowShortcuts
) {
439 if (AcpiEx
->HID
== 0) {
440 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
442 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
445 if (AcpiEx
->UID
== 0) {
446 UefiDevicePathLibCatPrint (Str
, L
"%a,", UIDStr
);
448 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", AcpiEx
->UID
);
451 if (AcpiEx
->CID
== 0) {
452 UefiDevicePathLibCatPrint (Str
, L
"%a)", CIDStr
);
454 UefiDevicePathLibCatPrint (Str
, L
"%s)", CIDText
);
457 UefiDevicePathLibCatPrint (
459 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
472 Converts a ACPI address device path structure to its string representative.
474 @param Str The string representative of input device.
475 @param DevPath The input device path structure.
476 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
477 of the display node is used, where applicable. If DisplayOnly
478 is FALSE, then the longer text representation of the display node
480 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
481 representation for a device node can be used, where applicable.
485 DevPathToTextAcpiAdr (
486 IN OUT POOL_PRINT
*Str
,
488 IN BOOLEAN DisplayOnly
,
489 IN BOOLEAN AllowShortcuts
492 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
495 UINT16 AdditionalAdrCount
;
498 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
499 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
501 UefiDevicePathLibCatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
502 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
503 UefiDevicePathLibCatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
505 UefiDevicePathLibCatPrint (Str
, L
")");
509 Converts a ATAPI device path structure to its string representative.
511 @param Str The string representative of input device.
512 @param DevPath The input device path structure.
513 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
514 of the display node is used, where applicable. If DisplayOnly
515 is FALSE, then the longer text representation of the display node
517 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
518 representation for a device node can be used, where applicable.
523 IN OUT POOL_PRINT
*Str
,
525 IN BOOLEAN DisplayOnly
,
526 IN BOOLEAN AllowShortcuts
529 ATAPI_DEVICE_PATH
*Atapi
;
534 UefiDevicePathLibCatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
536 UefiDevicePathLibCatPrint (
539 (Atapi
->PrimarySecondary
== 1) ? L
"Secondary" : L
"Primary",
540 (Atapi
->SlaveMaster
== 1) ? L
"Slave" : L
"Master",
547 Converts a SCSI device path structure to its string representative.
549 @param Str The string representative of input device.
550 @param DevPath The input device path structure.
551 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
552 of the display node is used, where applicable. If DisplayOnly
553 is FALSE, then the longer text representation of the display node
555 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
556 representation for a device node can be used, where applicable.
561 IN OUT POOL_PRINT
*Str
,
563 IN BOOLEAN DisplayOnly
,
564 IN BOOLEAN AllowShortcuts
567 SCSI_DEVICE_PATH
*Scsi
;
570 UefiDevicePathLibCatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
574 Converts a Fibre 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 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
597 UefiDevicePathLibCatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
601 Converts a FibreEx device path structure to its string representative.
603 @param Str The string representative of input device.
604 @param DevPath The input device path structure.
605 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
606 of the display node is used, where applicable. If DisplayOnly
607 is FALSE, then the longer text representation of the display node
609 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
610 representation for a device node can be used, where applicable.
614 DevPathToTextFibreEx (
615 IN OUT POOL_PRINT
*Str
,
617 IN BOOLEAN DisplayOnly
,
618 IN BOOLEAN AllowShortcuts
621 FIBRECHANNELEX_DEVICE_PATH
*FibreEx
;
625 UefiDevicePathLibCatPrint (Str
, L
"FibreEx(0x");
626 for (Index
= 0; Index
< sizeof (FibreEx
->WWN
) / sizeof (FibreEx
->WWN
[0]); Index
++) {
627 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->WWN
[Index
]);
629 UefiDevicePathLibCatPrint (Str
, L
",0x");
630 for (Index
= 0; Index
< sizeof (FibreEx
->Lun
) / sizeof (FibreEx
->Lun
[0]); Index
++) {
631 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->Lun
[Index
]);
633 UefiDevicePathLibCatPrint (Str
, L
")");
637 Converts a Sas Ex device path structure to its string representative.
639 @param Str The string representative of input device.
640 @param DevPath The input device path structure.
641 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
642 of the display node is used, where applicable. If DisplayOnly
643 is FALSE, then the longer text representation of the display node
645 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
646 representation for a device node can be used, where applicable.
651 IN OUT POOL_PRINT
*Str
,
653 IN BOOLEAN DisplayOnly
,
654 IN BOOLEAN AllowShortcuts
657 SASEX_DEVICE_PATH
*SasEx
;
661 UefiDevicePathLibCatPrint (Str
, L
"SasEx(0x");
663 for (Index
= 0; Index
< sizeof (SasEx
->SasAddress
) / sizeof (SasEx
->SasAddress
[0]); Index
++) {
664 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->SasAddress
[Index
]);
666 UefiDevicePathLibCatPrint (Str
, L
",0x");
667 for (Index
= 0; Index
< sizeof (SasEx
->Lun
) / sizeof (SasEx
->Lun
[0]); Index
++) {
668 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->Lun
[Index
]);
670 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", SasEx
->RelativeTargetPort
);
672 if (((SasEx
->DeviceTopology
& 0x0f) == 0) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
673 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0");
674 } else if (((SasEx
->DeviceTopology
& 0x0f) <= 2) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
675 UefiDevicePathLibCatPrint (
678 ((SasEx
->DeviceTopology
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
679 ((SasEx
->DeviceTopology
& BIT5
) != 0) ? L
"External" : L
"Internal",
680 ((SasEx
->DeviceTopology
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
682 if ((SasEx
->DeviceTopology
& 0x0f) == 1) {
683 UefiDevicePathLibCatPrint (Str
, L
"0");
686 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
688 UefiDevicePathLibCatPrint (Str
, L
"0x%x", ((SasEx
->DeviceTopology
>> 8) & 0xff) + 1);
691 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0", SasEx
->DeviceTopology
);
694 UefiDevicePathLibCatPrint (Str
, L
")");
700 Converts a NVM Express Namespace device path structure to its string representative.
702 @param Str The string representative of input device.
703 @param DevPath The input device path structure.
704 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
705 of the display node is used, where applicable. If DisplayOnly
706 is FALSE, then the longer text representation of the display node
708 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
709 representation for a device node can be used, where applicable.
714 IN OUT POOL_PRINT
*Str
,
716 IN BOOLEAN DisplayOnly
,
717 IN BOOLEAN AllowShortcuts
720 NVME_NAMESPACE_DEVICE_PATH
*Nvme
;
724 Uuid
= (UINT8
*) &Nvme
->NamespaceUuid
;
725 UefiDevicePathLibCatPrint (
727 L
"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",
729 Uuid
[7], Uuid
[6], Uuid
[5], Uuid
[4],
730 Uuid
[3], Uuid
[2], Uuid
[1], Uuid
[0]
735 Converts a UFS device path structure to its string representative.
737 @param Str The string representative of input device.
738 @param DevPath The input device path structure.
739 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
740 of the display node is used, where applicable. If DisplayOnly
741 is FALSE, then the longer text representation of the display node
743 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
744 representation for a device node can be used, where applicable.
749 IN OUT POOL_PRINT
*Str
,
751 IN BOOLEAN DisplayOnly
,
752 IN BOOLEAN AllowShortcuts
755 UFS_DEVICE_PATH
*Ufs
;
758 UefiDevicePathLibCatPrint (Str
, L
"UFS(0x%x,0x%x)", Ufs
->Pun
, Ufs
->Lun
);
762 Converts a SD (Secure Digital) device path structure to its string representative.
764 @param Str The string representative of input device.
765 @param DevPath The input device path structure.
766 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
767 of the display node is used, where applicable. If DisplayOnly
768 is FALSE, then the longer text representation of the display node
770 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
771 representation for a device node can be used, where applicable.
776 IN OUT POOL_PRINT
*Str
,
778 IN BOOLEAN DisplayOnly
,
779 IN BOOLEAN AllowShortcuts
785 UefiDevicePathLibCatPrint (
793 Converts a 1394 device path structure to its string representative.
795 @param Str The string representative of input device.
796 @param DevPath The input device path structure.
797 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
798 of the display node is used, where applicable. If DisplayOnly
799 is FALSE, then the longer text representation of the display node
801 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
802 representation for a device node can be used, where applicable.
807 IN OUT POOL_PRINT
*Str
,
809 IN BOOLEAN DisplayOnly
,
810 IN BOOLEAN AllowShortcuts
813 F1394_DEVICE_PATH
*F1394DevPath
;
815 F1394DevPath
= DevPath
;
817 // Guid has format of IEEE-EUI64
819 UefiDevicePathLibCatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
823 Converts a USB device path structure to its string representative.
825 @param Str The string representative of input device.
826 @param DevPath The input device path structure.
827 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
828 of the display node is used, where applicable. If DisplayOnly
829 is FALSE, then the longer text representation of the display node
831 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
832 representation for a device node can be used, where applicable.
837 IN OUT POOL_PRINT
*Str
,
839 IN BOOLEAN DisplayOnly
,
840 IN BOOLEAN AllowShortcuts
843 USB_DEVICE_PATH
*Usb
;
846 UefiDevicePathLibCatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
850 Converts a USB WWID device path structure to its string representative.
852 @param Str The string representative of input device.
853 @param DevPath The input device path structure.
854 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
855 of the display node is used, where applicable. If DisplayOnly
856 is FALSE, then the longer text representation of the display node
858 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
859 representation for a device node can be used, where applicable.
863 DevPathToTextUsbWWID (
864 IN OUT POOL_PRINT
*Str
,
866 IN BOOLEAN DisplayOnly
,
867 IN BOOLEAN AllowShortcuts
870 USB_WWID_DEVICE_PATH
*UsbWWId
;
871 CHAR16
*SerialNumberStr
;
877 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
878 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
879 if (SerialNumberStr
[Length
- 1] != 0) {
881 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
883 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
884 ASSERT (NewStr
!= NULL
);
886 SerialNumberStr
= NewStr
;
889 UefiDevicePathLibCatPrint (
891 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
894 UsbWWId
->InterfaceNumber
,
900 Converts a Logic Unit device path structure to its string representative.
902 @param Str The string representative of input device.
903 @param DevPath The input device path structure.
904 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
905 of the display node is used, where applicable. If DisplayOnly
906 is FALSE, then the longer text representation of the display node
908 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
909 representation for a device node can be used, where applicable.
913 DevPathToTextLogicalUnit (
914 IN OUT POOL_PRINT
*Str
,
916 IN BOOLEAN DisplayOnly
,
917 IN BOOLEAN AllowShortcuts
920 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
922 LogicalUnit
= DevPath
;
923 UefiDevicePathLibCatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
927 Converts a USB class device path structure to its string representative.
929 @param Str The string representative of input device.
930 @param DevPath The input device path structure.
931 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
932 of the display node is used, where applicable. If DisplayOnly
933 is FALSE, then the longer text representation of the display node
935 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
936 representation for a device node can be used, where applicable.
940 DevPathToTextUsbClass (
941 IN OUT POOL_PRINT
*Str
,
943 IN BOOLEAN DisplayOnly
,
944 IN BOOLEAN AllowShortcuts
947 USB_CLASS_DEVICE_PATH
*UsbClass
;
948 BOOLEAN IsKnownSubClass
;
953 IsKnownSubClass
= TRUE
;
954 switch (UsbClass
->DeviceClass
) {
955 case USB_CLASS_AUDIO
:
956 UefiDevicePathLibCatPrint (Str
, L
"UsbAudio");
959 case USB_CLASS_CDCCONTROL
:
960 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCControl");
964 UefiDevicePathLibCatPrint (Str
, L
"UsbHID");
967 case USB_CLASS_IMAGE
:
968 UefiDevicePathLibCatPrint (Str
, L
"UsbImage");
971 case USB_CLASS_PRINTER
:
972 UefiDevicePathLibCatPrint (Str
, L
"UsbPrinter");
975 case USB_CLASS_MASS_STORAGE
:
976 UefiDevicePathLibCatPrint (Str
, L
"UsbMassStorage");
980 UefiDevicePathLibCatPrint (Str
, L
"UsbHub");
983 case USB_CLASS_CDCDATA
:
984 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCData");
987 case USB_CLASS_SMART_CARD
:
988 UefiDevicePathLibCatPrint (Str
, L
"UsbSmartCard");
991 case USB_CLASS_VIDEO
:
992 UefiDevicePathLibCatPrint (Str
, L
"UsbVideo");
995 case USB_CLASS_DIAGNOSTIC
:
996 UefiDevicePathLibCatPrint (Str
, L
"UsbDiagnostic");
999 case USB_CLASS_WIRELESS
:
1000 UefiDevicePathLibCatPrint (Str
, L
"UsbWireless");
1004 IsKnownSubClass
= FALSE
;
1008 if (IsKnownSubClass
) {
1009 UefiDevicePathLibCatPrint (
1011 L
"(0x%x,0x%x,0x%x,0x%x)",
1013 UsbClass
->ProductId
,
1014 UsbClass
->DeviceSubClass
,
1015 UsbClass
->DeviceProtocol
1020 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
1021 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
1022 UefiDevicePathLibCatPrint (
1024 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
1026 UsbClass
->ProductId
,
1027 UsbClass
->DeviceProtocol
1030 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
1031 UefiDevicePathLibCatPrint (
1033 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
1035 UsbClass
->ProductId
,
1036 UsbClass
->DeviceProtocol
1039 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
1040 UefiDevicePathLibCatPrint (
1042 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
1044 UsbClass
->ProductId
,
1045 UsbClass
->DeviceProtocol
1051 UefiDevicePathLibCatPrint (
1053 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
1055 UsbClass
->ProductId
,
1056 UsbClass
->DeviceClass
,
1057 UsbClass
->DeviceSubClass
,
1058 UsbClass
->DeviceProtocol
1063 Converts a SATA device path structure to its string representative.
1065 @param Str The string representative of input device.
1066 @param DevPath The input device path structure.
1067 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1068 of the display node is used, where applicable. If DisplayOnly
1069 is FALSE, then the longer text representation of the display node
1071 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1072 representation for a device node can be used, where applicable.
1077 IN OUT POOL_PRINT
*Str
,
1079 IN BOOLEAN DisplayOnly
,
1080 IN BOOLEAN AllowShortcuts
1083 SATA_DEVICE_PATH
*Sata
;
1086 UefiDevicePathLibCatPrint (
1088 L
"Sata(0x%x,0x%x,0x%x)",
1089 Sata
->HBAPortNumber
,
1090 Sata
->PortMultiplierPortNumber
,
1096 Converts a I20 device path structure to its string representative.
1098 @param Str The string representative of input device.
1099 @param DevPath The input device path structure.
1100 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1101 of the display node is used, where applicable. If DisplayOnly
1102 is FALSE, then the longer text representation of the display node
1104 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1105 representation for a device node can be used, where applicable.
1110 IN OUT POOL_PRINT
*Str
,
1112 IN BOOLEAN DisplayOnly
,
1113 IN BOOLEAN AllowShortcuts
1116 I2O_DEVICE_PATH
*I2ODevPath
;
1118 I2ODevPath
= DevPath
;
1119 UefiDevicePathLibCatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1123 Converts a MAC address device path structure to its string representative.
1125 @param Str The string representative of input device.
1126 @param DevPath The input device path structure.
1127 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1128 of the display node is used, where applicable. If DisplayOnly
1129 is FALSE, then the longer text representation of the display node
1131 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1132 representation for a device node can be used, where applicable.
1136 DevPathToTextMacAddr (
1137 IN OUT POOL_PRINT
*Str
,
1139 IN BOOLEAN DisplayOnly
,
1140 IN BOOLEAN AllowShortcuts
1143 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1144 UINTN HwAddressSize
;
1147 MacDevPath
= DevPath
;
1149 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1150 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1154 UefiDevicePathLibCatPrint (Str
, L
"MAC(");
1156 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1157 UefiDevicePathLibCatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1160 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1164 Converts network protocol string to its text representation.
1166 @param Str The string representative of input device.
1167 @param Protocol The network protocol ID.
1171 CatNetworkProtocol (
1172 IN OUT POOL_PRINT
*Str
,
1176 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1177 UefiDevicePathLibCatPrint (Str
, L
"TCP");
1178 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1179 UefiDevicePathLibCatPrint (Str
, L
"UDP");
1181 UefiDevicePathLibCatPrint (Str
, L
"0x%x", Protocol
);
1186 Converts IP v4 address to its text representation.
1188 @param Str The string representative of input device.
1189 @param Address The IP v4 address.
1193 IN OUT POOL_PRINT
*Str
,
1194 IN EFI_IPv4_ADDRESS
*Address
1197 UefiDevicePathLibCatPrint (Str
, L
"%d.%d.%d.%d", Address
->Addr
[0], Address
->Addr
[1], Address
->Addr
[2], Address
->Addr
[3]);
1201 Converts IP v6 address to its text representation.
1203 @param Str The string representative of input device.
1204 @param Address The IP v6 address.
1208 IN OUT POOL_PRINT
*Str
,
1209 IN EFI_IPv6_ADDRESS
*Address
1212 UefiDevicePathLibCatPrint (
1213 Str
, L
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1214 Address
->Addr
[0], Address
->Addr
[1],
1215 Address
->Addr
[2], Address
->Addr
[3],
1216 Address
->Addr
[4], Address
->Addr
[5],
1217 Address
->Addr
[6], Address
->Addr
[7],
1218 Address
->Addr
[8], Address
->Addr
[9],
1219 Address
->Addr
[10], Address
->Addr
[11],
1220 Address
->Addr
[12], Address
->Addr
[13],
1221 Address
->Addr
[14], Address
->Addr
[15]
1226 Converts a IPv4 device path structure to its string representative.
1228 @param Str The string representative of input device.
1229 @param DevPath The input device path structure.
1230 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1231 of the display node is used, where applicable. If DisplayOnly
1232 is FALSE, then the longer text representation of the display node
1234 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1235 representation for a device node can be used, where applicable.
1240 IN OUT POOL_PRINT
*Str
,
1242 IN BOOLEAN DisplayOnly
,
1243 IN BOOLEAN AllowShortcuts
1246 IPv4_DEVICE_PATH
*IPDevPath
;
1248 IPDevPath
= DevPath
;
1249 UefiDevicePathLibCatPrint (Str
, L
"IPv4(");
1250 CatIPv4Address (Str
, &IPDevPath
->RemoteIpAddress
);
1253 UefiDevicePathLibCatPrint (Str
, L
")");
1257 UefiDevicePathLibCatPrint (Str
, L
",");
1258 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1260 UefiDevicePathLibCatPrint (Str
, L
",%s,", IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP");
1261 CatIPv4Address (Str
, &IPDevPath
->LocalIpAddress
);
1262 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1263 UefiDevicePathLibCatPrint (Str
, L
",");
1264 CatIPv4Address (Str
, &IPDevPath
->GatewayIpAddress
);
1265 UefiDevicePathLibCatPrint (Str
, L
",");
1266 CatIPv4Address (Str
, &IPDevPath
->SubnetMask
);
1268 UefiDevicePathLibCatPrint (Str
, L
")");
1272 Converts a IPv6 device path structure to its string representative.
1274 @param Str The string representative of input device.
1275 @param DevPath The input device path structure.
1276 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1277 of the display node is used, where applicable. If DisplayOnly
1278 is FALSE, then the longer text representation of the display node
1280 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1281 representation for a device node can be used, where applicable.
1286 IN OUT POOL_PRINT
*Str
,
1288 IN BOOLEAN DisplayOnly
,
1289 IN BOOLEAN AllowShortcuts
1292 IPv6_DEVICE_PATH
*IPDevPath
;
1294 IPDevPath
= DevPath
;
1295 UefiDevicePathLibCatPrint (Str
, L
"IPv6(");
1296 CatIPv6Address (Str
, &IPDevPath
->RemoteIpAddress
);
1298 UefiDevicePathLibCatPrint (Str
, L
")");
1302 UefiDevicePathLibCatPrint (Str
, L
",");
1303 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1305 switch (IPDevPath
->IpAddressOrigin
) {
1307 UefiDevicePathLibCatPrint (Str
, L
",Static,");
1310 UefiDevicePathLibCatPrint (Str
, L
",StatelessAutoConfigure,");
1313 UefiDevicePathLibCatPrint (Str
, L
",StatefulAutoConfigure,");
1317 CatIPv6Address (Str
, &IPDevPath
->LocalIpAddress
);
1319 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1320 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", IPDevPath
->PrefixLength
);
1321 CatIPv6Address (Str
, &IPDevPath
->GatewayIpAddress
);
1323 UefiDevicePathLibCatPrint (Str
, L
")");
1327 Converts an Infini Band device path structure to its string representative.
1329 @param Str The string representative of input device.
1330 @param DevPath The input device path structure.
1331 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1332 of the display node is used, where applicable. If DisplayOnly
1333 is FALSE, then the longer text representation of the display node
1335 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1336 representation for a device node can be used, where applicable.
1340 DevPathToTextInfiniBand (
1341 IN OUT POOL_PRINT
*Str
,
1343 IN BOOLEAN DisplayOnly
,
1344 IN BOOLEAN AllowShortcuts
1347 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1349 InfiniBand
= DevPath
;
1350 UefiDevicePathLibCatPrint (
1352 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1353 InfiniBand
->ResourceFlags
,
1354 InfiniBand
->PortGid
,
1355 InfiniBand
->ServiceId
,
1356 InfiniBand
->TargetPortId
,
1357 InfiniBand
->DeviceId
1362 Converts a UART 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 UART_DEVICE_PATH
*Uart
;
1386 switch (Uart
->Parity
) {
1416 if (Uart
->BaudRate
== 0) {
1417 UefiDevicePathLibCatPrint (Str
, L
"Uart(DEFAULT,");
1419 UefiDevicePathLibCatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1422 if (Uart
->DataBits
== 0) {
1423 UefiDevicePathLibCatPrint (Str
, L
"DEFAULT,");
1425 UefiDevicePathLibCatPrint (Str
, L
"%d,", Uart
->DataBits
);
1428 UefiDevicePathLibCatPrint (Str
, L
"%c,", Parity
);
1430 switch (Uart
->StopBits
) {
1432 UefiDevicePathLibCatPrint (Str
, L
"D)");
1436 UefiDevicePathLibCatPrint (Str
, L
"1)");
1440 UefiDevicePathLibCatPrint (Str
, L
"1.5)");
1444 UefiDevicePathLibCatPrint (Str
, L
"2)");
1448 UefiDevicePathLibCatPrint (Str
, L
"x)");
1454 Converts an iSCSI device path structure to its string representative.
1456 @param Str The string representative of input device.
1457 @param DevPath The input device path structure.
1458 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1459 of the display node is used, where applicable. If DisplayOnly
1460 is FALSE, then the longer text representation of the display node
1462 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1463 representation for a device node can be used, where applicable.
1467 DevPathToTextiSCSI (
1468 IN OUT POOL_PRINT
*Str
,
1470 IN BOOLEAN DisplayOnly
,
1471 IN BOOLEAN AllowShortcuts
1474 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1477 ISCSIDevPath
= DevPath
;
1478 UefiDevicePathLibCatPrint (
1480 L
"iSCSI(%a,0x%x,0x%lx,",
1481 ISCSIDevPath
->TargetName
,
1482 ISCSIDevPath
->TargetPortalGroupTag
,
1486 Options
= ISCSIDevPath
->LoginOption
;
1487 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1488 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1489 if (((Options
>> 11) & 0x0001) != 0) {
1490 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"None");
1491 } else if (((Options
>> 12) & 0x0001) != 0) {
1492 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1494 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_BI");
1498 UefiDevicePathLibCatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1502 Converts a VLAN device path structure to its string representative.
1504 @param Str The string representative of input device.
1505 @param DevPath The input device path structure.
1506 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1507 of the display node is used, where applicable. If DisplayOnly
1508 is FALSE, then the longer text representation of the display node
1510 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1511 representation for a device node can be used, where applicable.
1516 IN OUT POOL_PRINT
*Str
,
1518 IN BOOLEAN DisplayOnly
,
1519 IN BOOLEAN AllowShortcuts
1522 VLAN_DEVICE_PATH
*Vlan
;
1525 UefiDevicePathLibCatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1529 Converts a Bluetooth device path structure to its string representative.
1531 @param Str The string representative of input device.
1532 @param DevPath The input device path structure.
1533 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1534 of the display node is used, where applicable. If DisplayOnly
1535 is FALSE, then the longer text representation of the display node
1537 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1538 representation for a device node can be used, where applicable.
1542 DevPathToTextBluetooth (
1543 IN OUT POOL_PRINT
*Str
,
1545 IN BOOLEAN DisplayOnly
,
1546 IN BOOLEAN AllowShortcuts
1549 BLUETOOTH_DEVICE_PATH
*Bluetooth
;
1551 Bluetooth
= DevPath
;
1552 UefiDevicePathLibCatPrint (
1554 L
"Bluetooth(%02x:%02x:%02x:%02x:%02x:%02x)",
1555 Bluetooth
->BD_ADDR
.Address
[5],
1556 Bluetooth
->BD_ADDR
.Address
[4],
1557 Bluetooth
->BD_ADDR
.Address
[3],
1558 Bluetooth
->BD_ADDR
.Address
[2],
1559 Bluetooth
->BD_ADDR
.Address
[1],
1560 Bluetooth
->BD_ADDR
.Address
[0]
1565 Converts a URI device path structure to its string representative.
1567 @param Str The string representative of input device.
1568 @param DevPath The input device path structure.
1569 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1570 of the display node is used, where applicable. If DisplayOnly
1571 is FALSE, then the longer text representation of the display node
1573 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1574 representation for a device node can be used, where applicable.
1579 IN OUT POOL_PRINT
*Str
,
1581 IN BOOLEAN DisplayOnly
,
1582 IN BOOLEAN AllowShortcuts
1585 URI_DEVICE_PATH
*Uri
;
1590 // Uri in the device path may not be null terminated.
1593 UriLength
= DevicePathNodeLength (Uri
) - sizeof (URI_DEVICE_PATH
);
1594 UriStr
= AllocatePool (UriLength
+ 1);
1595 ASSERT (UriStr
!= NULL
);
1597 CopyMem (UriStr
, Uri
->Uri
, UriLength
);
1598 UriStr
[UriLength
] = '\0';
1599 UefiDevicePathLibCatPrint (Str
, L
"Uri(%a)", UriStr
);
1604 Converts a Hard drive device path structure to its string representative.
1606 @param Str The string representative of input device.
1607 @param DevPath The input device path structure.
1608 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1609 of the display node is used, where applicable. If DisplayOnly
1610 is FALSE, then the longer text representation of the display node
1612 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1613 representation for a device node can be used, where applicable.
1617 DevPathToTextHardDrive (
1618 IN OUT POOL_PRINT
*Str
,
1620 IN BOOLEAN DisplayOnly
,
1621 IN BOOLEAN AllowShortcuts
1624 HARDDRIVE_DEVICE_PATH
*Hd
;
1627 switch (Hd
->SignatureType
) {
1628 case SIGNATURE_TYPE_MBR
:
1629 UefiDevicePathLibCatPrint (
1631 L
"HD(%d,%s,0x%08x,",
1632 Hd
->PartitionNumber
,
1634 *((UINT32
*) (&(Hd
->Signature
[0])))
1638 case SIGNATURE_TYPE_GUID
:
1639 UefiDevicePathLibCatPrint (
1642 Hd
->PartitionNumber
,
1644 (EFI_GUID
*) &(Hd
->Signature
[0])
1649 UefiDevicePathLibCatPrint (
1652 Hd
->PartitionNumber
,
1658 UefiDevicePathLibCatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1662 Converts a CDROM device path structure to its string representative.
1664 @param Str The string representative of input device.
1665 @param DevPath The input device path structure.
1666 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1667 of the display node is used, where applicable. If DisplayOnly
1668 is FALSE, then the longer text representation of the display node
1670 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1671 representation for a device node can be used, where applicable.
1675 DevPathToTextCDROM (
1676 IN OUT POOL_PRINT
*Str
,
1678 IN BOOLEAN DisplayOnly
,
1679 IN BOOLEAN AllowShortcuts
1682 CDROM_DEVICE_PATH
*Cd
;
1686 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1690 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1694 Converts a File device path structure to its string representative.
1696 @param Str The string representative of input device.
1697 @param DevPath The input device path structure.
1698 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1699 of the display node is used, where applicable. If DisplayOnly
1700 is FALSE, then the longer text representation of the display node
1702 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1703 representation for a device node can be used, where applicable.
1707 DevPathToTextFilePath (
1708 IN OUT POOL_PRINT
*Str
,
1710 IN BOOLEAN DisplayOnly
,
1711 IN BOOLEAN AllowShortcuts
1714 FILEPATH_DEVICE_PATH
*Fp
;
1717 UefiDevicePathLibCatPrint (Str
, L
"%s", Fp
->PathName
);
1721 Converts a Media protocol device path structure to its string representative.
1723 @param Str The string representative of input device.
1724 @param DevPath The input device path structure.
1725 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1726 of the display node is used, where applicable. If DisplayOnly
1727 is FALSE, then the longer text representation of the display node
1729 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1730 representation for a device node can be used, where applicable.
1734 DevPathToTextMediaProtocol (
1735 IN OUT POOL_PRINT
*Str
,
1737 IN BOOLEAN DisplayOnly
,
1738 IN BOOLEAN AllowShortcuts
1741 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1743 MediaProt
= DevPath
;
1744 UefiDevicePathLibCatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1748 Converts a Firmware Volume device path structure to its string representative.
1750 @param Str The string representative of input device.
1751 @param DevPath The input device path structure.
1752 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1753 of the display node is used, where applicable. If DisplayOnly
1754 is FALSE, then the longer text representation of the display node
1756 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1757 representation for a device node can be used, where applicable.
1762 IN OUT POOL_PRINT
*Str
,
1764 IN BOOLEAN DisplayOnly
,
1765 IN BOOLEAN AllowShortcuts
1768 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1771 UefiDevicePathLibCatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1775 Converts a Firmware Volume File device path structure to its string representative.
1777 @param Str The string representative of input device.
1778 @param DevPath The input device path structure.
1779 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1780 of the display node is used, where applicable. If DisplayOnly
1781 is FALSE, then the longer text representation of the display node
1783 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1784 representation for a device node can be used, where applicable.
1788 DevPathToTextFvFile (
1789 IN OUT POOL_PRINT
*Str
,
1791 IN BOOLEAN DisplayOnly
,
1792 IN BOOLEAN AllowShortcuts
1795 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1798 UefiDevicePathLibCatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1802 Converts a Relative Offset device path structure to its string representative.
1804 @param Str The string representative of input device.
1805 @param DevPath The input device path structure.
1806 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1807 of the display node is used, where applicable. If DisplayOnly
1808 is FALSE, then the longer text representation of the display node
1810 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1811 representation for a device node can be used, where applicable.
1815 DevPathRelativeOffsetRange (
1816 IN OUT POOL_PRINT
*Str
,
1818 IN BOOLEAN DisplayOnly
,
1819 IN BOOLEAN AllowShortcuts
1822 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1825 UefiDevicePathLibCatPrint (
1827 L
"Offset(0x%lx,0x%lx)",
1828 Offset
->StartingOffset
,
1829 Offset
->EndingOffset
1834 Converts a BIOS Boot Specification device path structure to its string representative.
1836 @param Str The string representative of input device.
1837 @param DevPath The input device path structure.
1838 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1839 of the display node is used, where applicable. If DisplayOnly
1840 is FALSE, then the longer text representation of the display node
1842 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1843 representation for a device node can be used, where applicable.
1848 IN OUT POOL_PRINT
*Str
,
1850 IN BOOLEAN DisplayOnly
,
1851 IN BOOLEAN AllowShortcuts
1854 BBS_BBS_DEVICE_PATH
*Bbs
;
1858 switch (Bbs
->DeviceType
) {
1859 case BBS_TYPE_FLOPPY
:
1863 case BBS_TYPE_HARDDRIVE
:
1867 case BBS_TYPE_CDROM
:
1871 case BBS_TYPE_PCMCIA
:
1879 case BBS_TYPE_EMBEDDED_NETWORK
:
1889 UefiDevicePathLibCatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1891 UefiDevicePathLibCatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
1895 UefiDevicePathLibCatPrint (Str
, L
")");
1899 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
1903 Converts an End-of-Device-Path structure to its string representative.
1905 @param Str The string representative of input device.
1906 @param DevPath The input device path structure.
1907 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1908 of the display node is used, where applicable. If DisplayOnly
1909 is FALSE, then the longer text representation of the display node
1911 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1912 representation for a device node can be used, where applicable.
1916 DevPathToTextEndInstance (
1917 IN OUT POOL_PRINT
*Str
,
1919 IN BOOLEAN DisplayOnly
,
1920 IN BOOLEAN AllowShortcuts
1923 UefiDevicePathLibCatPrint (Str
, L
",");
1926 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric
[] = {
1927 {HARDWARE_DEVICE_PATH
, L
"HardwarePath" },
1928 {ACPI_DEVICE_PATH
, L
"AcpiPath" },
1929 {MESSAGING_DEVICE_PATH
, L
"Msg" },
1930 {MEDIA_DEVICE_PATH
, L
"MediaPath" },
1931 {BBS_DEVICE_PATH
, L
"BbsPath" },
1936 Converts an unknown device path structure to its string representative.
1938 @param Str The string representative of input device.
1939 @param DevPath The input device path structure.
1940 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1941 of the display node is used, where applicable. If DisplayOnly
1942 is FALSE, then the longer text representation of the display node
1944 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1945 representation for a device node can be used, where applicable.
1949 DevPathToTextNodeGeneric (
1950 IN OUT POOL_PRINT
*Str
,
1952 IN BOOLEAN DisplayOnly
,
1953 IN BOOLEAN AllowShortcuts
1956 EFI_DEVICE_PATH_PROTOCOL
*Node
;
1961 for (Index
= 0; mUefiDevicePathLibToTextTableGeneric
[Index
].Text
!= NULL
; Index
++) {
1962 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTableGeneric
[Index
].Type
) {
1967 if (mUefiDevicePathLibToTextTableGeneric
[Index
].Text
== NULL
) {
1969 // It's a node whose type cannot be recognized
1971 UefiDevicePathLibCatPrint (Str
, L
"Path(%d,%d", DevicePathType (Node
), DevicePathSubType (Node
));
1974 // It's a node whose type can be recognized
1976 UefiDevicePathLibCatPrint (Str
, L
"%s(%d", mUefiDevicePathLibToTextTableGeneric
[Index
].Text
, DevicePathSubType (Node
));
1979 Index
= sizeof (EFI_DEVICE_PATH_PROTOCOL
);
1980 if (Index
< DevicePathNodeLength (Node
)) {
1981 UefiDevicePathLibCatPrint (Str
, L
",");
1982 for (; Index
< DevicePathNodeLength (Node
); Index
++) {
1983 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((UINT8
*) Node
)[Index
]);
1987 UefiDevicePathLibCatPrint (Str
, L
")");
1990 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable
[] = {
1991 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
1992 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
1993 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
1994 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
1995 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
1996 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
1997 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
1998 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
1999 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
2000 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
2001 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
2002 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
2003 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
2004 {MESSAGING_DEVICE_PATH
, MSG_NVME_NAMESPACE_DP
, DevPathToTextNVMe
},
2005 {MESSAGING_DEVICE_PATH
, MSG_UFS_DP
, DevPathToTextUfs
},
2006 {MESSAGING_DEVICE_PATH
, MSG_SD_DP
, DevPathToTextSd
},
2007 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
2008 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
2009 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
2010 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
2011 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
2012 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
2013 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
2014 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
2015 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
2016 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
2017 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
2018 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
2019 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
2020 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
2021 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
2022 {MESSAGING_DEVICE_PATH
, MSG_URI_DP
, DevPathToTextUri
},
2023 {MESSAGING_DEVICE_PATH
, MSG_BLUETOOTH_DP
, DevPathToTextBluetooth
},
2024 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
2025 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
2026 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
2027 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
2028 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
2029 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
2030 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
2031 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
2032 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
2033 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
2038 Converts a device node to its string representation.
2040 @param DeviceNode A Pointer to the device node to be converted.
2041 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2042 of the display node is used, where applicable. If DisplayOnly
2043 is FALSE, then the longer text representation of the display node
2045 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2046 representation for a device node can be used, where applicable.
2048 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
2049 is NULL or there was insufficient memory.
2054 UefiDevicePathLibConvertDeviceNodeToText (
2055 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
2056 IN BOOLEAN DisplayOnly
,
2057 IN BOOLEAN AllowShortcuts
2062 DEVICE_PATH_TO_TEXT ToText
;
2064 if (DeviceNode
== NULL
) {
2068 ZeroMem (&Str
, sizeof (Str
));
2071 // Process the device path node
2072 // If not found, use a generic function
2074 ToText
= DevPathToTextNodeGeneric
;
2075 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
++) {
2076 if (DevicePathType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2077 DevicePathSubType (DeviceNode
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2079 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2087 ToText (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
2089 ASSERT (Str
.Str
!= NULL
);
2094 Converts a device path to its text representation.
2096 @param DevicePath A Pointer to the device to be converted.
2097 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
2098 of the display node is used, where applicable. If DisplayOnly
2099 is FALSE, then the longer text representation of the display node
2101 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
2102 representation for a device node can be used, where applicable.
2104 @return A pointer to the allocated text representation of the device path or
2105 NULL if DeviceNode is NULL or there was insufficient memory.
2110 UefiDevicePathLibConvertDevicePathToText (
2111 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
2112 IN BOOLEAN DisplayOnly
,
2113 IN BOOLEAN AllowShortcuts
2117 EFI_DEVICE_PATH_PROTOCOL
*Node
;
2118 EFI_DEVICE_PATH_PROTOCOL
*AlignedNode
;
2120 DEVICE_PATH_TO_TEXT ToText
;
2122 if (DevicePath
== NULL
) {
2126 ZeroMem (&Str
, sizeof (Str
));
2129 // Process each device path node
2131 Node
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
2132 while (!IsDevicePathEnd (Node
)) {
2134 // Find the handler to dump this device path node
2135 // If not found, use a generic function
2137 ToText
= DevPathToTextNodeGeneric
;
2138 for (Index
= 0; mUefiDevicePathLibToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
2140 if (DevicePathType (Node
) == mUefiDevicePathLibToTextTable
[Index
].Type
&&
2141 DevicePathSubType (Node
) == mUefiDevicePathLibToTextTable
[Index
].SubType
2143 ToText
= mUefiDevicePathLibToTextTable
[Index
].Function
;
2148 // Put a path separator in if needed
2150 if ((Str
.Count
!= 0) && (ToText
!= DevPathToTextEndInstance
)) {
2151 if (Str
.Str
[Str
.Count
] != L
',') {
2152 UefiDevicePathLibCatPrint (&Str
, L
"/");
2156 AlignedNode
= AllocateCopyPool (DevicePathNodeLength (Node
), Node
);
2158 // Print this node of the device path
2160 ToText (&Str
, AlignedNode
, DisplayOnly
, AllowShortcuts
);
2161 FreePool (AlignedNode
);
2164 // Next device path node
2166 Node
= NextDevicePathNode (Node
);
2169 if (Str
.Str
== NULL
) {
2170 return AllocateZeroPool (sizeof (CHAR16
));