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 allocated.
23 @param fmt The format string
24 @param ... The data will be printed.
26 @return Allocated buffer with the formatted string printed in it.
27 The caller must free the allocated buffer.
28 The buffer allocation is not packed.
34 IN OUT POOL_PRINT
*Str
,
43 AppendStr
= AllocateZeroPool (0x1000);
44 if (AppendStr
== NULL
) {
49 UnicodeVSPrint (AppendStr
, 0x1000, fmt
, Args
);
51 if (NULL
== Str
->str
) {
52 StringSize
= StrSize (AppendStr
);
53 Str
->str
= AllocateZeroPool (StringSize
);
54 ASSERT (Str
->str
!= NULL
);
56 StringSize
= StrSize (AppendStr
);
57 StringSize
+= (StrSize (Str
->str
) - sizeof (UINT16
));
59 Str
->str
= ReallocatePool (
64 ASSERT (Str
->str
!= NULL
);
67 Str
->maxlen
= MAX_CHAR
* sizeof (UINT16
);
68 if (StringSize
< Str
->maxlen
) {
69 StrCat (Str
->str
, AppendStr
);
70 Str
->len
= StringSize
- sizeof (UINT16
);
78 Convert Device Path to a Unicode string for printing.
80 @param Str The buffer holding the output string.
81 This buffer contains the length of the
82 string and the maixmum length reserved
83 for the string buffer.
84 @param DevPath The device path.
89 IN OUT POOL_PRINT
*Str
,
96 CatPrint (Str
, L
"Pci(%x|%x)", (UINTN
) Pci
->Device
, (UINTN
) Pci
->Function
);
100 Convert Device Path to a Unicode string for printing.
102 @param Str The buffer holding the output string.
103 This buffer contains the length of the
104 string and the maixmum length reserved
105 for the string buffer.
106 @param DevPath The device path.
111 IN OUT POOL_PRINT
*Str
,
115 PCCARD_DEVICE_PATH
*Pccard
;
118 CatPrint (Str
, L
"Pcmcia(Function%x)", (UINTN
) Pccard
->FunctionNumber
);
122 Convert Device Path to a Unicode string for printing.
124 @param Str The buffer holding the output string.
125 This buffer contains the length of the
126 string and the maixmum length reserved
127 for the string buffer.
128 @param DevPath The device path.
133 IN OUT POOL_PRINT
*Str
,
137 MEMMAP_DEVICE_PATH
*MemMap
;
142 L
"MemMap(%d:%lx-%lx)",
144 MemMap
->StartingAddress
,
145 MemMap
->EndingAddress
150 Convert Device Path to a Unicode string for printing.
152 @param Str The buffer holding the output string.
153 This buffer contains the length of the
154 string and the maixmum length reserved
155 for the string buffer.
156 @param DevPath The device path.
161 IN OUT POOL_PRINT
*Str
,
165 CONTROLLER_DEVICE_PATH
*Controller
;
167 Controller
= DevPath
;
168 CatPrint (Str
, L
"Ctrl(%d)", (UINTN
) Controller
->ControllerNumber
);
173 Convert Vendor device path to device name.
175 @param Str The buffer store device name
176 @param DevPath Pointer to vendor device path
182 IN OUT POOL_PRINT
*Str
,
186 VENDOR_DEVICE_PATH
*Vendor
;
190 UINT32 FlowControlMap
;
196 switch (DevicePathType (&Vendor
->Header
)) {
197 case HARDWARE_DEVICE_PATH
:
201 case MESSAGING_DEVICE_PATH
:
203 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
204 CatPrint (Str
, L
"VenPcAnsi()");
206 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
207 CatPrint (Str
, L
"VenVt100()");
209 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
210 CatPrint (Str
, L
"VenVt100Plus()");
212 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
213 CatPrint (Str
, L
"VenUft8()");
215 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
216 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
217 switch (FlowControlMap
& 0x00000003) {
219 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
223 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
227 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
236 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
240 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
241 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
242 ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
244 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
245 if ((Info
& 0x0f) == 0) {
246 CatPrint (Str
, L
"NoTopology,0,0,0,");
247 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
251 ((Info
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
252 ((Info
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
253 ((Info
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
255 if ((Info
& 0x0f) == 1) {
256 CatPrint (Str
, L
"0,");
258 CatPrint (Str
, L
"%x,", (UINTN
) ((Info
>> 8) & 0xff));
261 CatPrint (Str
, L
"0,0,0,0,");
264 CatPrint (Str
, L
"%x)", (UINTN
) ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
267 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
268 CatPrint (Str
, L
"DebugPort()");
273 case MEDIA_DEVICE_PATH
:
282 CatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
283 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
284 if (DataLength
> 0) {
285 CatPrint (Str
, L
",");
286 for (Index
= 0; Index
< DataLength
; Index
++) {
287 CatPrint (Str
, L
"%02x", (UINTN
) ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
290 CatPrint (Str
, L
")");
294 Convert Device Path to a Unicode string for printing.
296 @param Str The buffer holding the output string.
297 This buffer contains the length of the
298 string and the maixmum length reserved
299 for the string buffer.
300 @param DevPath The device path.
305 IN OUT POOL_PRINT
*Str
,
309 ACPI_HID_DEVICE_PATH
*Acpi
;
312 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
313 CatPrint (Str
, L
"Acpi(PNP%04x,%x)", (UINTN
) EISA_ID_TO_NUM (Acpi
->HID
), (UINTN
) Acpi
->UID
);
315 CatPrint (Str
, L
"Acpi(%08x,%x)", (UINTN
) Acpi
->HID
, (UINTN
) Acpi
->UID
);
320 Convert Device Path to a Unicode string for printing.
322 @param Str The buffer holding the output string.
323 This buffer contains the length of the
324 string and the maixmum length reserved
325 for the string buffer.
326 @param DevPath The device path.
330 DevPathExtendedAcpi (
331 IN OUT POOL_PRINT
*Str
,
335 ACPI_EXTENDED_HID_DEVICE_PATH
*ExtendedAcpi
;
338 // Index for HID, UID and CID strings, 0 for non-exist
348 ASSERT (Str
!= NULL
);
349 ASSERT (DevPath
!= NULL
);
354 ExtendedAcpi
= DevPath
;
355 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) ExtendedAcpi
);
357 ASSERT (Length
>= 19);
358 AsChar8Array
= (CHAR8
*) ExtendedAcpi
;
364 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
367 if (Index
> Anchor
) {
373 Anchor
= (UINT16
) (Index
+ 1);
374 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
377 if (Index
> Anchor
) {
383 Anchor
= (UINT16
) (Index
+ 1);
384 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
387 if (Index
> Anchor
) {
391 if (HIDSTRIdx
== 0 && CIDSTRIdx
== 0 && ExtendedAcpi
->UID
== 0) {
392 CatPrint (Str
, L
"AcpiExp(");
393 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
394 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
396 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
398 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
399 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
401 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
403 if (UIDSTRIdx
!= 0) {
404 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
406 CatPrint (Str
, L
"\"\")");
409 CatPrint (Str
, L
"AcpiEx(");
410 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
411 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
413 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
415 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
416 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
418 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
420 CatPrint (Str
, L
"%x,", (UINTN
) ExtendedAcpi
->UID
);
422 if (HIDSTRIdx
!= 0) {
423 CatPrint (Str
, L
"%a,", AsChar8Array
+ HIDSTRIdx
);
425 CatPrint (Str
, L
"\"\",");
427 if (CIDSTRIdx
!= 0) {
428 CatPrint (Str
, L
"%a,", AsChar8Array
+ CIDSTRIdx
);
430 CatPrint (Str
, L
"\"\",");
432 if (UIDSTRIdx
!= 0) {
433 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
435 CatPrint (Str
, L
"\"\")");
442 Convert Device Path to a Unicode string for printing.
444 @param Str The buffer holding the output string.
445 This buffer contains the length of the
446 string and the maixmum length reserved
447 for the string buffer.
448 @param DevPath The device path.
453 IN OUT POOL_PRINT
*Str
,
457 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
460 UINT16 AdditionalAdrCount
;
463 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
464 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
466 CatPrint (Str
, L
"AcpiAdr(%x", (UINTN
) AcpiAdr
->ADR
);
467 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
468 CatPrint (Str
, L
",%x", (UINTN
) *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
470 CatPrint (Str
, L
")");
474 Convert Device Path to a Unicode string for printing.
476 @param Str The buffer holding the output string.
477 This buffer contains the length of the
478 string and the maixmum length reserved
479 for the string buffer.
480 @param DevPath The device path.
485 IN OUT POOL_PRINT
*Str
,
489 ATAPI_DEVICE_PATH
*Atapi
;
495 Atapi
->PrimarySecondary
? L
"Secondary" : L
"Primary",
496 Atapi
->SlaveMaster
? L
"Slave" : L
"Master"
501 Convert Device Path to a Unicode string for printing.
503 @param Str The buffer holding the output string.
504 This buffer contains the length of the
505 string and the maixmum length reserved
506 for the string buffer.
507 @param DevPath The device path.
512 IN OUT POOL_PRINT
*Str
,
516 SCSI_DEVICE_PATH
*Scsi
;
519 CatPrint (Str
, L
"Scsi(Pun%x,Lun%x)", (UINTN
) Scsi
->Pun
, (UINTN
) Scsi
->Lun
);
523 Convert Device Path to a Unicode string for printing.
525 @param Str The buffer holding the output string.
526 This buffer contains the length of the
527 string and the maixmum length reserved
528 for the string buffer.
529 @param DevPath The device path.
534 IN OUT POOL_PRINT
*Str
,
538 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
541 CatPrint (Str
, L
"Fibre(Wwn%lx,Lun%x)", Fibre
->WWN
, Fibre
->Lun
);
545 Convert Device Path to a Unicode string for printing.
547 @param Str The buffer holding the output string.
548 This buffer contains the length of the
549 string and the maixmum length reserved
550 for the string buffer.
551 @param DevPath The device path.
556 IN OUT POOL_PRINT
*Str
,
560 F1394_DEVICE_PATH
*F1394Path
;
563 CatPrint (Str
, L
"1394(%g)", &F1394Path
->Guid
);
567 Convert Device Path to a Unicode string for printing.
569 @param Str The buffer holding the output string.
570 This buffer contains the length of the
571 string and the maixmum length reserved
572 for the string buffer.
573 @param DevPath The device path.
578 IN OUT POOL_PRINT
*Str
,
582 USB_DEVICE_PATH
*Usb
;
585 CatPrint (Str
, L
"Usb(%x,%x)", (UINTN
) Usb
->ParentPortNumber
, (UINTN
) Usb
->InterfaceNumber
);
589 Convert Device Path to a Unicode string for printing.
591 @param Str The buffer holding the output string.
592 This buffer contains the length of the
593 string and the maixmum length reserved
594 for the string buffer.
595 @param DevPath The device path.
600 IN OUT POOL_PRINT
*Str
,
604 USB_WWID_DEVICE_PATH
*UsbWWId
;
609 L
"UsbWwid(%x,%x,%x,\"WWID\")",
610 (UINTN
) UsbWWId
->VendorId
,
611 (UINTN
) UsbWWId
->ProductId
,
612 (UINTN
) UsbWWId
->InterfaceNumber
617 Convert Device Path to a Unicode string for printing.
619 @param Str The buffer holding the output string.
620 This buffer contains the length of the
621 string and the maixmum length reserved
622 for the string buffer.
623 @param DevPath The device path.
628 IN OUT POOL_PRINT
*Str
,
632 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
634 LogicalUnit
= DevPath
;
635 CatPrint (Str
, L
"Unit(%x)", (UINTN
) LogicalUnit
->Lun
);
639 Convert Device Path to a Unicode string for printing.
641 @param Str The buffer holding the output string.
642 This buffer contains the length of the
643 string and the maixmum length reserved
644 for the string buffer.
645 @param DevPath The device path.
650 IN OUT POOL_PRINT
*Str
,
654 USB_CLASS_DEVICE_PATH
*UsbClass
;
659 L
"Usb Class(%x,%x,%x,%x,%x)",
660 (UINTN
) UsbClass
->VendorId
,
661 (UINTN
) UsbClass
->ProductId
,
662 (UINTN
) UsbClass
->DeviceClass
,
663 (UINTN
) UsbClass
->DeviceSubClass
,
664 (UINTN
) UsbClass
->DeviceProtocol
669 Convert Device Path to a Unicode string for printing.
671 @param Str The buffer holding the output string.
672 This buffer contains the length of the
673 string and the maixmum length reserved
674 for the string buffer.
675 @param DevPath The device path.
680 IN OUT POOL_PRINT
*Str
,
684 SATA_DEVICE_PATH
*Sata
;
690 (UINTN
) Sata
->HBAPortNumber
,
691 (UINTN
) Sata
->PortMultiplierPortNumber
,
697 Convert Device Path to a Unicode string for printing.
699 @param Str The buffer holding the output string.
700 This buffer contains the length of the
701 string and the maixmum length reserved
702 for the string buffer.
703 @param DevPath The device path.
708 IN OUT POOL_PRINT
*Str
,
712 I2O_DEVICE_PATH
*I2OPath
;
715 CatPrint (Str
, L
"I2O(%x)", (UINTN
) I2OPath
->Tid
);
719 Convert Device Path to a Unicode string for printing.
721 @param Str The buffer holding the output string.
722 This buffer contains the length of the
723 string and the maixmum length reserved
724 for the string buffer.
725 @param DevPath The device path.
730 IN OUT POOL_PRINT
*Str
,
734 MAC_ADDR_DEVICE_PATH
*MACDevPath
;
738 MACDevPath
= DevPath
;
740 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
741 if (MACDevPath
->IfType
== 0x01 || MACDevPath
->IfType
== 0x00) {
745 CatPrint (Str
, L
"Mac(");
747 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
748 CatPrint (Str
, L
"%02x", (UINTN
) MACDevPath
->MacAddress
.Addr
[Index
]);
751 CatPrint (Str
, L
")");
755 Convert Device Path to a Unicode string for printing.
757 @param Str The buffer holding the output string.
758 This buffer contains the length of the
759 string and the maixmum length reserved
760 for the string buffer.
761 @param DevPath The device path.
766 IN OUT POOL_PRINT
*Str
,
770 IPv4_DEVICE_PATH
*IPDevPath
;
775 L
"IPv4(%d.%d.%d.%d:%d)",
776 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[0],
777 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[1],
778 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[2],
779 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[3],
780 (UINTN
) IPDevPath
->RemotePort
785 Convert Device Path to a Unicode string for printing.
787 @param Str The buffer holding the output string.
788 This buffer contains the length of the
789 string and the maixmum length reserved
790 for the string buffer.
791 @param DevPath The device path.
796 IN OUT POOL_PRINT
*Str
,
800 IPv6_DEVICE_PATH
*IPv6DevPath
;
802 IPv6DevPath
= DevPath
;
805 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
806 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[0],
807 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[1],
808 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[2],
809 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[3],
810 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[4],
811 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[5],
812 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[6],
813 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[7],
814 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[8],
815 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[9],
816 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[10],
817 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[11],
818 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[12],
819 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[13],
820 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[14],
821 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[15]
826 Convert Device Path to a Unicode string for printing.
828 @param Str The buffer holding the output string.
829 This buffer contains the length of the
830 string and the maixmum length reserved
831 for the string buffer.
832 @param DevPath The device path.
837 IN OUT POOL_PRINT
*Str
,
841 INFINIBAND_DEVICE_PATH
*InfiniBand
;
843 InfiniBand
= DevPath
;
846 L
"Infiniband(%x,%g,%lx,%lx,%lx)",
847 (UINTN
) InfiniBand
->ResourceFlags
,
849 InfiniBand
->ServiceId
,
850 InfiniBand
->TargetPortId
,
856 Convert Device Path to a Unicode string for printing.
858 @param Str The buffer holding the output string.
859 This buffer contains the length of the
860 string and the maixmum length reserved
861 for the string buffer.
862 @param DevPath The device path.
867 IN OUT POOL_PRINT
*Str
,
871 UART_DEVICE_PATH
*Uart
;
875 switch (Uart
->Parity
) {
905 if (Uart
->BaudRate
== 0) {
906 CatPrint (Str
, L
"Uart(DEFAULT,%c,", Parity
);
908 CatPrint (Str
, L
"Uart(%d,%c,", Uart
->BaudRate
, Parity
);
911 if (Uart
->DataBits
== 0) {
912 CatPrint (Str
, L
"D,");
914 CatPrint (Str
, L
"%d,", (UINTN
) Uart
->DataBits
);
917 switch (Uart
->StopBits
) {
919 CatPrint (Str
, L
"D)");
923 CatPrint (Str
, L
"1)");
927 CatPrint (Str
, L
"1.5)");
931 CatPrint (Str
, L
"2)");
935 CatPrint (Str
, L
"x)");
941 Convert Device Path to a Unicode string for printing.
943 @param Str The buffer holding the output string.
944 This buffer contains the length of the
945 string and the maixmum length reserved
946 for the string buffer.
947 @param DevPath The device path.
952 IN OUT POOL_PRINT
*Str
,
956 ISCSI_DEVICE_PATH_WITH_NAME
*IScsi
;
959 ASSERT (Str
!= NULL
);
960 ASSERT (DevPath
!= NULL
);
966 IScsi
->iSCSITargetName
,
967 IScsi
->TargetPortalGroupTag
,
971 Options
= IScsi
->LoginOption
;
972 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
973 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
974 if (((Options
>> 11) & 0x0001) != 0) {
975 CatPrint (Str
, L
"%s,", L
"None");
976 } else if (((Options
>> 12) & 0x0001) != 0) {
977 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
979 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
983 CatPrint (Str
, L
"%s)", (IScsi
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
987 Convert Device Path to a Unicode string for printing.
989 @param Str The buffer holding the output string.
990 This buffer contains the length of the
991 string and the maixmum length reserved
992 for the string buffer.
993 @param DevPath The device path.
998 IN OUT POOL_PRINT
*Str
,
1002 HARDDRIVE_DEVICE_PATH
*Hd
;
1005 switch (Hd
->SignatureType
) {
1006 case SIGNATURE_TYPE_MBR
:
1009 L
"HD(Part%d,Sig%08x)",
1010 (UINTN
) Hd
->PartitionNumber
,
1011 (UINTN
) *((UINT32
*) (&(Hd
->Signature
[0])))
1015 case SIGNATURE_TYPE_GUID
:
1018 L
"HD(Part%d,Sig%g)",
1019 (UINTN
) Hd
->PartitionNumber
,
1020 (EFI_GUID
*) &(Hd
->Signature
[0])
1027 L
"HD(Part%d,MBRType=%02x,SigType=%02x)",
1028 (UINTN
) Hd
->PartitionNumber
,
1029 (UINTN
) Hd
->MBRType
,
1030 (UINTN
) Hd
->SignatureType
1037 Convert Device Path to a Unicode string for printing.
1039 @param Str The buffer holding the output string.
1040 This buffer contains the length of the
1041 string and the maixmum length reserved
1042 for the string buffer.
1043 @param DevPath The device path.
1048 IN OUT POOL_PRINT
*Str
,
1052 CDROM_DEVICE_PATH
*Cd
;
1055 CatPrint (Str
, L
"CDROM(Entry%x)", (UINTN
) Cd
->BootEntry
);
1059 Convert Device Path to a Unicode string for printing.
1061 @param Str The buffer holding the output string.
1062 This buffer contains the length of the
1063 string and the maixmum length reserved
1064 for the string buffer.
1065 @param DevPath The device path.
1070 IN OUT POOL_PRINT
*Str
,
1074 FILEPATH_DEVICE_PATH
*Fp
;
1077 CatPrint (Str
, L
"%s", Fp
->PathName
);
1081 Convert Device Path to a Unicode string for printing.
1083 @param Str The buffer holding the output string.
1084 This buffer contains the length of the
1085 string and the maixmum length reserved
1086 for the string buffer.
1087 @param DevPath The device path.
1091 DevPathMediaProtocol (
1092 IN OUT POOL_PRINT
*Str
,
1096 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1098 MediaProt
= DevPath
;
1099 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1103 Convert Device Path to a Unicode string for printing.
1105 @param Str The buffer holding the output string.
1106 This buffer contains the length of the
1107 string and the maixmum length reserved
1108 for the string buffer.
1109 @param DevPath The device path.
1114 IN OUT POOL_PRINT
*Str
,
1118 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFilePath
;
1120 FvFilePath
= DevPath
;
1121 CatPrint (Str
, L
"%g", &FvFilePath
->FvFileName
);
1125 Convert Device Path to a Unicode string for printing.
1127 @param Str The buffer holding the output string.
1128 This buffer contains the length of the
1129 string and the maixmum length reserved
1130 for the string buffer.
1131 @param DevPath The device path.
1136 IN OUT POOL_PRINT
*Str
,
1140 BBS_BBS_DEVICE_PATH
*Bbs
;
1144 switch (Bbs
->DeviceType
) {
1145 case BBS_TYPE_FLOPPY
:
1149 case BBS_TYPE_HARDDRIVE
:
1150 Type
= L
"Harddrive";
1153 case BBS_TYPE_CDROM
:
1157 case BBS_TYPE_PCMCIA
:
1165 case BBS_TYPE_EMBEDDED_NETWORK
:
1177 CatPrint (Str
, L
"Legacy-%s", Type
);
1181 Convert Device Path to a Unicode string for printing.
1183 @param Str The buffer holding the output string.
1184 This buffer contains the length of the
1185 string and the maixmum length reserved
1186 for the string buffer.
1187 @param DevPath The device path.
1191 DevPathEndInstance (
1192 IN OUT POOL_PRINT
*Str
,
1196 CatPrint (Str
, L
",");
1200 Convert Device Path to a Unicode string for printing.
1202 @param Str The buffer holding the output string.
1203 This buffer contains the length of the
1204 string and the maixmum length reserved
1205 for the string buffer.
1206 @param DevPath The device path.
1210 DevPathNodeUnknown (
1211 IN OUT POOL_PRINT
*Str
,
1215 CatPrint (Str
, L
"?");
1218 DEVICE_PATH_STRING_TABLE DevPathTable
[] = {
1220 HARDWARE_DEVICE_PATH
,
1225 HARDWARE_DEVICE_PATH
,
1230 HARDWARE_DEVICE_PATH
,
1235 HARDWARE_DEVICE_PATH
,
1240 HARDWARE_DEVICE_PATH
,
1260 MESSAGING_DEVICE_PATH
,
1265 MESSAGING_DEVICE_PATH
,
1270 MESSAGING_DEVICE_PATH
,
1271 MSG_FIBRECHANNEL_DP
,
1275 MESSAGING_DEVICE_PATH
,
1280 MESSAGING_DEVICE_PATH
,
1285 MESSAGING_DEVICE_PATH
,
1290 MESSAGING_DEVICE_PATH
,
1291 MSG_DEVICE_LOGICAL_UNIT_DP
,
1295 MESSAGING_DEVICE_PATH
,
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
,
1367 DevPathMediaProtocol
1371 MEDIA_PIWG_FW_FILE_DP
,
1380 END_DEVICE_PATH_TYPE
,
1381 END_INSTANCE_DEVICE_PATH_SUBTYPE
,
1393 This function converts an input device structure to a Unicode string.
1395 @param DevPath A pointer to the device path structure.
1397 @return A new allocated Unicode string that represents the device path.
1403 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
1407 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1408 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*);
1415 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
*DevPathToText
;
1417 ZeroMem (&Str
, sizeof (Str
));
1419 if (DevPath
== NULL
) {
1423 Status
= gBS
->LocateProtocol (
1424 &gEfiDevicePathToTextProtocolGuid
,
1426 (VOID
**) &DevPathToText
1428 if (!EFI_ERROR (Status
)) {
1429 ToText
= DevPathToText
->ConvertDevicePathToText (
1434 ASSERT (ToText
!= NULL
);
1439 // Process each device path node
1441 DevPathNode
= DevPath
;
1442 while (!IsDevicePathEnd (DevPathNode
)) {
1444 // Find the handler to dump this device path node
1447 for (Index
= 0; DevPathTable
[Index
].Function
; Index
+= 1) {
1449 if (DevicePathType (DevPathNode
) == DevPathTable
[Index
].Type
&&
1450 DevicePathSubType (DevPathNode
) == DevPathTable
[Index
].SubType
1452 DumpNode
= DevPathTable
[Index
].Function
;
1457 // If not found, use a generic function
1460 DumpNode
= DevPathNodeUnknown
;
1463 // Put a path seperator in if needed
1465 if (Str
.len
&& DumpNode
!= DevPathEndInstance
) {
1466 CatPrint (&Str
, L
"/");
1469 // Print this node of the device path
1471 DumpNode (&Str
, DevPathNode
);
1474 // Next device path node
1476 DevPathNode
= NextDevicePathNode (DevPathNode
);
1480 NewSize
= (Str
.len
+ 1) * sizeof (CHAR16
);
1481 Str
.str
= ReallocatePool (NewSize
, NewSize
, Str
.str
);
1482 ASSERT (Str
.str
!= NULL
);
1483 Str
.str
[Str
.len
] = 0;