2 BDS internal function define the default device path string, it can be
3 replaced by platform device path.
5 Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
6 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.
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.
35 IN OUT POOL_PRINT
*Str
,
44 AppendStr
= AllocateZeroPool (0x1000);
45 if (AppendStr
== NULL
) {
50 UnicodeVSPrint (AppendStr
, 0x1000, Fmt
, Args
);
52 if (NULL
== Str
->Str
) {
53 StringSize
= StrSize (AppendStr
);
54 Str
->Str
= AllocateZeroPool (StringSize
);
55 ASSERT (Str
->Str
!= NULL
);
57 StringSize
= StrSize (AppendStr
);
58 StringSize
+= (StrSize (Str
->Str
) - sizeof (UINT16
));
60 Str
->Str
= EfiReallocatePool (
65 ASSERT (Str
->Str
!= NULL
);
68 Str
->Maxlen
= MAX_CHAR
* sizeof (UINT16
);
69 if (StringSize
< Str
->Maxlen
) {
70 StrCat (Str
->Str
, AppendStr
);
71 Str
->Len
= StringSize
- sizeof (UINT16
);
79 Convert Device Path to a Unicode string for printing.
81 @param Str The buffer holding the output string.
82 This buffer contains the length of the
83 string and the maixmum length reserved
84 for the string buffer.
85 @param DevPath The device path.
90 IN OUT POOL_PRINT
*Str
,
97 CatPrint (Str
, L
"Pci(%x|%x)", (UINTN
) Pci
->Device
, (UINTN
) Pci
->Function
);
101 Convert Device Path to a Unicode string for printing.
103 @param Str The buffer holding the output string.
104 This buffer contains the length of the
105 string and the maixmum length reserved
106 for the string buffer.
107 @param DevPath The device path.
112 IN OUT POOL_PRINT
*Str
,
116 PCCARD_DEVICE_PATH
*Pccard
;
119 CatPrint (Str
, L
"Pcmcia(Function%x)", (UINTN
) Pccard
->FunctionNumber
);
123 Convert Device Path to a Unicode string for printing.
125 @param Str The buffer holding the output string.
126 This buffer contains the length of the
127 string and the maixmum length reserved
128 for the string buffer.
129 @param DevPath The device path.
134 IN OUT POOL_PRINT
*Str
,
138 MEMMAP_DEVICE_PATH
*MemMap
;
143 L
"MemMap(%d:%lx-%lx)",
144 (UINTN
) MemMap
->MemoryType
,
145 MemMap
->StartingAddress
,
146 MemMap
->EndingAddress
151 Convert Device Path to a Unicode string for printing.
153 @param Str The buffer holding the output string.
154 This buffer contains the length of the
155 string and the maixmum length reserved
156 for the string buffer.
157 @param DevPath The device path.
162 IN OUT POOL_PRINT
*Str
,
166 CONTROLLER_DEVICE_PATH
*Controller
;
168 Controller
= DevPath
;
169 CatPrint (Str
, L
"Ctrl(%d)", (UINTN
) Controller
->ControllerNumber
);
174 Convert Vendor device path to device name.
176 @param Str The buffer store device name
177 @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
:
204 if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) {
205 CatPrint (Str, L"VenPcAnsi()");
207 } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) {
208 CatPrint (Str, L"VenVt100()");
210 } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) {
211 CatPrint (Str, L"VenVt100Plus()");
213 } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {
214 CatPrint (Str, L"VenUft8()");
216 } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid )) {
217 FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);
218 switch (FlowControlMap & 0x00000003) {
220 CatPrint (Str, L"UartFlowCtrl(%s)", L"None");
224 CatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware");
228 CatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff");
239 if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
243 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
244 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
245 (UINTN
) ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
247 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
248 if ((Info
& 0x0f) == 0) {
249 CatPrint (Str
, L
"NoTopology,0,0,0,");
250 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
254 ((Info
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
255 ((Info
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
256 ((Info
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
258 if ((Info
& 0x0f) == 1) {
259 CatPrint (Str
, L
"0,");
261 CatPrint (Str
, L
"%x,", (UINTN
) ((Info
>> 8) & 0xff));
264 CatPrint (Str
, L
"0,0,0,0,");
267 CatPrint (Str
, L
"%x)", (UINTN
) ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
270 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
271 CatPrint (Str
, L
"DebugPort()");
276 case MEDIA_DEVICE_PATH
:
285 CatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
286 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
287 if (DataLength
> 0) {
288 CatPrint (Str
, L
",");
289 for (Index
= 0; Index
< DataLength
; Index
++) {
290 CatPrint (Str
, L
"%02x", (UINTN
) ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
293 CatPrint (Str
, L
")");
297 Convert Device Path to a Unicode string for printing.
299 @param Str The buffer holding the output string.
300 This buffer contains the length of the
301 string and the maixmum length reserved
302 for the string buffer.
303 @param DevPath The device path.
308 IN OUT POOL_PRINT
*Str
,
312 ACPI_HID_DEVICE_PATH
*Acpi
;
315 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
316 CatPrint (Str
, L
"Acpi(PNP%04x,%x)", (UINTN
) EISA_ID_TO_NUM (Acpi
->HID
), (UINTN
) Acpi
->UID
);
318 CatPrint (Str
, L
"Acpi(%08x,%x)", (UINTN
) Acpi
->HID
, (UINTN
) Acpi
->UID
);
323 Convert Device Path to a Unicode string for printing.
325 @param Str The buffer holding the output string.
326 This buffer contains the length of the
327 string and the maixmum length reserved
328 for the string buffer.
329 @param DevPath The device path.
333 DevPathExtendedAcpi (
334 IN OUT POOL_PRINT
*Str
,
338 ACPI_EXTENDED_HID_DEVICE_PATH
*ExtendedAcpi
;
341 // Index for HID, UID and CID strings, 0 for non-exist
354 ExtendedAcpi
= DevPath
;
355 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) ExtendedAcpi
);
357 AsChar8Array
= (CHAR8
*) ExtendedAcpi
;
363 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
366 if (Index
> Anchor
) {
372 Anchor
= (UINT16
) (Index
+ 1);
373 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
376 if (Index
> Anchor
) {
382 Anchor
= (UINT16
) (Index
+ 1);
383 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
386 if (Index
> Anchor
) {
390 if (HIDSTRIdx
== 0 && CIDSTRIdx
== 0 && ExtendedAcpi
->UID
== 0) {
391 CatPrint (Str
, L
"AcpiExp(");
392 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
393 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
395 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
397 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
398 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
400 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
402 if (UIDSTRIdx
!= 0) {
403 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
405 CatPrint (Str
, L
"\"\")");
408 CatPrint (Str
, L
"AcpiEx(");
409 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
410 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
412 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
414 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
415 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
417 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
419 CatPrint (Str
, L
"%x,", (UINTN
) ExtendedAcpi
->UID
);
421 if (HIDSTRIdx
!= 0) {
422 CatPrint (Str
, L
"%a,", AsChar8Array
+ HIDSTRIdx
);
424 CatPrint (Str
, L
"\"\",");
426 if (CIDSTRIdx
!= 0) {
427 CatPrint (Str
, L
"%a,", AsChar8Array
+ CIDSTRIdx
);
429 CatPrint (Str
, L
"\"\",");
431 if (UIDSTRIdx
!= 0) {
432 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
434 CatPrint (Str
, L
"\"\")");
441 Convert Device Path to a Unicode string for printing.
443 @param Str The buffer holding the output string.
444 This buffer contains the length of the
445 string and the maixmum length reserved
446 for the string buffer.
447 @param DevPath The device path.
452 IN OUT POOL_PRINT
*Str
,
456 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
459 UINT16 AdditionalAdrCount
;
462 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
463 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
465 CatPrint (Str
, L
"AcpiAdr(%x", (UINTN
) AcpiAdr
->ADR
);
466 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
467 CatPrint (Str
, L
",%x", (UINTN
) *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
469 CatPrint (Str
, L
")");
473 Convert Device Path to a Unicode string for printing.
475 @param Str The buffer holding the output string.
476 This buffer contains the length of the
477 string and the maixmum length reserved
478 for the string buffer.
479 @param DevPath The device path.
484 IN OUT POOL_PRINT
*Str
,
488 ATAPI_DEVICE_PATH
*Atapi
;
494 (Atapi
->PrimarySecondary
!= 0)? L
"Secondary" : L
"Primary",
495 (Atapi
->SlaveMaster
!= 0)? L
"Slave" : L
"Master"
500 Convert Device Path to a Unicode string for printing.
502 @param Str The buffer holding the output string.
503 This buffer contains the length of the
504 string and the maixmum length reserved
505 for the string buffer.
506 @param DevPath The device path.
511 IN OUT POOL_PRINT
*Str
,
515 SCSI_DEVICE_PATH
*Scsi
;
518 CatPrint (Str
, L
"Scsi(Pun%x,Lun%x)", (UINTN
) Scsi
->Pun
, (UINTN
) Scsi
->Lun
);
522 Convert Device Path to a Unicode string for printing.
524 @param Str The buffer holding the output string.
525 This buffer contains the length of the
526 string and the maixmum length reserved
527 for the string buffer.
528 @param DevPath The device path.
533 IN OUT POOL_PRINT
*Str
,
537 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
540 CatPrint (Str
, L
"Fibre(Wwn%lx,Lun%x)", Fibre
->WWN
, Fibre
->Lun
);
544 Convert Device Path to a Unicode string for printing.
546 @param Str The buffer holding the output string.
547 This buffer contains the length of the
548 string and the maixmum length reserved
549 for the string buffer.
550 @param DevPath The device path.
555 IN OUT POOL_PRINT
*Str
,
559 F1394_DEVICE_PATH
*F1394Path
;
562 CatPrint (Str
, L
"1394(%lx)", &F1394Path
->Guid
);
566 Convert Device Path to a Unicode string for printing.
568 @param Str The buffer holding the output string.
569 This buffer contains the length of the
570 string and the maixmum length reserved
571 for the string buffer.
572 @param DevPath The device path.
577 IN OUT POOL_PRINT
*Str
,
581 USB_DEVICE_PATH
*Usb
;
584 CatPrint (Str
, L
"Usb(%x,%x)", (UINTN
) Usb
->ParentPortNumber
, (UINTN
) Usb
->InterfaceNumber
);
588 Convert Device Path to a Unicode string for printing.
590 @param Str The buffer holding the output string.
591 This buffer contains the length of the
592 string and the maixmum length reserved
593 for the string buffer.
594 @param DevPath The device path.
599 IN OUT POOL_PRINT
*Str
,
603 USB_WWID_DEVICE_PATH
*UsbWWId
;
608 L
"UsbWwid(%x,%x,%x,\"WWID\")",
609 (UINTN
) UsbWWId
->VendorId
,
610 (UINTN
) UsbWWId
->ProductId
,
611 (UINTN
) UsbWWId
->InterfaceNumber
616 Convert Device Path to a Unicode string for printing.
618 @param Str The buffer holding the output string.
619 This buffer contains the length of the
620 string and the maixmum length reserved
621 for the string buffer.
622 @param DevPath The device path.
627 IN OUT POOL_PRINT
*Str
,
631 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
633 LogicalUnit
= DevPath
;
634 CatPrint (Str
, L
"Unit(%x)", (UINTN
) LogicalUnit
->Lun
);
638 Convert Device Path to a Unicode string for printing.
640 @param Str The buffer holding the output string.
641 This buffer contains the length of the
642 string and the maixmum length reserved
643 for the string buffer.
644 @param DevPath The device path.
649 IN OUT POOL_PRINT
*Str
,
653 USB_CLASS_DEVICE_PATH
*UsbClass
;
658 L
"Usb Class(%x,%x,%x,%x,%x)",
659 (UINTN
) UsbClass
->VendorId
,
660 (UINTN
) UsbClass
->ProductId
,
661 (UINTN
) UsbClass
->DeviceClass
,
662 (UINTN
) UsbClass
->DeviceSubClass
,
663 (UINTN
) UsbClass
->DeviceProtocol
668 Convert Device Path to a Unicode string for printing.
670 @param Str The buffer holding the output string.
671 This buffer contains the length of the
672 string and the maixmum length reserved
673 for the string buffer.
674 @param DevPath The device path.
679 IN OUT POOL_PRINT
*Str
,
683 SATA_DEVICE_PATH
*Sata
;
686 if ((Sata
->PortMultiplierPortNumber
& SATA_HBA_DIRECT_CONNECT_FLAG
) != 0) {
690 (UINTN
) Sata
->HBAPortNumber
,
697 (UINTN
) Sata
->HBAPortNumber
,
698 (UINTN
) Sata
->PortMultiplierPortNumber
,
705 Convert Device Path to a Unicode string for printing.
707 @param Str The buffer holding the output string.
708 This buffer contains the length of the
709 string and the maixmum length reserved
710 for the string buffer.
711 @param DevPath The device path.
716 IN OUT POOL_PRINT
*Str
,
720 I2O_DEVICE_PATH
*I2OPath
;
723 CatPrint (Str
, L
"I2O(%x)", (UINTN
) I2OPath
->Tid
);
727 Convert Device Path to a Unicode string for printing.
729 @param Str The buffer holding the output string.
730 This buffer contains the length of the
731 string and the maixmum length reserved
732 for the string buffer.
733 @param DevPath The device path.
738 IN OUT POOL_PRINT
*Str
,
742 MAC_ADDR_DEVICE_PATH
*MACDevPath
;
746 MACDevPath
= DevPath
;
748 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
749 if (MACDevPath
->IfType
== 0x01 || MACDevPath
->IfType
== 0x00) {
753 CatPrint (Str
, L
"Mac(");
755 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
756 CatPrint (Str
, L
"%02x", (UINTN
) MACDevPath
->MacAddress
.Addr
[Index
]);
759 CatPrint (Str
, L
")");
763 Convert Device Path to a Unicode string for printing.
765 @param Str The buffer holding the output string.
766 This buffer contains the length of the
767 string and the maixmum length reserved
768 for the string buffer.
769 @param DevPath The device path.
774 IN OUT POOL_PRINT
*Str
,
778 IPv4_DEVICE_PATH
*IPDevPath
;
783 L
"IPv4(%d.%d.%d.%d:%d)",
784 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[0],
785 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[1],
786 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[2],
787 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[3],
788 (UINTN
) IPDevPath
->RemotePort
793 Convert Device Path to a Unicode string for printing.
795 @param Str The buffer holding the output string.
796 This buffer contains the length of the
797 string and the maixmum length reserved
798 for the string buffer.
799 @param DevPath The device path.
804 IN OUT POOL_PRINT
*Str
,
808 IPv6_DEVICE_PATH
*IPv6DevPath
;
810 IPv6DevPath
= DevPath
;
813 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
814 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[0],
815 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[1],
816 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[2],
817 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[3],
818 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[4],
819 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[5],
820 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[6],
821 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[7],
822 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[8],
823 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[9],
824 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[10],
825 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[11],
826 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[12],
827 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[13],
828 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[14],
829 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[15]
834 Convert Device Path to a Unicode string for printing.
836 @param Str The buffer holding the output string.
837 This buffer contains the length of the
838 string and the maixmum length reserved
839 for the string buffer.
840 @param DevPath The device path.
845 IN OUT POOL_PRINT
*Str
,
849 INFINIBAND_DEVICE_PATH
*InfiniBand
;
851 InfiniBand
= DevPath
;
854 L
"Infiniband(%x,%g,%lx,%lx,%lx)",
855 (UINTN
) InfiniBand
->ResourceFlags
,
857 InfiniBand
->ServiceId
,
858 InfiniBand
->TargetPortId
,
864 Convert Device Path to a Unicode string for printing.
866 @param Str The buffer holding the output string.
867 This buffer contains the length of the
868 string and the maixmum length reserved
869 for the string buffer.
870 @param DevPath The device path.
875 IN OUT POOL_PRINT
*Str
,
879 UART_DEVICE_PATH
*Uart
;
883 switch (Uart
->Parity
) {
913 if (Uart
->BaudRate
== 0) {
914 CatPrint (Str
, L
"Uart(DEFAULT,%c,", Parity
);
916 CatPrint (Str
, L
"Uart(%ld,%c,", Uart
->BaudRate
, Parity
);
919 if (Uart
->DataBits
== 0) {
920 CatPrint (Str
, L
"D,");
922 CatPrint (Str
, L
"%d,", (UINTN
) Uart
->DataBits
);
925 switch (Uart
->StopBits
) {
927 CatPrint (Str
, L
"D)");
931 CatPrint (Str
, L
"1)");
935 CatPrint (Str
, L
"1.5)");
939 CatPrint (Str
, L
"2)");
943 CatPrint (Str
, L
"x)");
949 Convert Device Path to a Unicode string for printing.
951 @param Str The buffer holding the output string.
952 This buffer contains the length of the
953 string and the maixmum length reserved
954 for the string buffer.
955 @param DevPath The device path.
960 IN OUT POOL_PRINT
*Str
,
964 ISCSI_DEVICE_PATH_WITH_NAME
*IScsi
;
972 (UINTN
) 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 VLAN_DEVICE_PATH
*Vlan
;
1010 CatPrint (Str
, L
"Vlan(%d)", (UINTN
) Vlan
->VlanId
);
1014 Convert Device Path to a Unicode string for printing.
1016 @param Str The buffer holding the output string.
1017 This buffer contains the length of the
1018 string and the maixmum length reserved
1019 for the string buffer.
1020 @param DevPath The device path.
1025 IN OUT POOL_PRINT
*Str
,
1029 HARDDRIVE_DEVICE_PATH
*Hd
;
1032 switch (Hd
->SignatureType
) {
1033 case SIGNATURE_TYPE_MBR
:
1036 L
"HD(Part%d,Sig%08x)",
1037 (UINTN
) Hd
->PartitionNumber
,
1038 (UINTN
) *((UINT32
*) (&(Hd
->Signature
[0])))
1042 case SIGNATURE_TYPE_GUID
:
1045 L
"HD(Part%d,Sig%g)",
1046 (UINTN
) Hd
->PartitionNumber
,
1047 (EFI_GUID
*) &(Hd
->Signature
[0])
1054 L
"HD(Part%d,MBRType=%02x,SigType=%02x)",
1055 (UINTN
) Hd
->PartitionNumber
,
1056 (UINTN
) Hd
->MBRType
,
1057 (UINTN
) Hd
->SignatureType
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 CDROM_DEVICE_PATH
*Cd
;
1082 CatPrint (Str
, L
"CDROM(Entry%x)", (UINTN
) Cd
->BootEntry
);
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.
1097 IN OUT POOL_PRINT
*Str
,
1101 FILEPATH_DEVICE_PATH
*Fp
;
1104 CatPrint (Str
, L
"%s", Fp
->PathName
);
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.
1118 DevPathMediaProtocol (
1119 IN OUT POOL_PRINT
*Str
,
1123 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1125 MediaProt
= DevPath
;
1126 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
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 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFilePath
;
1147 FvFilePath
= DevPath
;
1148 CatPrint (Str
, L
"%g", &FvFilePath
->FvFileName
);
1152 Convert Device Path to a Unicode string for printing.
1154 @param Str The buffer holding the output string.
1155 This buffer contains the length of the
1156 string and the maixmum length reserved
1157 for the string buffer.
1158 @param DevPath The device path.
1162 MyDevPathRelativeOffsetRange (
1163 IN OUT POOL_PRINT
*Str
,
1167 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1173 Offset
->StartingOffset
,
1174 Offset
->EndingOffset
1179 Convert Device Path to a Unicode string for printing.
1181 @param Str The buffer holding the output string.
1182 This buffer contains the length of the
1183 string and the maixmum length reserved
1184 for the string buffer.
1185 @param DevPath The device path.
1190 IN OUT POOL_PRINT
*Str
,
1194 BBS_BBS_DEVICE_PATH
*Bbs
;
1198 switch (Bbs
->DeviceType
) {
1199 case BBS_TYPE_FLOPPY
:
1203 case BBS_TYPE_HARDDRIVE
:
1204 Type
= L
"Harddrive";
1207 case BBS_TYPE_CDROM
:
1211 case BBS_TYPE_PCMCIA
:
1219 case BBS_TYPE_EMBEDDED_NETWORK
:
1231 CatPrint (Str
, L
"Legacy-%s", Type
);
1235 Convert Device Path to a Unicode string for printing.
1237 @param Str The buffer holding the output string.
1238 This buffer contains the length of the
1239 string and the maixmum length reserved
1240 for the string buffer.
1241 @param DevPath The device path.
1245 DevPathEndInstance (
1246 IN OUT POOL_PRINT
*Str
,
1250 CatPrint (Str
, L
",");
1254 Convert Device Path to a Unicode string for printing.
1256 @param Str The buffer holding the output string.
1257 This buffer contains the length of the
1258 string and the maixmum length reserved
1259 for the string buffer.
1260 @param DevPath The device path.
1264 DevPathNodeUnknown (
1265 IN OUT POOL_PRINT
*Str
,
1269 CatPrint (Str
, L
"?");
1272 Convert Device Path to a Unicode string for printing.
1274 @param Str The buffer holding the output string.
1275 This buffer contains the length of the
1276 string and the maximum length reserved
1277 for the string buffer.
1278 @param DevPath The device path.
1283 IN OUT POOL_PRINT
*Str
,
1287 MEDIA_FW_VOL_DEVICE_PATH
*FvPath
;
1290 CatPrint (Str
, L
"Fv(%g)", &FvPath
->FvName
);
1293 DEVICE_PATH_STRING_TABLE DevPathTable
[] = {
1295 HARDWARE_DEVICE_PATH
,
1300 HARDWARE_DEVICE_PATH
,
1305 HARDWARE_DEVICE_PATH
,
1310 HARDWARE_DEVICE_PATH
,
1315 HARDWARE_DEVICE_PATH
,
1335 MESSAGING_DEVICE_PATH
,
1340 MESSAGING_DEVICE_PATH
,
1345 MESSAGING_DEVICE_PATH
,
1346 MSG_FIBRECHANNEL_DP
,
1350 MESSAGING_DEVICE_PATH
,
1355 MESSAGING_DEVICE_PATH
,
1360 MESSAGING_DEVICE_PATH
,
1365 MESSAGING_DEVICE_PATH
,
1366 MSG_DEVICE_LOGICAL_UNIT_DP
,
1370 MESSAGING_DEVICE_PATH
,
1375 MESSAGING_DEVICE_PATH
,
1380 MESSAGING_DEVICE_PATH
,
1385 MESSAGING_DEVICE_PATH
,
1390 MESSAGING_DEVICE_PATH
,
1395 MESSAGING_DEVICE_PATH
,
1400 MESSAGING_DEVICE_PATH
,
1405 MESSAGING_DEVICE_PATH
,
1410 MESSAGING_DEVICE_PATH
,
1415 MESSAGING_DEVICE_PATH
,
1420 MESSAGING_DEVICE_PATH
,
1447 DevPathMediaProtocol
1451 MEDIA_PIWG_FW_VOL_DP
,
1456 MEDIA_PIWG_FW_FILE_DP
,
1461 MEDIA_RELATIVE_OFFSET_RANGE_DP
,
1462 MyDevPathRelativeOffsetRange
,
1470 END_DEVICE_PATH_TYPE
,
1471 END_INSTANCE_DEVICE_PATH_SUBTYPE
,
1483 This function converts an input device structure to a Unicode string.
1485 @param DevPath A pointer to the device path structure.
1487 @return A new allocated Unicode string that represents the device path.
1493 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
1497 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1498 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*);
1505 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
*DevPathToText
;
1507 ZeroMem (&Str
, sizeof (Str
));
1509 if (DevPath
== NULL
) {
1513 Status
= gBS
->LocateProtocol (
1514 &gEfiDevicePathToTextProtocolGuid
,
1516 (VOID
**) &DevPathToText
1518 if (!EFI_ERROR (Status
)) {
1519 ToText
= DevPathToText
->ConvertDevicePathToText (
1524 ASSERT (ToText
!= NULL
);
1529 // Process each device path node
1531 DevPathNode
= DevPath
;
1532 while (!IsDevicePathEnd (DevPathNode
)) {
1534 // Find the handler to dump this device path node
1537 for (Index
= 0; DevPathTable
[Index
].Function
!= NULL
; Index
+= 1) {
1539 if (DevicePathType (DevPathNode
) == DevPathTable
[Index
].Type
&&
1540 DevicePathSubType (DevPathNode
) == DevPathTable
[Index
].SubType
1542 DumpNode
= DevPathTable
[Index
].Function
;
1547 // If not found, use a generic function
1550 DumpNode
= DevPathNodeUnknown
;
1553 // Put a path seperator in if needed
1555 if ((Str
.Len
!= 0) && (DumpNode
!= DevPathEndInstance
)) {
1556 CatPrint (&Str
, L
"/");
1559 // Print this node of the device path
1561 DumpNode (&Str
, DevPathNode
);
1564 // Next device path node
1566 DevPathNode
= NextDevicePathNode (DevPathNode
);
1570 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1571 Str
.Str
= EfiReallocatePool (Str
.Str
, NewSize
, NewSize
);
1572 ASSERT (Str
.Str
!= NULL
);
1573 Str
.Str
[Str
.Len
] = 0;