3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 DevicePathToText protocol as defined in the UEFI 2.0 specification.
22 #include <protocol/DevicePathToText.h>
23 #include "DevicePath.h"
25 EFI_DEVICE_PATH_PROTOCOL
*
27 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
32 Function unpacks a device path data structure so that all the nodes of a device path
33 are naturally aligned.
36 DevPath - A pointer to a device path data structure
39 If the memory for the device path is successfully allocated, then a pointer to the
40 new device path is returned. Otherwise, NULL is returned.
44 EFI_DEVICE_PATH_PROTOCOL
*Src
;
45 EFI_DEVICE_PATH_PROTOCOL
*Dest
;
46 EFI_DEVICE_PATH_PROTOCOL
*NewPath
;
49 if (DevPath
== NULL
) {
53 // Walk device path and round sizes to valid boundries
58 Size
+= DevicePathNodeLength (Src
);
59 Size
+= ALIGN_SIZE (Size
);
61 if (IsDevicePathEnd (Src
)) {
65 Src
= (EFI_DEVICE_PATH_PROTOCOL
*) NextDevicePathNode (Src
);
68 // Allocate space for the unpacked path
70 NewPath
= AllocateZeroPool (Size
);
71 if (NewPath
!= NULL
) {
73 ASSERT (((UINTN
) NewPath
) % MIN_ALIGNMENT_SIZE
== 0);
81 Size
= DevicePathNodeLength (Src
);
82 CopyMem (Dest
, Src
, Size
);
83 Size
+= ALIGN_SIZE (Size
);
84 SetDevicePathNodeLength (Dest
, Size
);
85 Dest
->Type
|= EFI_DP_TYPE_UNPACKED
;
86 Dest
= (EFI_DEVICE_PATH_PROTOCOL
*) (((UINT8
*) Dest
) + Size
);
88 if (IsDevicePathEnd (Src
)) {
92 Src
= (EFI_DEVICE_PATH_PROTOCOL
*) NextDevicePathNode (Src
);
108 Adjusts the size of a previously allocated buffer.
111 OldPool - A pointer to the buffer whose size is being adjusted.
112 OldSize - The size of the current buffer.
113 NewSize - The size of the new buffer.
116 EFI_SUCEESS - The requested number of bytes were allocated.
117 EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.
118 EFI_INVALID_PARAMETER - The buffer was invalid.
126 NewPool
= AllocateZeroPool (NewSize
);
131 CopyMem (NewPool
, OldPool
, OldSize
< NewSize
? OldSize
: NewSize
);
134 gBS
->FreePool (OldPool
);
142 IN OUT POOL_PRINT
*Str
,
149 Concatenates a formatted unicode string to allocated pool.
150 The caller must free the resulting buffer.
153 Str - Tracks the allocated pool, size in use, and
154 amount of pool allocated.
155 Fmt - The format string
158 Allocated buffer with the formatted string printed in it.
159 The caller must free the allocated buffer. The buffer
160 allocation is not packed.
168 AppendStr
= AllocateZeroPool (0x1000);
169 if (AppendStr
== NULL
) {
173 VA_START (Args
, Fmt
);
174 UnicodeVSPrint (AppendStr
, 0x1000, Fmt
, Args
);
176 if (NULL
== Str
->Str
) {
177 Size
= StrSize (AppendStr
);
178 Str
->Str
= AllocateZeroPool (Size
);
179 ASSERT (Str
->Str
!= NULL
);
181 Size
= StrSize (AppendStr
) + StrSize (Str
->Str
) - sizeof (UINT16
);
182 Str
->Str
= ReallocatePool (
187 ASSERT (Str
->Str
!= NULL
);
190 Str
->MaxLen
= MAX_CHAR
* sizeof (UINT16
);
191 if (Size
< Str
->MaxLen
) {
192 StrCat (Str
->Str
, AppendStr
);
193 Str
->Len
= Size
- sizeof (UINT16
);
196 gBS
->FreePool (AppendStr
);
202 IN OUT POOL_PRINT
*Str
,
204 IN BOOLEAN DisplayOnly
,
205 IN BOOLEAN AllowShortcuts
208 PCI_DEVICE_PATH
*Pci
;
211 CatPrint (Str
, L
"Pci(%x,%x)", Pci
->Function
, Pci
->Device
);
215 DevPathToTextPccard (
216 IN OUT POOL_PRINT
*Str
,
218 IN BOOLEAN DisplayOnly
,
219 IN BOOLEAN AllowShortcuts
222 PCCARD_DEVICE_PATH
*Pccard
;
225 CatPrint (Str
, L
"PcCard(%x)", Pccard
->FunctionNumber
);
229 DevPathToTextMemMap (
230 IN OUT POOL_PRINT
*Str
,
232 IN BOOLEAN DisplayOnly
,
233 IN BOOLEAN AllowShortcuts
236 MEMMAP_DEVICE_PATH
*MemMap
;
241 L
"MemoryMapped(%lx,%lx)",
242 MemMap
->StartingAddress
,
243 MemMap
->EndingAddress
248 DevPathToTextVendor (
249 IN OUT POOL_PRINT
*Str
,
251 IN BOOLEAN DisplayOnly
,
252 IN BOOLEAN AllowShortcuts
255 VENDOR_DEVICE_PATH
*Vendor
;
258 UINT32 FlowControlMap
;
261 Vendor
= (VENDOR_DEVICE_PATH
*) DevPath
;
262 switch (DevicePathType (&Vendor
->Header
)) {
263 case HARDWARE_DEVICE_PATH
:
267 case MESSAGING_DEVICE_PATH
:
269 if (AllowShortcuts
) {
270 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
271 CatPrint (Str
, L
"VenPcAnsi()");
273 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
274 CatPrint (Str
, L
"VenVt100()");
276 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
277 CatPrint (Str
, L
"VenVt100Plus()");
279 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
280 CatPrint (Str
, L
"VenUft8()");
282 } else if (CompareGuid (&Vendor
->Guid
, &mEfiDevicePathMessagingUartFlowControlGuid
)) {
283 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
284 switch (FlowControlMap
& 0x00000003) {
286 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
290 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
294 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
302 } else if (CompareGuid (&Vendor
->Guid
, &mEfiDevicePathMessagingSASGuid
)) {
306 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
307 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
308 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
310 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
311 if ((Info
& 0x0f) == 0) {
312 CatPrint (Str
, L
"NoTopology,0,0,0,");
313 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
317 (Info
& (0x1 << 4)) ? L
"SATA" : L
"SAS",
318 (Info
& (0x1 << 5)) ? L
"External" : L
"Internal",
319 (Info
& (0x1 << 6)) ? L
"Expanded" : L
"Direct"
321 if ((Info
& 0x0f) == 1) {
322 CatPrint (Str
, L
"0,");
324 CatPrint (Str
, L
"%x,", (Info
>> 8) & 0xff);
327 CatPrint (Str
, L
"0,0,0,0,");
330 CatPrint (Str
, L
"%x)", ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
332 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
333 CatPrint (Str
, L
"DebugPort()");
344 case MEDIA_DEVICE_PATH
:
353 CatPrint (Str
, L
"Ven%s(%g,", Type
, &Vendor
->Guid
);
354 for (Index
= 0; Index
< DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
); Index
++) {
355 CatPrint (Str
, L
"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
358 CatPrint (Str
, L
")");
362 DevPathToTextController (
363 IN OUT POOL_PRINT
*Str
,
365 IN BOOLEAN DisplayOnly
,
366 IN BOOLEAN AllowShortcuts
369 CONTROLLER_DEVICE_PATH
*Controller
;
371 Controller
= DevPath
;
375 (UINT16
*)Controller
->ControllerNumber
381 IN OUT POOL_PRINT
*Str
,
383 IN BOOLEAN DisplayOnly
,
384 IN BOOLEAN AllowShortcuts
387 ACPI_HID_DEVICE_PATH
*Acpi
;
390 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
391 if (AllowShortcuts
) {
392 switch (EISA_ID_TO_NUM (Acpi
->HID
)) {
394 CatPrint (Str
, L
"PciRoot(%x)", Acpi
->UID
);
398 CatPrint (Str
, L
"Floppy(%x)", Acpi
->UID
);
402 CatPrint (Str
, L
"Keyboard(%x)", Acpi
->UID
);
406 CatPrint (Str
, L
"Serial(%x)", Acpi
->UID
);
410 CatPrint (Str
, L
"ParallelPort(%x)", Acpi
->UID
);
420 CatPrint (Str
, L
"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi
->HID
), Acpi
->UID
);
422 CatPrint (Str
, L
"Acpi(%08x,%x)", Acpi
->HID
, Acpi
->UID
);
426 #define NextStrA(a) ((UINT8 *) (((UINT8 *) (a)) + AsciiStrLen (a) + 1))
429 DevPathToTextExtAcpi (
430 IN OUT POOL_PRINT
*Str
,
432 IN BOOLEAN DisplayOnly
,
433 IN BOOLEAN AllowShortcuts
436 ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR
*AcpiExt
;
440 if (AllowShortcuts
) {
441 if ((*(AcpiExt
->HidUidCidStr
) == '\0') &&
442 (*(NextStrA (NextStrA (AcpiExt
->HidUidCidStr
))) == '\0') &&
445 if ((AcpiExt
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
448 L
"AcpiExp(PNP%04x,%x,%a)",
449 EISA_ID_TO_NUM (AcpiExt
->HID
),
451 NextStrA (AcpiExt
->HidUidCidStr
)
456 L
"AcpiExp(%08x,%x,%a)",
459 NextStrA (AcpiExt
->HidUidCidStr
)
466 if ((AcpiExt
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
469 L
"AcpiEx(PNP%04x,%x,%x,%a,%a,%a)",
470 EISA_ID_TO_NUM (AcpiExt
->HID
),
473 AcpiExt
->HidUidCidStr
,
474 NextStrA (NextStrA (AcpiExt
->HidUidCidStr
)),
475 NextStrA (AcpiExt
->HidUidCidStr
)
480 L
"AcpiEx(%08x,%x,%x,%a,%a,%a)",
484 AcpiExt
->HidUidCidStr
,
485 NextStrA (NextStrA (AcpiExt
->HidUidCidStr
)),
486 NextStrA (AcpiExt
->HidUidCidStr
)
493 IN OUT POOL_PRINT
*Str
,
495 IN BOOLEAN DisplayOnly
,
496 IN BOOLEAN AllowShortcuts
499 ATAPI_DEVICE_PATH
*Atapi
;
504 CatPrint (Str
, L
"Ata(%x)", Atapi
->Lun
);
509 Atapi
->PrimarySecondary
? L
"Secondary" : L
"Primary",
510 Atapi
->SlaveMaster
? L
"Slave" : L
"Master",
518 IN OUT POOL_PRINT
*Str
,
520 IN BOOLEAN DisplayOnly
,
521 IN BOOLEAN AllowShortcuts
524 SCSI_DEVICE_PATH
*Scsi
;
527 CatPrint (Str
, L
"Scsi(%x,%x)", Scsi
->Pun
, Scsi
->Lun
);
532 IN OUT POOL_PRINT
*Str
,
534 IN BOOLEAN DisplayOnly
,
535 IN BOOLEAN AllowShortcuts
538 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
541 CatPrint (Str
, L
"Fibre(%lx,%lx)", Fibre
->WWN
, Fibre
->Lun
);
546 IN OUT POOL_PRINT
*Str
,
548 IN BOOLEAN DisplayOnly
,
549 IN BOOLEAN AllowShortcuts
552 F1394_DEVICE_PATH
*F1394
;
555 CatPrint (Str
, L
"I1394(%lx)", F1394
->Guid
);
560 IN OUT POOL_PRINT
*Str
,
562 IN BOOLEAN DisplayOnly
,
563 IN BOOLEAN AllowShortcuts
566 USB_DEVICE_PATH
*Usb
;
569 CatPrint (Str
, L
"USB(%x,%x)", Usb
->ParentPortNumber
, Usb
->InterfaceNumber
);
573 DevPathToTextUsbWWID (
574 IN OUT POOL_PRINT
*Str
,
576 IN BOOLEAN DisplayOnly
,
577 IN BOOLEAN AllowShortcuts
580 USB_WWID_DEVICE_PATH
*UsbWWId
;
585 L
"UsbWwid(%x,%x,%x,\"WWID\")",
588 UsbWWId
->InterfaceNumber
593 DevPathToTextLogicalUnit (
594 IN OUT POOL_PRINT
*Str
,
596 IN BOOLEAN DisplayOnly
,
597 IN BOOLEAN AllowShortcuts
600 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
602 LogicalUnit
= DevPath
;
603 CatPrint (Str
, L
"Unit(%x)", LogicalUnit
->Lun
);
607 DevPathToTextUsbClass (
608 IN OUT POOL_PRINT
*Str
,
610 IN BOOLEAN DisplayOnly
,
611 IN BOOLEAN AllowShortcuts
614 USB_CLASS_DEVICE_PATH
*UsbClass
;
618 if (AllowShortcuts
== TRUE
) {
619 switch (UsbClass
->DeviceClass
) {
623 L
"UsbAudio(%x,%x,%x,%x)",
626 UsbClass
->DeviceSubClass
,
627 UsbClass
->DeviceProtocol
634 L
"UsbCDCControl(%x,%x,%x,%x)",
637 UsbClass
->DeviceSubClass
,
638 UsbClass
->DeviceProtocol
645 L
"UsbHID(%x,%x,%x,%x)",
648 UsbClass
->DeviceSubClass
,
649 UsbClass
->DeviceProtocol
656 L
"UsbImage(%x,%x,%x,%x)",
659 UsbClass
->DeviceSubClass
,
660 UsbClass
->DeviceProtocol
667 L
"UsbPrinter(%x,%x,%x,%x)",
670 UsbClass
->DeviceSubClass
,
671 UsbClass
->DeviceProtocol
678 L
"UsbMassStorage(%x,%x,%x,%x)",
681 UsbClass
->DeviceSubClass
,
682 UsbClass
->DeviceProtocol
689 L
"UsbHub(%x,%x,%x,%x)",
692 UsbClass
->DeviceSubClass
,
693 UsbClass
->DeviceProtocol
700 L
"UsbCDCData(%x,%x,%x,%x)",
703 UsbClass
->DeviceSubClass
,
704 UsbClass
->DeviceProtocol
711 L
"UsbSmartCard(%x,%x,%x,%x)",
714 UsbClass
->DeviceSubClass
,
715 UsbClass
->DeviceProtocol
722 L
"UsbVideo(%x,%x,%x,%x)",
725 UsbClass
->DeviceSubClass
,
726 UsbClass
->DeviceProtocol
733 L
"UsbDiagnostic(%x,%x,%x,%x)",
736 UsbClass
->DeviceSubClass
,
737 UsbClass
->DeviceProtocol
744 L
"UsbWireless(%x,%x,%x,%x)",
747 UsbClass
->DeviceSubClass
,
748 UsbClass
->DeviceProtocol
753 if (UsbClass
->DeviceSubClass
== 1) {
756 L
"UsbDeviceFirmwareUpdate(%x,%x,%x)",
759 UsbClass
->DeviceProtocol
761 } else if (UsbClass
->DeviceSubClass
== 2) {
764 L
"UsbIrdaBridge(%x,%x,%x)",
767 UsbClass
->DeviceProtocol
769 } else if (UsbClass
->DeviceSubClass
== 3) {
772 L
"UsbTestAndMeasurement(%x,%x,%x)",
775 UsbClass
->DeviceProtocol
789 L
"UsbClass(%x,%x,%x,%x,%x)",
792 UsbClass
->DeviceClass
,
793 UsbClass
->DeviceSubClass
,
794 UsbClass
->DeviceProtocol
800 IN OUT POOL_PRINT
*Str
,
802 IN BOOLEAN DisplayOnly
,
803 IN BOOLEAN AllowShortcuts
806 I2O_DEVICE_PATH
*I2O
;
809 CatPrint (Str
, L
"I2O(%x)", I2O
->Tid
);
813 DevPathToTextMacAddr (
814 IN OUT POOL_PRINT
*Str
,
816 IN BOOLEAN DisplayOnly
,
817 IN BOOLEAN AllowShortcuts
820 MAC_ADDR_DEVICE_PATH
*MAC
;
826 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
827 if (MAC
->IfType
== 0x01 || MAC
->IfType
== 0x00) {
831 CatPrint (Str
, L
"MAC(");
833 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
834 CatPrint (Str
, L
"%02x", MAC
->MacAddress
.Addr
[Index
]);
837 CatPrint (Str
, L
",%x)", MAC
->IfType
);
842 IN OUT POOL_PRINT
*Str
,
844 IN BOOLEAN DisplayOnly
,
845 IN BOOLEAN AllowShortcuts
848 IPv4_DEVICE_PATH
*IP
;
851 if (DisplayOnly
== TRUE
) {
854 L
"IPv4(%d.%d.%d.%d)",
855 IP
->RemoteIpAddress
.Addr
[0],
856 IP
->RemoteIpAddress
.Addr
[1],
857 IP
->RemoteIpAddress
.Addr
[2],
858 IP
->RemoteIpAddress
.Addr
[3]
865 L
"IPv4(%d.%d.%d.%d,%s,%s,%d.%d.%d.%d)",
866 IP
->RemoteIpAddress
.Addr
[0],
867 IP
->RemoteIpAddress
.Addr
[1],
868 IP
->RemoteIpAddress
.Addr
[2],
869 IP
->RemoteIpAddress
.Addr
[3],
870 IP
->Protocol
? L
"TCP" : L
"UDP",
871 (IP
->StaticIpAddress
== TRUE
) ? L
"Static" : L
"DHCP",
872 IP
->LocalIpAddress
.Addr
[0],
873 IP
->LocalIpAddress
.Addr
[1],
874 IP
->LocalIpAddress
.Addr
[2],
875 IP
->LocalIpAddress
.Addr
[3]
881 IN OUT POOL_PRINT
*Str
,
883 IN BOOLEAN DisplayOnly
,
884 IN BOOLEAN AllowShortcuts
887 IPv6_DEVICE_PATH
*IP
;
890 if (DisplayOnly
== TRUE
) {
893 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
894 IP
->RemoteIpAddress
.Addr
[0],
895 IP
->RemoteIpAddress
.Addr
[1],
896 IP
->RemoteIpAddress
.Addr
[2],
897 IP
->RemoteIpAddress
.Addr
[3],
898 IP
->RemoteIpAddress
.Addr
[4],
899 IP
->RemoteIpAddress
.Addr
[5],
900 IP
->RemoteIpAddress
.Addr
[6],
901 IP
->RemoteIpAddress
.Addr
[7],
902 IP
->RemoteIpAddress
.Addr
[8],
903 IP
->RemoteIpAddress
.Addr
[9],
904 IP
->RemoteIpAddress
.Addr
[10],
905 IP
->RemoteIpAddress
.Addr
[11],
906 IP
->RemoteIpAddress
.Addr
[12],
907 IP
->RemoteIpAddress
.Addr
[13],
908 IP
->RemoteIpAddress
.Addr
[14],
909 IP
->RemoteIpAddress
.Addr
[15]
916 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,%s,%s,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
917 IP
->RemoteIpAddress
.Addr
[0],
918 IP
->RemoteIpAddress
.Addr
[1],
919 IP
->RemoteIpAddress
.Addr
[2],
920 IP
->RemoteIpAddress
.Addr
[3],
921 IP
->RemoteIpAddress
.Addr
[4],
922 IP
->RemoteIpAddress
.Addr
[5],
923 IP
->RemoteIpAddress
.Addr
[6],
924 IP
->RemoteIpAddress
.Addr
[7],
925 IP
->RemoteIpAddress
.Addr
[8],
926 IP
->RemoteIpAddress
.Addr
[9],
927 IP
->RemoteIpAddress
.Addr
[10],
928 IP
->RemoteIpAddress
.Addr
[11],
929 IP
->RemoteIpAddress
.Addr
[12],
930 IP
->RemoteIpAddress
.Addr
[13],
931 IP
->RemoteIpAddress
.Addr
[14],
932 IP
->RemoteIpAddress
.Addr
[15],
933 IP
->Protocol
? L
"TCP" : L
"UDP",
934 (IP
->StaticIpAddress
== TRUE
) ? L
"Static" : L
"DHCP",
935 IP
->LocalIpAddress
.Addr
[0],
936 IP
->LocalIpAddress
.Addr
[1],
937 IP
->LocalIpAddress
.Addr
[2],
938 IP
->LocalIpAddress
.Addr
[3],
939 IP
->LocalIpAddress
.Addr
[4],
940 IP
->LocalIpAddress
.Addr
[5],
941 IP
->LocalIpAddress
.Addr
[6],
942 IP
->LocalIpAddress
.Addr
[7],
943 IP
->LocalIpAddress
.Addr
[8],
944 IP
->LocalIpAddress
.Addr
[9],
945 IP
->LocalIpAddress
.Addr
[10],
946 IP
->LocalIpAddress
.Addr
[11],
947 IP
->LocalIpAddress
.Addr
[12],
948 IP
->LocalIpAddress
.Addr
[13],
949 IP
->LocalIpAddress
.Addr
[14],
950 IP
->LocalIpAddress
.Addr
[15]
955 DevPathToTextInfiniBand (
956 IN OUT POOL_PRINT
*Str
,
958 IN BOOLEAN DisplayOnly
,
959 IN BOOLEAN AllowShortcuts
962 INFINIBAND_DEVICE_PATH
*InfiniBand
;
964 InfiniBand
= DevPath
;
967 L
"Infiniband(%x,%g,%lx,%lx,%lx)",
968 InfiniBand
->ResourceFlags
,
970 InfiniBand
->ServiceId
,
971 InfiniBand
->TargetPortId
,
978 IN OUT POOL_PRINT
*Str
,
980 IN BOOLEAN DisplayOnly
,
981 IN BOOLEAN AllowShortcuts
984 UART_DEVICE_PATH
*Uart
;
988 switch (Uart
->Parity
) {
1018 if (Uart
->BaudRate
== 0) {
1019 CatPrint (Str
, L
"Uart(DEFAULT,");
1021 CatPrint (Str
, L
"Uart(%ld,", Uart
->BaudRate
);
1024 if (Uart
->DataBits
== 0) {
1025 CatPrint (Str
, L
"DEFAULT,");
1027 CatPrint (Str
, L
"%d,", Uart
->DataBits
);
1030 CatPrint (Str
, L
"%c,", Parity
);
1032 switch (Uart
->StopBits
) {
1034 CatPrint (Str
, L
"D)");
1038 CatPrint (Str
, L
"1)");
1042 CatPrint (Str
, L
"1.5)");
1046 CatPrint (Str
, L
"2)");
1050 CatPrint (Str
, L
"x)");
1056 DevPathToTextiSCSI (
1057 IN OUT POOL_PRINT
*Str
,
1059 IN BOOLEAN DisplayOnly
,
1060 IN BOOLEAN AllowShortcuts
1063 ISCSI_DEVICE_PATH_WITH_NAME
*iSCSI
;
1069 L
"iSCSI(%s,%x,%lx,",
1070 iSCSI
->iSCSITargetName
,
1071 iSCSI
->TargetPortalGroupTag
,
1075 Options
= iSCSI
->LoginOption
;
1076 CatPrint (Str
, L
"%s,", ((Options
>> 1) & 0x0001) ? L
"CRC32C" : L
"None");
1077 CatPrint (Str
, L
"%s,", ((Options
>> 3) & 0x0001) ? L
"CRC32C" : L
"None");
1078 if ((Options
>> 11) & 0x0001) {
1079 CatPrint (Str
, L
"%s,", L
"None");
1080 } else if ((Options
>> 12) & 0x0001) {
1081 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
1083 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
1087 CatPrint (Str
, L
"%s)", (iSCSI
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
1091 DevPathToTextHardDrive (
1092 IN OUT POOL_PRINT
*Str
,
1094 IN BOOLEAN DisplayOnly
,
1095 IN BOOLEAN AllowShortcuts
1098 HARDDRIVE_DEVICE_PATH
*Hd
;
1101 switch (Hd
->SignatureType
) {
1106 Hd
->PartitionNumber
,
1111 case SIGNATURE_TYPE_MBR
:
1115 Hd
->PartitionNumber
,
1117 *((UINT32
*) (&(Hd
->Signature
[0])))
1121 case SIGNATURE_TYPE_GUID
:
1125 Hd
->PartitionNumber
,
1127 (EFI_GUID
*) &(Hd
->Signature
[0])
1135 CatPrint (Str
, L
"%lx,%lx)", Hd
->PartitionStart
, Hd
->PartitionSize
);
1139 DevPathToTextCDROM (
1140 IN OUT POOL_PRINT
*Str
,
1142 IN BOOLEAN DisplayOnly
,
1143 IN BOOLEAN AllowShortcuts
1146 CDROM_DEVICE_PATH
*Cd
;
1149 if (DisplayOnly
== TRUE
) {
1150 CatPrint (Str
, L
"CDROM(%x)", Cd
->BootEntry
);
1154 CatPrint (Str
, L
"CDROM(%x,%lx,%lx)", Cd
->BootEntry
, Cd
->PartitionStart
, Cd
->PartitionSize
);
1158 DevPathToTextFilePath (
1159 IN OUT POOL_PRINT
*Str
,
1161 IN BOOLEAN DisplayOnly
,
1162 IN BOOLEAN AllowShortcuts
1165 FILEPATH_DEVICE_PATH
*Fp
;
1168 CatPrint (Str
, L
"%s", Fp
->PathName
);
1172 DevPathToTextMediaProtocol (
1173 IN OUT POOL_PRINT
*Str
,
1175 IN BOOLEAN DisplayOnly
,
1176 IN BOOLEAN AllowShortcuts
1179 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1181 MediaProt
= DevPath
;
1182 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1187 IN OUT POOL_PRINT
*Str
,
1189 IN BOOLEAN DisplayOnly
,
1190 IN BOOLEAN AllowShortcuts
1193 BBS_BBS_DEVICE_PATH
*Bbs
;
1197 switch (Bbs
->DeviceType
) {
1198 case BBS_TYPE_FLOPPY
:
1202 case BBS_TYPE_HARDDRIVE
:
1206 case BBS_TYPE_CDROM
:
1210 case BBS_TYPE_PCMCIA
:
1218 case BBS_TYPE_EMBEDDED_NETWORK
:
1227 CatPrint (Str
, L
"BBS(%s,%a", Type
, Bbs
->String
);
1229 if (DisplayOnly
== TRUE
) {
1230 CatPrint (Str
, L
")");
1234 CatPrint (Str
, L
",%x)", Bbs
->StatusFlag
);
1238 DevPathToTextEndInstance (
1239 IN OUT POOL_PRINT
*Str
,
1241 IN BOOLEAN DisplayOnly
,
1242 IN BOOLEAN AllowShortcuts
1245 CatPrint (Str
, L
",");
1249 DevPathToTextNodeUnknown (
1250 IN OUT POOL_PRINT
*Str
,
1252 IN BOOLEAN DisplayOnly
,
1253 IN BOOLEAN AllowShortcuts
1256 CatPrint (Str
, L
"?");
1259 DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
[] = {
1260 HARDWARE_DEVICE_PATH
,
1263 HARDWARE_DEVICE_PATH
,
1265 DevPathToTextPccard
,
1266 HARDWARE_DEVICE_PATH
,
1268 DevPathToTextMemMap
,
1269 HARDWARE_DEVICE_PATH
,
1271 DevPathToTextVendor
,
1272 HARDWARE_DEVICE_PATH
,
1274 DevPathToTextController
,
1280 DevPathToTextExtAcpi
,
1281 MESSAGING_DEVICE_PATH
,
1284 MESSAGING_DEVICE_PATH
,
1287 MESSAGING_DEVICE_PATH
,
1288 MSG_FIBRECHANNEL_DP
,
1290 MESSAGING_DEVICE_PATH
,
1293 MESSAGING_DEVICE_PATH
,
1296 MESSAGING_DEVICE_PATH
,
1298 DevPathToTextUsbWWID
,
1299 MESSAGING_DEVICE_PATH
,
1300 MSG_DEVICE_LOGICAL_UNIT_DP
,
1301 DevPathToTextLogicalUnit
,
1302 MESSAGING_DEVICE_PATH
,
1304 DevPathToTextUsbClass
,
1305 MESSAGING_DEVICE_PATH
,
1308 MESSAGING_DEVICE_PATH
,
1310 DevPathToTextMacAddr
,
1311 MESSAGING_DEVICE_PATH
,
1314 MESSAGING_DEVICE_PATH
,
1317 MESSAGING_DEVICE_PATH
,
1319 DevPathToTextInfiniBand
,
1320 MESSAGING_DEVICE_PATH
,
1323 MESSAGING_DEVICE_PATH
,
1325 DevPathToTextVendor
,
1326 MESSAGING_DEVICE_PATH
,
1331 DevPathToTextHardDrive
,
1337 DevPathToTextVendor
,
1340 DevPathToTextFilePath
,
1343 DevPathToTextMediaProtocol
,
1346 DevPathToTextFilePath
,
1350 END_DEVICE_PATH_TYPE
,
1351 END_INSTANCE_DEVICE_PATH_SUBTYPE
,
1352 DevPathToTextEndInstance
,
1359 ConvertDeviceNodeToText (
1360 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
1361 IN BOOLEAN DisplayOnly
,
1362 IN BOOLEAN AllowShortcuts
1366 Routine Description:
1367 Convert a device node to its text representation.
1370 DeviceNode - Points to the device node to be converted.
1371 DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
1372 of the display node is used, where applicable. If DisplayOnly
1373 is FALSE, then the longer text representation of the display node
1375 AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
1376 representation for a device node can be used, where applicable.
1379 A pointer - a pointer to the allocated text representation of the device node.
1380 NULL - if DeviceNode is NULL or there was insufficient memory.
1387 VOID (*DumpNode
)(POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1389 if (DeviceNode
== NULL
) {
1393 ZeroMem (&Str
, sizeof (Str
));
1396 // Process the device path node
1399 for (Index
= 0; DevPathToTextTable
[Index
].Function
!= NULL
; Index
++) {
1400 if (DevicePathType (DeviceNode
) == DevPathToTextTable
[Index
].Type
&&
1401 DevicePathSubType (DeviceNode
) == DevPathToTextTable
[Index
].SubType
1403 DumpNode
= DevPathToTextTable
[Index
].Function
;
1408 // If not found, use a generic function
1410 if (DumpNode
== NULL
) {
1411 DumpNode
= DevPathToTextNodeUnknown
;
1417 DumpNode (&Str
, (VOID
*) DeviceNode
, DisplayOnly
, AllowShortcuts
);
1420 // Shrink pool used for string allocation
1422 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1423 Str
.Str
= ReallocatePool (Str
.Str
, NewSize
, NewSize
);
1424 ASSERT (Str
.Str
!= NULL
);
1425 Str
.Str
[Str
.Len
] = 0;
1430 ConvertDevicePathToText (
1431 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
1432 IN BOOLEAN DisplayOnly
,
1433 IN BOOLEAN AllowShortcuts
1437 Routine Description:
1438 Convert a device path to its text representation.
1441 DeviceNode - Points to the device path to be converted.
1442 DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
1443 of the display node is used, where applicable. If DisplayOnly
1444 is FALSE, then the longer text representation of the display node
1446 AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
1447 representation for a device node can be used, where applicable.
1450 A pointer - a pointer to the allocated text representation of the device path.
1451 NULL - if DeviceNode is NULL or there was insufficient memory.
1456 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1457 EFI_DEVICE_PATH_PROTOCOL
*UnpackDevPath
;
1460 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
1462 if (DevicePath
== NULL
) {
1466 ZeroMem (&Str
, sizeof (Str
));
1469 // Unpacked the device path
1471 UnpackDevPath
= UnpackDevicePath ((EFI_DEVICE_PATH_PROTOCOL
*) DevicePath
);
1472 ASSERT (UnpackDevPath
!= NULL
);
1475 // Process each device path node
1477 DevPathNode
= UnpackDevPath
;
1478 while (!IsDevicePathEnd (DevPathNode
)) {
1480 // Find the handler to dump this device path node
1483 for (Index
= 0; DevPathToTextTable
[Index
].Function
; Index
+= 1) {
1485 if (DevicePathType (DevPathNode
) == DevPathToTextTable
[Index
].Type
&&
1486 DevicePathSubType (DevPathNode
) == DevPathToTextTable
[Index
].SubType
1488 DumpNode
= DevPathToTextTable
[Index
].Function
;
1493 // If not found, use a generic function
1496 DumpNode
= DevPathToTextNodeUnknown
;
1499 // Put a path seperator in if needed
1501 if (Str
.Len
&& DumpNode
!= DevPathToTextEndInstance
) {
1502 if (*(Str
.Str
+ Str
.Len
/ sizeof (CHAR16
) - 1) != L
',') {
1503 CatPrint (&Str
, L
"/");
1507 // Print this node of the device path
1509 DumpNode (&Str
, DevPathNode
, DisplayOnly
, AllowShortcuts
);
1512 // Next device path node
1514 DevPathNode
= NextDevicePathNode (DevPathNode
);
1517 // Shrink pool used for string allocation
1519 gBS
->FreePool (UnpackDevPath
);
1521 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1522 Str
.Str
= ReallocatePool (Str
.Str
, NewSize
, NewSize
);
1523 ASSERT (Str
.Str
!= NULL
);
1524 Str
.Str
[Str
.Len
] = 0;