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.
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)",
143 (UINTN
) MemMap
->MemoryType
,
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
181 IN OUT POOL_PRINT
*Str
,
185 VENDOR_DEVICE_PATH
*Vendor
;
189 UINT32 FlowControlMap
;
195 switch (DevicePathType (&Vendor
->Header
)) {
196 case HARDWARE_DEVICE_PATH
:
200 case MESSAGING_DEVICE_PATH
:
202 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
203 CatPrint (Str
, L
"VenPcAnsi()");
205 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
206 CatPrint (Str
, L
"VenVt100()");
208 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
209 CatPrint (Str
, L
"VenVt100Plus()");
211 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
212 CatPrint (Str
, L
"VenUft8()");
214 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
215 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
216 switch (FlowControlMap
& 0x00000003) {
218 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
222 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
226 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
235 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
239 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
240 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
241 (UINTN
) ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
243 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
244 if ((Info
& 0x0f) == 0) {
245 CatPrint (Str
, L
"NoTopology,0,0,0,");
246 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
250 ((Info
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
251 ((Info
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
252 ((Info
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
254 if ((Info
& 0x0f) == 1) {
255 CatPrint (Str
, L
"0,");
257 CatPrint (Str
, L
"%x,", (UINTN
) ((Info
>> 8) & 0xff));
260 CatPrint (Str
, L
"0,0,0,0,");
263 CatPrint (Str
, L
"%x)", (UINTN
) ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
266 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
267 CatPrint (Str
, L
"DebugPort()");
272 case MEDIA_DEVICE_PATH
:
281 CatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
282 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
283 if (DataLength
> 0) {
284 CatPrint (Str
, L
",");
285 for (Index
= 0; Index
< DataLength
; Index
++) {
286 CatPrint (Str
, L
"%02x", (UINTN
) ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
289 CatPrint (Str
, L
")");
293 Convert Device Path to a Unicode string for printing.
295 @param Str The buffer holding the output string.
296 This buffer contains the length of the
297 string and the maixmum length reserved
298 for the string buffer.
299 @param DevPath The device path.
304 IN OUT POOL_PRINT
*Str
,
308 ACPI_HID_DEVICE_PATH
*Acpi
;
311 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
312 CatPrint (Str
, L
"Acpi(PNP%04x,%x)", (UINTN
) EISA_ID_TO_NUM (Acpi
->HID
), (UINTN
) Acpi
->UID
);
314 CatPrint (Str
, L
"Acpi(%08x,%x)", (UINTN
) Acpi
->HID
, (UINTN
) Acpi
->UID
);
319 Convert Device Path to a Unicode string for printing.
321 @param Str The buffer holding the output string.
322 This buffer contains the length of the
323 string and the maixmum length reserved
324 for the string buffer.
325 @param DevPath The device path.
329 DevPathExtendedAcpi (
330 IN OUT POOL_PRINT
*Str
,
334 ACPI_EXTENDED_HID_DEVICE_PATH
*ExtendedAcpi
;
337 // Index for HID, UID and CID strings, 0 for non-exist
350 ExtendedAcpi
= DevPath
;
351 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) ExtendedAcpi
);
353 AsChar8Array
= (CHAR8
*) ExtendedAcpi
;
359 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
362 if (Index
> Anchor
) {
368 Anchor
= (UINT16
) (Index
+ 1);
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
) {
386 if (HIDSTRIdx
== 0 && CIDSTRIdx
== 0 && ExtendedAcpi
->UID
== 0) {
387 CatPrint (Str
, L
"AcpiExp(");
388 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
389 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
391 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
393 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
394 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
396 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
398 if (UIDSTRIdx
!= 0) {
399 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
401 CatPrint (Str
, L
"\"\")");
404 CatPrint (Str
, L
"AcpiEx(");
405 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
406 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
408 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
410 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
411 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
413 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
415 CatPrint (Str
, L
"%x,", (UINTN
) ExtendedAcpi
->UID
);
417 if (HIDSTRIdx
!= 0) {
418 CatPrint (Str
, L
"%a,", AsChar8Array
+ HIDSTRIdx
);
420 CatPrint (Str
, L
"\"\",");
422 if (CIDSTRIdx
!= 0) {
423 CatPrint (Str
, L
"%a,", AsChar8Array
+ CIDSTRIdx
);
425 CatPrint (Str
, L
"\"\",");
427 if (UIDSTRIdx
!= 0) {
428 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
430 CatPrint (Str
, L
"\"\")");
437 Convert Device Path to a Unicode string for printing.
439 @param Str The buffer holding the output string.
440 This buffer contains the length of the
441 string and the maixmum length reserved
442 for the string buffer.
443 @param DevPath The device path.
448 IN OUT POOL_PRINT
*Str
,
452 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
455 UINT16 AdditionalAdrCount
;
458 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
459 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
461 CatPrint (Str
, L
"AcpiAdr(%x", (UINTN
) AcpiAdr
->ADR
);
462 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
463 CatPrint (Str
, L
",%x", (UINTN
) *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
465 CatPrint (Str
, L
")");
469 Convert Device Path to a Unicode string for printing.
471 @param Str The buffer holding the output string.
472 This buffer contains the length of the
473 string and the maixmum length reserved
474 for the string buffer.
475 @param DevPath The device path.
480 IN OUT POOL_PRINT
*Str
,
484 ATAPI_DEVICE_PATH
*Atapi
;
490 (Atapi
->PrimarySecondary
!= 0)? L
"Secondary" : L
"Primary",
491 (Atapi
->SlaveMaster
!= 0)? L
"Slave" : L
"Master"
496 Convert Device Path to a Unicode string for printing.
498 @param Str The buffer holding the output string.
499 This buffer contains the length of the
500 string and the maixmum length reserved
501 for the string buffer.
502 @param DevPath The device path.
507 IN OUT POOL_PRINT
*Str
,
511 SCSI_DEVICE_PATH
*Scsi
;
514 CatPrint (Str
, L
"Scsi(Pun%x,Lun%x)", (UINTN
) Scsi
->Pun
, (UINTN
) Scsi
->Lun
);
518 Convert Device Path to a Unicode string for printing.
520 @param Str The buffer holding the output string.
521 This buffer contains the length of the
522 string and the maixmum length reserved
523 for the string buffer.
524 @param DevPath The device path.
529 IN OUT POOL_PRINT
*Str
,
533 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
536 CatPrint (Str
, L
"Fibre(Wwn%lx,Lun%x)", Fibre
->WWN
, Fibre
->Lun
);
540 Convert Device Path to a Unicode string for printing.
542 @param Str The buffer holding the output string.
543 This buffer contains the length of the
544 string and the maixmum length reserved
545 for the string buffer.
546 @param DevPath The device path.
551 IN OUT POOL_PRINT
*Str
,
555 F1394_DEVICE_PATH
*F1394Path
;
558 CatPrint (Str
, L
"1394(%lx)", &F1394Path
->Guid
);
562 Convert Device Path to a Unicode string for printing.
564 @param Str The buffer holding the output string.
565 This buffer contains the length of the
566 string and the maixmum length reserved
567 for the string buffer.
568 @param DevPath The device path.
573 IN OUT POOL_PRINT
*Str
,
577 USB_DEVICE_PATH
*Usb
;
580 CatPrint (Str
, L
"Usb(%x,%x)", (UINTN
) Usb
->ParentPortNumber
, (UINTN
) Usb
->InterfaceNumber
);
584 Convert Device Path to a Unicode string for printing.
586 @param Str The buffer holding the output string.
587 This buffer contains the length of the
588 string and the maixmum length reserved
589 for the string buffer.
590 @param DevPath The device path.
595 IN OUT POOL_PRINT
*Str
,
599 USB_WWID_DEVICE_PATH
*UsbWWId
;
604 L
"UsbWwid(%x,%x,%x,\"WWID\")",
605 (UINTN
) UsbWWId
->VendorId
,
606 (UINTN
) UsbWWId
->ProductId
,
607 (UINTN
) UsbWWId
->InterfaceNumber
612 Convert Device Path to a Unicode string for printing.
614 @param Str The buffer holding the output string.
615 This buffer contains the length of the
616 string and the maixmum length reserved
617 for the string buffer.
618 @param DevPath The device path.
623 IN OUT POOL_PRINT
*Str
,
627 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
629 LogicalUnit
= DevPath
;
630 CatPrint (Str
, L
"Unit(%x)", (UINTN
) LogicalUnit
->Lun
);
634 Convert Device Path to a Unicode string for printing.
636 @param Str The buffer holding the output string.
637 This buffer contains the length of the
638 string and the maixmum length reserved
639 for the string buffer.
640 @param DevPath The device path.
645 IN OUT POOL_PRINT
*Str
,
649 USB_CLASS_DEVICE_PATH
*UsbClass
;
654 L
"Usb Class(%x,%x,%x,%x,%x)",
655 (UINTN
) UsbClass
->VendorId
,
656 (UINTN
) UsbClass
->ProductId
,
657 (UINTN
) UsbClass
->DeviceClass
,
658 (UINTN
) UsbClass
->DeviceSubClass
,
659 (UINTN
) UsbClass
->DeviceProtocol
664 Convert Device Path to a Unicode string for printing.
666 @param Str The buffer holding the output string.
667 This buffer contains the length of the
668 string and the maixmum length reserved
669 for the string buffer.
670 @param DevPath The device path.
675 IN OUT POOL_PRINT
*Str
,
679 SATA_DEVICE_PATH
*Sata
;
682 if ((Sata
->PortMultiplierPortNumber
& SATA_HBA_DIRECT_CONNECT_FLAG
) != 0) {
686 (UINTN
) Sata
->HBAPortNumber
,
693 (UINTN
) Sata
->HBAPortNumber
,
694 (UINTN
) Sata
->PortMultiplierPortNumber
,
701 Convert Device Path to a Unicode string for printing.
703 @param Str The buffer holding the output string.
704 This buffer contains the length of the
705 string and the maixmum length reserved
706 for the string buffer.
707 @param DevPath The device path.
712 IN OUT POOL_PRINT
*Str
,
716 I2O_DEVICE_PATH
*I2OPath
;
719 CatPrint (Str
, L
"I2O(%x)", (UINTN
) I2OPath
->Tid
);
723 Convert Device Path to a Unicode string for printing.
725 @param Str The buffer holding the output string.
726 This buffer contains the length of the
727 string and the maixmum length reserved
728 for the string buffer.
729 @param DevPath The device path.
734 IN OUT POOL_PRINT
*Str
,
738 MAC_ADDR_DEVICE_PATH
*MACDevPath
;
742 MACDevPath
= DevPath
;
744 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
745 if (MACDevPath
->IfType
== 0x01 || MACDevPath
->IfType
== 0x00) {
749 CatPrint (Str
, L
"Mac(");
751 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
752 CatPrint (Str
, L
"%02x", (UINTN
) MACDevPath
->MacAddress
.Addr
[Index
]);
755 CatPrint (Str
, L
")");
759 Convert Device Path to a Unicode string for printing.
761 @param Str The buffer holding the output string.
762 This buffer contains the length of the
763 string and the maixmum length reserved
764 for the string buffer.
765 @param DevPath The device path.
770 IN OUT POOL_PRINT
*Str
,
774 IPv4_DEVICE_PATH
*IPDevPath
;
779 L
"IPv4(%d.%d.%d.%d:%d)",
780 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[0],
781 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[1],
782 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[2],
783 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[3],
784 (UINTN
) IPDevPath
->RemotePort
789 Convert Device Path to a Unicode string for printing.
791 @param Str The buffer holding the output string.
792 This buffer contains the length of the
793 string and the maixmum length reserved
794 for the string buffer.
795 @param DevPath The device path.
800 IN OUT POOL_PRINT
*Str
,
804 IPv6_DEVICE_PATH
*IPv6DevPath
;
806 IPv6DevPath
= DevPath
;
809 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
810 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[0],
811 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[1],
812 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[2],
813 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[3],
814 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[4],
815 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[5],
816 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[6],
817 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[7],
818 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[8],
819 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[9],
820 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[10],
821 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[11],
822 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[12],
823 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[13],
824 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[14],
825 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[15]
830 Convert Device Path to a Unicode string for printing.
832 @param Str The buffer holding the output string.
833 This buffer contains the length of the
834 string and the maixmum length reserved
835 for the string buffer.
836 @param DevPath The device path.
841 IN OUT POOL_PRINT
*Str
,
845 INFINIBAND_DEVICE_PATH
*InfiniBand
;
847 InfiniBand
= DevPath
;
850 L
"Infiniband(%x,%g,%lx,%lx,%lx)",
851 (UINTN
) InfiniBand
->ResourceFlags
,
853 InfiniBand
->ServiceId
,
854 InfiniBand
->TargetPortId
,
860 Convert Device Path to a Unicode string for printing.
862 @param Str The buffer holding the output string.
863 This buffer contains the length of the
864 string and the maixmum length reserved
865 for the string buffer.
866 @param DevPath The device path.
871 IN OUT POOL_PRINT
*Str
,
875 UART_DEVICE_PATH
*Uart
;
879 switch (Uart
->Parity
) {
909 if (Uart
->BaudRate
== 0) {
910 CatPrint (Str
, L
"Uart(DEFAULT,%c,", Parity
);
912 CatPrint (Str
, L
"Uart(%ld,%c,", Uart
->BaudRate
, Parity
);
915 if (Uart
->DataBits
== 0) {
916 CatPrint (Str
, L
"D,");
918 CatPrint (Str
, L
"%d,", (UINTN
) Uart
->DataBits
);
921 switch (Uart
->StopBits
) {
923 CatPrint (Str
, L
"D)");
927 CatPrint (Str
, L
"1)");
931 CatPrint (Str
, L
"1.5)");
935 CatPrint (Str
, L
"2)");
939 CatPrint (Str
, L
"x)");
945 Convert Device Path to a Unicode string for printing.
947 @param Str The buffer holding the output string.
948 This buffer contains the length of the
949 string and the maixmum length reserved
950 for the string buffer.
951 @param DevPath The device path.
956 IN OUT POOL_PRINT
*Str
,
960 ISCSI_DEVICE_PATH_WITH_NAME
*IScsi
;
968 (UINTN
) IScsi
->TargetPortalGroupTag
,
972 Options
= IScsi
->LoginOption
;
973 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
974 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
975 if (((Options
>> 11) & 0x0001) != 0) {
976 CatPrint (Str
, L
"%s,", L
"None");
977 } else if (((Options
>> 12) & 0x0001) != 0) {
978 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
980 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
984 CatPrint (Str
, L
"%s)", (IScsi
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
988 Convert Device Path to a Unicode string for printing.
990 @param Str The buffer holding the output string.
991 This buffer contains the length of the
992 string and the maixmum length reserved
993 for the string buffer.
994 @param DevPath The device path.
999 IN OUT POOL_PRINT
*Str
,
1003 VLAN_DEVICE_PATH
*Vlan
;
1006 CatPrint (Str
, L
"Vlan(%d)", (UINTN
) Vlan
->VlanId
);
1010 Convert Device Path to a Unicode string for printing.
1012 @param Str The buffer holding the output string.
1013 This buffer contains the length of the
1014 string and the maixmum length reserved
1015 for the string buffer.
1016 @param DevPath The device path.
1021 IN OUT POOL_PRINT
*Str
,
1025 HARDDRIVE_DEVICE_PATH
*Hd
;
1028 switch (Hd
->SignatureType
) {
1029 case SIGNATURE_TYPE_MBR
:
1032 L
"HD(Part%d,Sig%08x)",
1033 (UINTN
) Hd
->PartitionNumber
,
1034 (UINTN
) *((UINT32
*) (&(Hd
->Signature
[0])))
1038 case SIGNATURE_TYPE_GUID
:
1041 L
"HD(Part%d,Sig%g)",
1042 (UINTN
) Hd
->PartitionNumber
,
1043 (EFI_GUID
*) &(Hd
->Signature
[0])
1050 L
"HD(Part%d,MBRType=%02x,SigType=%02x)",
1051 (UINTN
) Hd
->PartitionNumber
,
1052 (UINTN
) Hd
->MBRType
,
1053 (UINTN
) Hd
->SignatureType
1060 Convert Device Path to a Unicode string for printing.
1062 @param Str The buffer holding the output string.
1063 This buffer contains the length of the
1064 string and the maixmum length reserved
1065 for the string buffer.
1066 @param DevPath The device path.
1071 IN OUT POOL_PRINT
*Str
,
1075 CDROM_DEVICE_PATH
*Cd
;
1078 CatPrint (Str
, L
"CDROM(Entry%x)", (UINTN
) Cd
->BootEntry
);
1082 Convert Device Path to a Unicode string for printing.
1084 @param Str The buffer holding the output string.
1085 This buffer contains the length of the
1086 string and the maixmum length reserved
1087 for the string buffer.
1088 @param DevPath The device path.
1093 IN OUT POOL_PRINT
*Str
,
1097 FILEPATH_DEVICE_PATH
*Fp
;
1100 CatPrint (Str
, L
"%s", Fp
->PathName
);
1104 Convert Device Path to a Unicode string for printing.
1106 @param Str The buffer holding the output string.
1107 This buffer contains the length of the
1108 string and the maixmum length reserved
1109 for the string buffer.
1110 @param DevPath The device path.
1114 DevPathMediaProtocol (
1115 IN OUT POOL_PRINT
*Str
,
1119 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1121 MediaProt
= DevPath
;
1122 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1126 Convert Device Path to a Unicode string for printing.
1128 @param Str The buffer holding the output string.
1129 This buffer contains the length of the
1130 string and the maixmum length reserved
1131 for the string buffer.
1132 @param DevPath The device path.
1137 IN OUT POOL_PRINT
*Str
,
1141 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFilePath
;
1143 FvFilePath
= DevPath
;
1144 CatPrint (Str
, L
"%g", &FvFilePath
->FvFileName
);
1148 Convert Device Path to a Unicode string for printing.
1150 @param Str The buffer holding the output string.
1151 This buffer contains the length of the
1152 string and the maixmum length reserved
1153 for the string buffer.
1154 @param DevPath The device path.
1158 DevPathRelativeOffsetRange (
1159 IN OUT POOL_PRINT
*Str
,
1163 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1169 Offset
->StartingOffset
,
1170 Offset
->EndingOffset
1175 Convert Device Path to a Unicode string for printing.
1177 @param Str The buffer holding the output string.
1178 This buffer contains the length of the
1179 string and the maixmum length reserved
1180 for the string buffer.
1181 @param DevPath The device path.
1186 IN OUT POOL_PRINT
*Str
,
1190 BBS_BBS_DEVICE_PATH
*Bbs
;
1194 switch (Bbs
->DeviceType
) {
1195 case BBS_TYPE_FLOPPY
:
1199 case BBS_TYPE_HARDDRIVE
:
1200 Type
= L
"Harddrive";
1203 case BBS_TYPE_CDROM
:
1207 case BBS_TYPE_PCMCIA
:
1215 case BBS_TYPE_EMBEDDED_NETWORK
:
1227 CatPrint (Str
, L
"Legacy-%s", Type
);
1231 Convert Device Path to a Unicode string for printing.
1233 @param Str The buffer holding the output string.
1234 This buffer contains the length of the
1235 string and the maixmum length reserved
1236 for the string buffer.
1237 @param DevPath The device path.
1241 DevPathEndInstance (
1242 IN OUT POOL_PRINT
*Str
,
1246 CatPrint (Str
, L
",");
1250 Convert Device Path to a Unicode string for printing.
1252 @param Str The buffer holding the output string.
1253 This buffer contains the length of the
1254 string and the maixmum length reserved
1255 for the string buffer.
1256 @param DevPath The device path.
1260 DevPathNodeUnknown (
1261 IN OUT POOL_PRINT
*Str
,
1265 CatPrint (Str
, L
"?");
1268 Convert Device Path to a Unicode string for printing.
1270 @param Str The buffer holding the output string.
1271 This buffer contains the length of the
1272 string and the maximum length reserved
1273 for the string buffer.
1274 @param DevPath The device path.
1279 IN OUT POOL_PRINT
*Str
,
1283 MEDIA_FW_VOL_DEVICE_PATH
*FvPath
;
1286 CatPrint (Str
, L
"Fv(%g)", &FvPath
->FvName
);
1289 DEVICE_PATH_STRING_TABLE DevPathTable
[] = {
1291 HARDWARE_DEVICE_PATH
,
1296 HARDWARE_DEVICE_PATH
,
1301 HARDWARE_DEVICE_PATH
,
1306 HARDWARE_DEVICE_PATH
,
1311 HARDWARE_DEVICE_PATH
,
1331 MESSAGING_DEVICE_PATH
,
1336 MESSAGING_DEVICE_PATH
,
1341 MESSAGING_DEVICE_PATH
,
1342 MSG_FIBRECHANNEL_DP
,
1346 MESSAGING_DEVICE_PATH
,
1351 MESSAGING_DEVICE_PATH
,
1356 MESSAGING_DEVICE_PATH
,
1361 MESSAGING_DEVICE_PATH
,
1362 MSG_DEVICE_LOGICAL_UNIT_DP
,
1366 MESSAGING_DEVICE_PATH
,
1371 MESSAGING_DEVICE_PATH
,
1376 MESSAGING_DEVICE_PATH
,
1381 MESSAGING_DEVICE_PATH
,
1386 MESSAGING_DEVICE_PATH
,
1391 MESSAGING_DEVICE_PATH
,
1396 MESSAGING_DEVICE_PATH
,
1401 MESSAGING_DEVICE_PATH
,
1406 MESSAGING_DEVICE_PATH
,
1411 MESSAGING_DEVICE_PATH
,
1416 MESSAGING_DEVICE_PATH
,
1443 DevPathMediaProtocol
1447 MEDIA_PIWG_FW_VOL_DP
,
1452 MEDIA_PIWG_FW_FILE_DP
,
1457 MEDIA_RELATIVE_OFFSET_RANGE_DP
,
1458 DevPathRelativeOffsetRange
,
1466 END_DEVICE_PATH_TYPE
,
1467 END_INSTANCE_DEVICE_PATH_SUBTYPE
,
1479 This function converts an input device structure to a Unicode string.
1481 @param DevPath A pointer to the device path structure.
1483 @return A new allocated Unicode string that represents the device path.
1489 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
1493 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1494 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*);
1501 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
*DevPathToText
;
1503 ZeroMem (&Str
, sizeof (Str
));
1505 if (DevPath
== NULL
) {
1509 Status
= gBS
->LocateProtocol (
1510 &gEfiDevicePathToTextProtocolGuid
,
1512 (VOID
**) &DevPathToText
1514 if (!EFI_ERROR (Status
)) {
1515 ToText
= DevPathToText
->ConvertDevicePathToText (
1520 ASSERT (ToText
!= NULL
);
1525 // Process each device path node
1527 DevPathNode
= DevPath
;
1528 while (!IsDevicePathEnd (DevPathNode
)) {
1530 // Find the handler to dump this device path node
1533 for (Index
= 0; DevPathTable
[Index
].Function
!= NULL
; Index
+= 1) {
1535 if (DevicePathType (DevPathNode
) == DevPathTable
[Index
].Type
&&
1536 DevicePathSubType (DevPathNode
) == DevPathTable
[Index
].SubType
1538 DumpNode
= DevPathTable
[Index
].Function
;
1543 // If not found, use a generic function
1546 DumpNode
= DevPathNodeUnknown
;
1549 // Put a path seperator in if needed
1551 if ((Str
.Len
!= 0) && (DumpNode
!= DevPathEndInstance
)) {
1552 CatPrint (&Str
, L
"/");
1555 // Print this node of the device path
1557 DumpNode (&Str
, DevPathNode
);
1560 // Next device path node
1562 DevPathNode
= NextDevicePathNode (DevPathNode
);
1566 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1567 Str
.Str
= ReallocatePool (NewSize
, NewSize
, Str
.Str
);
1568 ASSERT (Str
.Str
!= NULL
);
1569 Str
.Str
[Str
.Len
] = 0;