2 DevicePathToText protocol as defined in the UEFI 2.0 specification.
4 Copyright (c) 2013, 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.
32 UefiDevicePathLibCatPrint (
33 IN OUT POOL_PRINT
*Str
,
42 Count
= SPrintLength (Fmt
, Args
);
44 if ((Str
->Count
+ (Count
+ 1)) * sizeof (CHAR16
) > Str
->Capacity
) {
45 Str
->Capacity
= (Str
->Count
+ (Count
+ 1) * 2) * sizeof (CHAR16
);
46 Str
->Str
= ReallocatePool (
47 Str
->Count
* sizeof (CHAR16
),
51 ASSERT (Str
->Str
!= NULL
);
53 UnicodeVSPrint (&Str
->Str
[Str
->Count
], Str
->Capacity
- Str
->Count
* sizeof (CHAR16
), Fmt
, Args
);
61 Converts a PCI device path structure to its string representative.
63 @param Str The string representative of input device.
64 @param DevPath The input device path structure.
65 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
66 of the display node is used, where applicable. If DisplayOnly
67 is FALSE, then the longer text representation of the display node
69 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
70 representation for a device node can be used, where applicable.
75 IN OUT POOL_PRINT
*Str
,
77 IN BOOLEAN DisplayOnly
,
78 IN BOOLEAN AllowShortcuts
84 UefiDevicePathLibCatPrint (Str
, L
"Pci(0x%x,0x%x)", Pci
->Device
, Pci
->Function
);
88 Converts a PC Card device path structure to its string representative.
90 @param Str The string representative of input device.
91 @param DevPath The input device path structure.
92 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
93 of the display node is used, where applicable. If DisplayOnly
94 is FALSE, then the longer text representation of the display node
96 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
97 representation for a device node can be used, where applicable.
101 DevPathToTextPccard (
102 IN OUT POOL_PRINT
*Str
,
104 IN BOOLEAN DisplayOnly
,
105 IN BOOLEAN AllowShortcuts
108 PCCARD_DEVICE_PATH
*Pccard
;
111 UefiDevicePathLibCatPrint (Str
, L
"PcCard(0x%x)", Pccard
->FunctionNumber
);
115 Converts a Memory Map device path structure to its string representative.
117 @param Str The string representative of input device.
118 @param DevPath The input device path structure.
119 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
120 of the display node is used, where applicable. If DisplayOnly
121 is FALSE, then the longer text representation of the display node
123 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
124 representation for a device node can be used, where applicable.
128 DevPathToTextMemMap (
129 IN OUT POOL_PRINT
*Str
,
131 IN BOOLEAN DisplayOnly
,
132 IN BOOLEAN AllowShortcuts
135 MEMMAP_DEVICE_PATH
*MemMap
;
138 UefiDevicePathLibCatPrint (
140 L
"MemoryMapped(0x%x,0x%lx,0x%lx)",
142 MemMap
->StartingAddress
,
143 MemMap
->EndingAddress
148 Converts a Vendor device path structure to its string representative.
150 @param Str The string representative of input device.
151 @param DevPath The input device path structure.
152 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
153 of the display node is used, where applicable. If DisplayOnly
154 is FALSE, then the longer text representation of the display node
156 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
157 representation for a device node can be used, where applicable.
161 DevPathToTextVendor (
162 IN OUT POOL_PRINT
*Str
,
164 IN BOOLEAN DisplayOnly
,
165 IN BOOLEAN AllowShortcuts
168 VENDOR_DEVICE_PATH
*Vendor
;
172 UINT32 FlowControlMap
;
175 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
176 switch (DevicePathType (&Vendor
->Header
)) {
177 case HARDWARE_DEVICE_PATH
:
181 case MESSAGING_DEVICE_PATH
:
183 if (AllowShortcuts
) {
184 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
185 UefiDevicePathLibCatPrint (Str
, L
"VenPcAnsi()");
187 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
188 UefiDevicePathLibCatPrint (Str
, L
"VenVt100()");
190 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
191 UefiDevicePathLibCatPrint (Str
, L
"VenVt100Plus()");
193 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
194 UefiDevicePathLibCatPrint (Str
, L
"VenUft8()");
196 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
197 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
198 switch (FlowControlMap
& 0x00000003) {
200 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
204 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
208 UefiDevicePathLibCatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
216 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
217 UefiDevicePathLibCatPrint (
219 L
"SAS(0x%lx,0x%lx,0x%x,",
220 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
221 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
222 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
224 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
225 if (((Info
& 0x0f) == 0) && ((Info
& BIT7
) == 0)) {
226 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0,");
227 } else if (((Info
& 0x0f) <= 2) && ((Info
& BIT7
) == 0)) {
228 UefiDevicePathLibCatPrint (
231 ((Info
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
232 ((Info
& BIT5
) != 0) ? L
"External" : L
"Internal",
233 ((Info
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
235 if ((Info
& 0x0f) == 1) {
236 UefiDevicePathLibCatPrint (Str
, L
"0,");
239 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
241 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", ((Info
>> 8) & 0xff) + 1);
244 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0,", Info
);
247 UefiDevicePathLibCatPrint (Str
, L
"0x%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
249 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
250 UefiDevicePathLibCatPrint (Str
, L
"DebugPort()");
256 case MEDIA_DEVICE_PATH
:
265 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
266 UefiDevicePathLibCatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
267 if (DataLength
!= 0) {
268 UefiDevicePathLibCatPrint (Str
, L
",");
269 for (Index
= 0; Index
< DataLength
; Index
++) {
270 UefiDevicePathLibCatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
274 UefiDevicePathLibCatPrint (Str
, L
")");
278 Converts a Controller device path structure to its string representative.
280 @param Str The string representative of input device.
281 @param DevPath The input device path structure.
282 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
283 of the display node is used, where applicable. If DisplayOnly
284 is FALSE, then the longer text representation of the display node
286 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
287 representation for a device node can be used, where applicable.
291 DevPathToTextController (
292 IN OUT POOL_PRINT
*Str
,
294 IN BOOLEAN DisplayOnly
,
295 IN BOOLEAN AllowShortcuts
298 CONTROLLER_DEVICE_PATH
*Controller
;
300 Controller
= DevPath
;
301 UefiDevicePathLibCatPrint (
304 Controller
->ControllerNumber
309 Converts a ACPI device path structure to its string representative.
311 @param Str The string representative of input device.
312 @param DevPath The input device path structure.
313 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
314 of the display node is used, where applicable. If DisplayOnly
315 is FALSE, then the longer text representation of the display node
317 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
318 representation for a device node can be used, where applicable.
323 IN OUT POOL_PRINT
*Str
,
325 IN BOOLEAN DisplayOnly
,
326 IN BOOLEAN AllowShortcuts
329 ACPI_HID_DEVICE_PATH
*Acpi
;
332 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
333 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
335 UefiDevicePathLibCatPrint (Str
, L
"PciRoot(0x%x)", Acpi
->UID
);
339 UefiDevicePathLibCatPrint (Str
, L
"PcieRoot(0x%x)", Acpi
->UID
);
343 UefiDevicePathLibCatPrint (Str
, L
"Floppy(0x%x)", Acpi
->UID
);
347 UefiDevicePathLibCatPrint (Str
, L
"Keyboard(0x%x)", Acpi
->UID
);
351 UefiDevicePathLibCatPrint (Str
, L
"Serial(0x%x)", Acpi
->UID
);
355 UefiDevicePathLibCatPrint (Str
, L
"ParallelPort(0x%x)", Acpi
->UID
);
359 UefiDevicePathLibCatPrint (Str
, L
"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
363 UefiDevicePathLibCatPrint (Str
, L
"Acpi(0x%08x,0x%x)", Acpi
->HID
, Acpi
->UID
);
368 Converts a ACPI extended HID device path structure to its string representative.
370 @param Str The string representative of input device.
371 @param DevPath The input device path structure.
372 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
373 of the display node is used, where applicable. If DisplayOnly
374 is FALSE, then the longer text representation of the display node
376 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
377 representation for a device node can be used, where applicable.
381 DevPathToTextAcpiEx (
382 IN OUT POOL_PRINT
*Str
,
384 IN BOOLEAN DisplayOnly
,
385 IN BOOLEAN AllowShortcuts
388 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
396 HIDStr
= (CHAR8
*) (((UINT8
*) AcpiEx
) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
397 UIDStr
= HIDStr
+ AsciiStrLen (HIDStr
) + 1;
398 CIDStr
= UIDStr
+ AsciiStrLen (UIDStr
) + 1;
401 // Converts EISA identification to string.
407 ((AcpiEx
->HID
>> 10) & 0x1f) + 'A' - 1,
408 ((AcpiEx
->HID
>> 5) & 0x1f) + 'A' - 1,
409 ((AcpiEx
->HID
>> 0) & 0x1f) + 'A' - 1,
410 (AcpiEx
->HID
>> 16) & 0xFFFF
416 ((AcpiEx
->CID
>> 10) & 0x1f) + 'A' - 1,
417 ((AcpiEx
->CID
>> 5) & 0x1f) + 'A' - 1,
418 ((AcpiEx
->CID
>> 0) & 0x1f) + 'A' - 1,
419 (AcpiEx
->CID
>> 16) & 0xFFFF
422 if ((*HIDStr
== '\0') && (*CIDStr
== '\0') && (AcpiEx
->UID
== 0)) {
426 UefiDevicePathLibCatPrint (
428 L
"AcpiExp(%s,%s,%a)",
434 if (AllowShortcuts
) {
438 if (AcpiEx
->HID
== 0) {
439 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%a,", HIDStr
);
441 UefiDevicePathLibCatPrint (Str
, L
"AcpiEx(%s,", HIDText
);
444 if (AcpiEx
->UID
== 0) {
445 UefiDevicePathLibCatPrint (Str
, L
"%a,", UIDStr
);
447 UefiDevicePathLibCatPrint (Str
, L
"0x%x,", AcpiEx
->UID
);
450 if (AcpiEx
->CID
== 0) {
451 UefiDevicePathLibCatPrint (Str
, L
"%a)", CIDStr
);
453 UefiDevicePathLibCatPrint (Str
, L
"%s)", CIDText
);
456 UefiDevicePathLibCatPrint (
458 L
"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
471 Converts a ACPI address device path structure to its string representative.
473 @param Str The string representative of input device.
474 @param DevPath The input device path structure.
475 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
476 of the display node is used, where applicable. If DisplayOnly
477 is FALSE, then the longer text representation of the display node
479 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
480 representation for a device node can be used, where applicable.
484 DevPathToTextAcpiAdr (
485 IN OUT POOL_PRINT
*Str
,
487 IN BOOLEAN DisplayOnly
,
488 IN BOOLEAN AllowShortcuts
491 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
494 UINT16 AdditionalAdrCount
;
497 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
498 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
500 UefiDevicePathLibCatPrint (Str
, L
"AcpiAdr(0x%x", AcpiAdr
->ADR
);
501 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
502 UefiDevicePathLibCatPrint (Str
, L
",0x%x", *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
504 UefiDevicePathLibCatPrint (Str
, L
")");
508 Converts a ATAPI device path structure to its string representative.
510 @param Str The string representative of input device.
511 @param DevPath The input device path structure.
512 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
513 of the display node is used, where applicable. If DisplayOnly
514 is FALSE, then the longer text representation of the display node
516 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
517 representation for a device node can be used, where applicable.
522 IN OUT POOL_PRINT
*Str
,
524 IN BOOLEAN DisplayOnly
,
525 IN BOOLEAN AllowShortcuts
528 ATAPI_DEVICE_PATH
*Atapi
;
533 UefiDevicePathLibCatPrint (Str
, L
"Ata(0x%x)", Atapi
->Lun
);
535 UefiDevicePathLibCatPrint (
538 (Atapi
->PrimarySecondary
== 1) ? L
"Secondary" : L
"Primary",
539 (Atapi
->SlaveMaster
== 1) ? L
"Slave" : L
"Master",
546 Converts a SCSI device path structure to its string representative.
548 @param Str The string representative of input device.
549 @param DevPath The input device path structure.
550 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
551 of the display node is used, where applicable. If DisplayOnly
552 is FALSE, then the longer text representation of the display node
554 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
555 representation for a device node can be used, where applicable.
560 IN OUT POOL_PRINT
*Str
,
562 IN BOOLEAN DisplayOnly
,
563 IN BOOLEAN AllowShortcuts
566 SCSI_DEVICE_PATH
*Scsi
;
569 UefiDevicePathLibCatPrint (Str
, L
"Scsi(0x%x,0x%x)", Scsi
->Pun
, Scsi
->Lun
);
573 Converts a Fibre device path structure to its string representative.
575 @param Str The string representative of input device.
576 @param DevPath The input device path structure.
577 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
578 of the display node is used, where applicable. If DisplayOnly
579 is FALSE, then the longer text representation of the display node
581 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
582 representation for a device node can be used, where applicable.
587 IN OUT POOL_PRINT
*Str
,
589 IN BOOLEAN DisplayOnly
,
590 IN BOOLEAN AllowShortcuts
593 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
596 UefiDevicePathLibCatPrint (Str
, L
"Fibre(0x%lx,0x%lx)", Fibre
->WWN
, Fibre
->Lun
);
600 Converts a FibreEx device path structure to its string representative.
602 @param Str The string representative of input device.
603 @param DevPath The input device path structure.
604 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
605 of the display node is used, where applicable. If DisplayOnly
606 is FALSE, then the longer text representation of the display node
608 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
609 representation for a device node can be used, where applicable.
613 DevPathToTextFibreEx (
614 IN OUT POOL_PRINT
*Str
,
616 IN BOOLEAN DisplayOnly
,
617 IN BOOLEAN AllowShortcuts
620 FIBRECHANNELEX_DEVICE_PATH
*FibreEx
;
624 UefiDevicePathLibCatPrint (Str
, L
"FibreEx(0x");
625 for (Index
= 0; Index
< sizeof (FibreEx
->WWN
) / sizeof (FibreEx
->WWN
[0]); Index
++) {
626 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->WWN
[Index
]);
628 UefiDevicePathLibCatPrint (Str
, L
",0x");
629 for (Index
= 0; Index
< sizeof (FibreEx
->Lun
) / sizeof (FibreEx
->Lun
[0]); Index
++) {
630 UefiDevicePathLibCatPrint (Str
, L
"%02x", FibreEx
->Lun
[Index
]);
632 UefiDevicePathLibCatPrint (Str
, L
")");
636 Converts a Sas Ex device path structure to its string representative.
638 @param Str The string representative of input device.
639 @param DevPath The input device path structure.
640 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
641 of the display node is used, where applicable. If DisplayOnly
642 is FALSE, then the longer text representation of the display node
644 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
645 representation for a device node can be used, where applicable.
650 IN OUT POOL_PRINT
*Str
,
652 IN BOOLEAN DisplayOnly
,
653 IN BOOLEAN AllowShortcuts
656 SASEX_DEVICE_PATH
*SasEx
;
660 UefiDevicePathLibCatPrint (Str
, L
"SasEx(0x");
662 for (Index
= 0; Index
< sizeof (SasEx
->SasAddress
) / sizeof (SasEx
->SasAddress
[0]); Index
++) {
663 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->SasAddress
[Index
]);
665 UefiDevicePathLibCatPrint (Str
, L
",0x");
666 for (Index
= 0; Index
< sizeof (SasEx
->Lun
) / sizeof (SasEx
->Lun
[0]); Index
++) {
667 UefiDevicePathLibCatPrint (Str
, L
"%02x", SasEx
->Lun
[Index
]);
669 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", SasEx
->RelativeTargetPort
);
671 if (((SasEx
->DeviceTopology
& 0x0f) == 0) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
672 UefiDevicePathLibCatPrint (Str
, L
"NoTopology,0,0,0");
673 } else if (((SasEx
->DeviceTopology
& 0x0f) <= 2) && ((SasEx
->DeviceTopology
& BIT7
) == 0)) {
674 UefiDevicePathLibCatPrint (
677 ((SasEx
->DeviceTopology
& BIT4
) != 0) ? L
"SATA" : L
"SAS",
678 ((SasEx
->DeviceTopology
& BIT5
) != 0) ? L
"External" : L
"Internal",
679 ((SasEx
->DeviceTopology
& BIT6
) != 0) ? L
"Expanded" : L
"Direct"
681 if ((SasEx
->DeviceTopology
& 0x0f) == 1) {
682 UefiDevicePathLibCatPrint (Str
, L
"0");
685 // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
687 UefiDevicePathLibCatPrint (Str
, L
"0x%x", ((SasEx
->DeviceTopology
>> 8) & 0xff) + 1);
690 UefiDevicePathLibCatPrint (Str
, L
"0x%x,0,0,0", SasEx
->DeviceTopology
);
693 UefiDevicePathLibCatPrint (Str
, L
")");
699 Converts a 1394 device path structure to its string representative.
701 @param Str The string representative of input device.
702 @param DevPath The input device path structure.
703 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
704 of the display node is used, where applicable. If DisplayOnly
705 is FALSE, then the longer text representation of the display node
707 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
708 representation for a device node can be used, where applicable.
713 IN OUT POOL_PRINT
*Str
,
715 IN BOOLEAN DisplayOnly
,
716 IN BOOLEAN AllowShortcuts
719 F1394_DEVICE_PATH
*F1394DevPath
;
721 F1394DevPath
= DevPath
;
723 // Guid has format of IEEE-EUI64
725 UefiDevicePathLibCatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
729 Converts a USB device path structure to its string representative.
731 @param Str The string representative of input device.
732 @param DevPath The input device path structure.
733 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
734 of the display node is used, where applicable. If DisplayOnly
735 is FALSE, then the longer text representation of the display node
737 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
738 representation for a device node can be used, where applicable.
743 IN OUT POOL_PRINT
*Str
,
745 IN BOOLEAN DisplayOnly
,
746 IN BOOLEAN AllowShortcuts
749 USB_DEVICE_PATH
*Usb
;
752 UefiDevicePathLibCatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
756 Converts a USB WWID device path structure to its string representative.
758 @param Str The string representative of input device.
759 @param DevPath The input device path structure.
760 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
761 of the display node is used, where applicable. If DisplayOnly
762 is FALSE, then the longer text representation of the display node
764 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
765 representation for a device node can be used, where applicable.
769 DevPathToTextUsbWWID (
770 IN OUT POOL_PRINT
*Str
,
772 IN BOOLEAN DisplayOnly
,
773 IN BOOLEAN AllowShortcuts
776 USB_WWID_DEVICE_PATH
*UsbWWId
;
777 CHAR16
*SerialNumberStr
;
783 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
784 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
785 if (SerialNumberStr
[Length
- 1] != 0) {
787 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
789 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
790 ASSERT (NewStr
!= NULL
);
792 SerialNumberStr
= NewStr
;
795 UefiDevicePathLibCatPrint (
797 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
800 UsbWWId
->InterfaceNumber
,
806 Converts a Logic Unit device path structure to its string representative.
808 @param Str The string representative of input device.
809 @param DevPath The input device path structure.
810 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
811 of the display node is used, where applicable. If DisplayOnly
812 is FALSE, then the longer text representation of the display node
814 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
815 representation for a device node can be used, where applicable.
819 DevPathToTextLogicalUnit (
820 IN OUT POOL_PRINT
*Str
,
822 IN BOOLEAN DisplayOnly
,
823 IN BOOLEAN AllowShortcuts
826 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
828 LogicalUnit
= DevPath
;
829 UefiDevicePathLibCatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
833 Converts a USB class device path structure to its string representative.
835 @param Str The string representative of input device.
836 @param DevPath The input device path structure.
837 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
838 of the display node is used, where applicable. If DisplayOnly
839 is FALSE, then the longer text representation of the display node
841 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
842 representation for a device node can be used, where applicable.
846 DevPathToTextUsbClass (
847 IN OUT POOL_PRINT
*Str
,
849 IN BOOLEAN DisplayOnly
,
850 IN BOOLEAN AllowShortcuts
853 USB_CLASS_DEVICE_PATH
*UsbClass
;
854 BOOLEAN IsKnownSubClass
;
859 IsKnownSubClass
= TRUE
;
860 switch (UsbClass
->DeviceClass
) {
861 case USB_CLASS_AUDIO
:
862 UefiDevicePathLibCatPrint (Str
, L
"UsbAudio");
865 case USB_CLASS_CDCCONTROL
:
866 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCControl");
870 UefiDevicePathLibCatPrint (Str
, L
"UsbHID");
873 case USB_CLASS_IMAGE
:
874 UefiDevicePathLibCatPrint (Str
, L
"UsbImage");
877 case USB_CLASS_PRINTER
:
878 UefiDevicePathLibCatPrint (Str
, L
"UsbPrinter");
881 case USB_CLASS_MASS_STORAGE
:
882 UefiDevicePathLibCatPrint (Str
, L
"UsbMassStorage");
886 UefiDevicePathLibCatPrint (Str
, L
"UsbHub");
889 case USB_CLASS_CDCDATA
:
890 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCData");
893 case USB_CLASS_SMART_CARD
:
894 UefiDevicePathLibCatPrint (Str
, L
"UsbSmartCard");
897 case USB_CLASS_VIDEO
:
898 UefiDevicePathLibCatPrint (Str
, L
"UsbVideo");
901 case USB_CLASS_DIAGNOSTIC
:
902 UefiDevicePathLibCatPrint (Str
, L
"UsbDiagnostic");
905 case USB_CLASS_WIRELESS
:
906 UefiDevicePathLibCatPrint (Str
, L
"UsbWireless");
910 IsKnownSubClass
= FALSE
;
914 if (IsKnownSubClass
) {
915 UefiDevicePathLibCatPrint (
917 L
"(0x%x,0x%x,0x%x,0x%x)",
920 UsbClass
->DeviceSubClass
,
921 UsbClass
->DeviceProtocol
926 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
927 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
928 UefiDevicePathLibCatPrint (
930 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
933 UsbClass
->DeviceProtocol
936 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
937 UefiDevicePathLibCatPrint (
939 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
942 UsbClass
->DeviceProtocol
945 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
946 UefiDevicePathLibCatPrint (
948 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
951 UsbClass
->DeviceProtocol
957 UefiDevicePathLibCatPrint (
959 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
962 UsbClass
->DeviceClass
,
963 UsbClass
->DeviceSubClass
,
964 UsbClass
->DeviceProtocol
969 Converts a SATA device path structure to its string representative.
971 @param Str The string representative of input device.
972 @param DevPath The input device path structure.
973 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
974 of the display node is used, where applicable. If DisplayOnly
975 is FALSE, then the longer text representation of the display node
977 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
978 representation for a device node can be used, where applicable.
983 IN OUT POOL_PRINT
*Str
,
985 IN BOOLEAN DisplayOnly
,
986 IN BOOLEAN AllowShortcuts
989 SATA_DEVICE_PATH
*Sata
;
992 if ((Sata
->PortMultiplierPortNumber
& SATA_HBA_DIRECT_CONNECT_FLAG
) != 0) {
993 UefiDevicePathLibCatPrint (
1000 UefiDevicePathLibCatPrint (
1002 L
"Sata(0x%x,0x%x,0x%x)",
1003 Sata
->HBAPortNumber
,
1004 Sata
->PortMultiplierPortNumber
,
1011 Converts a I20 device path structure to its string representative.
1013 @param Str The string representative of input device.
1014 @param DevPath The input device path structure.
1015 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1016 of the display node is used, where applicable. If DisplayOnly
1017 is FALSE, then the longer text representation of the display node
1019 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1020 representation for a device node can be used, where applicable.
1025 IN OUT POOL_PRINT
*Str
,
1027 IN BOOLEAN DisplayOnly
,
1028 IN BOOLEAN AllowShortcuts
1031 I2O_DEVICE_PATH
*I2ODevPath
;
1033 I2ODevPath
= DevPath
;
1034 UefiDevicePathLibCatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1038 Converts a MAC address device path structure to its string representative.
1040 @param Str The string representative of input device.
1041 @param DevPath The input device path structure.
1042 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1043 of the display node is used, where applicable. If DisplayOnly
1044 is FALSE, then the longer text representation of the display node
1046 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1047 representation for a device node can be used, where applicable.
1051 DevPathToTextMacAddr (
1052 IN OUT POOL_PRINT
*Str
,
1054 IN BOOLEAN DisplayOnly
,
1055 IN BOOLEAN AllowShortcuts
1058 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1059 UINTN HwAddressSize
;
1062 MacDevPath
= DevPath
;
1064 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1065 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1069 UefiDevicePathLibCatPrint (Str
, L
"MAC(");
1071 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1072 UefiDevicePathLibCatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1075 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1079 Converts network protocol string to its text representation.
1081 @param Str The string representative of input device.
1082 @param Protocol The network protocol ID.
1086 CatNetworkProtocol (
1087 IN OUT POOL_PRINT
*Str
,
1091 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1092 UefiDevicePathLibCatPrint (Str
, L
"TCP");
1093 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1094 UefiDevicePathLibCatPrint (Str
, L
"UDP");
1096 UefiDevicePathLibCatPrint (Str
, L
"0x%x", Protocol
);
1101 Converts IP v4 address to its text representation.
1103 @param Str The string representative of input device.
1104 @param Address The IP v4 address.
1108 IN OUT POOL_PRINT
*Str
,
1109 IN EFI_IPv4_ADDRESS
*Address
1112 UefiDevicePathLibCatPrint (Str
, L
"%d.%d.%d.%d", Address
->Addr
[0], Address
->Addr
[1], Address
->Addr
[2], Address
->Addr
[3]);
1116 Converts IP v6 address to its text representation.
1118 @param Str The string representative of input device.
1119 @param Address The IP v6 address.
1123 IN OUT POOL_PRINT
*Str
,
1124 IN EFI_IPv6_ADDRESS
*Address
1127 UefiDevicePathLibCatPrint (
1128 Str
, L
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1129 Address
->Addr
[0], Address
->Addr
[1],
1130 Address
->Addr
[2], Address
->Addr
[3],
1131 Address
->Addr
[4], Address
->Addr
[5],
1132 Address
->Addr
[6], Address
->Addr
[7],
1133 Address
->Addr
[8], Address
->Addr
[9],
1134 Address
->Addr
[10], Address
->Addr
[11],
1135 Address
->Addr
[12], Address
->Addr
[13],
1136 Address
->Addr
[14], Address
->Addr
[15]
1141 Converts a IPv4 device path structure to its string representative.
1143 @param Str The string representative of input device.
1144 @param DevPath The input device path structure.
1145 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1146 of the display node is used, where applicable. If DisplayOnly
1147 is FALSE, then the longer text representation of the display node
1149 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1150 representation for a device node can be used, where applicable.
1155 IN OUT POOL_PRINT
*Str
,
1157 IN BOOLEAN DisplayOnly
,
1158 IN BOOLEAN AllowShortcuts
1161 IPv4_DEVICE_PATH
*IPDevPath
;
1163 IPDevPath
= DevPath
;
1164 UefiDevicePathLibCatPrint (Str
, L
"IPv4(");
1165 CatIPv4Address (Str
, &IPDevPath
->RemoteIpAddress
);
1168 UefiDevicePathLibCatPrint (Str
, L
")");
1172 UefiDevicePathLibCatPrint (Str
, L
",");
1173 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1175 UefiDevicePathLibCatPrint (Str
, L
",%s,", IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP");
1176 CatIPv4Address (Str
, &IPDevPath
->LocalIpAddress
);
1177 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1178 UefiDevicePathLibCatPrint (Str
, L
",");
1179 CatIPv4Address (Str
, &IPDevPath
->GatewayIpAddress
);
1180 UefiDevicePathLibCatPrint (Str
, L
",");
1181 CatIPv4Address (Str
, &IPDevPath
->SubnetMask
);
1183 UefiDevicePathLibCatPrint (Str
, L
")");
1187 Converts a IPv6 device path structure to its string representative.
1189 @param Str The string representative of input device.
1190 @param DevPath The input device path structure.
1191 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1192 of the display node is used, where applicable. If DisplayOnly
1193 is FALSE, then the longer text representation of the display node
1195 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1196 representation for a device node can be used, where applicable.
1201 IN OUT POOL_PRINT
*Str
,
1203 IN BOOLEAN DisplayOnly
,
1204 IN BOOLEAN AllowShortcuts
1207 IPv6_DEVICE_PATH
*IPDevPath
;
1209 IPDevPath
= DevPath
;
1210 UefiDevicePathLibCatPrint (Str
, L
"IPv6(");
1211 CatIPv6Address (Str
, &IPDevPath
->RemoteIpAddress
);
1213 UefiDevicePathLibCatPrint (Str
, L
")");
1217 UefiDevicePathLibCatPrint (Str
, L
",");
1218 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1220 switch (IPDevPath
->IpAddressOrigin
) {
1222 UefiDevicePathLibCatPrint (Str
, L
",Static,");
1225 UefiDevicePathLibCatPrint (Str
, L
",StatelessAutoConfigure,");
1228 UefiDevicePathLibCatPrint (Str
, L
",StatefulAutoConfigure,");
1232 CatIPv6Address (Str
, &IPDevPath
->LocalIpAddress
);
1234 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1235 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", IPDevPath
->PrefixLength
);
1236 CatIPv6Address (Str
, &IPDevPath
->GatewayIpAddress
);
1238 UefiDevicePathLibCatPrint (Str
, L
")");
1242 Converts an Infini Band device path structure to its string representative.
1244 @param Str The string representative of input device.
1245 @param DevPath The input device path structure.
1246 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1247 of the display node is used, where applicable. If DisplayOnly
1248 is FALSE, then the longer text representation of the display node
1250 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1251 representation for a device node can be used, where applicable.
1255 DevPathToTextInfiniBand (
1256 IN OUT POOL_PRINT
*Str
,
1258 IN BOOLEAN DisplayOnly
,
1259 IN BOOLEAN AllowShortcuts
1262 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1264 InfiniBand
= DevPath
;
1265 UefiDevicePathLibCatPrint (
1267 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1268 InfiniBand
->ResourceFlags
,
1269 InfiniBand
->PortGid
,
1270 InfiniBand
->ServiceId
,
1271 InfiniBand
->TargetPortId
,
1272 InfiniBand
->DeviceId
1277 Converts a UART device path structure to its string representative.
1279 @param Str The string representative of input device.
1280 @param DevPath The input device path structure.
1281 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1282 of the display node is used, where applicable. If DisplayOnly
1283 is FALSE, then the longer text representation of the display node
1285 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1286 representation for a device node can be used, where applicable.
1291 IN OUT POOL_PRINT
*Str
,
1293 IN BOOLEAN DisplayOnly
,
1294 IN BOOLEAN AllowShortcuts
1297 UART_DEVICE_PATH
*Uart
;
1301 switch (Uart
->Parity
) {
1331 if (Uart
->BaudRate
== 0) {
1332 UefiDevicePathLibCatPrint (Str
, L
"Uart(DEFAULT,");
1334 UefiDevicePathLibCatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1337 if (Uart
->DataBits
== 0) {
1338 UefiDevicePathLibCatPrint (Str
, L
"DEFAULT,");
1340 UefiDevicePathLibCatPrint (Str
, L
"%d,", Uart
->DataBits
);
1343 UefiDevicePathLibCatPrint (Str
, L
"%c,", Parity
);
1345 switch (Uart
->StopBits
) {
1347 UefiDevicePathLibCatPrint (Str
, L
"D)");
1351 UefiDevicePathLibCatPrint (Str
, L
"1)");
1355 UefiDevicePathLibCatPrint (Str
, L
"1.5)");
1359 UefiDevicePathLibCatPrint (Str
, L
"2)");
1363 UefiDevicePathLibCatPrint (Str
, L
"x)");
1369 Converts an iSCSI device path structure to its string representative.
1371 @param Str The string representative of input device.
1372 @param DevPath The input device path structure.
1373 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1374 of the display node is used, where applicable. If DisplayOnly
1375 is FALSE, then the longer text representation of the display node
1377 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1378 representation for a device node can be used, where applicable.
1382 DevPathToTextiSCSI (
1383 IN OUT POOL_PRINT
*Str
,
1385 IN BOOLEAN DisplayOnly
,
1386 IN BOOLEAN AllowShortcuts
1389 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1392 ISCSIDevPath
= DevPath
;
1393 UefiDevicePathLibCatPrint (
1395 L
"iSCSI(%a,0x%x,0x%lx,",
1396 ISCSIDevPath
->TargetName
,
1397 ISCSIDevPath
->TargetPortalGroupTag
,
1401 Options
= ISCSIDevPath
->LoginOption
;
1402 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1403 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1404 if (((Options
>> 11) & 0x0001) != 0) {
1405 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"None");
1406 } else if (((Options
>> 12) & 0x0001) != 0) {
1407 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1409 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_BI");
1413 UefiDevicePathLibCatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1417 Converts a VLAN 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.
1431 IN OUT POOL_PRINT
*Str
,
1433 IN BOOLEAN DisplayOnly
,
1434 IN BOOLEAN AllowShortcuts
1437 VLAN_DEVICE_PATH
*Vlan
;
1440 UefiDevicePathLibCatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1444 Converts a Hard drive device path structure to its string representative.
1446 @param Str The string representative of input device.
1447 @param DevPath The input device path structure.
1448 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1449 of the display node is used, where applicable. If DisplayOnly
1450 is FALSE, then the longer text representation of the display node
1452 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1453 representation for a device node can be used, where applicable.
1457 DevPathToTextHardDrive (
1458 IN OUT POOL_PRINT
*Str
,
1460 IN BOOLEAN DisplayOnly
,
1461 IN BOOLEAN AllowShortcuts
1464 HARDDRIVE_DEVICE_PATH
*Hd
;
1467 switch (Hd
->SignatureType
) {
1468 case SIGNATURE_TYPE_MBR
:
1469 UefiDevicePathLibCatPrint (
1471 L
"HD(%d,%s,0x%08x,",
1472 Hd
->PartitionNumber
,
1474 *((UINT32
*) (&(Hd
->Signature
[0])))
1478 case SIGNATURE_TYPE_GUID
:
1479 UefiDevicePathLibCatPrint (
1482 Hd
->PartitionNumber
,
1484 (EFI_GUID
*) &(Hd
->Signature
[0])
1489 UefiDevicePathLibCatPrint (
1492 Hd
->PartitionNumber
,
1498 UefiDevicePathLibCatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1502 Converts a CDROM 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.
1515 DevPathToTextCDROM (
1516 IN OUT POOL_PRINT
*Str
,
1518 IN BOOLEAN DisplayOnly
,
1519 IN BOOLEAN AllowShortcuts
1522 CDROM_DEVICE_PATH
*Cd
;
1526 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1530 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1534 Converts a File device path structure to its string representative.
1536 @param Str The string representative of input device.
1537 @param DevPath The input device path structure.
1538 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1539 of the display node is used, where applicable. If DisplayOnly
1540 is FALSE, then the longer text representation of the display node
1542 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1543 representation for a device node can be used, where applicable.
1547 DevPathToTextFilePath (
1548 IN OUT POOL_PRINT
*Str
,
1550 IN BOOLEAN DisplayOnly
,
1551 IN BOOLEAN AllowShortcuts
1554 FILEPATH_DEVICE_PATH
*Fp
;
1557 UefiDevicePathLibCatPrint (Str
, L
"%s", Fp
->PathName
);
1561 Converts a Media protocol device path structure to its string representative.
1563 @param Str The string representative of input device.
1564 @param DevPath The input device path structure.
1565 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1566 of the display node is used, where applicable. If DisplayOnly
1567 is FALSE, then the longer text representation of the display node
1569 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1570 representation for a device node can be used, where applicable.
1574 DevPathToTextMediaProtocol (
1575 IN OUT POOL_PRINT
*Str
,
1577 IN BOOLEAN DisplayOnly
,
1578 IN BOOLEAN AllowShortcuts
1581 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1583 MediaProt
= DevPath
;
1584 UefiDevicePathLibCatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1588 Converts a Firmware Volume device path structure to its string representative.
1590 @param Str The string representative of input device.
1591 @param DevPath The input device path structure.
1592 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1593 of the display node is used, where applicable. If DisplayOnly
1594 is FALSE, then the longer text representation of the display node
1596 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1597 representation for a device node can be used, where applicable.
1602 IN OUT POOL_PRINT
*Str
,
1604 IN BOOLEAN DisplayOnly
,
1605 IN BOOLEAN AllowShortcuts
1608 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1611 UefiDevicePathLibCatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1615 Converts a Firmware Volume File device path structure to its string representative.
1617 @param Str The string representative of input device.
1618 @param DevPath The input device path structure.
1619 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1620 of the display node is used, where applicable. If DisplayOnly
1621 is FALSE, then the longer text representation of the display node
1623 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1624 representation for a device node can be used, where applicable.
1628 DevPathToTextFvFile (
1629 IN OUT POOL_PRINT
*Str
,
1631 IN BOOLEAN DisplayOnly
,
1632 IN BOOLEAN AllowShortcuts
1635 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1638 UefiDevicePathLibCatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1642 Converts a Relative Offset device path structure to its string representative.
1644 @param Str The string representative of input device.
1645 @param DevPath The input device path structure.
1646 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1647 of the display node is used, where applicable. If DisplayOnly
1648 is FALSE, then the longer text representation of the display node
1650 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1651 representation for a device node can be used, where applicable.
1655 DevPathRelativeOffsetRange (
1656 IN OUT POOL_PRINT
*Str
,
1658 IN BOOLEAN DisplayOnly
,
1659 IN BOOLEAN AllowShortcuts
1662 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1665 UefiDevicePathLibCatPrint (
1667 L
"Offset(0x%lx,0x%lx)",
1668 Offset
->StartingOffset
,
1669 Offset
->EndingOffset
1674 Converts a BIOS Boot Specification device path structure to its string representative.
1676 @param Str The string representative of input device.
1677 @param DevPath The input device path structure.
1678 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1679 of the display node is used, where applicable. If DisplayOnly
1680 is FALSE, then the longer text representation of the display node
1682 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1683 representation for a device node can be used, where applicable.
1688 IN OUT POOL_PRINT
*Str
,
1690 IN BOOLEAN DisplayOnly
,
1691 IN BOOLEAN AllowShortcuts
1694 BBS_BBS_DEVICE_PATH
*Bbs
;
1698 switch (Bbs
->DeviceType
) {
1699 case BBS_TYPE_FLOPPY
:
1703 case BBS_TYPE_HARDDRIVE
:
1707 case BBS_TYPE_CDROM
:
1711 case BBS_TYPE_PCMCIA
:
1719 case BBS_TYPE_EMBEDDED_NETWORK
:
1729 UefiDevicePathLibCatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1731 UefiDevicePathLibCatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
1735 UefiDevicePathLibCatPrint (Str
, L
")");
1739 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
1743 Converts an End-of-Device-Path structure to its string representative.
1745 @param Str The string representative of input device.
1746 @param DevPath The input device path structure.
1747 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1748 of the display node is used, where applicable. If DisplayOnly
1749 is FALSE, then the longer text representation of the display node
1751 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1752 representation for a device node can be used, where applicable.
1756 DevPathToTextEndInstance (
1757 IN OUT POOL_PRINT
*Str
,
1759 IN BOOLEAN DisplayOnly
,
1760 IN BOOLEAN AllowShortcuts
1763 UefiDevicePathLibCatPrint (Str
, L
",");
1767 Converts an unknown device path structure to its string representative.
1769 @param Str The string representative of input device.
1770 @param DevPath The input device path structure.
1771 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1772 of the display node is used, where applicable. If DisplayOnly
1773 is FALSE, then the longer text representation of the display node
1775 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1776 representation for a device node can be used, where applicable.
1780 DevPathToTextNodeUnknown (
1781 IN OUT POOL_PRINT
*Str
,
1783 IN BOOLEAN DisplayOnly
,
1784 IN BOOLEAN AllowShortcuts
1787 UefiDevicePathLibCatPrint (Str
, L
"?");
1790 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibDevPathToTextTable
[] = {
1791 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
1792 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
1793 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
1794 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
1795 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
1796 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
1797 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
1798 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
1799 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
1800 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
1801 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
1802 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
1803 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
1804 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
1805 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
1806 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
1807 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
1808 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
1809 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
1810 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
1811 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
1812 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
1813 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
1814 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
1815 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
1816 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
1817 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
1818 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
1819 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
1820 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
1821 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
1822 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
1823 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1824 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
1825 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
1826 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
1827 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
1828 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
1833 Converts a device node to its string representation.
1835 @param DeviceNode A Pointer to the device node to be converted.
1836 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1837 of the display node is used, where applicable. If DisplayOnly
1838 is FALSE, then the longer text representation of the display node
1840 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1841 representation for a device node can be used, where applicable.
1843 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
1844 is NULL or there was insufficient memory.
1849 UefiDevicePathLibConvertDeviceNodeToText (
1850 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
1851 IN BOOLEAN DisplayOnly
,
1852 IN BOOLEAN AllowShortcuts
1857 DEVICE_PATH_TO_TEXT ToText
;
1859 if (DeviceNode
== NULL
) {
1863 ZeroMem (&Str
, sizeof (Str
));
1866 // Process the device path node
1867 // If not found, use a generic function
1869 ToText
= DevPathToTextNodeUnknown
;
1870 for (Index
= 0; mUefiDevicePathLibDevPathToTextTable
[Index
].Function
!= NULL
; Index
++) {
1871 if (DevicePathType (DeviceNode
) == mUefiDevicePathLibDevPathToTextTable
[Index
].Type
&&
1872 DevicePathSubType (DeviceNode
) == mUefiDevicePathLibDevPathToTextTable
[Index
].SubType
1874 ToText
= mUefiDevicePathLibDevPathToTextTable
[Index
].Function
;
1882 ToText (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
1884 ASSERT (Str
.Str
!= NULL
);
1889 Converts a device path to its text representation.
1891 @param DevicePath A Pointer to the device to be converted.
1892 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1893 of the display node is used, where applicable. If DisplayOnly
1894 is FALSE, then the longer text representation of the display node
1896 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1897 representation for a device node can be used, where applicable.
1899 @return A pointer to the allocated text representation of the device path or
1900 NULL if DeviceNode is NULL or there was insufficient memory.
1905 UefiDevicePathLibConvertDevicePathToText (
1906 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
1907 IN BOOLEAN DisplayOnly
,
1908 IN BOOLEAN AllowShortcuts
1912 EFI_DEVICE_PATH_PROTOCOL
*Node
;
1913 EFI_DEVICE_PATH_PROTOCOL
*AlignedNode
;
1915 DEVICE_PATH_TO_TEXT ToText
;
1917 if (DevicePath
== NULL
) {
1921 ZeroMem (&Str
, sizeof (Str
));
1924 // Process each device path node
1926 Node
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
1927 while (!IsDevicePathEnd (Node
)) {
1929 // Find the handler to dump this device path node
1930 // If not found, use a generic function
1932 ToText
= DevPathToTextNodeUnknown
;
1933 for (Index
= 0; mUefiDevicePathLibDevPathToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
1935 if (DevicePathType (Node
) == mUefiDevicePathLibDevPathToTextTable
[Index
].Type
&&
1936 DevicePathSubType (Node
) == mUefiDevicePathLibDevPathToTextTable
[Index
].SubType
1938 ToText
= mUefiDevicePathLibDevPathToTextTable
[Index
].Function
;
1943 // Put a path separator in if needed
1945 if ((Str
.Count
!= 0) && (ToText
!= DevPathToTextEndInstance
)) {
1946 if (Str
.Str
[Str
.Count
] != L
',') {
1947 UefiDevicePathLibCatPrint (&Str
, L
"/");
1951 AlignedNode
= AllocateCopyPool (DevicePathNodeLength (Node
), Node
);
1953 // Print this node of the device path
1955 ToText (&Str
, AlignedNode
, DisplayOnly
, AllowShortcuts
);
1956 FreePool (AlignedNode
);
1959 // Next device path node
1961 Node
= NextDevicePathNode (Node
);
1964 if (Str
.Str
== NULL
) {
1965 return AllocateZeroPool (sizeof (CHAR16
));