libefivar: Apply uncrustify changes

Apply uncrustify changes to .c/.h files.

Reduce the diffs with EDK2 to aid with future merges.  The
unconventional way we've imported this code makes using a vendor branch
to manage it at the very least tricky. Update FreeBSD-update to reflect
the slight shift in advise.

Reviewed by:	imp
Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Obtained from:	2f88bd3a12
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
This commit is contained in:
Jose Luis Duran 2022-02-23 22:23:57 -03:00 committed by Warner Losh
parent 60de142cfc
commit 5754f5823b
5 changed files with 1494 additions and 1449 deletions

View file

@ -1,6 +1,5 @@
$FreeBSD$
For the printing and parsing functionalit, we use the Tianocore routines directly.
For the printing and parsing functionality, we use the Tianocore routines
directly.
efivar-dp-format.c is a copy of MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
efivar-dp-parse.c is a copy of MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@ -9,31 +8,30 @@ These files are first mechnaically processed with
sed -e "s/L'/'/;"'s/L"/"/g;s/%g/%36s/g;s/%a/%s/g;s/^VOID/static VOID/g;s/ *$//g'
for several reasons. We're moving from wide rotuines to narrow
routines. The UTC-2 this code is written for is a bad match for
wchar_t which is an int. It's a much better match for plain narrow
characters on FreeBSD. So we pretend that CHAR16 for these files is
really char * (ASCII).
for several reasons. We're moving from wide rotuines to narrow routines. The
UTC-2 this code is written for is a bad match for wchar_t which is an int. It's
a much better match for plain narrow characters on FreeBSD. So we pretend that
CHAR16 for these files is really char * (ASCII).
Next, we have have to convert the Unicode printf that this code
expects to FreeBSD's printf. %g means "Print the GUID" and %a means
"print the ASCII string." so we mechanically convert them. Once we've
done that we can compare efivar-dp-*.c to its source to see what's
changed. Because we go through this indirection, I've done that
outside of svn. To upgrade you have to do these files by hand. You
have to go through and make routines static.
Next, we have have to convert the Unicode printf that this code expects to
FreeBSD's printf. %g means "Print the GUID" and %a means "print the ASCII
string." so we mechanically convert them. Once we've done that we can compare
efivar-dp-*.c to its source to see what's changed. Because we go through this
indirection, I've done that outside of git. To upgrade you have to do these
files by hand. You have to go through and make routines static.
uefi-*.[ch] are internal routines to support this. They've been copied
from EDK2 as well, but in a more hap-hazard manner. This was a trade
off between ease of implementation / upgrade vs pulling in too much
since less than half of any file was needed.
uefi-*.[ch] are internal routines to support this. They've been copied from EDK2
as well, but in a more hap-hazard manner. This was a trade off between ease of
implementation / upgrade vs pulling in too much since less than half of any file
was needed.
efi-osdep.h shims the EDK2 types to FreeBSD's types. It's included by
ProcessorBind.h which EDK2 uses to define the CPU. We keep it separate
from uefi-dplib.h to allow better sharing.
ProcessorBind.h which EDK2 uses to define the CPU. We keep it separate from
uefi-dplib.h to allow better sharing.
uefi-dplib.h shims the EDK2 routines that are needed to FreeBSD's
routines. This is relatively easy since we map all the UCS-2 routines
to simple char * routines.
uefi-dplib.h shims the EDK2 routines that are needed to FreeBSD's routines. This
is relatively easy since we map all the UCS-2 routines to simple char *
routines.
RESIST THE URGE TO CLEAN UP THESE FILES.
RESIST THE URGE TO CLEAN UP THESE FILES. Except when such cleanups help with the
goal of keeping them in sync with EDK2.

View file

