2 BDS internal function define the default device path string, it can be
3 replaced by platform device path.
5 Copyright (c) 2004 - 2008, Intel Corporation. <BR>
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "InternalBdsLib.h"
19 Concatenates a formatted unicode string to allocated pool.
20 The caller must free the resulting buffer.
22 @param Str Tracks the allocated pool, size in use, and amount of pool
24 @param fmt The format string
26 @param ... Variable argument list.
28 @return Allocated buffer with the formatted string printed in it.
29 The caller must free the allocated buffer. The buffer
30 allocation is not packed.
36 IN OUT POOL_PRINT
*Str
,
45 AppendStr
= AllocateZeroPool (0x1000);
46 if (AppendStr
== NULL
) {
51 UnicodeVSPrint (AppendStr
, 0x1000, fmt
, Args
);
53 if (NULL
== Str
->str
) {
54 StringSize
= StrSize (AppendStr
);
55 Str
->str
= AllocateZeroPool (StringSize
);
56 ASSERT (Str
->str
!= NULL
);
58 StringSize
= StrSize (AppendStr
);
59 StringSize
+= (StrSize (Str
->str
) - sizeof (UINT16
));
61 Str
->str
= ReallocatePool (
66 ASSERT (Str
->str
!= NULL
);
69 Str
->maxlen
= MAX_CHAR
* sizeof (UINT16
);
70 if (StringSize
< Str
->maxlen
) {
71 StrCat (Str
->str
, AppendStr
);
72 Str
->len
= StringSize
- sizeof (UINT16
);
80 Convert Device Path to a Unicode string for printing.
82 @param Str The buffer holding the output string.
83 This buffer contains the length of the
84 string and the maixmum length reserved
85 for the string buffer.
86 @param DevPath The device path.
91 IN OUT POOL_PRINT
*Str
,
98 CatPrint (Str
, L
"Pci(%x|%x)", (UINTN
) Pci
->Device
, (UINTN
) Pci
->Function
);
102 Convert Device Path to a Unicode string for printing.
104 @param Str The buffer holding the output string.
105 This buffer contains the length of the
106 string and the maixmum length reserved
107 for the string buffer.
108 @param DevPath The device path.
113 IN OUT POOL_PRINT
*Str
,
117 PCCARD_DEVICE_PATH
*Pccard
;
120 CatPrint (Str
, L
"Pcmcia(Function%x)", (UINTN
) Pccard
->FunctionNumber
);
124 Convert Device Path to a Unicode string for printing.
126 @param Str The buffer holding the output string.
127 This buffer contains the length of the
128 string and the maixmum length reserved
129 for the string buffer.
130 @param DevPath The device path.
135 IN OUT POOL_PRINT
*Str
,
139 MEMMAP_DEVICE_PATH
*MemMap
;
144 L
"MemMap(%d:%lx-%lx)",
146 MemMap
->StartingAddress
,
147 MemMap
->EndingAddress
152 Convert Device Path to a Unicode string for printing.
154 @param Str The buffer holding the output string.
155 This buffer contains the length of the
156 string and the maixmum length reserved
157 for the string buffer.
158 @param DevPath The device path.
163 IN OUT POOL_PRINT
*Str
,
167 CONTROLLER_DEVICE_PATH
*Controller
;
169 Controller
= DevPath
;
170 CatPrint (Str
, L
"Ctrl(%d)", (UINTN
) Controller
->ControllerNumber
);
175 Convert Device Path to a Unicode string for printing.
177 @param Str The buffer holding the output string.
178 This buffer contains the length of the
179 string and the maixmum length reserved
180 for the string buffer.
181 @param DevPath The device path.
187 IN OUT POOL_PRINT
*Str
,
191 VENDOR_DEVICE_PATH
*Vendor
;
195 UINT32 FlowControlMap
;
201 switch (DevicePathType (&Vendor
->Header
)) {
202 case HARDWARE_DEVICE_PATH
:
206 case MESSAGING_DEVICE_PATH
:
208 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
209 CatPrint (Str
, L
"VenPcAnsi()");
211 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
212 CatPrint (Str
, L
"VenVt100()");
214 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
215 CatPrint (Str
, L
"VenVt100Plus()");
217 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
218 CatPrint (Str
, L
"VenUft8()");
220 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
221 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
222 switch (FlowControlMap
& 0x00000003) {
224 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
228 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
232 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
241 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
245 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
246 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
247 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
249 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
250 if ((Info
& 0x0f) == 0) {
251 CatPrint (Str
, L
"NoTopology,0,0,0,");
252 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
256 ((Info
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
257 ((Info
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
258 ((Info
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
260 if ((Info
& 0x0f) == 1) {
261 CatPrint (Str
, L
"0,");
263 CatPrint (Str
, L
"%x,", (UINTN
) ((Info
>> 8) & 0xff));
266 CatPrint (Str
, L
"0,0,0,0,");
269 CatPrint (Str
, L
"%x)", (UINTN
) ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
272 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
273 CatPrint (Str
, L
"DebugPort()");
278 case MEDIA_DEVICE_PATH
:
287 CatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
288 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
289 if (DataLength
> 0) {
290 CatPrint (Str
, L
",");
291 for (Index
= 0; Index
< DataLength
; Index
++) {
292 CatPrint (Str
, L
"%02x", (UINTN
) ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
295 CatPrint (Str
, L
")");
299 Convert Device Path to a Unicode string for printing.
301 @param Str The buffer holding the output string.
302 This buffer contains the length of the
303 string and the maixmum length reserved
304 for the string buffer.
305 @param DevPath The device path.
310 IN OUT POOL_PRINT
*Str
,
314 ACPI_HID_DEVICE_PATH
*Acpi
;
317 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
318 CatPrint (Str
, L
"Acpi(PNP%04x,%x)", (UINTN
) EISA_ID_TO_NUM (Acpi
->HID
), (UINTN
) Acpi
->UID
);
320 CatPrint (Str
, L
"Acpi(%08x,%x)", (UINTN
) Acpi
->HID
, (UINTN
) Acpi
->UID
);
325 Convert Device Path to a Unicode string for printing.
327 @param Str The buffer holding the output string.
328 This buffer contains the length of the
329 string and the maixmum length reserved
330 for the string buffer.
331 @param DevPath The device path.
335 DevPathExtendedAcpi (
336 IN OUT POOL_PRINT
*Str
,
340 ACPI_EXTENDED_HID_DEVICE_PATH
*ExtendedAcpi
;
343 // Index for HID, UID and CID strings, 0 for non-exist
353 ASSERT (Str
!= NULL
);
354 ASSERT (DevPath
!= NULL
);
359 ExtendedAcpi
= DevPath
;
360 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) ExtendedAcpi
);
362 ASSERT (Length
>= 19);
363 AsChar8Array
= (CHAR8
*) ExtendedAcpi
;
369 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
372 if (Index
> Anchor
) {
378 Anchor
= (UINT16
) (Index
+ 1);
379 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
382 if (Index
> Anchor
) {
388 Anchor
= (UINT16
) (Index
+ 1);
389 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
392 if (Index
> Anchor
) {
396 if (HIDSTRIdx
== 0 && CIDSTRIdx
== 0 && ExtendedAcpi
->UID
== 0) {
397 CatPrint (Str
, L
"AcpiExp(");
398 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
399 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
401 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
403 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
404 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
406 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
408 if (UIDSTRIdx
!= 0) {
409 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
411 CatPrint (Str
, L
"\"\")");
414 CatPrint (Str
, L
"AcpiEx(");
415 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
416 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
418 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
420 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
421 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
423 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
425 CatPrint (Str
, L
"%x,", (UINTN
) ExtendedAcpi
->UID
);
427 if (HIDSTRIdx
!= 0) {
428 CatPrint (Str
, L
"%a,", AsChar8Array
+ HIDSTRIdx
);
430 CatPrint (Str
, L
"\"\",");
432 if (CIDSTRIdx
!= 0) {
433 CatPrint (Str
, L
"%a,", AsChar8Array
+ CIDSTRIdx
);
435 CatPrint (Str
, L
"\"\",");
437 if (UIDSTRIdx
!= 0) {
438 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
440 CatPrint (Str
, L
"\"\")");
447 Convert Device Path to a Unicode string for printing.
449 @param Str The buffer holding the output string.
450 This buffer contains the length of the
451 string and the maixmum length reserved
452 for the string buffer.
453 @param DevPath The device path.
458 IN OUT POOL_PRINT
*Str
,
462 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
465 UINT16 AdditionalAdrCount
;
468 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
469 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
471 CatPrint (Str
, L
"AcpiAdr(%x", (UINTN
) AcpiAdr
->ADR
);
472 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
473 CatPrint (Str
, L
",%x", (UINTN
) *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
475 CatPrint (Str
, L
")");
479 Convert Device Path to a Unicode string for printing.
481 @param Str The buffer holding the output string.
482 This buffer contains the length of the
483 string and the maixmum length reserved
484 for the string buffer.
485 @param DevPath The device path.
490 IN OUT POOL_PRINT
*Str
,
494 ATAPI_DEVICE_PATH
*Atapi
;
500 Atapi
->PrimarySecondary
? L
"Secondary" : L
"Primary",
501 Atapi
->SlaveMaster
? L
"Slave" : L
"Master"
506 Convert Device Path to a Unicode string for printing.
508 @param Str The buffer holding the output string.
509 This buffer contains the length of the
510 string and the maixmum length reserved
511 for the string buffer.
512 @param DevPath The device path.
517 IN OUT POOL_PRINT
*Str
,
521 SCSI_DEVICE_PATH
*Scsi
;
524 CatPrint (Str
, L
"Scsi(Pun%x,Lun%x)", (UINTN
) Scsi
->Pun
, (UINTN
) Scsi
->Lun
);
528 Convert Device Path to a Unicode string for printing.
530 @param Str The buffer holding the output string.
531 This buffer contains the length of the
532 string and the maixmum length reserved
533 for the string buffer.
534 @param DevPath The device path.
539 IN OUT POOL_PRINT
*Str
,
543 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
546 CatPrint (Str
, L
"Fibre(Wwn%lx,Lun%x)", Fibre
->WWN
, Fibre
->Lun
);
550 Convert Device Path to a Unicode string for printing.
552 @param Str The buffer holding the output string.
553 This buffer contains the length of the
554 string and the maixmum length reserved
555 for the string buffer.
556 @param DevPath The device path.
561 IN OUT POOL_PRINT
*Str
,
565 F1394_DEVICE_PATH
*F1394Path
;
568 CatPrint (Str
, L
"1394(%g)", &F1394Path
->Guid
);
572 Convert Device Path to a Unicode string for printing.
574 @param Str The buffer holding the output string.
575 This buffer contains the length of the
576 string and the maixmum length reserved
577 for the string buffer.
578 @param DevPath The device path.
583 IN OUT POOL_PRINT
*Str
,
587 USB_DEVICE_PATH
*Usb
;
590 CatPrint (Str
, L
"Usb(%x,%x)", (UINTN
) Usb
->ParentPortNumber
, (UINTN
) Usb
->InterfaceNumber
);
594 Convert Device Path to a Unicode string for printing.
596 @param Str The buffer holding the output string.
597 This buffer contains the length of the
598 string and the maixmum length reserved
599 for the string buffer.
600 @param DevPath The device path.
605 IN OUT POOL_PRINT
*Str
,
609 USB_WWID_DEVICE_PATH
*UsbWWId
;
614 L
"UsbWwid(%x,%x,%x,\"WWID\")",
615 (UINTN
) UsbWWId
->VendorId
,
616 (UINTN
) UsbWWId
->ProductId
,
617 (UINTN
) UsbWWId
->InterfaceNumber
622 Convert Device Path to a Unicode string for printing.
624 @param Str The buffer holding the output string.
625 This buffer contains the length of the
626 string and the maixmum length reserved
627 for the string buffer.
628 @param DevPath The device path.
633 IN OUT POOL_PRINT
*Str
,
637 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
639 LogicalUnit
= DevPath
;
640 CatPrint (Str
, L
"Unit(%x)", (UINTN
) LogicalUnit
->Lun
);
644 Convert Device Path to a Unicode string for printing.
646 @param Str The buffer holding the output string.
647 This buffer contains the length of the
648 string and the maixmum length reserved
649 for the string buffer.
650 @param DevPath The device path.
655 IN OUT POOL_PRINT
*Str
,
659 USB_CLASS_DEVICE_PATH
*UsbClass
;
664 L
"Usb Class(%x,%x,%x,%x,%x)",
665 (UINTN
) UsbClass
->VendorId
,
666 (UINTN
) UsbClass
->ProductId
,
667 (UINTN
) UsbClass
->DeviceClass
,
668 (UINTN
) UsbClass
->DeviceSubClass
,
669 (UINTN
) UsbClass
->DeviceProtocol
674 Convert Device Path to a Unicode string for printing.
676 @param Str The buffer holding the output string.
677 This buffer contains the length of the
678 string and the maixmum length reserved
679 for the string buffer.
680 @param DevPath The device path.
685 IN OUT POOL_PRINT
*Str
,
689 SATA_DEVICE_PATH
*Sata
;
695 (UINTN
) Sata
->HBAPortNumber
,
696 (UINTN
) Sata
->PortMultiplierPortNumber
,
702 Convert Device Path to a Unicode string for printing.
704 @param Str The buffer holding the output string.
705 This buffer contains the length of the
706 string and the maixmum length reserved
707 for the string buffer.
708 @param DevPath The device path.
713 IN OUT POOL_PRINT
*Str
,
717 I2O_DEVICE_PATH
*I2OPath
;
720 CatPrint (Str
, L
"I2O(%x)", (UINTN
) I2OPath
->Tid
);
724 Convert Device Path to a Unicode string for printing.
726 @param Str The buffer holding the output string.
727 This buffer contains the length of the
728 string and the maixmum length reserved
729 for the string buffer.
730 @param DevPath The device path.
735 IN OUT POOL_PRINT
*Str
,
739 MAC_ADDR_DEVICE_PATH
*MACDevPath
;
743 MACDevPath
= DevPath
;
745 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
746 if (MACDevPath
->IfType
== 0x01 || MACDevPath
->IfType
== 0x00) {
750 CatPrint (Str
, L
"Mac(");
752 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
753 CatPrint (Str
, L
"%02x", (UINTN
) MACDevPath
->MacAddress
.Addr
[Index
]);
756 CatPrint (Str
, L
")");
760 Convert Device Path to a Unicode string for printing.
762 @param Str The buffer holding the output string.
763 This buffer contains the length of the
764 string and the maixmum length reserved
765 for the string buffer.
766 @param DevPath The device path.
771 IN OUT POOL_PRINT
*Str
,
775 IPv4_DEVICE_PATH
*IPDevPath
;
780 L
"IPv4(%d.%d.%d.%d:%d)",
781 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[0],
782 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[1],
783 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[2],
784 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[3],
785 (UINTN
) IPDevPath
->RemotePort
790 Convert Device Path to a Unicode string for printing.
792 @param Str The buffer holding the output string.
793 This buffer contains the length of the
794 string and the maixmum length reserved
795 for the string buffer.
796 @param DevPath The device path.
801 IN OUT POOL_PRINT
*Str
,
805 IPv6_DEVICE_PATH
*IPv6DevPath
;
807 IPv6DevPath
= DevPath
;
810 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
811 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[0],
812 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[1],
813 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[2],
814 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[3],
815 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[4],
816 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[5],
817 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[6],
818 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[7],
819 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[8],
820 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[9],
821 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[10],
822 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[11],
823 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[12],
824 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[13],
825 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[14],
826 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[15]
831 Convert Device Path to a Unicode string for printing.
833 @param Str The buffer holding the output string.
834 This buffer contains the length of the
835 string and the maixmum length reserved
836 for the string buffer.
837 @param DevPath The device path.
842 IN OUT POOL_PRINT
*Str
,
846 INFINIBAND_DEVICE_PATH
*InfiniBand
;
848 InfiniBand
= DevPath
;
851 L
"Infiniband(%x,%g,%lx,%lx,%lx)",
852 (UINTN
) InfiniBand
->ResourceFlags
,
854 InfiniBand
->ServiceId
,
855 InfiniBand
->TargetPortId
,
861 Convert Device Path to a Unicode string for printing.
863 @param Str The buffer holding the output string.
864 This buffer contains the length of the
865 string and the maixmum length reserved
866 for the string buffer.
867 @param DevPath The device path.
872 IN OUT POOL_PRINT
*Str
,
876 UART_DEVICE_PATH
*Uart
;
880 switch (Uart
->Parity
) {
910 if (Uart
->BaudRate
== 0) {
911 CatPrint (Str
, L
"Uart(DEFAULT,%c,", Parity
);
913 CatPrint (Str
, L
"Uart(%d,%c,", Uart
->BaudRate
, Parity
);
916 if (Uart
->DataBits
== 0) {
917 CatPrint (Str
, L
"D,");
919 CatPrint (Str
, L
"%d,", (UINTN
) Uart
->DataBits
);
922 switch (Uart
->StopBits
) {
924 CatPrint (Str
, L
"D)");
928 CatPrint (Str
, L
"1)");
932 CatPrint (Str
, L
"1.5)");
936 CatPrint (Str
, L
"2)");
940 CatPrint (Str
, L
"x)");
946 Convert Device Path to a Unicode string for printing.
948 @param Str The buffer holding the output string.
949 This buffer contains the length of the
950 string and the maixmum length reserved
951 for the string buffer.
952 @param DevPath The device path.
957 IN OUT POOL_PRINT
*Str
,
961 ISCSI_DEVICE_PATH_WITH_NAME
*IScsi
;
964 ASSERT (Str
!= NULL
);
965 ASSERT (DevPath
!= NULL
);
971 IScsi
->iSCSITargetName
,
972 IScsi
->TargetPortalGroupTag
,
976 Options
= IScsi
->LoginOption
;
977 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
978 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
979 if (((Options
>> 11) & 0x0001) != 0) {
980 CatPrint (Str
, L
"%s,", L
"None");
981 } else if (((Options
>> 12) & 0x0001) != 0) {
982 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
984 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
988 CatPrint (Str
, L
"%s)", (IScsi
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
992 Convert Device Path to a Unicode string for printing.
994 @param Str The buffer holding the output string.
995 This buffer contains the length of the
996 string and the maixmum length reserved
997 for the string buffer.
998 @param DevPath The device path.
1003 IN OUT POOL_PRINT
*Str
,
1007 HARDDRIVE_DEVICE_PATH
*Hd
;
1010 switch (Hd
->SignatureType
) {
1011 case SIGNATURE_TYPE_MBR
:
1014 L
"HD(Part%d,Sig%08x)",
1015 (UINTN
) Hd
->PartitionNumber
,
1016 (UINTN
) *((UINT32
*) (&(Hd
->Signature
[0])))
1020 case SIGNATURE_TYPE_GUID
:
1023 L
"HD(Part%d,Sig%g)",
1024 (UINTN
) Hd
->PartitionNumber
,
1025 (EFI_GUID
*) &(Hd
->Signature
[0])
1032 L
"HD(Part%d,MBRType=%02x,SigType=%02x)",
1033 (UINTN
) Hd
->PartitionNumber
,
1034 (UINTN
) Hd
->MBRType
,
1035 (UINTN
) Hd
->SignatureType
1042 Convert Device Path to a Unicode string for printing.
1044 @param Str The buffer holding the output string.
1045 This buffer contains the length of the
1046 string and the maixmum length reserved
1047 for the string buffer.
1048 @param DevPath The device path.
1053 IN OUT POOL_PRINT
*Str
,
1057 CDROM_DEVICE_PATH
*Cd
;
1060 CatPrint (Str
, L
"CDROM(Entry%x)", (UINTN
) Cd
->BootEntry
);
1064 Convert Device Path to a Unicode string for printing.
1066 @param Str The buffer holding the output string.
1067 This buffer contains the length of the
1068 string and the maixmum length reserved
1069 for the string buffer.
1070 @param DevPath The device path.
1075 IN OUT POOL_PRINT
*Str
,
1079 FILEPATH_DEVICE_PATH
*Fp
;
1082 CatPrint (Str
, L
"%s", Fp
->PathName
);
1086 Convert Device Path to a Unicode string for printing.
1088 @param Str The buffer holding the output string.
1089 This buffer contains the length of the
1090 string and the maixmum length reserved
1091 for the string buffer.
1092 @param DevPath The device path.
1096 DevPathMediaProtocol (
1097 IN OUT POOL_PRINT
*Str
,
1101 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1103 MediaProt
= DevPath
;
1104 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1108 Convert Device Path to a Unicode string for printing.
1110 @param Str The buffer holding the output string.
1111 This buffer contains the length of the
1112 string and the maixmum length reserved
1113 for the string buffer.
1114 @param DevPath The device path.
1119 IN OUT POOL_PRINT
*Str
,
1123 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFilePath
;
1125 FvFilePath
= DevPath
;
1126 CatPrint (Str
, L
"%g", &FvFilePath
->FvFileName
);
1130 Convert Device Path to a Unicode string for printing.
1132 @param Str The buffer holding the output string.
1133 This buffer contains the length of the
1134 string and the maixmum length reserved
1135 for the string buffer.
1136 @param DevPath The device path.
1141 IN OUT POOL_PRINT
*Str
,
1145 BBS_BBS_DEVICE_PATH
*Bbs
;
1149 switch (Bbs
->DeviceType
) {
1150 case BBS_TYPE_FLOPPY
:
1154 case BBS_TYPE_HARDDRIVE
:
1155 Type
= L
"Harddrive";
1158 case BBS_TYPE_CDROM
:
1162 case BBS_TYPE_PCMCIA
:
1170 case BBS_TYPE_EMBEDDED_NETWORK
:
1182 CatPrint (Str
, L
"Legacy-%s", Type
);
1186 Convert Device Path to a Unicode string for printing.
1188 @param Str The buffer holding the output string.
1189 This buffer contains the length of the
1190 string and the maixmum length reserved
1191 for the string buffer.
1192 @param DevPath The device path.
1196 DevPathEndInstance (
1197 IN OUT POOL_PRINT
*Str
,
1201 CatPrint (Str
, L
",");
1205 Convert Device Path to a Unicode string for printing.
1207 @param Str The buffer holding the output string.
1208 This buffer contains the length of the
1209 string and the maixmum length reserved
1210 for the string buffer.
1211 @param DevPath The device path.
1215 DevPathNodeUnknown (
1216 IN OUT POOL_PRINT
*Str
,
1220 CatPrint (Str
, L
"?");
1223 DEVICE_PATH_STRING_TABLE DevPathTable
[] = {
1225 HARDWARE_DEVICE_PATH
,
1230 HARDWARE_DEVICE_PATH
,
1235 HARDWARE_DEVICE_PATH
,
1240 HARDWARE_DEVICE_PATH
,
1245 HARDWARE_DEVICE_PATH
,
1265 MESSAGING_DEVICE_PATH
,
1270 MESSAGING_DEVICE_PATH
,
1275 MESSAGING_DEVICE_PATH
,
1276 MSG_FIBRECHANNEL_DP
,
1280 MESSAGING_DEVICE_PATH
,
1285 MESSAGING_DEVICE_PATH
,
1290 MESSAGING_DEVICE_PATH
,
1295 MESSAGING_DEVICE_PATH
,
1296 MSG_DEVICE_LOGICAL_UNIT_DP
,
1300 MESSAGING_DEVICE_PATH
,
1305 MESSAGING_DEVICE_PATH
,
1310 MESSAGING_DEVICE_PATH
,
1315 MESSAGING_DEVICE_PATH
,
1320 MESSAGING_DEVICE_PATH
,
1325 MESSAGING_DEVICE_PATH
,
1330 MESSAGING_DEVICE_PATH
,
1335 MESSAGING_DEVICE_PATH
,
1340 MESSAGING_DEVICE_PATH
,
1345 MESSAGING_DEVICE_PATH
,
1372 DevPathMediaProtocol
1376 MEDIA_PIWG_FW_FILE_DP
,
1385 END_DEVICE_PATH_TYPE
,
1386 END_INSTANCE_DEVICE_PATH_SUBTYPE
,
1398 This function converts an input device structure to a Unicode string.
1400 @param DevPath A pointer to the device path structure.
1402 @return A new allocated Unicode string that represents the device path.
1408 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
1412 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1413 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*);
1420 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
*DevPathToText
;
1422 ZeroMem (&Str
, sizeof (Str
));
1424 if (DevPath
== NULL
) {
1428 Status
= gBS
->LocateProtocol (
1429 &gEfiDevicePathToTextProtocolGuid
,
1431 (VOID
**) &DevPathToText
1433 if (!EFI_ERROR (Status
)) {
1434 ToText
= DevPathToText
->ConvertDevicePathToText (
1439 ASSERT (ToText
!= NULL
);
1444 // Process each device path node
1446 DevPathNode
= DevPath
;
1447 while (!IsDevicePathEnd (DevPathNode
)) {
1449 // Find the handler to dump this device path node
1452 for (Index
= 0; DevPathTable
[Index
].Function
; Index
+= 1) {
1454 if (DevicePathType (DevPathNode
) == DevPathTable
[Index
].Type
&&
1455 DevicePathSubType (DevPathNode
) == DevPathTable
[Index
].SubType
1457 DumpNode
= DevPathTable
[Index
].Function
;
1462 // If not found, use a generic function
1465 DumpNode
= DevPathNodeUnknown
;
1468 // Put a path seperator in if needed
1470 if (Str
.len
&& DumpNode
!= DevPathEndInstance
) {
1471 CatPrint (&Str
, L
"/");
1474 // Print this node of the device path
1476 DumpNode (&Str
, DevPathNode
);
1479 // Next device path node
1481 DevPathNode
= NextDevicePathNode (DevPathNode
);
1484 // Shrink pool used for string allocation
1489 NewSize
= (Str
.len
+ 1) * sizeof (CHAR16
);
1490 Str
.str
= ReallocatePool (NewSize
, NewSize
, Str
.str
);
1491 ASSERT (Str
.str
!= NULL
);
1492 Str
.str
[Str
.len
] = 0;