2 Internal function defines the default device path string for SecureBoot configuration module.
4 Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "SecureBootConfigImpl.h"
18 Concatenates a formatted unicode string to allocated pool.
19 The caller must free the resulting buffer.
21 @param[in, out] Str Tracks the allocated pool, size in use, and amount of pool allocated.
22 @param[in] Fmt The format string
23 @param[in] ... The data will be printed.
25 @return Allocated buffer with the formatted string printed in it.
26 The caller must free the allocated buffer.
27 The buffer allocation is not packed.
33 IN OUT POOL_PRINT
*Str
,
42 AppendStr
= AllocateZeroPool (0x1000);
43 if (AppendStr
== NULL
) {
48 UnicodeVSPrint (AppendStr
, 0x1000, Fmt
, Args
);
50 if (NULL
== Str
->Str
) {
51 StringSize
= StrSize (AppendStr
);
52 Str
->Str
= AllocateZeroPool (StringSize
);
53 ASSERT (Str
->Str
!= NULL
);
55 StringSize
= StrSize (AppendStr
);
56 StringSize
+= (StrSize (Str
->Str
) - sizeof (UINT16
));
58 Str
->Str
= ReallocatePool (
63 ASSERT (Str
->Str
!= NULL
);
66 Str
->Maxlen
= MAX_CHAR
* sizeof (UINT16
);
67 if (StringSize
< Str
->Maxlen
) {
68 StrCat (Str
->Str
, AppendStr
);
69 Str
->Len
= StringSize
- sizeof (UINT16
);
77 Convert Device Path to a Unicode string for printing.
79 @param[in, out] Str The buffer holding the output string.
80 This buffer contains the length of the string and
81 the maixmum length reserved for the string buffer.
82 @param[in] DevPath The device path.
87 IN OUT POOL_PRINT
*Str
,
94 CatPrint (Str
, L
"Pci(%x|%x)", (UINTN
) Pci
->Device
, (UINTN
) Pci
->Function
);
98 Convert Device Path to a Unicode string for printing.
100 @param[in, out] Str The buffer holding the output string.
101 This buffer contains the length of the string and
102 the maixmum length reserved for the string buffer.
103 @param[in] DevPath The device path.
108 IN OUT POOL_PRINT
*Str
,
112 PCCARD_DEVICE_PATH
*Pccard
;
115 CatPrint (Str
, L
"Pcmcia(Function%x)", (UINTN
) Pccard
->FunctionNumber
);
119 Convert Device Path to a Unicode string for printing.
121 @param[in, out] Str The buffer holding the output string.
122 This buffer contains the length of the string and
123 the maixmum length reserved for the string buffer.
124 @param[in] DevPath The device path.
129 IN OUT POOL_PRINT
*Str
,
133 MEMMAP_DEVICE_PATH
*MemMap
;
138 L
"MemMap(%d:%lx-%lx)",
139 (UINTN
) MemMap
->MemoryType
,
140 MemMap
->StartingAddress
,
141 MemMap
->EndingAddress
146 Convert Device Path to a Unicode string for printing.
148 @param[in, out] Str The buffer holding the output string.
149 This buffer contains the length of the string and
150 the maixmum length reserved for the string buffer.
151 @param[in] DevPath The device path.
156 IN OUT POOL_PRINT
*Str
,
160 CONTROLLER_DEVICE_PATH
*Controller
;
162 Controller
= DevPath
;
163 CatPrint (Str
, L
"Ctrl(%d)", (UINTN
) Controller
->ControllerNumber
);
168 Convert Vendor device path to device name.
170 @param[in, out] Str The buffer store device name
171 @param[in] DevPath Pointer to vendor device path
176 IN OUT POOL_PRINT
*Str
,
180 VENDOR_DEVICE_PATH
*Vendor
;
184 UINT32 FlowControlMap
;
190 switch (DevicePathType (&Vendor
->Header
)) {
191 case HARDWARE_DEVICE_PATH
:
195 case MESSAGING_DEVICE_PATH
:
197 if (CompareGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
)) {
198 CatPrint (Str
, L
"VenPcAnsi()");
200 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100Guid
)) {
201 CatPrint (Str
, L
"VenVt100()");
203 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
)) {
204 CatPrint (Str
, L
"VenVt100Plus()");
206 } else if (CompareGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
)) {
207 CatPrint (Str
, L
"VenUft8()");
209 } else if (CompareGuid (&Vendor
->Guid
, &gEfiUartDevicePathGuid
)) {
210 FlowControlMap
= (((UART_FLOW_CONTROL_DEVICE_PATH
*) Vendor
)->FlowControlMap
);
211 switch (FlowControlMap
& 0x00000003) {
213 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"None");
217 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"Hardware");
221 CatPrint (Str
, L
"UartFlowCtrl(%s)", L
"XonXoff");
230 } else if (CompareGuid (&Vendor
->Guid
, &gEfiSasDevicePathGuid
)) {
234 ((SAS_DEVICE_PATH
*) Vendor
)->SasAddress
,
235 ((SAS_DEVICE_PATH
*) Vendor
)->Lun
,
236 (UINTN
) ((SAS_DEVICE_PATH
*) Vendor
)->RelativeTargetPort
238 Info
= (((SAS_DEVICE_PATH
*) Vendor
)->DeviceTopology
);
239 if ((Info
& 0x0f) == 0) {
240 CatPrint (Str
, L
"NoTopology,0,0,0,");
241 } else if (((Info
& 0x0f) == 1) || ((Info
& 0x0f) == 2)) {
245 ((Info
& (0x1 << 4)) != 0) ? L
"SATA" : L
"SAS",
246 ((Info
& (0x1 << 5)) != 0) ? L
"External" : L
"Internal",
247 ((Info
& (0x1 << 6)) != 0) ? L
"Expanded" : L
"Direct"
249 if ((Info
& 0x0f) == 1) {
250 CatPrint (Str
, L
"0,");
252 CatPrint (Str
, L
"%x,", (UINTN
) ((Info
>> 8) & 0xff));
255 CatPrint (Str
, L
"0,0,0,0,");
258 CatPrint (Str
, L
"%x)", (UINTN
) ((SAS_DEVICE_PATH
*) Vendor
)->Reserved
);
261 } else if (CompareGuid (&Vendor
->Guid
, &gEfiDebugPortProtocolGuid
)) {
262 CatPrint (Str
, L
"DebugPort()");
267 case MEDIA_DEVICE_PATH
:
276 CatPrint (Str
, L
"Ven%s(%g", Type
, &Vendor
->Guid
);
277 DataLength
= DevicePathNodeLength (&Vendor
->Header
) - sizeof (VENDOR_DEVICE_PATH
);
278 if (DataLength
> 0) {
279 CatPrint (Str
, L
",");
280 for (Index
= 0; Index
< DataLength
; Index
++) {
281 CatPrint (Str
, L
"%02x", (UINTN
) ((VENDOR_DEVICE_PATH_WITH_DATA
*) Vendor
)->VendorDefinedData
[Index
]);
284 CatPrint (Str
, L
")");
288 Convert Device Path to a Unicode string for printing.
290 @param[in, out] Str The buffer holding the output string.
291 This buffer contains the length of the string and
292 the maixmum length reserved for the string buffer.
293 @param[in] DevPath The device path.
298 IN OUT POOL_PRINT
*Str
,
302 ACPI_HID_DEVICE_PATH
*Acpi
;
305 if ((Acpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
306 CatPrint (Str
, L
"Acpi(PNP%04x,%x)", (UINTN
) EISA_ID_TO_NUM (Acpi
->HID
), (UINTN
) Acpi
->UID
);
308 CatPrint (Str
, L
"Acpi(%08x,%x)", (UINTN
) Acpi
->HID
, (UINTN
) Acpi
->UID
);
313 Convert Device Path to a Unicode string for printing.
315 @param[in, out] Str The buffer holding the output string.
316 This buffer contains the length of the string and
317 the maixmum length reserved for the string buffer.
318 @param[in] DevPath The device path.
322 DevPathExtendedAcpi (
323 IN OUT POOL_PRINT
*Str
,
327 ACPI_EXTENDED_HID_DEVICE_PATH
*ExtendedAcpi
;
330 // Index for HID, UID and CID strings, 0 for non-exist
343 ExtendedAcpi
= DevPath
;
344 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) ExtendedAcpi
);
346 AsChar8Array
= (CHAR8
*) ExtendedAcpi
;
352 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
355 if (Index
> Anchor
) {
361 Anchor
= (UINT16
) (Index
+ 1);
362 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
365 if (Index
> Anchor
) {
371 Anchor
= (UINT16
) (Index
+ 1);
372 for (Index
= Anchor
; Index
< Length
&& AsChar8Array
[Index
] != '\0'; Index
++) {
375 if (Index
> Anchor
) {
379 if (HIDSTRIdx
== 0 && CIDSTRIdx
== 0 && ExtendedAcpi
->UID
== 0) {
380 CatPrint (Str
, L
"AcpiExp(");
381 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
382 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
384 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
386 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
387 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
389 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
391 if (UIDSTRIdx
!= 0) {
392 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
394 CatPrint (Str
, L
"\"\")");
397 CatPrint (Str
, L
"AcpiEx(");
398 if ((ExtendedAcpi
->HID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
399 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->HID
));
401 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->HID
);
403 if ((ExtendedAcpi
->CID
& PNP_EISA_ID_MASK
) == PNP_EISA_ID_CONST
) {
404 CatPrint (Str
, L
"PNP%04x,", (UINTN
) EISA_ID_TO_NUM (ExtendedAcpi
->CID
));
406 CatPrint (Str
, L
"%08x,", (UINTN
) ExtendedAcpi
->CID
);
408 CatPrint (Str
, L
"%x,", (UINTN
) ExtendedAcpi
->UID
);
410 if (HIDSTRIdx
!= 0) {
411 CatPrint (Str
, L
"%a,", AsChar8Array
+ HIDSTRIdx
);
413 CatPrint (Str
, L
"\"\",");
415 if (CIDSTRIdx
!= 0) {
416 CatPrint (Str
, L
"%a,", AsChar8Array
+ CIDSTRIdx
);
418 CatPrint (Str
, L
"\"\",");
420 if (UIDSTRIdx
!= 0) {
421 CatPrint (Str
, L
"%a)", AsChar8Array
+ UIDSTRIdx
);
423 CatPrint (Str
, L
"\"\")");
430 Convert Device Path to a Unicode string for printing.
432 @param[in, out] Str The buffer holding the output string.
433 This buffer contains the length of the string and
434 the maixmum length reserved for the string buffer.
435 @param[in] DevPath The device path.
440 IN OUT POOL_PRINT
*Str
,
444 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
447 UINT16 AdditionalAdrCount
;
450 Length
= (UINT16
) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
);
451 AdditionalAdrCount
= (UINT16
) ((Length
- 8) / 4);
453 CatPrint (Str
, L
"AcpiAdr(%x", (UINTN
) AcpiAdr
->ADR
);
454 for (Index
= 0; Index
< AdditionalAdrCount
; Index
++) {
455 CatPrint (Str
, L
",%x", (UINTN
) *(UINT32
*) ((UINT8
*) AcpiAdr
+ 8 + Index
* 4));
457 CatPrint (Str
, L
")");
461 Convert Device Path to a Unicode string for printing.
463 @param[in, out] Str The buffer holding the output string.
464 This buffer contains the length of the string and
465 the maixmum length reserved for the string buffer.
466 @param[in] DevPath The device path.
471 IN OUT POOL_PRINT
*Str
,
475 ATAPI_DEVICE_PATH
*Atapi
;
481 (Atapi
->PrimarySecondary
!= 0)? L
"Secondary" : L
"Primary",
482 (Atapi
->SlaveMaster
!= 0)? L
"Slave" : L
"Master"
487 Convert Device Path to a Unicode string for printing.
489 @param[in, out] Str The buffer holding the output string.
490 This buffer contains the length of the string and
491 the maixmum length reserved for the string buffer.
492 @param[in] DevPath The device path.
497 IN OUT POOL_PRINT
*Str
,
501 SCSI_DEVICE_PATH
*Scsi
;
504 CatPrint (Str
, L
"Scsi(Pun%x,Lun%x)", (UINTN
) Scsi
->Pun
, (UINTN
) Scsi
->Lun
);
508 Convert Device Path to a Unicode string for printing.
510 @param[in, out] Str The buffer holding the output string.
511 This buffer contains the length of the string and
512 the maixmum length reserved for the string buffer.
513 @param[in] DevPath The device path.
518 IN OUT POOL_PRINT
*Str
,
522 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
525 CatPrint (Str
, L
"Fibre(Wwn%lx,Lun%x)", Fibre
->WWN
, Fibre
->Lun
);
529 Convert Device Path to a Unicode string for printing.
531 @param[in, out] Str The buffer holding the output string.
532 This buffer contains the length of the string and
533 the maixmum length reserved for the string buffer.
534 @param[in] DevPath The device path.
539 IN OUT POOL_PRINT
*Str
,
543 F1394_DEVICE_PATH
*F1394Path
;
546 CatPrint (Str
, L
"1394(%lx)", &F1394Path
->Guid
);
550 Convert Device Path to a Unicode string for printing.
552 @param[in, out] Str The buffer holding the output string.
553 This buffer contains the length of the string and
554 the maixmum length reserved for the string buffer.
555 @param[in] DevPath The device path.
560 IN OUT POOL_PRINT
*Str
,
564 USB_DEVICE_PATH
*Usb
;
567 CatPrint (Str
, L
"Usb(%x,%x)", (UINTN
) Usb
->ParentPortNumber
, (UINTN
) Usb
->InterfaceNumber
);
571 Convert Device Path to a Unicode string for printing.
573 @param[in, out] Str The buffer holding the output string.
574 This buffer contains the length of the string and
575 the maixmum length reserved for the string buffer.
576 @param[in] DevPath The device path.
581 IN OUT POOL_PRINT
*Str
,
585 USB_WWID_DEVICE_PATH
*UsbWWId
;
590 L
"UsbWwid(%x,%x,%x,\"WWID\")",
591 (UINTN
) UsbWWId
->VendorId
,
592 (UINTN
) UsbWWId
->ProductId
,
593 (UINTN
) UsbWWId
->InterfaceNumber
598 Convert Device Path to a Unicode string for printing.
600 @param[in, out] Str The buffer holding the output string.
601 This buffer contains the length of the string and
602 the maixmum length reserved for the string buffer.
603 @param[in] DevPath The device path.
608 IN OUT POOL_PRINT
*Str
,
612 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
614 LogicalUnit
= DevPath
;
615 CatPrint (Str
, L
"Unit(%x)", (UINTN
) LogicalUnit
->Lun
);
619 Convert Device Path to a Unicode string for printing.
621 @param[in, out] Str The buffer holding the output string.
622 This buffer contains the length of the string and
623 the maixmum length reserved for the string buffer.
624 @param[in] DevPath The device path.
629 IN OUT POOL_PRINT
*Str
,
633 USB_CLASS_DEVICE_PATH
*UsbClass
;
638 L
"Usb Class(%x,%x,%x,%x,%x)",
639 (UINTN
) UsbClass
->VendorId
,
640 (UINTN
) UsbClass
->ProductId
,
641 (UINTN
) UsbClass
->DeviceClass
,
642 (UINTN
) UsbClass
->DeviceSubClass
,
643 (UINTN
) UsbClass
->DeviceProtocol
648 Convert Device Path to a Unicode string for printing.
650 @param[in, out] Str The buffer holding the output string.
651 This buffer contains the length of the string and
652 the maixmum length reserved for the string buffer.
653 @param[in] DevPath The device path.
658 IN OUT POOL_PRINT
*Str
,
662 SATA_DEVICE_PATH
*Sata
;
665 if ((Sata
->PortMultiplierPortNumber
& SATA_HBA_DIRECT_CONNECT_FLAG
) != 0) {
669 (UINTN
) Sata
->HBAPortNumber
,
676 (UINTN
) Sata
->HBAPortNumber
,
677 (UINTN
) Sata
->PortMultiplierPortNumber
,
684 Convert Device Path to a Unicode string for printing.
686 @param[in, out] Str The buffer holding the output string.
687 This buffer contains the length of the string and
688 the maixmum length reserved for the string buffer.
689 @param[in] DevPath The device path.
694 IN OUT POOL_PRINT
*Str
,
698 I2O_DEVICE_PATH
*I2OPath
;
701 CatPrint (Str
, L
"I2O(%x)", (UINTN
) I2OPath
->Tid
);
705 Convert Device Path to a Unicode string for printing.
707 @param[in, out] Str The buffer holding the output string.
708 This buffer contains the length of the string and
709 the maixmum length reserved for the string buffer.
710 @param[in] DevPath The device path.
715 IN OUT POOL_PRINT
*Str
,
719 MAC_ADDR_DEVICE_PATH
*MACDevPath
;
723 MACDevPath
= DevPath
;
725 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
726 if (MACDevPath
->IfType
== 0x01 || MACDevPath
->IfType
== 0x00) {
730 CatPrint (Str
, L
"Mac(");
732 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
733 CatPrint (Str
, L
"%02x", (UINTN
) MACDevPath
->MacAddress
.Addr
[Index
]);
736 CatPrint (Str
, L
")");
740 Convert Device Path to a Unicode string for printing.
742 @param[in, out] Str The buffer holding the output string.
743 This buffer contains the length of the string and
744 the maixmum length reserved for the string buffer.
745 @param[in] DevPath The device path.
750 IN OUT POOL_PRINT
*Str
,
754 IPv4_DEVICE_PATH
*IPDevPath
;
759 L
"IPv4(%d.%d.%d.%d:%d)",
760 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[0],
761 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[1],
762 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[2],
763 (UINTN
) IPDevPath
->RemoteIpAddress
.Addr
[3],
764 (UINTN
) IPDevPath
->RemotePort
769 Convert Device Path to a Unicode string for printing.
771 @param[in, out] Str The buffer holding the output string.
772 This buffer contains the length of the string and
773 the maixmum length reserved for the string buffer.
774 @param[in] DevPath The device path.
779 IN OUT POOL_PRINT
*Str
,
783 IPv6_DEVICE_PATH
*IPv6DevPath
;
785 IPv6DevPath
= DevPath
;
788 L
"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
789 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[0],
790 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[1],
791 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[2],
792 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[3],
793 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[4],
794 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[5],
795 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[6],
796 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[7],
797 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[8],
798 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[9],
799 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[10],
800 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[11],
801 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[12],
802 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[13],
803 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[14],
804 (UINTN
) IPv6DevPath
->RemoteIpAddress
.Addr
[15]
809 Convert Device Path to a Unicode string for printing.
811 @param[in, out] Str The buffer holding the output string.
812 This buffer contains the length of the string and
813 the maixmum length reserved for the string buffer.
814 @param[in] DevPath The device path.
819 IN OUT POOL_PRINT
*Str
,
823 INFINIBAND_DEVICE_PATH
*InfiniBand
;
825 InfiniBand
= DevPath
;
828 L
"Infiniband(%x,%g,%lx,%lx,%lx)",
829 (UINTN
) InfiniBand
->ResourceFlags
,
831 InfiniBand
->ServiceId
,
832 InfiniBand
->TargetPortId
,
838 Convert Device Path to a Unicode string for printing.
840 @param[in, out] Str The buffer holding the output string.
841 This buffer contains the length of the string and
842 the maixmum length reserved for the string buffer.
843 @param[in] DevPath The device path.
848 IN OUT POOL_PRINT
*Str
,
852 UART_DEVICE_PATH
*Uart
;
856 switch (Uart
->Parity
) {
886 if (Uart
->BaudRate
== 0) {
887 CatPrint (Str
, L
"Uart(DEFAULT,%c,", Parity
);
889 CatPrint (Str
, L
"Uart(%ld,%c,", Uart
->BaudRate
, Parity
);
892 if (Uart
->DataBits
== 0) {
893 CatPrint (Str
, L
"D,");
895 CatPrint (Str
, L
"%d,", (UINTN
) Uart
->DataBits
);
898 switch (Uart
->StopBits
) {
900 CatPrint (Str
, L
"D)");
904 CatPrint (Str
, L
"1)");
908 CatPrint (Str
, L
"1.5)");
912 CatPrint (Str
, L
"2)");
916 CatPrint (Str
, L
"x)");
922 Convert Device Path to a Unicode string for printing.
924 @param[in, out] Str The buffer holding the output string.
925 This buffer contains the length of the string and
926 the maixmum length reserved for the string buffer.
927 @param[in] DevPath The device path.
932 IN OUT POOL_PRINT
*Str
,
936 ISCSI_DEVICE_PATH_WITH_NAME
*IScsi
;
944 (UINTN
) IScsi
->TargetPortalGroupTag
,
948 Options
= IScsi
->LoginOption
;
949 CatPrint (Str
, L
"%s,", (((Options
>> 1) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
950 CatPrint (Str
, L
"%s,", (((Options
>> 3) & 0x0001) != 0) ? L
"CRC32C" : L
"None");
951 if (((Options
>> 11) & 0x0001) != 0) {
952 CatPrint (Str
, L
"%s,", L
"None");
953 } else if (((Options
>> 12) & 0x0001) != 0) {
954 CatPrint (Str
, L
"%s,", L
"CHAP_UNI");
956 CatPrint (Str
, L
"%s,", L
"CHAP_BI");
960 CatPrint (Str
, L
"%s)", (IScsi
->NetworkProtocol
== 0) ? L
"TCP" : L
"reserved");
964 Convert Device Path to a Unicode string for printing.
966 @param[in, out] Str The buffer holding the output string.
967 This buffer contains the length of the string and
968 the maixmum length reserved for the string buffer.
969 @param[in] DevPath The device path.
974 IN OUT POOL_PRINT
*Str
,
978 VLAN_DEVICE_PATH
*Vlan
;
981 CatPrint (Str
, L
"Vlan(%d)", (UINTN
) Vlan
->VlanId
);
985 Convert Device Path to a Unicode string for printing.
987 @param[in, out] Str The buffer holding the output string.
988 This buffer contains the length of the string and
989 the maixmum length reserved for the string buffer.
990 @param[in] DevPath The device path.
995 IN OUT POOL_PRINT
*Str
,
999 HARDDRIVE_DEVICE_PATH
*Hd
;
1002 switch (Hd
->SignatureType
) {
1003 case SIGNATURE_TYPE_MBR
:
1006 L
"HD(Part%d,Sig%08x)",
1007 (UINTN
) Hd
->PartitionNumber
,
1008 (UINTN
) *((UINT32
*) (&(Hd
->Signature
[0])))
1012 case SIGNATURE_TYPE_GUID
:
1015 L
"HD(Part%d,Sig%g)",
1016 (UINTN
) Hd
->PartitionNumber
,
1017 (EFI_GUID
*) &(Hd
->Signature
[0])
1024 L
"HD(Part%d,MBRType=%02x,SigType=%02x)",
1025 (UINTN
) Hd
->PartitionNumber
,
1026 (UINTN
) Hd
->MBRType
,
1027 (UINTN
) Hd
->SignatureType
1034 Convert Device Path to a Unicode string for printing.
1036 @param[in, out] Str The buffer holding the output string.
1037 This buffer contains the length of the string and
1038 the maixmum length reserved for the string buffer.
1039 @param[in] DevPath The device path.
1044 IN OUT POOL_PRINT
*Str
,
1048 CDROM_DEVICE_PATH
*Cd
;
1051 CatPrint (Str
, L
"CDROM(Entry%x)", (UINTN
) Cd
->BootEntry
);
1055 Convert Device Path to a Unicode string for printing.
1057 @param[in, out] Str The buffer holding the output string.
1058 This buffer contains the length of the string and
1059 the maixmum length reserved for the string buffer.
1060 @param[in] DevPath The device path.
1065 IN OUT POOL_PRINT
*Str
,
1069 FILEPATH_DEVICE_PATH
*Fp
;
1072 CatPrint (Str
, L
"%s", Fp
->PathName
);
1076 Convert Device Path to a Unicode string for printing.
1078 @param[in, out] Str The buffer holding the output string.
1079 This buffer contains the length of the string and
1080 the maixmum length reserved for the string buffer.
1081 @param[in] DevPath The device path.
1085 DevPathMediaProtocol (
1086 IN OUT POOL_PRINT
*Str
,
1090 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProt
;
1092 MediaProt
= DevPath
;
1093 CatPrint (Str
, L
"Media(%g)", &MediaProt
->Protocol
);
1097 Convert Device Path to a Unicode string for printing.
1099 @param[in, out] Str The buffer holding the output string.
1100 This buffer contains the length of the string and
1101 the maixmum length reserved for the string buffer.
1102 @param[in] DevPath The device path.
1107 IN OUT POOL_PRINT
*Str
,
1111 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFilePath
;
1113 FvFilePath
= DevPath
;
1114 CatPrint (Str
, L
"%g", &FvFilePath
->FvFileName
);
1118 Convert Device Path to a Unicode string for printing.
1120 @param[in, out] Str The buffer holding the output string.
1121 This buffer contains the length of the string and
1122 the maixmum length reserved for the string buffer.
1123 @param[in] DevPath The device path.
1127 DevPathRelativeOffsetRange (
1128 IN OUT POOL_PRINT
*Str
,
1132 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
1138 Offset
->StartingOffset
,
1139 Offset
->EndingOffset
1144 Convert Device Path to a Unicode string for printing.
1146 @param[in, out] Str The buffer holding the output string.
1147 This buffer contains the length of the string and
1148 the maixmum length reserved for the string buffer.
1149 @param[in] DevPath The device path.
1154 IN OUT POOL_PRINT
*Str
,
1158 BBS_BBS_DEVICE_PATH
*Bbs
;
1162 switch (Bbs
->DeviceType
) {
1163 case BBS_TYPE_FLOPPY
:
1167 case BBS_TYPE_HARDDRIVE
:
1168 Type
= L
"Harddrive";
1171 case BBS_TYPE_CDROM
:
1175 case BBS_TYPE_PCMCIA
:
1183 case BBS_TYPE_EMBEDDED_NETWORK
:
1195 CatPrint (Str
, L
"Legacy-%s", Type
);
1199 Convert Device Path to a Unicode string for printing.
1201 @param[in, out] Str The buffer holding the output string.
1202 This buffer contains the length of the string and
1203 the maixmum length reserved for the string buffer.
1204 @param[in] DevPath The device path.
1208 DevPathEndInstance (
1209 IN OUT POOL_PRINT
*Str
,
1213 CatPrint (Str
, L
",");
1217 Convert Device Path to a Unicode string for printing.
1219 @param[in, out] Str The buffer holding the output string.
1220 This buffer contains the length of the string and
1221 the maixmum length reserved for the string buffer.
1222 @param[in] DevPath The device path.
1226 DevPathNodeUnknown (
1227 IN OUT POOL_PRINT
*Str
,
1231 CatPrint (Str
, L
"?");
1234 Convert Device Path to a Unicode string for printing.
1236 @param[in, out] Str The buffer holding the output string.
1237 This buffer contains the length of the string and
1238 the maixmum length reserved for the string buffer.
1239 @param[in] DevPath The device path.
1244 IN OUT POOL_PRINT
*Str
,
1248 MEDIA_FW_VOL_DEVICE_PATH
*FvPath
;
1251 CatPrint (Str
, L
"Fv(%g)", &FvPath
->FvName
);
1254 DEVICE_PATH_STRING_TABLE DevPathTable
[] = {
1256 HARDWARE_DEVICE_PATH
,
1261 HARDWARE_DEVICE_PATH
,
1266 HARDWARE_DEVICE_PATH
,
1271 HARDWARE_DEVICE_PATH
,
1276 HARDWARE_DEVICE_PATH
,
1296 MESSAGING_DEVICE_PATH
,
1301 MESSAGING_DEVICE_PATH
,
1306 MESSAGING_DEVICE_PATH
,
1307 MSG_FIBRECHANNEL_DP
,
1311 MESSAGING_DEVICE_PATH
,
1316 MESSAGING_DEVICE_PATH
,
1321 MESSAGING_DEVICE_PATH
,
1326 MESSAGING_DEVICE_PATH
,
1327 MSG_DEVICE_LOGICAL_UNIT_DP
,
1331 MESSAGING_DEVICE_PATH
,
1336 MESSAGING_DEVICE_PATH
,
1341 MESSAGING_DEVICE_PATH
,
1346 MESSAGING_DEVICE_PATH
,
1351 MESSAGING_DEVICE_PATH
,
1356 MESSAGING_DEVICE_PATH
,
1361 MESSAGING_DEVICE_PATH
,
1366 MESSAGING_DEVICE_PATH
,
1371 MESSAGING_DEVICE_PATH
,
1376 MESSAGING_DEVICE_PATH
,
1381 MESSAGING_DEVICE_PATH
,
1408 DevPathMediaProtocol
1412 MEDIA_PIWG_FW_VOL_DP
,
1417 MEDIA_PIWG_FW_FILE_DP
,
1422 MEDIA_RELATIVE_OFFSET_RANGE_DP
,
1423 DevPathRelativeOffsetRange
,
1431 END_DEVICE_PATH_TYPE
,
1432 END_INSTANCE_DEVICE_PATH_SUBTYPE
,
1444 This function converts an input device structure to a Unicode string.
1446 @param[in] DevPath A pointer to the device path structure.
1448 @return A new allocated Unicode string that represents the device path.
1454 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
1458 EFI_DEVICE_PATH_PROTOCOL
*DevPathNode
;
1459 VOID (*DumpNode
) (POOL_PRINT
*, VOID
*);
1466 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
*DevPathToText
;
1468 ZeroMem (&Str
, sizeof (Str
));
1470 if (DevPath
== NULL
) {
1474 Status
= gBS
->LocateProtocol (
1475 &gEfiDevicePathToTextProtocolGuid
,
1477 (VOID
**) &DevPathToText
1479 if (!EFI_ERROR (Status
)) {
1480 ToText
= DevPathToText
->ConvertDevicePathToText (
1485 ASSERT (ToText
!= NULL
);
1490 // Process each device path node
1492 DevPathNode
= DevPath
;
1493 while (!IsDevicePathEnd (DevPathNode
)) {
1495 // Find the handler to dump this device path node
1498 for (Index
= 0; DevPathTable
[Index
].Function
!= NULL
; Index
+= 1) {
1500 if (DevicePathType (DevPathNode
) == DevPathTable
[Index
].Type
&&
1501 DevicePathSubType (DevPathNode
) == DevPathTable
[Index
].SubType
1503 DumpNode
= DevPathTable
[Index
].Function
;
1508 // If not found, use a generic function
1511 DumpNode
= DevPathNodeUnknown
;
1514 // Put a path seperator in if needed
1516 if ((Str
.Len
!= 0) && (DumpNode
!= DevPathEndInstance
)) {
1517 CatPrint (&Str
, L
"/");
1520 // Print this node of the device path
1522 DumpNode (&Str
, DevPathNode
);
1525 // Next device path node
1527 DevPathNode
= NextDevicePathNode (DevPathNode
);
1531 NewSize
= (Str
.Len
+ 1) * sizeof (CHAR16
);
1532 Str
.Str
= ReallocatePool (NewSize
, NewSize
, Str
.Str
);
1533 ASSERT (Str
.Str
!= NULL
);
1534 Str
.Str
[Str
.Len
] = 0;