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.
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 1394 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 F1394_DEVICE_PATH
*F1394DevPath
;
722 F1394DevPath
= DevPath
;
724 // Guid has format of IEEE-EUI64
726 UefiDevicePathLibCatPrint (Str
, L
"I1394(%016lx)", F1394DevPath
->Guid
);
730 Converts a USB device path structure to its string representative.
732 @param Str The string representative of input device.
733 @param DevPath The input device path structure.
734 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
735 of the display node is used, where applicable. If DisplayOnly
736 is FALSE, then the longer text representation of the display node
738 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
739 representation for a device node can be used, where applicable.
744 IN OUT POOL_PRINT
*Str
,
746 IN BOOLEAN DisplayOnly
,
747 IN BOOLEAN AllowShortcuts
750 USB_DEVICE_PATH
*Usb
;
753 UefiDevicePathLibCatPrint (Str
, L
"USB(0x%x,0x%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
757 Converts a USB WWID device path structure to its string representative.
759 @param Str The string representative of input device.
760 @param DevPath The input device path structure.
761 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
762 of the display node is used, where applicable. If DisplayOnly
763 is FALSE, then the longer text representation of the display node
765 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
766 representation for a device node can be used, where applicable.
770 DevPathToTextUsbWWID (
771 IN OUT POOL_PRINT
*Str
,
773 IN BOOLEAN DisplayOnly
,
774 IN BOOLEAN AllowShortcuts
777 USB_WWID_DEVICE_PATH
*UsbWWId
;
778 CHAR16
*SerialNumberStr
;
784 SerialNumberStr
= (CHAR16
*) ((UINT8
*) UsbWWId
+ sizeof (USB_WWID_DEVICE_PATH
));
785 Length
= (UINT16
) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) UsbWWId
) - sizeof (USB_WWID_DEVICE_PATH
)) / sizeof (CHAR16
));
786 if (SerialNumberStr
[Length
- 1] != 0) {
788 // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
790 NewStr
= AllocateCopyPool ((Length
+ 1) * sizeof (CHAR16
), SerialNumberStr
);
791 ASSERT (NewStr
!= NULL
);
793 SerialNumberStr
= NewStr
;
796 UefiDevicePathLibCatPrint (
798 L
"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
801 UsbWWId
->InterfaceNumber
,
807 Converts a Logic Unit device path structure to its string representative.
809 @param Str The string representative of input device.
810 @param DevPath The input device path structure.
811 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
812 of the display node is used, where applicable. If DisplayOnly
813 is FALSE, then the longer text representation of the display node
815 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
816 representation for a device node can be used, where applicable.
820 DevPathToTextLogicalUnit (
821 IN OUT POOL_PRINT
*Str
,
823 IN BOOLEAN DisplayOnly
,
824 IN BOOLEAN AllowShortcuts
827 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
829 LogicalUnit
= DevPath
;
830 UefiDevicePathLibCatPrint (Str
, L
"Unit(0x%x)", LogicalUnit
->Lun
);
834 Converts a USB class device path structure to its string representative.
836 @param Str The string representative of input device.
837 @param DevPath The input device path structure.
838 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
839 of the display node is used, where applicable. If DisplayOnly
840 is FALSE, then the longer text representation of the display node
842 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
843 representation for a device node can be used, where applicable.
847 DevPathToTextUsbClass (
848 IN OUT POOL_PRINT
*Str
,
850 IN BOOLEAN DisplayOnly
,
851 IN BOOLEAN AllowShortcuts
854 USB_CLASS_DEVICE_PATH
*UsbClass
;
855 BOOLEAN IsKnownSubClass
;
860 IsKnownSubClass
= TRUE
;
861 switch (UsbClass
->DeviceClass
) {
862 case USB_CLASS_AUDIO
:
863 UefiDevicePathLibCatPrint (Str
, L
"UsbAudio");
866 case USB_CLASS_CDCCONTROL
:
867 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCControl");
871 UefiDevicePathLibCatPrint (Str
, L
"UsbHID");
874 case USB_CLASS_IMAGE
:
875 UefiDevicePathLibCatPrint (Str
, L
"UsbImage");
878 case USB_CLASS_PRINTER
:
879 UefiDevicePathLibCatPrint (Str
, L
"UsbPrinter");
882 case USB_CLASS_MASS_STORAGE
:
883 UefiDevicePathLibCatPrint (Str
, L
"UsbMassStorage");
887 UefiDevicePathLibCatPrint (Str
, L
"UsbHub");
890 case USB_CLASS_CDCDATA
:
891 UefiDevicePathLibCatPrint (Str
, L
"UsbCDCData");
894 case USB_CLASS_SMART_CARD
:
895 UefiDevicePathLibCatPrint (Str
, L
"UsbSmartCard");
898 case USB_CLASS_VIDEO
:
899 UefiDevicePathLibCatPrint (Str
, L
"UsbVideo");
902 case USB_CLASS_DIAGNOSTIC
:
903 UefiDevicePathLibCatPrint (Str
, L
"UsbDiagnostic");
906 case USB_CLASS_WIRELESS
:
907 UefiDevicePathLibCatPrint (Str
, L
"UsbWireless");
911 IsKnownSubClass
= FALSE
;
915 if (IsKnownSubClass
) {
916 UefiDevicePathLibCatPrint (
918 L
"(0x%x,0x%x,0x%x,0x%x)",
921 UsbClass
->DeviceSubClass
,
922 UsbClass
->DeviceProtocol
927 if (UsbClass
->DeviceClass
== USB_CLASS_RESERVE
) {
928 if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_FW_UPDATE
) {
929 UefiDevicePathLibCatPrint (
931 L
"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
934 UsbClass
->DeviceProtocol
937 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_IRDA_BRIDGE
) {
938 UefiDevicePathLibCatPrint (
940 L
"UsbIrdaBridge(0x%x,0x%x,0x%x)",
943 UsbClass
->DeviceProtocol
946 } else if (UsbClass
->DeviceSubClass
== USB_SUBCLASS_TEST
) {
947 UefiDevicePathLibCatPrint (
949 L
"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
952 UsbClass
->DeviceProtocol
958 UefiDevicePathLibCatPrint (
960 L
"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
963 UsbClass
->DeviceClass
,
964 UsbClass
->DeviceSubClass
,
965 UsbClass
->DeviceProtocol
970 Converts a SATA device path structure to its string representative.
972 @param Str The string representative of input device.
973 @param DevPath The input device path structure.
974 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
975 of the display node is used, where applicable. If DisplayOnly
976 is FALSE, then the longer text representation of the display node
978 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
979 representation for a device node can be used, where applicable.
984 IN OUT POOL_PRINT
*Str
,
986 IN BOOLEAN DisplayOnly
,
987 IN BOOLEAN AllowShortcuts
990 SATA_DEVICE_PATH
*Sata
;
993 if ((Sata
->PortMultiplierPortNumber
& SATA_HBA_DIRECT_CONNECT_FLAG
) != 0) {
994 UefiDevicePathLibCatPrint (
1001 UefiDevicePathLibCatPrint (
1003 L
"Sata(0x%x,0x%x,0x%x)",
1004 Sata
->HBAPortNumber
,
1005 Sata
->PortMultiplierPortNumber
,
1012 Converts a I20 device path structure to its string representative.
1014 @param Str The string representative of input device.
1015 @param DevPath The input device path structure.
1016 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1017 of the display node is used, where applicable. If DisplayOnly
1018 is FALSE, then the longer text representation of the display node
1020 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1021 representation for a device node can be used, where applicable.
1026 IN OUT POOL_PRINT
*Str
,
1028 IN BOOLEAN DisplayOnly
,
1029 IN BOOLEAN AllowShortcuts
1032 I2O_DEVICE_PATH
*I2ODevPath
;
1034 I2ODevPath
= DevPath
;
1035 UefiDevicePathLibCatPrint (Str
, L
"I2O(0x%x)", I2ODevPath
->Tid
);
1039 Converts a MAC address device path structure to its string representative.
1041 @param Str The string representative of input device.
1042 @param DevPath The input device path structure.
1043 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1044 of the display node is used, where applicable. If DisplayOnly
1045 is FALSE, then the longer text representation of the display node
1047 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1048 representation for a device node can be used, where applicable.
1052 DevPathToTextMacAddr (
1053 IN OUT POOL_PRINT
*Str
,
1055 IN BOOLEAN DisplayOnly
,
1056 IN BOOLEAN AllowShortcuts
1059 MAC_ADDR_DEVICE_PATH
*MacDevPath
;
1060 UINTN HwAddressSize
;
1063 MacDevPath
= DevPath
;
1065 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
1066 if (MacDevPath
->IfType
== 0x01 || MacDevPath
->IfType
== 0x00) {
1070 UefiDevicePathLibCatPrint (Str
, L
"MAC(");
1072 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
1073 UefiDevicePathLibCatPrint (Str
, L
"%02x", MacDevPath
->MacAddress
.Addr
[Index
]);
1076 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", MacDevPath
->IfType
);
1080 Converts network protocol string to its text representation.
1082 @param Str The string representative of input device.
1083 @param Protocol The network protocol ID.
1087 CatNetworkProtocol (
1088 IN OUT POOL_PRINT
*Str
,
1092 if (Protocol
== RFC_1700_TCP_PROTOCOL
) {
1093 UefiDevicePathLibCatPrint (Str
, L
"TCP");
1094 } else if (Protocol
== RFC_1700_UDP_PROTOCOL
) {
1095 UefiDevicePathLibCatPrint (Str
, L
"UDP");
1097 UefiDevicePathLibCatPrint (Str
, L
"0x%x", Protocol
);
1102 Converts IP v4 address to its text representation.
1104 @param Str The string representative of input device.
1105 @param Address The IP v4 address.
1109 IN OUT POOL_PRINT
*Str
,
1110 IN EFI_IPv4_ADDRESS
*Address
1113 UefiDevicePathLibCatPrint (Str
, L
"%d.%d.%d.%d", Address
->Addr
[0], Address
->Addr
[1], Address
->Addr
[2], Address
->Addr
[3]);
1117 Converts IP v6 address to its text representation.
1119 @param Str The string representative of input device.
1120 @param Address The IP v6 address.
1124 IN OUT POOL_PRINT
*Str
,
1125 IN EFI_IPv6_ADDRESS
*Address
1128 UefiDevicePathLibCatPrint (
1129 Str
, L
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
1130 Address
->Addr
[0], Address
->Addr
[1],
1131 Address
->Addr
[2], Address
->Addr
[3],
1132 Address
->Addr
[4], Address
->Addr
[5],
1133 Address
->Addr
[6], Address
->Addr
[7],
1134 Address
->Addr
[8], Address
->Addr
[9],
1135 Address
->Addr
[10], Address
->Addr
[11],
1136 Address
->Addr
[12], Address
->Addr
[13],
1137 Address
->Addr
[14], Address
->Addr
[15]
1142 Converts a IPv4 device path structure to its string representative.
1144 @param Str The string representative of input device.
1145 @param DevPath The input device path structure.
1146 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1147 of the display node is used, where applicable. If DisplayOnly
1148 is FALSE, then the longer text representation of the display node
1150 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1151 representation for a device node can be used, where applicable.
1156 IN OUT POOL_PRINT
*Str
,
1158 IN BOOLEAN DisplayOnly
,
1159 IN BOOLEAN AllowShortcuts
1162 IPv4_DEVICE_PATH
*IPDevPath
;
1164 IPDevPath
= DevPath
;
1165 UefiDevicePathLibCatPrint (Str
, L
"IPv4(");
1166 CatIPv4Address (Str
, &IPDevPath
->RemoteIpAddress
);
1169 UefiDevicePathLibCatPrint (Str
, L
")");
1173 UefiDevicePathLibCatPrint (Str
, L
",");
1174 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1176 UefiDevicePathLibCatPrint (Str
, L
",%s,", IPDevPath
->StaticIpAddress
? L
"Static" : L
"DHCP");
1177 CatIPv4Address (Str
, &IPDevPath
->LocalIpAddress
);
1178 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv4_DEVICE_PATH
)) {
1179 UefiDevicePathLibCatPrint (Str
, L
",");
1180 CatIPv4Address (Str
, &IPDevPath
->GatewayIpAddress
);
1181 UefiDevicePathLibCatPrint (Str
, L
",");
1182 CatIPv4Address (Str
, &IPDevPath
->SubnetMask
);
1184 UefiDevicePathLibCatPrint (Str
, L
")");
1188 Converts a IPv6 device path structure to its string representative.
1190 @param Str The string representative of input device.
1191 @param DevPath The input device path structure.
1192 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1193 of the display node is used, where applicable. If DisplayOnly
1194 is FALSE, then the longer text representation of the display node
1196 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1197 representation for a device node can be used, where applicable.
1202 IN OUT POOL_PRINT
*Str
,
1204 IN BOOLEAN DisplayOnly
,
1205 IN BOOLEAN AllowShortcuts
1208 IPv6_DEVICE_PATH
*IPDevPath
;
1210 IPDevPath
= DevPath
;
1211 UefiDevicePathLibCatPrint (Str
, L
"IPv6(");
1212 CatIPv6Address (Str
, &IPDevPath
->RemoteIpAddress
);
1214 UefiDevicePathLibCatPrint (Str
, L
")");
1218 UefiDevicePathLibCatPrint (Str
, L
",");
1219 CatNetworkProtocol (Str
, IPDevPath
->Protocol
);
1221 switch (IPDevPath
->IpAddressOrigin
) {
1223 UefiDevicePathLibCatPrint (Str
, L
",Static,");
1226 UefiDevicePathLibCatPrint (Str
, L
",StatelessAutoConfigure,");
1229 UefiDevicePathLibCatPrint (Str
, L
",StatefulAutoConfigure,");
1233 CatIPv6Address (Str
, &IPDevPath
->LocalIpAddress
);
1235 if (DevicePathNodeLength (IPDevPath
) == sizeof (IPv6_DEVICE_PATH
)) {
1236 UefiDevicePathLibCatPrint (Str
, L
",0x%x,", IPDevPath
->PrefixLength
);
1237 CatIPv6Address (Str
, &IPDevPath
->GatewayIpAddress
);
1239 UefiDevicePathLibCatPrint (Str
, L
")");
1243 Converts an Infini Band device path structure to its string representative.
1245 @param Str The string representative of input device.
1246 @param DevPath The input device path structure.
1247 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1248 of the display node is used, where applicable. If DisplayOnly
1249 is FALSE, then the longer text representation of the display node
1251 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1252 representation for a device node can be used, where applicable.
1256 DevPathToTextInfiniBand (
1257 IN OUT POOL_PRINT
*Str
,
1259 IN BOOLEAN DisplayOnly
,
1260 IN BOOLEAN AllowShortcuts
1263 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1265 InfiniBand
= DevPath
;
1266 UefiDevicePathLibCatPrint (
1268 L
"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
1269 InfiniBand
->ResourceFlags
,
1270 InfiniBand
->PortGid
,
1271 InfiniBand
->ServiceId
,
1272 InfiniBand
->TargetPortId
,
1273 InfiniBand
->DeviceId
1278 Converts a UART device path structure to its string representative.
1280 @param Str The string representative of input device.
1281 @param DevPath The input device path structure.
1282 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1283 of the display node is used, where applicable. If DisplayOnly
1284 is FALSE, then the longer text representation of the display node
1286 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1287 representation for a device node can be used, where applicable.
1292 IN OUT POOL_PRINT
*Str
,
1294 IN BOOLEAN DisplayOnly
,
1295 IN BOOLEAN AllowShortcuts
1298 UART_DEVICE_PATH
*Uart
;
1302 switch (Uart
->Parity
) {
1332 if (Uart
->BaudRate
== 0) {
1333 UefiDevicePathLibCatPrint (Str
, L
"Uart(DEFAULT,");
1335 UefiDevicePathLibCatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1338 if (Uart
->DataBits
== 0) {
1339 UefiDevicePathLibCatPrint (Str
, L
"DEFAULT,");
1341 UefiDevicePathLibCatPrint (Str
, L
"%d,", Uart
->DataBits
);
1344 UefiDevicePathLibCatPrint (Str
, L
"%c,", Parity
);
1346 switch (Uart
->StopBits
) {
1348 UefiDevicePathLibCatPrint (Str
, L
"D)");
1352 UefiDevicePathLibCatPrint (Str
, L
"1)");
1356 UefiDevicePathLibCatPrint (Str
, L
"1.5)");
1360 UefiDevicePathLibCatPrint (Str
, L
"2)");
1364 UefiDevicePathLibCatPrint (Str
, L
"x)");
1370 Converts an iSCSI device path structure to its string representative.
1372 @param Str The string representative of input device.
1373 @param DevPath The input device path structure.
1374 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1375 of the display node is used, where applicable. If DisplayOnly
1376 is FALSE, then the longer text representation of the display node
1378 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1379 representation for a device node can be used, where applicable.
1383 DevPathToTextiSCSI (
1384 IN OUT POOL_PRINT
*Str
,
1386 IN BOOLEAN DisplayOnly
,
1387 IN BOOLEAN AllowShortcuts
1390 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
1393 ISCSIDevPath
= DevPath
;
1394 UefiDevicePathLibCatPrint (
1396 L
"iSCSI(%a,0x%x,0x%lx,",
1397 ISCSIDevPath
->TargetName
,
1398 ISCSIDevPath
->TargetPortalGroupTag
,
1402 Options
= ISCSIDevPath
->LoginOption
;
1403 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1404 UefiDevicePathLibCatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
1405 if (((Options
>> 11) & 0x0001) != 0) {
1406 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"None");
1407 } else if (((Options
>> 12) & 0x0001) != 0) {
1408 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1410 UefiDevicePathLibCatPrint (Str
, L
"%s,", L
"CHAP_BI");
1414 UefiDevicePathLibCatPrint (Str
, L
"%s)", (ISCSIDevPath
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1418 Converts a VLAN device path structure to its string representative.
1420 @param Str The string representative of input device.
1421 @param DevPath The input device path structure.
1422 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1423 of the display node is used, where applicable. If DisplayOnly
1424 is FALSE, then the longer text representation of the display node
1426 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1427 representation for a device node can be used, where applicable.
1432 IN OUT POOL_PRINT
*Str
,
1434 IN BOOLEAN DisplayOnly
,
1435 IN BOOLEAN AllowShortcuts
1438 VLAN_DEVICE_PATH
*Vlan
;
1441 UefiDevicePathLibCatPrint (Str
, L
"Vlan(%d)", Vlan
->VlanId
);
1445 Converts a Hard drive device path structure to its string representative.
1447 @param Str The string representative of input device.
1448 @param DevPath The input device path structure.
1449 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1450 of the display node is used, where applicable. If DisplayOnly
1451 is FALSE, then the longer text representation of the display node
1453 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1454 representation for a device node can be used, where applicable.
1458 DevPathToTextHardDrive (
1459 IN OUT POOL_PRINT
*Str
,
1461 IN BOOLEAN DisplayOnly
,
1462 IN BOOLEAN AllowShortcuts
1465 HARDDRIVE_DEVICE_PATH
*Hd
;
1468 switch (Hd
->SignatureType
) {
1469 case SIGNATURE_TYPE_MBR
:
1470 UefiDevicePathLibCatPrint (
1472 L
"HD(%d,%s,0x%08x,",
1473 Hd
->PartitionNumber
,
1475 *((UINT32
*) (&(Hd
->Signature
[0])))
1479 case SIGNATURE_TYPE_GUID
:
1480 UefiDevicePathLibCatPrint (
1483 Hd
->PartitionNumber
,
1485 (EFI_GUID
*) &(Hd
->Signature
[0])
1490 UefiDevicePathLibCatPrint (
1493 Hd
->PartitionNumber
,
1499 UefiDevicePathLibCatPrint (Str
, L
"0x%lx,0x%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1503 Converts a CDROM device path structure to its string representative.
1505 @param Str The string representative of input device.
1506 @param DevPath The input device path structure.
1507 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1508 of the display node is used, where applicable. If DisplayOnly
1509 is FALSE, then the longer text representation of the display node
1511 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1512 representation for a device node can be used, where applicable.
1516 DevPathToTextCDROM (
1517 IN OUT POOL_PRINT
*Str
,
1519 IN BOOLEAN DisplayOnly
,
1520 IN BOOLEAN AllowShortcuts
1523 CDROM_DEVICE_PATH
*Cd
;
1527 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x)", Cd
->BootEntry
);
1531 UefiDevicePathLibCatPrint (Str
, L
"CDROM(0x%x,0x%lx,0x%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1535 Converts a File device path structure to its string representative.
1537 @param Str The string representative of input device.
1538 @param DevPath The input device path structure.
1539 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1540 of the display node is used, where applicable. If DisplayOnly
1541 is FALSE, then the longer text representation of the display node
1543 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1544 representation for a device node can be used, where applicable.
1548 DevPathToTextFilePath (
1549 IN OUT POOL_PRINT
*Str
,
1551 IN BOOLEAN DisplayOnly
,
1552 IN BOOLEAN AllowShortcuts
1555 FILEPATH_DEVICE_PATH
*Fp
;
1558 UefiDevicePathLibCatPrint (Str
, L
"%s", Fp
->PathName
);
1562 Converts a Media protocol device path structure to its string representative.
1564 @param Str The string representative of input device.
1565 @param DevPath The input device path structure.
1566 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1567 of the display node is used, where applicable. If DisplayOnly
1568 is FALSE, then the longer text representation of the display node
1570 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1571 representation for a device node can be used, where applicable.
1575 DevPathToTextMediaProtocol (
1576 IN OUT POOL_PRINT
*Str
,
1578 IN BOOLEAN DisplayOnly
,
1579 IN BOOLEAN AllowShortcuts
1582 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1584 MediaProt
= DevPath
;
1585 UefiDevicePathLibCatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1589 Converts a Firmware Volume device path structure to its string representative.
1591 @param Str The string representative of input device.
1592 @param DevPath The input device path structure.
1593 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1594 of the display node is used, where applicable. If DisplayOnly
1595 is FALSE, then the longer text representation of the display node
1597 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1598 representation for a device node can be used, where applicable.
1603 IN OUT POOL_PRINT
*Str
,
1605 IN BOOLEAN DisplayOnly
,
1606 IN BOOLEAN AllowShortcuts
1609 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
1612 UefiDevicePathLibCatPrint (Str
, L
"Fv(%g)", &Fv
->FvName
);
1616 Converts a Firmware Volume File device path structure to its string representative.
1618 @param Str The string representative of input device.
1619 @param DevPath The input device path structure.
1620 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1621 of the display node is used, where applicable. If DisplayOnly
1622 is FALSE, then the longer text representation of the display node
1624 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1625 representation for a device node can be used, where applicable.
1629 DevPathToTextFvFile (
1630 IN OUT POOL_PRINT
*Str
,
1632 IN BOOLEAN DisplayOnly
,
1633 IN BOOLEAN AllowShortcuts
1636 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
1639 UefiDevicePathLibCatPrint (Str
, L
"FvFile(%g)", &FvFile
->FvFileName
);
1643 Converts a Relative Offset device path structure to its string representative.
1645 @param Str The string representative of input device.
1646 @param DevPath The input device path structure.
1647 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1648 of the display node is used, where applicable. If DisplayOnly
1649 is FALSE, then the longer text representation of the display node
1651 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1652 representation for a device node can be used, where applicable.
1656 DevPathRelativeOffsetRange (
1657 IN OUT POOL_PRINT
*Str
,
1659 IN BOOLEAN DisplayOnly
,
1660 IN BOOLEAN AllowShortcuts
1663 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1666 UefiDevicePathLibCatPrint (
1668 L
"Offset(0x%lx,0x%lx)",
1669 Offset
->StartingOffset
,
1670 Offset
->EndingOffset
1675 Converts a BIOS Boot Specification device path structure to its string representative.
1677 @param Str The string representative of input device.
1678 @param DevPath The input device path structure.
1679 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1680 of the display node is used, where applicable. If DisplayOnly
1681 is FALSE, then the longer text representation of the display node
1683 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1684 representation for a device node can be used, where applicable.
1689 IN OUT POOL_PRINT
*Str
,
1691 IN BOOLEAN DisplayOnly
,
1692 IN BOOLEAN AllowShortcuts
1695 BBS_BBS_DEVICE_PATH
*Bbs
;
1699 switch (Bbs
->DeviceType
) {
1700 case BBS_TYPE_FLOPPY
:
1704 case BBS_TYPE_HARDDRIVE
:
1708 case BBS_TYPE_CDROM
:
1712 case BBS_TYPE_PCMCIA
:
1720 case BBS_TYPE_EMBEDDED_NETWORK
:
1730 UefiDevicePathLibCatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1732 UefiDevicePathLibCatPrint (Str
, L
"BBS(0x%x,%a", Bbs
->DeviceType
, Bbs
->String
);
1736 UefiDevicePathLibCatPrint (Str
, L
")");
1740 UefiDevicePathLibCatPrint (Str
, L
",0x%x)", Bbs
->StatusFlag
);
1744 Converts an End-of-Device-Path structure to its string representative.
1746 @param Str The string representative of input device.
1747 @param DevPath The input device path structure.
1748 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1749 of the display node is used, where applicable. If DisplayOnly
1750 is FALSE, then the longer text representation of the display node
1752 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1753 representation for a device node can be used, where applicable.
1757 DevPathToTextEndInstance (
1758 IN OUT POOL_PRINT
*Str
,
1760 IN BOOLEAN DisplayOnly
,
1761 IN BOOLEAN AllowShortcuts
1764 UefiDevicePathLibCatPrint (Str
, L
",");
1768 Converts an unknown device path structure to its string representative.
1770 @param Str The string representative of input device.
1771 @param DevPath The input device path structure.
1772 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1773 of the display node is used, where applicable. If DisplayOnly
1774 is FALSE, then the longer text representation of the display node
1776 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1777 representation for a device node can be used, where applicable.
1781 DevPathToTextNodeUnknown (
1782 IN OUT POOL_PRINT
*Str
,
1784 IN BOOLEAN DisplayOnly
,
1785 IN BOOLEAN AllowShortcuts
1788 UefiDevicePathLibCatPrint (Str
, L
"?");
1791 GLOBAL_REMOVE_IF_UNREFERENCED
const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibDevPathToTextTable
[] = {
1792 {HARDWARE_DEVICE_PATH
, HW_PCI_DP
, DevPathToTextPci
},
1793 {HARDWARE_DEVICE_PATH
, HW_PCCARD_DP
, DevPathToTextPccard
},
1794 {HARDWARE_DEVICE_PATH
, HW_MEMMAP_DP
, DevPathToTextMemMap
},
1795 {HARDWARE_DEVICE_PATH
, HW_VENDOR_DP
, DevPathToTextVendor
},
1796 {HARDWARE_DEVICE_PATH
, HW_CONTROLLER_DP
, DevPathToTextController
},
1797 {ACPI_DEVICE_PATH
, ACPI_DP
, DevPathToTextAcpi
},
1798 {ACPI_DEVICE_PATH
, ACPI_EXTENDED_DP
, DevPathToTextAcpiEx
},
1799 {ACPI_DEVICE_PATH
, ACPI_ADR_DP
, DevPathToTextAcpiAdr
},
1800 {MESSAGING_DEVICE_PATH
, MSG_ATAPI_DP
, DevPathToTextAtapi
},
1801 {MESSAGING_DEVICE_PATH
, MSG_SCSI_DP
, DevPathToTextScsi
},
1802 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNEL_DP
, DevPathToTextFibre
},
1803 {MESSAGING_DEVICE_PATH
, MSG_FIBRECHANNELEX_DP
, DevPathToTextFibreEx
},
1804 {MESSAGING_DEVICE_PATH
, MSG_SASEX_DP
, DevPathToTextSasEx
},
1805 {MESSAGING_DEVICE_PATH
, MSG_1394_DP
, DevPathToText1394
},
1806 {MESSAGING_DEVICE_PATH
, MSG_USB_DP
, DevPathToTextUsb
},
1807 {MESSAGING_DEVICE_PATH
, MSG_USB_WWID_DP
, DevPathToTextUsbWWID
},
1808 {MESSAGING_DEVICE_PATH
, MSG_DEVICE_LOGICAL_UNIT_DP
, DevPathToTextLogicalUnit
},
1809 {MESSAGING_DEVICE_PATH
, MSG_USB_CLASS_DP
, DevPathToTextUsbClass
},
1810 {MESSAGING_DEVICE_PATH
, MSG_SATA_DP
, DevPathToTextSata
},
1811 {MESSAGING_DEVICE_PATH
, MSG_I2O_DP
, DevPathToTextI2O
},
1812 {MESSAGING_DEVICE_PATH
, MSG_MAC_ADDR_DP
, DevPathToTextMacAddr
},
1813 {MESSAGING_DEVICE_PATH
, MSG_IPv4_DP
, DevPathToTextIPv4
},
1814 {MESSAGING_DEVICE_PATH
, MSG_IPv6_DP
, DevPathToTextIPv6
},
1815 {MESSAGING_DEVICE_PATH
, MSG_INFINIBAND_DP
, DevPathToTextInfiniBand
},
1816 {MESSAGING_DEVICE_PATH
, MSG_UART_DP
, DevPathToTextUart
},
1817 {MESSAGING_DEVICE_PATH
, MSG_VENDOR_DP
, DevPathToTextVendor
},
1818 {MESSAGING_DEVICE_PATH
, MSG_ISCSI_DP
, DevPathToTextiSCSI
},
1819 {MESSAGING_DEVICE_PATH
, MSG_VLAN_DP
, DevPathToTextVlan
},
1820 {MEDIA_DEVICE_PATH
, MEDIA_HARDDRIVE_DP
, DevPathToTextHardDrive
},
1821 {MEDIA_DEVICE_PATH
, MEDIA_CDROM_DP
, DevPathToTextCDROM
},
1822 {MEDIA_DEVICE_PATH
, MEDIA_VENDOR_DP
, DevPathToTextVendor
},
1823 {MEDIA_DEVICE_PATH
, MEDIA_PROTOCOL_DP
, DevPathToTextMediaProtocol
},
1824 {MEDIA_DEVICE_PATH
, MEDIA_FILEPATH_DP
, DevPathToTextFilePath
},
1825 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_VOL_DP
, DevPathToTextFv
},
1826 {MEDIA_DEVICE_PATH
, MEDIA_PIWG_FW_FILE_DP
, DevPathToTextFvFile
},
1827 {MEDIA_DEVICE_PATH
, MEDIA_RELATIVE_OFFSET_RANGE_DP
, DevPathRelativeOffsetRange
},
1828 {BBS_DEVICE_PATH
, BBS_BBS_DP
, DevPathToTextBBS
},
1829 {END_DEVICE_PATH_TYPE
, END_INSTANCE_DEVICE_PATH_SUBTYPE
, DevPathToTextEndInstance
},
1834 Converts a device node to its string representation.
1836 @param DeviceNode A Pointer to the device node to be converted.
1837 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1838 of the display node is used, where applicable. If DisplayOnly
1839 is FALSE, then the longer text representation of the display node
1841 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1842 representation for a device node can be used, where applicable.
1844 @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
1845 is NULL or there was insufficient memory.
1850 UefiDevicePathLibConvertDeviceNodeToText (
1851 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
1852 IN BOOLEAN DisplayOnly
,
1853 IN BOOLEAN AllowShortcuts
1858 DEVICE_PATH_TO_TEXT ToText
;
1860 if (DeviceNode
== NULL
) {
1864 ZeroMem (&Str
, sizeof (Str
));
1867 // Process the device path node
1868 // If not found, use a generic function
1870 ToText
= DevPathToTextNodeUnknown
;
1871 for (Index
= 0; mUefiDevicePathLibDevPathToTextTable
[Index
].Function
!= NULL
; Index
++) {
1872 if (DevicePathType (DeviceNode
) == mUefiDevicePathLibDevPathToTextTable
[Index
].Type
&&
1873 DevicePathSubType (DeviceNode
) == mUefiDevicePathLibDevPathToTextTable
[Index
].SubType
1875 ToText
= mUefiDevicePathLibDevPathToTextTable
[Index
].Function
;
1883 ToText (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
1885 ASSERT (Str
.Str
!= NULL
);
1890 Converts a device path to its text representation.
1892 @param DevicePath A Pointer to the device to be converted.
1893 @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
1894 of the display node is used, where applicable. If DisplayOnly
1895 is FALSE, then the longer text representation of the display node
1897 @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
1898 representation for a device node can be used, where applicable.
1900 @return A pointer to the allocated text representation of the device path or
1901 NULL if DeviceNode is NULL or there was insufficient memory.
1906 UefiDevicePathLibConvertDevicePathToText (
1907 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
1908 IN BOOLEAN DisplayOnly
,
1909 IN BOOLEAN AllowShortcuts
1913 EFI_DEVICE_PATH_PROTOCOL
*Node
;
1914 EFI_DEVICE_PATH_PROTOCOL
*AlignedNode
;
1916 DEVICE_PATH_TO_TEXT ToText
;
1918 if (DevicePath
== NULL
) {
1922 ZeroMem (&Str
, sizeof (Str
));
1925 // Process each device path node
1927 Node
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
;
1928 while (!IsDevicePathEnd (Node
)) {
1930 // Find the handler to dump this device path node
1931 // If not found, use a generic function
1933 ToText
= DevPathToTextNodeUnknown
;
1934 for (Index
= 0; mUefiDevicePathLibDevPathToTextTable
[Index
].Function
!= NULL
; Index
+= 1) {
1936 if (DevicePathType (Node
) == mUefiDevicePathLibDevPathToTextTable
[Index
].Type
&&
1937 DevicePathSubType (Node
) == mUefiDevicePathLibDevPathToTextTable
[Index
].SubType
1939 ToText
= mUefiDevicePathLibDevPathToTextTable
[Index
].Function
;
1944 // Put a path separator in if needed
1946 if ((Str
.Count
!= 0) && (ToText
!= DevPathToTextEndInstance
)) {
1947 if (Str
.Str
[Str
.Count
] != L
',') {
1948 UefiDevicePathLibCatPrint (&Str
, L
"/");
1952 AlignedNode
= AllocateCopyPool (DevicePathNodeLength (Node
), Node
);
1954 // Print this node of the device path
1956 ToText (&Str
, AlignedNode
, DisplayOnly
, AllowShortcuts
);
1957 FreePool (AlignedNode
);
1960 // Next device path node
1962 Node
= NextDevicePathNode (Node
);
1965 if (Str
.Str
== NULL
) {
1966 return AllocateZeroPool (sizeof (CHAR16
));