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)",
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
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 (UINTN
) ((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
351 ExtendedAcpi
= DevPath
;
352 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) ExtendedAcpi
);
354 AsChar8Array
= (CHAR8
*) ExtendedAcpi
;
360 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
363 if (Index
> Anchor
) {
369 Anchor
= (UINT16
) (Index
+ 1);
370 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
373 if (Index
> Anchor
) {
379 Anchor
= (UINT16
) (Index
+ 1);
380 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
383 if (Index
> Anchor
) {
387 if (HIDSTRIdx
== 0 && CIDSTRIdx
== 0 && ExtendedAcpi
->UID
== 0) {
388 CatPrint (Str
, L
"AcpiExp(");
389 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
390 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
392 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
394 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
395 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
397 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
399 if (UIDSTRIdx
!= 0) {
400 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
402 CatPrint (Str
, L
"\"\")");
405 CatPrint (Str
, L
"AcpiEx(");
406 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
407 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
409 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
411 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
412 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
414 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
416 CatPrint (Str
, L
"%x,", (UINTN
) ExtendedAcpi
->UID
);
418 if (HIDSTRIdx
!= 0) {
419 CatPrint (Str
, L
"%a,", AsChar8Array
+ HIDSTRIdx
);
421 CatPrint (Str
, L
"\"\",");
423 if (CIDSTRIdx
!= 0) {
424 CatPrint (Str
, L
"%a,", AsChar8Array
+ CIDSTRIdx
);
426 CatPrint (Str
, L
"\"\",");
428 if (UIDSTRIdx
!= 0) {
429 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
431 CatPrint (Str
, L
"\"\")");
438 Convert Device Path to a Unicode string for printing.
440 @param Str The buffer holding the output string.
441 This buffer contains the length of the
442 string and the maixmum length reserved
443 for the string buffer.
444 @param DevPath The device path.
449 IN OUT POOL_PRINT
*Str
,
453 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
456 UINT16 AdditionalAdrCount
;
459 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
460 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
462 CatPrint (Str
, L
"AcpiAdr(%x", (UINTN
) AcpiAdr
->ADR
);
463 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
464 CatPrint (Str
, L
",%x", (UINTN
) *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
466 CatPrint (Str
, L
")");
470 Convert Device Path to a Unicode string for printing.
472 @param Str The buffer holding the output string.
473 This buffer contains the length of the
474 string and the maixmum length reserved
475 for the string buffer.
476 @param DevPath The device path.
481 IN OUT POOL_PRINT
*Str
,
485 ATAPI_DEVICE_PATH
*Atapi
;
491 Atapi
->PrimarySecondary
? L
"Secondary" : L
"Primary",
492 Atapi
->SlaveMaster
? L
"Slave" : L
"Master"
497 Convert Device Path to a Unicode string for printing.
499 @param Str The buffer holding the output string.
500 This buffer contains the length of the
501 string and the maixmum length reserved
502 for the string buffer.
503 @param DevPath The device path.
508 IN OUT POOL_PRINT
*Str
,
512 SCSI_DEVICE_PATH
*Scsi
;
515 CatPrint (Str
, L
"Scsi(Pun%x,Lun%x)", (UINTN
) Scsi
->Pun
, (UINTN
) Scsi
->Lun
);
519 Convert Device Path to a Unicode string for printing.
521 @param Str The buffer holding the output string.
522 This buffer contains the length of the
523 string and the maixmum length reserved
524 for the string buffer.
525 @param DevPath The device path.
530 IN OUT POOL_PRINT
*Str
,
534 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
537 CatPrint (Str
, L
"Fibre(Wwn%lx,Lun%x)", Fibre
->WWN
, Fibre
->Lun
);
541 Convert Device Path to a Unicode string for printing.
543 @param Str The buffer holding the output string.
544 This buffer contains the length of the
545 string and the maixmum length reserved
546 for the string buffer.
547 @param DevPath The device path.
552 IN OUT POOL_PRINT
*Str
,
556 F1394_DEVICE_PATH
*F1394Path
;
559 CatPrint (Str
, L
"1394(%lx)", &F1394Path
->Guid
);
563 Convert Device Path to a Unicode string for printing.
565 @param Str The buffer holding the output string.
566 This buffer contains the length of the
567 string and the maixmum length reserved
568 for the string buffer.
569 @param DevPath The device path.
574 IN OUT POOL_PRINT
*Str
,
578 USB_DEVICE_PATH
*Usb
;
581 CatPrint (Str
, L
"Usb(%x,%x)", (UINTN
) Usb
->ParentPortNumber
, (UINTN
) Usb
->InterfaceNumber
);
585 Convert Device Path to a Unicode string for printing.
587 @param Str The buffer holding the output string.
588 This buffer contains the length of the
589 string and the maixmum length reserved
590 for the string buffer.
591 @param DevPath The device path.
596 IN OUT POOL_PRINT
*Str
,
600 USB_WWID_DEVICE_PATH
*UsbWWId
;
605 L
"UsbWwid(%x,%x,%x,\"WWID\")",
606 (UINTN
) UsbWWId
->VendorId
,
607 (UINTN
) UsbWWId
->ProductId
,
608 (UINTN
) UsbWWId
->InterfaceNumber
613 Convert Device Path to a Unicode string for printing.
615 @param Str The buffer holding the output string.
616 This buffer contains the length of the
617 string and the maixmum length reserved
618 for the string buffer.
619 @param DevPath The device path.
624 IN OUT POOL_PRINT
*Str
,
628 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
630 LogicalUnit
= DevPath
;
631 CatPrint (Str
, L
"Unit(%x)", (UINTN
) LogicalUnit
->Lun
);
635 Convert Device Path to a Unicode string for printing.
637 @param Str The buffer holding the output string.
638 This buffer contains the length of the
639 string and the maixmum length reserved
640 for the string buffer.
641 @param DevPath The device path.
646 IN OUT POOL_PRINT
*Str
,
650 USB_CLASS_DEVICE_PATH
*UsbClass
;
655 L
"Usb Class(%x,%x,%x,%x,%x)",
656 (UINTN
) UsbClass
->VendorId
,
657 (UINTN
) UsbClass
->ProductId
,
658 (UINTN
) UsbClass
->DeviceClass
,
659 (UINTN
) UsbClass
->DeviceSubClass
,
660 (UINTN
) UsbClass
->DeviceProtocol
665 Convert Device Path to a Unicode string for printing.
667 @param Str The buffer holding the output string.
668 This buffer contains the length of the
669 string and the maixmum length reserved
670 for the string buffer.
671 @param DevPath The device path.
676 IN OUT POOL_PRINT
*Str
,
680 SATA_DEVICE_PATH
*Sata
;
683 if (Sata
->PortMultiplierPortNumber
& SATA_HBA_DIRECT_CONNECT_FLAG
) {
687 (UINTN
) Sata
->HBAPortNumber
,
694 (UINTN
) Sata
->HBAPortNumber
,
695 (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(%ld,%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
;
968 IScsi
->iSCSITargetName
,
969 (UINTN
) IScsi
->TargetPortalGroupTag
,
973 Options
= IScsi
->LoginOption
;
974 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
975 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
976 if (((Options
>> 11) & 0x0001) != 0) {
977 CatPrint (Str
, L
"%s,", L
"None");
978 } else if (((Options
>> 12) & 0x0001) != 0) {
979 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
981 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
985 CatPrint (Str
, L
"%s)", (IScsi
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
989 Convert Device Path to a Unicode string for printing.
991 @param Str The buffer holding the output string.
992 This buffer contains the length of the
993 string and the maixmum length reserved
994 for the string buffer.
995 @param DevPath The device path.
1000 IN OUT POOL_PRINT
*Str
,
1004 HARDDRIVE_DEVICE_PATH
*Hd
;
1007 switch (Hd
->SignatureType
) {
1008 case SIGNATURE_TYPE_MBR
:
1011 L
"HD(Part%d,Sig%08x)",
1012 (UINTN
) Hd
->PartitionNumber
,
1013 (UINTN
) *((UINT32
*) (&(Hd
->Signature
[0])))
1017 case SIGNATURE_TYPE_GUID
:
1020 L
"HD(Part%d,Sig%g)",
1021 (UINTN
) Hd
->PartitionNumber
,
1022 (EFI_GUID
*) &(Hd
->Signature
[0])
1029 L
"HD(Part%d,MBRType=%02x,SigType=%02x)",
1030 (UINTN
) Hd
->PartitionNumber
,
1031 (UINTN
) Hd
->MBRType
,
1032 (UINTN
) Hd
->SignatureType
1039 Convert Device Path to a Unicode string for printing.
1041 @param Str The buffer holding the output string.
1042 This buffer contains the length of the
1043 string and the maixmum length reserved
1044 for the string buffer.
1045 @param DevPath The device path.
1050 IN OUT POOL_PRINT
*Str
,
1054 CDROM_DEVICE_PATH
*Cd
;
1057 CatPrint (Str
, L
"CDROM(Entry%x)", (UINTN
) Cd
->BootEntry
);
1061 Convert Device Path to a Unicode string for printing.
1063 @param Str The buffer holding the output string.
1064 This buffer contains the length of the
1065 string and the maixmum length reserved
1066 for the string buffer.
1067 @param DevPath The device path.
1072 IN OUT POOL_PRINT
*Str
,
1076 FILEPATH_DEVICE_PATH
*Fp
;
1079 CatPrint (Str
, L
"%s", Fp
->PathName
);
1083 Convert Device Path to a Unicode string for printing.
1085 @param Str The buffer holding the output string.
1086 This buffer contains the length of the
1087 string and the maixmum length reserved
1088 for the string buffer.
1089 @param DevPath The device path.
1093 DevPathMediaProtocol (
1094 IN OUT POOL_PRINT
*Str
,
1098 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1100 MediaProt
= DevPath
;
1101 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1105 Convert Device Path to a Unicode string for printing.
1107 @param Str The buffer holding the output string.
1108 This buffer contains the length of the
1109 string and the maixmum length reserved
1110 for the string buffer.
1111 @param DevPath The device path.
1116 IN OUT POOL_PRINT
*Str
,
1120 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFilePath
;
1122 FvFilePath
= DevPath
;
1123 CatPrint (Str
, L
"%g", &FvFilePath
->FvFileName
);
1127 Convert Device Path to a Unicode string for printing.
1129 @param Str The buffer holding the output string.
1130 This buffer contains the length of the
1131 string and the maixmum length reserved
1132 for the string buffer.
1133 @param DevPath The device path.
1138 IN OUT POOL_PRINT
*Str
,
1142 BBS_BBS_DEVICE_PATH
*Bbs
;
1146 switch (Bbs
->DeviceType
) {
1147 case BBS_TYPE_FLOPPY
:
1151 case BBS_TYPE_HARDDRIVE
:
1152 Type
= L
"Harddrive";
1155 case BBS_TYPE_CDROM
:
1159 case BBS_TYPE_PCMCIA
:
1167 case BBS_TYPE_EMBEDDED_NETWORK
:
1179 CatPrint (Str
, L
"Legacy-%s", Type
);
1183 Convert Device Path to a Unicode string for printing.
1185 @param Str The buffer holding the output string.
1186 This buffer contains the length of the
1187 string and the maixmum length reserved
1188 for the string buffer.
1189 @param DevPath The device path.
1193 DevPathEndInstance (
1194 IN OUT POOL_PRINT
*Str
,
1198 CatPrint (Str
, L
",");
1202 Convert Device Path to a Unicode string for printing.
1204 @param Str The buffer holding the output string.
1205 This buffer contains the length of the
1206 string and the maixmum length reserved
1207 for the string buffer.
1208 @param DevPath The device path.
1212 DevPathNodeUnknown (
1213 IN OUT POOL_PRINT
*Str
,
1217 CatPrint (Str
, L
"?");
1220 Convert Device Path to a Unicode string for printing.
1222 @param Str The buffer holding the output string.
1223 This buffer contains the length of the
1224 string and the maximum length reserved
1225 for the string buffer.
1226 @param DevPath The device path.
1231 IN OUT POOL_PRINT
*Str
,
1235 MEDIA_FW_VOL_DEVICE_PATH
*FvPath
;
1238 CatPrint (Str
, L
"Fv(%g)", &FvPath
->FvName
);
1241 DEVICE_PATH_STRING_TABLE DevPathTable
[] = {
1243 HARDWARE_DEVICE_PATH
,
1248 HARDWARE_DEVICE_PATH
,
1253 HARDWARE_DEVICE_PATH
,
1258 HARDWARE_DEVICE_PATH
,
1263 HARDWARE_DEVICE_PATH
,
1283 MESSAGING_DEVICE_PATH
,
1288 MESSAGING_DEVICE_PATH
,
1293 MESSAGING_DEVICE_PATH
,
1294 MSG_FIBRECHANNEL_DP
,
1298 MESSAGING_DEVICE_PATH
,
1303 MESSAGING_DEVICE_PATH
,
1308 MESSAGING_DEVICE_PATH
,
1313 MESSAGING_DEVICE_PATH
,
1314 MSG_DEVICE_LOGICAL_UNIT_DP
,
1318 MESSAGING_DEVICE_PATH
,
1323 MESSAGING_DEVICE_PATH
,
1328 MESSAGING_DEVICE_PATH
,
1333 MESSAGING_DEVICE_PATH
,
1338 MESSAGING_DEVICE_PATH
,
1343 MESSAGING_DEVICE_PATH
,
1348 MESSAGING_DEVICE_PATH
,
1353 MESSAGING_DEVICE_PATH
,
1358 MESSAGING_DEVICE_PATH
,
1363 MESSAGING_DEVICE_PATH
,
1390 DevPathMediaProtocol
1394 MEDIA_PIWG_FW_VOL_DP
,
1399 MEDIA_PIWG_FW_FILE_DP
,
1408 END_DEVICE_PATH_TYPE
,
1409 END_INSTANCE_DEVICE_PATH_SUBTYPE
,
1421 This function converts an input device structure to a Unicode string.
1423 @param DevPath A pointer to the device path structure.
1425 @return A new allocated Unicode string that represents the device path.
1431 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
1435 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1436 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*);
1443 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
*DevPathToText
;
1445 ZeroMem (&Str
, sizeof (Str
));
1447 if (DevPath
== NULL
) {
1451 Status
= gBS
->LocateProtocol (
1452 &gEfiDevicePathToTextProtocolGuid
,
1454 (VOID
**) &DevPathToText
1456 if (!EFI_ERROR (Status
)) {
1457 ToText
= DevPathToText
->ConvertDevicePathToText (
1462 ASSERT (ToText
!= NULL
);
1467 // Process each device path node
1469 DevPathNode
= DevPath
;
1470 while (!IsDevicePathEnd (DevPathNode
)) {
1472 // Find the handler to dump this device path node
1475 for (Index
= 0; DevPathTable
[Index
].Function
; Index
+= 1) {
1477 if (DevicePathType (DevPathNode
) == DevPathTable
[Index
].Type
&&
1478 DevicePathSubType (DevPathNode
) == DevPathTable
[Index
].SubType
1480 DumpNode
= DevPathTable
[Index
].Function
;
1485 // If not found, use a generic function
1488 DumpNode
= DevPathNodeUnknown
;
1491 // Put a path seperator in if needed
1493 if (Str
.len
&& DumpNode
!= DevPathEndInstance
) {
1494 CatPrint (&Str
, L
"/");
1497 // Print this node of the device path
1499 DumpNode (&Str
, DevPathNode
);
1502 // Next device path node
1504 DevPathNode
= NextDevicePathNode (DevPathNode
);
1508 NewSize
= (Str
.len
+ 1) * sizeof (CHAR16
);
1509 Str
.str
= ReallocatePool (NewSize
, NewSize
, Str
.str
);
1510 ASSERT (Str
.str
!= NULL
);
1511 Str
.str
[Str
.len
] = 0;