@ -98,16 +98,20 @@ UefiDevicePathLibCatPrint (
VA_LIST Args;
VA_START (Args, Fmt);
Count = vsnprintf(NULL, 0, Fmt, Args);
VA_END(Args);
Count = vsnprintf (NULL, 0, Fmt, Args);
VA_END (Args);
if ((Str->Count + (Count + 1)) > Str->Capacity) {
Str->Capacity = (Str->Count + (Count + 1) * 2);
Str->Str = reallocf(Str->Str, Str->Capacity);
Str->Str = reallocf (
Str->Str,
Str->Capacity
);
ASSERT (Str->Str != NULL);
}
VA_START (Args, Fmt);
vsnprintf(Str->Str + Str->Count, Str->Capacity - Str->Count, Fmt, Args);
vsnprintf (Str->Str + Str->Count, Str->Capacity - Str->Count, Fmt, Args);
Str->Count += Count;
VA_END (Args);
@ -229,7 +233,7 @@ DevPathToTextVendor (
UINT32 FlowControlMap;
UINT16 Info;
Vendor = (VENDOR_DEVICE_PATH *) DevPath;
Vendor = (VENDOR_DEVICE_PATH *)DevPath;
switch (DevicePathType (&Vendor->Header)) {
case HARDWARE_DEVICE_PATH:
Type = "Hw";
@ -240,18 +244,18 @@ DevPathToTextVendor (
if (AllowShortcuts) {
if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) {
UefiDevicePathLibCatPrint (Str, "VenPcAnsi()");
return ;
return;
} else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) {
UefiDevicePathLibCatPrint (Str, "VenVt100()");
return ;
return;
} else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) {
UefiDevicePathLibCatPrint (Str, "VenVt100Plus()");
return ;
return;
} else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {
UefiDevicePathLibCatPrint (Str, "VenUtf8()");
return ;
return;
} else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {
FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);
FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *)Vendor)->FlowControlMap);
switch (FlowControlMap & 0x00000003) {
case 0:
UefiDevicePathLibCatPrint (Str, "UartFlowCtrl(%s)", "None");
@ -269,16 +273,16 @@ DevPathToTextVendor (
break;
}
return ;
return;
} else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) {
UefiDevicePathLibCatPrint (
Str,
"SAS(0x%lx,0x%lx,0x%x,",
((SAS_DEVICE_PATH *) Vendor)->SasAddress,
((SAS_DEVICE_PATH *) Vendor)->Lun,
((SAS_DEVICE_PATH *) Vendor)->RelativeTargetPort
((SAS_DEVICE_PATH *)Vendor)->SasAddress,
((SAS_DEVICE_PATH *)Vendor)->Lun,
((SAS_DEVICE_PATH *)Vendor)->RelativeTargetPort
);
Info = (((SAS_DEVICE_PATH *) Vendor)->DeviceTopology);
Info = (((SAS_DEVICE_PATH *)Vendor)->DeviceTopology);
if (((Info & 0x0f) == 0) && ((Info & BIT7) == 0)) {
UefiDevicePathLibCatPrint (Str, "NoTopology,0,0,0,");
} else if (((Info & 0x0f) <= 2) && ((Info & BIT7) == 0)) {
@ -301,13 +305,14 @@ DevPathToTextVendor (
UefiDevicePathLibCatPrint (Str, "0x%x,0,0,0,", Info);
}
UefiDevicePathLibCatPrint (Str, "0x%x)", ((SAS_DEVICE_PATH *) Vendor)->Reserved);
return ;
UefiDevicePathLibCatPrint (Str, "0x%x)", ((SAS_DEVICE_PATH *)Vendor)->Reserved);
return;
} else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {
UefiDevicePathLibCatPrint (Str, "DebugPort()");
return ;
return;
}
}
break;
case MEDIA_DEVICE_PATH:
@ -324,7 +329,7 @@ DevPathToTextVendor (
if (DataLength != 0) {
UefiDevicePathLibCatPrint (Str, ",");
for (Index = 0; Index < DataLength; Index++) {
UefiDevicePathLibCatPrint (Str, "%02x", ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);
UefiDevicePathLibCatPrint (Str, "%02x", ((VENDOR_DEVICE_PATH_WITH_DATA *)Vendor)->VendorDefinedData[Index]);
}
}
@ -482,27 +487,30 @@ DevPathToTextAcpiEx (
char CIDText[11];
AcpiEx = DevPath;
HIDStr = (CHAR8 *) (((UINT8 *) AcpiEx) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
HIDStr = (CHAR8 *)(((UINT8 *)AcpiEx) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
UIDStr = HIDStr + AsciiStrLen (HIDStr) + 1;
CIDStr = UIDStr + AsciiStrLen (UIDStr) + 1;
if (DisplayOnly) {
if ((EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A03) ||
(EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A03 && EISA_ID_TO_NUM (AcpiEx->HID) != 0x0A08)) {
((EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A03) && (EISA_ID_TO_NUM (AcpiEx->HID) != 0x0A08)))
{
if (AcpiEx->UID == 0) {
UefiDevicePathLibCatPrint (Str, "PciRoot(%s)", UIDStr);
} else {
UefiDevicePathLibCatPrint (Str, "PciRoot(0x%x)", AcpiEx->UID);
}
return;
}
if (EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A08 || EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A08) {
if ((EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A08) || (EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A08)) {
if (AcpiEx->UID == 0) {
UefiDevicePathLibCatPrint (Str, "PcieRoot(%s)", UIDStr);
} else {
UefiDevicePathLibCatPrint (Str, "PcieRoot(0x%x)", AcpiEx->UID);
}
return;
}
}
@ -614,14 +622,15 @@ DevPathToTextAcpiAdr (
UINT16 AdditionalAdrCount;
AcpiAdr = DevPath;
Length = (UINT16) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);
AdditionalAdrCount = (UINT16) ((Length - 8) / 4);
Length = (UINT16)DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *)AcpiAdr);
AdditionalAdrCount = (UINT16)((Length - 8) / 4);
UefiDevicePathLibCatPrint (Str, "AcpiAdr(0x%x", AcpiAdr->ADR);
Addr = &AcpiAdr->ADR + 1;
for (Index = 0; Index < AdditionalAdrCount; Index++) {
UefiDevicePathLibCatPrint (Str, ",0x%x", Addr[Index]);
}
UefiDevicePathLibCatPrint (Str, ")");
}
@ -746,10 +755,12 @@ DevPathToTextFibreEx (
for (Index = 0; Index < sizeof (FibreEx->WWN) / sizeof (FibreEx->WWN[0]); Index++) {
UefiDevicePathLibCatPrint (Str, "%02x", FibreEx->WWN[Index]);
}
UefiDevicePathLibCatPrint (Str, ",0x");
for (Index = 0; Index < sizeof (FibreEx->Lun) / sizeof (FibreEx->Lun[0]); Index++) {
UefiDevicePathLibCatPrint (Str, "%02x", FibreEx->Lun[Index]);
}
UefiDevicePathLibCatPrint (Str, ")");
}
@ -783,10 +794,12 @@ DevPathToTextSasEx (
for (Index = 0; Index < sizeof (SasEx->SasAddress) / sizeof (SasEx->SasAddress[0]); Index++) {
UefiDevicePathLibCatPrint (Str, "%02x", SasEx->SasAddress[Index]);
}
UefiDevicePathLibCatPrint (Str, ",0x");
for (Index = 0; Index < sizeof (SasEx->Lun) / sizeof (SasEx->Lun[0]); Index++) {
UefiDevicePathLibCatPrint (Str, "%02x", SasEx->Lun[Index]);
}
UefiDevicePathLibCatPrint (Str, ",0x%x,", SasEx->RelativeTargetPort);
if (((SasEx->DeviceTopology & 0x0f) == 0) && ((SasEx->DeviceTopology & BIT7) == 0)) {
@ -812,8 +825,7 @@ DevPathToTextSasEx (
}
UefiDevicePathLibCatPrint (Str, ")");
return ;
return;
}
/**
@ -841,13 +853,19 @@ DevPathToTextNVMe (
UINT8 *Uuid;
Nvme = DevPath;
Uuid = (UINT8 *) &Nvme->NamespaceUuid;
Uuid = (UINT8 *)&Nvme->NamespaceUuid;
UefiDevicePathLibCatPrint (
Str,
"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",
Nvme->NamespaceId,
Uuid[7], Uuid[6], Uuid[5], Uuid[4],
Uuid[3], Uuid[2], Uuid[1], Uuid[0]
Uuid[7],
Uuid[6],
Uuid[5],
Uuid[4],
Uuid[3],
Uuid[2],
Uuid[1],
Uuid[0]
);
}
@ -1025,15 +1043,15 @@ DevPathToTextUsbWWID (
UsbWWId = DevPath;
SerialNumberStr = (CHAR16 *) (&UsbWWId + 1);
Length = (UINT16) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));
if (Length >= 1 && SerialNumberStr [Length - 1] != 0) {
SerialNumberStr = (CHAR16 *)(&UsbWWId + 1);
Length = (UINT16)((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *)UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));
if ((Length >= 1) && (SerialNumberStr[Length - 1] != 0)) {
//
// In case no NULL terminator in SerialNumber, create a new one with NULL terminator
//
NewStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), SerialNumberStr);
ASSERT (NewStr != NULL);
NewStr [Length] = 0;
NewStr[Length] = 0;
SerialNumberStr = NewStr;
}
@ -1098,7 +1116,6 @@ DevPathToTextUsbClass (
USB_CLASS_DEVICE_PATH *UsbClass;
BOOLEAN IsKnownSubClass;
UsbClass = DevPath;
IsKnownSubClass = TRUE;
@ -1298,7 +1315,7 @@ DevPathToTextMacAddr (
MacDevPath = DevPath;
HwAddressSize = sizeof (EFI_MAC_ADDRESS);
if (MacDevPath->IfType == 0x01 || MacDevPath->IfType == 0x00) {
if ((MacDevPath->IfType == 0x01) || (MacDevPath->IfType == 0x00)) {
HwAddressSize = 6;
}
@ -1361,15 +1378,24 @@ CatIPv6Address (
)
{
UefiDevicePathLibCatPrint (
Str, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
Address->Addr[0], Address->Addr[1],
Address->Addr[2], Address->Addr[3],
Address->Addr[4], Address->Addr[5],
Address->Addr[6], Address->Addr[7],
Address->Addr[8], Address->Addr[9],
Address->Addr[10], Address->Addr[11],
Address->Addr[12], Address->Addr[13],
Address->Addr[14], Address->Addr[15]
Str,
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
Address->Addr[0],
Address->Addr[1],
Address->Addr[2],
Address->Addr[3],
Address->Addr[4],
Address->Addr[5],
Address->Addr[6],
Address->Addr[7],
Address->Addr[8],
Address->Addr[9],
Address->Addr[10],
Address->Addr[11],
Address->Addr[12],
Address->Addr[13],
Address->Addr[14],
Address->Addr[15]
);
}
@ -1402,7 +1428,7 @@ DevPathToTextIPv4 (
if (DisplayOnly) {
UefiDevicePathLibCatPrint (Str, ")");
return ;
return;
}
UefiDevicePathLibCatPrint (Str, ",");
@ -1416,6 +1442,7 @@ DevPathToTextIPv4 (
UefiDevicePathLibCatPrint (Str, ",");
CatIPv4Address (Str, &IPDevPath->SubnetMask);
}
UefiDevicePathLibCatPrint (Str, ")");
}
@ -1447,7 +1474,7 @@ DevPathToTextIPv6 (
CatIPv6Address (Str, &IPDevPath->RemoteIpAddress);
if (DisplayOnly) {
UefiDevicePathLibCatPrint (Str, ")");
return ;
return;
}
UefiDevicePathLibCatPrint (Str, ",");
@ -1471,6 +1498,7 @@ DevPathToTextIPv6 (
UefiDevicePathLibCatPrint (Str, ",0x%x,", IPDevPath->PrefixLength);
CatIPv6Address (Str, &IPDevPath->GatewayIpAddress);
}
UefiDevicePathLibCatPrint (Str, ")");
}
@ -1636,6 +1664,7 @@ DevPathToTextiSCSI (
for (Index = 0; Index < sizeof (ISCSIDevPath->Lun) / sizeof (UINT8); Index++) {
UefiDevicePathLibCatPrint (Str, "%02x", ((UINT8 *)&ISCSIDevPath->Lun)[Index]);
}
Options = ISCSIDevPath->LoginOption;
UefiDevicePathLibCatPrint (Str, ",%s,", (((Options >> 1) & 0x0001) != 0) ? "CRC32C" : "None");
UefiDevicePathLibCatPrint (Str, "%s,", (((Options >> 3) & 0x0001) != 0) ? "CRC32C" : "None");
@ -1645,7 +1674,6 @@ DevPathToTextiSCSI (
UefiDevicePathLibCatPrint (Str, "%s,", "CHAP_UNI");
} else {
UefiDevicePathLibCatPrint (Str, "%s,", "CHAP_BI");
}
UefiDevicePathLibCatPrint (Str, "%s)", (ISCSIDevPath->NetworkProtocol == 0) ? "TCP" : "reserved");
@ -1809,7 +1837,7 @@ DevPathToTextDns (
UINT32 DnsServerIpIndex;
DnsDevPath = DevPath;
DnsServerIpCount = (UINT32) (DevicePathNodeLength(DnsDevPath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof (DnsDevPath->IsIPv6)) / sizeof (EFI_IP_ADDRESS);
DnsServerIpCount = (UINT32)(DevicePathNodeLength (DnsDevPath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof (DnsDevPath->IsIPv6)) / sizeof (EFI_IP_ADDRESS);
UefiDevicePathLibCatPrint (Str, "Dns(");
@ -1898,7 +1926,7 @@ DevPathToTextHardDrive (
"HD(%d,%s,0x%08x,",
Hd->PartitionNumber,
"MBR",
// *((UINT32 *) (&(Hd->Signature[0])))
// *((UINT32 *)(&(Hd->Signature[0])))
le32dec(&(Hd->Signature[0]))
);
break;
@ -1952,7 +1980,7 @@ DevPathToTextCDROM (
Cd = DevPath;
if (DisplayOnly) {
UefiDevicePathLibCatPrint (Str, "CDROM(0x%x)", Cd->BootEntry);
return ;
return;
}
UefiDevicePathLibCatPrint (Str, "CDROM(0x%x,0x%lx,0x%lx)", Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize);
@ -2233,7 +2261,7 @@ DevPathToTextBBS (
if (DisplayOnly) {
UefiDevicePathLibCatPrint (Str, ")");
return ;
return;
}
UefiDevicePathLibCatPrint (Str, ",0x%x)", Bbs->StatusFlag);
@ -2264,12 +2292,12 @@ DevPathToTextEndInstance (
}
GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric[] = {
{HARDWARE_DEVICE_PATH, "HardwarePath" },
{ACPI_DEVICE_PATH, "AcpiPath" },
{MESSAGING_DEVICE_PATH, "Msg" },
{MEDIA_DEVICE_PATH, "MediaPath" },
{BBS_DEVICE_PATH, "BbsPath" },
{0, NULL}
{ HARDWARE_DEVICE_PATH, "HardwarePath" },
{ ACPI_DEVICE_PATH, "AcpiPath" },
{ MESSAGING_DEVICE_PATH, "Msg" },
{ MEDIA_DEVICE_PATH, "MediaPath" },
{ BBS_DEVICE_PATH, "BbsPath" },
{ 0, NULL }
};
/**
@ -2319,8 +2347,8 @@ DevPathToTextNodeGeneric (
Index = sizeof (EFI_DEVICE_PATH_PROTOCOL);
if (Index < DevicePathNodeLength (Node)) {
UefiDevicePathLibCatPrint (Str, ",");
for (; Index < DevicePathNodeLength (Node); Index++) {
UefiDevicePathLibCatPrint (Str, "%02x", ((UINT8 *) Node)[Index]);
for ( ; Index < DevicePathNodeLength (Node); Index++) {
UefiDevicePathLibCatPrint (Str, "%02x", ((UINT8 *)Node)[Index]);
}
}
@ -2328,56 +2356,56 @@ DevPathToTextNodeGeneric (
}
static const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable[] = {
{HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci },
{HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard },
{HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap },
{HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor },
{HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController },
{HARDWARE_DEVICE_PATH, HW_BMC_DP, DevPathToTextBmc },
{ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi },
{ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextAcpiEx },
{ACPI_DEVICE_PATH, ACPI_ADR_DP, DevPathToTextAcpiAdr },
{MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi },
{MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi },
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre },
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx },
{MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx },
{MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP, DevPathToTextNVMe },
{MESSAGING_DEVICE_PATH, MSG_UFS_DP, DevPathToTextUfs },
{MESSAGING_DEVICE_PATH, MSG_SD_DP, DevPathToTextSd },
{MESSAGING_DEVICE_PATH, MSG_EMMC_DP, DevPathToTextEmmc },
{MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394 },
{MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb },
{MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID },
{MESSAGING_DEVICE_PATH, MSG_DEVICE_LOGICAL_UNIT_DP, DevPathToTextLogicalUnit },
{MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, DevPathToTextUsbClass },
{MESSAGING_DEVICE_PATH, MSG_SATA_DP, DevPathToTextSata },
{MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O },
{MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr },
{MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4 },
{MESSAGING_DEVICE_PATH, MSG_IPv6_DP, DevPathToTextIPv6 },
{MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, DevPathToTextInfiniBand },
{MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart },
{MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor },
{MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI },
{MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan },
{MESSAGING_DEVICE_PATH, MSG_DNS_DP, DevPathToTextDns },
{MESSAGING_DEVICE_PATH, MSG_URI_DP, DevPathToTextUri },
{MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP, DevPathToTextBluetooth },
{MESSAGING_DEVICE_PATH, MSG_WIFI_DP, DevPathToTextWiFi },
{MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_LE_DP, DevPathToTextBluetoothLE },
{MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive },
{MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM },
{MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor },
{MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol },
{MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath },
{MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_VOL_DP, DevPathToTextFv },
{MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP, DevPathToTextFvFile },
{MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, DevPathRelativeOffsetRange },
{MEDIA_DEVICE_PATH, MEDIA_RAM_DISK_DP, DevPathToTextRamDisk },
{BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS },
{END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance },
{0, 0, NULL}
{ HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci },
{ HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard },
{ HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap },
{ HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor },
{ HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController },
{ HARDWARE_DEVICE_PATH, HW_BMC_DP, DevPathToTextBmc },
{ ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi },
{ ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextAcpiEx },
{ ACPI_DEVICE_PATH, ACPI_ADR_DP, DevPathToTextAcpiAdr },
{ MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi },
{ MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi },
{ MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre },
{ MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx },
{ MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx },
{ MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP, DevPathToTextNVMe },
{ MESSAGING_DEVICE_PATH, MSG_UFS_DP, DevPathToTextUfs },
{ MESSAGING_DEVICE_PATH, MSG_SD_DP, DevPathToTextSd },
{ MESSAGING_DEVICE_PATH, MSG_EMMC_DP, DevPathToTextEmmc },
{ MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394 },
{ MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb },
{ MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID },
{ MESSAGING_DEVICE_PATH, MSG_DEVICE_LOGICAL_UNIT_DP, DevPathToTextLogicalUnit },
{ MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, DevPathToTextUsbClass },
{ MESSAGING_DEVICE_PATH, MSG_SATA_DP, DevPathToTextSata },
{ MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O },
{ MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr },
{ MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4 },
{ MESSAGING_DEVICE_PATH, MSG_IPv6_DP, DevPathToTextIPv6 },
{ MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, DevPathToTextInfiniBand },
{ MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart },
{ MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor },
{ MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI },
{ MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan },
{ MESSAGING_DEVICE_PATH, MSG_DNS_DP, DevPathToTextDns },
{ MESSAGING_DEVICE_PATH, MSG_URI_DP, DevPathToTextUri },
{ MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP, DevPathToTextBluetooth },
{ MESSAGING_DEVICE_PATH, MSG_WIFI_DP, DevPathToTextWiFi },
{ MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_LE_DP, DevPathToTextBluetoothLE },
{ MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive },
{ MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM },
{ MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor },
{ MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol },
{ MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath },
{ MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_VOL_DP, DevPathToTextFv },
{ MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP, DevPathToTextFvFile },
{ MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, DevPathRelativeOffsetRange },
{ MEDIA_DEVICE_PATH, MEDIA_RAM_DISK_DP, DevPathToTextRamDisk },
{ BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS },
{ END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance },
{ 0, 0, NULL }
};
/**
@ -2421,9 +2449,10 @@ UefiDevicePathLibConvertDeviceNodeToText (
Node = __DECONST(EFI_DEVICE_PATH_PROTOCOL *, DeviceNode);
ToText = DevPathToTextNodeGeneric;
for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index++) {
if (DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type &&
DevicePathSubType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].SubType
) {
if ((DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type) &&
(DevicePathSubType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].SubType)
)
{
ToText = mUefiDevicePathLibToTextTable[Index].Function;
break;
}
@ -2432,7 +2461,7 @@ UefiDevicePathLibConvertDeviceNodeToText (
//
// Print this node
//
ToText (&Str, (VOID *) Node, DisplayOnly, AllowShortcuts);
ToText (&Str, (VOID *)Node, DisplayOnly, AllowShortcuts);
ASSERT (Str.Str != NULL);
return Str.Str;
@ -2484,14 +2513,15 @@ UefiDevicePathLibConvertDevicePathToText (
//
ToText = DevPathToTextNodeGeneric;
for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index += 1) {
if (DevicePathType (Node) == mUefiDevicePathLibToTextTable[Index].Type &&
DevicePathSubType (Node) == mUefiDevicePathLibToTextTable[Index].SubType
) {
if ((DevicePathType (Node) == mUefiDevicePathLibToTextTable[Index].Type) &&
(DevicePathSubType (Node) == mUefiDevicePathLibToTextTable[Index].SubType)
)
{
ToText = mUefiDevicePathLibToTextTable[Index].Function;
break;
}
}
//
// Put a path separator in if needed
//

File diff suppressed because it is too large Load diff

View file

@ -63,7 +63,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define IS_SLASH(a) ((a) == '/')
#define IS_NULL(a) ((a) == '\0')
//
// Private Data structure
//
@ -399,7 +398,6 @@ UefiDevicePathLibIsDevicePathMultiInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
Converts a device path to its text representation.

View file

@ -25,12 +25,12 @@ extern EFI_GUID gEfiVirtualDiskGuid;
EFI_GUID gEfiDebugPortProtocolGuid = { 0xEBA4E8D2, 0x3858, 0x41EC, { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 }} ;
EFI_GUID gEfiPcAnsiGuid = { 0xE0C14753, 0xF9BE, 0x11D2, { 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} ;
EFI_GUID gEfiPersistentVirtualCdGuid = { 0x08018188, 0x42CD, 0xBB48, {0x10, 0x0F, 0x53, 0x87, 0xD5, 0x3D, 0xED, 0x3D }} ;
EFI_GUID gEfiPersistentVirtualDiskGuid = { 0x5CEA02C9, 0x4D07, 0x69D3, {0x26, 0x9F ,0x44, 0x96, 0xFB, 0xE0, 0x96, 0xF9 }} ;
EFI_GUID gEfiPersistentVirtualCdGuid = { 0x08018188, 0x42CD, 0xBB48, { 0x10, 0x0F, 0x53, 0x87, 0xD5, 0x3D, 0xED, 0x3D }} ;
EFI_GUID gEfiPersistentVirtualDiskGuid = { 0x5CEA02C9, 0x4D07, 0x69D3, { 0x26, 0x9F ,0x44, 0x96, 0xFB, 0xE0, 0x96, 0xF9 }} ;
EFI_GUID gEfiSasDevicePathGuid = { 0xd487ddb4, 0x008b, 0x11d9, { 0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d }} ;
EFI_GUID gEfiUartDevicePathGuid = { 0x37499a9d, 0x542f, 0x4c89, { 0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 }} ;
EFI_GUID gEfiVT100Guid = { 0xDFA66065, 0xB419, 0x11D3, { 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} ;
EFI_GUID gEfiVT100PlusGuid = { 0x7BAEC70B, 0x57E0, 0x4C76, { 0x8E, 0x87, 0x2F, 0x9E, 0x28, 0x08, 0x83, 0x43 }} ;
EFI_GUID gEfiVTUTF8Guid = { 0xAD15A0D6, 0x8BEC, 0x4ACF, { 0xA0, 0x73, 0xD0, 0x1D, 0xE7, 0x7E, 0x2D, 0x88 }} ;
EFI_GUID gEfiVirtualCdGuid = { 0x3D5ABD30, 0x4175, 0x87CE, {0x6D, 0x64, 0xD2, 0xAD, 0xE5, 0x23, 0xC4, 0xBB }} ;
EFI_GUID gEfiVirtualDiskGuid = { 0x77AB535A, 0x45FC, 0x624B, {0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E }} ;
EFI_GUID gEfiVirtualCdGuid = { 0x3D5ABD30, 0x4175, 0x87CE, { 0x6D, 0x64, 0xD2, 0xAD, 0xE5, 0x23, 0xC4, 0xBB }} ;
EFI_GUID gEfiVirtualDiskGuid = { 0x77AB535A, 0x45FC, 0x624B, { 0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E }} ;