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:
parent
60de142cfc
commit
5754f5823b
@ -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.
|
||||
|
@ -103,9 +103,13 @@ UefiDevicePathLibCatPrint (
|
||||
|
||||
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);
|
||||
Str->Count += Count;
|
||||
@ -308,6 +312,7 @@ DevPathToTextVendor (
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MEDIA_DEVICE_PATH:
|
||||
@ -488,21 +493,24 @@ DevPathToTextAcpiEx (
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -622,6 +630,7 @@ DevPathToTextAcpiAdr (
|
||||
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)) {
|
||||
@ -813,7 +826,6 @@ DevPathToTextSasEx (
|
||||
|
||||
UefiDevicePathLibCatPrint (Str, ")");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -846,8 +858,14 @@ DevPathToTextNVMe (
|
||||
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]
|
||||
);
|
||||
}
|
||||
|
||||
@ -1027,7 +1045,7 @@ DevPathToTextUsbWWID (
|
||||
|
||||
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) {
|
||||
if ((Length >= 1) && (SerialNumberStr[Length - 1] != 0)) {
|
||||
//
|
||||
// In case no NULL terminator in SerialNumber, create a new one with NULL terminator
|
||||
//
|
||||
@ -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]
|
||||
);
|
||||
}
|
||||
|
||||
@ -1416,6 +1442,7 @@ DevPathToTextIPv4 (
|
||||
UefiDevicePathLibCatPrint (Str, ",");
|
||||
CatIPv4Address (Str, &IPDevPath->SubnetMask);
|
||||
}
|
||||
|
||||
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");
|
||||
@ -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;
|
||||
}
|
||||
@ -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
|
||||
//
|
||||
|
@ -134,9 +134,11 @@ GetParamByNodeName (
|
||||
if (IS_RIGHT_PARENTH (*StrPointer)) {
|
||||
break;
|
||||
}
|
||||
|
||||
StrPointer++;
|
||||
ParameterLength++;
|
||||
}
|
||||
|
||||
if (IS_NULL (*StrPointer)) {
|
||||
//
|
||||
// ')' not found
|
||||
@ -148,6 +150,7 @@ GetParamByNodeName (
|
||||
if (ParamStr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Terminate the parameter string
|
||||
//
|
||||
@ -192,6 +195,7 @@ SplitStr (
|
||||
if (*Str == Separator) {
|
||||
break;
|
||||
}
|
||||
|
||||
Str++;
|
||||
}
|
||||
|
||||
@ -263,9 +267,11 @@ GetNextDeviceNodeStr (
|
||||
if (!IS_SLASH (*Str) &&
|
||||
!IS_COMMA (*Str) &&
|
||||
!IS_LEFT_PARENTH (*Str) &&
|
||||
!IS_RIGHT_PARENTH (*Str)) {
|
||||
!IS_RIGHT_PARENTH (*Str))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Str++;
|
||||
}
|
||||
|
||||
@ -336,6 +342,7 @@ IsHexStr (
|
||||
while ((*Str != 0) && *Str == ' ') {
|
||||
Str++;
|
||||
}
|
||||
|
||||
//
|
||||
// skip preceeding zeros
|
||||
//
|
||||
@ -412,6 +419,7 @@ StrToAscii (
|
||||
while (!IS_NULL (*Str)) {
|
||||
*(Dest++) = (CHAR8)*(Str++);
|
||||
}
|
||||
|
||||
*Dest = 0;
|
||||
|
||||
//
|
||||
@ -448,6 +456,7 @@ DevPathFromTextGenericPath (
|
||||
} else {
|
||||
DataLength = StrLen (DataStr) / 2;
|
||||
}
|
||||
|
||||
Node = CreateDeviceNode (
|
||||
Type,
|
||||
(UINT8)Strtoi (SubtypeStr),
|
||||
@ -1013,11 +1022,12 @@ DevPathFromTextAcpiExp (
|
||||
// So when the CID parameter is not specified or specified as 0 in the text device node.
|
||||
// Set the CID to 0 in the ACPI extension device path structure.
|
||||
//
|
||||
if (*CIDStr == '\0' || *CIDStr == '0') {
|
||||
if ((*CIDStr == '\0') || (*CIDStr == '0')) {
|
||||
AcpiEx->CID = 0;
|
||||
} else {
|
||||
AcpiEx->CID = EisaIdFromText (CIDStr);
|
||||
}
|
||||
|
||||
AcpiEx->UID = 0;
|
||||
|
||||
AsciiStr = (CHAR8 *)((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
|
||||
@ -1069,6 +1079,7 @@ DevPathFromTextAcpiAdr (
|
||||
if (IS_NULL (*DisplayDeviceStr)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (Index > 0) {
|
||||
Length = DevicePathNodeLength (AcpiAdr);
|
||||
AcpiAdr = ReallocatePool (
|
||||
@ -1139,6 +1150,7 @@ IN CHAR16 *TextDeviceNode
|
||||
} else {
|
||||
Atapi->PrimarySecondary = (UINT8)Strtoi (PrimarySecondaryStr);
|
||||
}
|
||||
|
||||
if (StrCmp (SlaveMasterStr, "Master") == 0) {
|
||||
Atapi->SlaveMaster = 0;
|
||||
} else if (StrCmp (SlaveMasterStr, "Slave") == 0) {
|
||||
@ -1425,7 +1437,8 @@ DevPathFromTextVenPcAnsi (
|
||||
Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_VENDOR_DP,
|
||||
(UINT16) sizeof (VENDOR_DEVICE_PATH));
|
||||
(UINT16)sizeof (VENDOR_DEVICE_PATH)
|
||||
);
|
||||
CopyGuid (&Vendor->Guid, &gEfiPcAnsiGuid);
|
||||
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
|
||||
@ -1450,7 +1463,8 @@ DevPathFromTextVenVt100 (
|
||||
Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_VENDOR_DP,
|
||||
(UINT16) sizeof (VENDOR_DEVICE_PATH));
|
||||
(UINT16)sizeof (VENDOR_DEVICE_PATH)
|
||||
);
|
||||
CopyGuid (&Vendor->Guid, &gEfiVT100Guid);
|
||||
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
|
||||
@ -1475,7 +1489,8 @@ DevPathFromTextVenVt100Plus (
|
||||
Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_VENDOR_DP,
|
||||
(UINT16) sizeof (VENDOR_DEVICE_PATH));
|
||||
(UINT16)sizeof (VENDOR_DEVICE_PATH)
|
||||
);
|
||||
CopyGuid (&Vendor->Guid, &gEfiVT100PlusGuid);
|
||||
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
|
||||
@ -1500,7 +1515,8 @@ DevPathFromTextVenUtf8 (
|
||||
Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_VENDOR_DP,
|
||||
(UINT16) sizeof (VENDOR_DEVICE_PATH));
|
||||
(UINT16)sizeof (VENDOR_DEVICE_PATH)
|
||||
);
|
||||
CopyGuid (&Vendor->Guid, &gEfiVTUTF8Guid);
|
||||
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
|
||||
@ -1589,9 +1605,7 @@ DevPathFromTextSAS (
|
||||
|
||||
if (StrCmp (SASSATAStr, "NoTopology") == 0) {
|
||||
Info = 0x0;
|
||||
|
||||
} else if ((StrCmp (SASSATAStr, "SATA") == 0) || (StrCmp (SASSATAStr, "SAS") == 0)) {
|
||||
|
||||
Uint16 = (UINT16)Strtoi (DriveBayStr);
|
||||
if (Uint16 == 0) {
|
||||
Info = 0x1;
|
||||
@ -1614,6 +1628,7 @@ DevPathFromTextSAS (
|
||||
} else {
|
||||
Uint16 = ((UINT16)Strtoi (LocationStr) & BIT0);
|
||||
}
|
||||
|
||||
Info |= (Uint16 << 5);
|
||||
|
||||
//
|
||||
@ -1627,8 +1642,8 @@ DevPathFromTextSAS (
|
||||
} else {
|
||||
Uint16 = ((UINT16)Strtoi (ConnectStr) & (BIT0 | BIT1));
|
||||
}
|
||||
Info |= (Uint16 << 6);
|
||||
|
||||
Info |= (Uint16 << 6);
|
||||
} else {
|
||||
Info = (UINT16)Strtoi (SASSATAStr);
|
||||
}
|
||||
@ -1687,9 +1702,7 @@ DevPathFromTextSasEx (
|
||||
|
||||
if (StrCmp (SASSATAStr, "NoTopology") == 0) {
|
||||
Info = 0x0;
|
||||
|
||||
} else if ((StrCmp (SASSATAStr, "SATA") == 0) || (StrCmp (SASSATAStr, "SAS") == 0)) {
|
||||
|
||||
Uint16 = (UINT16)Strtoi (DriveBayStr);
|
||||
if (Uint16 == 0) {
|
||||
Info = 0x1;
|
||||
@ -1712,6 +1725,7 @@ DevPathFromTextSasEx (
|
||||
} else {
|
||||
Uint16 = ((UINT16)Strtoi (LocationStr) & BIT0);
|
||||
}
|
||||
|
||||
Info |= (Uint16 << 5);
|
||||
|
||||
//
|
||||
@ -1725,8 +1739,8 @@ DevPathFromTextSasEx (
|
||||
} else {
|
||||
Uint16 = ((UINT16)Strtoi (ConnectStr) & (BIT0 | BIT1));
|
||||
}
|
||||
Info |= (Uint16 << 6);
|
||||
|
||||
Info |= (Uint16 << 6);
|
||||
} else {
|
||||
Info = (UINT16)Strtoi (SASSATAStr);
|
||||
}
|
||||
@ -1922,7 +1936,7 @@ DevPathFromTextMAC (
|
||||
MACDevPath->IfType = (UINT8)Strtoi (IfTypeStr);
|
||||
|
||||
Length = sizeof (EFI_MAC_ADDRESS);
|
||||
if (MACDevPath->IfType == 0x01 || MACDevPath->IfType == 0x00) {
|
||||
if ((MACDevPath->IfType == 0x01) || (MACDevPath->IfType == 0x00)) {
|
||||
Length = 6;
|
||||
}
|
||||
|
||||
@ -1931,7 +1945,6 @@ DevPathFromTextMAC (
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)MACDevPath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts a text format to the network protocol ID.
|
||||
|
||||
@ -1957,7 +1970,6 @@ NetworkProtocolFromText (
|
||||
return Strtoi (Text);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts a text device path node to IPV4 device path structure.
|
||||
|
||||
@ -2109,6 +2121,7 @@ DevPathFromTextUart (
|
||||
} else {
|
||||
Strtoi64 (BaudStr, &Uart->BaudRate);
|
||||
}
|
||||
|
||||
Uart->DataBits = (UINT8)((StrCmp (DataBitsStr, "DEFAULT") == 0) ? 8 : Strtoi (DataBitsStr));
|
||||
switch (*ParityStr) {
|
||||
case 'D':
|
||||
@ -2196,6 +2209,7 @@ ConvertFromTextUsbClass (
|
||||
} else {
|
||||
UsbClass->DeviceClass = UsbClassText->Class;
|
||||
}
|
||||
|
||||
if (UsbClassText->SubClassExist) {
|
||||
SubClassStr = GetNextParamStr (&TextDeviceNode);
|
||||
if (*SubClassStr == '\0') {
|
||||
@ -2214,11 +2228,13 @@ ConvertFromTextUsbClass (
|
||||
} else {
|
||||
UsbClass->VendorId = (UINT16)Strtoi (VIDStr);
|
||||
}
|
||||
|
||||
if (*PIDStr == '\0') {
|
||||
UsbClass->ProductId = 0xFFFF;
|
||||
} else {
|
||||
UsbClass->ProductId = (UINT16)Strtoi (PIDStr);
|
||||
}
|
||||
|
||||
if (*ProtocolStr == '\0') {
|
||||
UsbClass->DeviceProtocol = 0xFF;
|
||||
} else {
|
||||
@ -2228,7 +2244,6 @@ ConvertFromTextUsbClass (
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)UsbClass;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts a text device path node to USB class device path structure.
|
||||
|
||||
@ -2625,14 +2640,16 @@ DevPathFromTextUsbWwid (
|
||||
InterfaceNumStr = GetNextParamStr (&TextDeviceNode);
|
||||
SerialNumberStr = GetNextParamStr (&TextDeviceNode);
|
||||
SerialNumberStrLen = StrLen (SerialNumberStr);
|
||||
if (SerialNumberStrLen >= 2 &&
|
||||
SerialNumberStr[0] == '\"' &&
|
||||
SerialNumberStr[SerialNumberStrLen - 1] == '\"'
|
||||
) {
|
||||
if ((SerialNumberStrLen >= 2) &&
|
||||
(SerialNumberStr[0] == '\"') &&
|
||||
(SerialNumberStr[SerialNumberStrLen - 1] == '\"')
|
||||
)
|
||||
{
|
||||
SerialNumberStr[SerialNumberStrLen - 1] = '\0';
|
||||
SerialNumberStr++;
|
||||
SerialNumberStrLen -= 2;
|
||||
}
|
||||
|
||||
UsbWwid = (USB_WWID_DEVICE_PATH *)CreateDeviceNode (
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_USB_WWID_DP,
|
||||
@ -2890,8 +2907,10 @@ DevPathFromTextBluetoothLE (
|
||||
|
||||
BluetoothLeDp->Address.Type = (UINT8)Strtoi (BluetoothLeAddrTypeStr);
|
||||
StrHexToBytes (
|
||||
BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2,
|
||||
BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Address)
|
||||
BluetoothLeAddrStr,
|
||||
sizeof (BluetoothLeDp->Address.Address) * 2,
|
||||
BluetoothLeDp->Address.Address,
|
||||
sizeof (BluetoothLeDp->Address.Address)
|
||||
);
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)BluetoothLeDp;
|
||||
}
|
||||
@ -2918,7 +2937,6 @@ DevPathFromTextDns (
|
||||
UINT32 DnsServerIpIndex;
|
||||
CHAR16 *DnsServerIp;
|
||||
|
||||
|
||||
//
|
||||
// Count the DNS server address number.
|
||||
//
|
||||
@ -3626,6 +3644,7 @@ DevPathFromTextSata (
|
||||
} else {
|
||||
Sata->PortMultiplierPortNumber = (UINT16)Strtoi (Param2);
|
||||
}
|
||||
|
||||
Sata->Lun = (UINT16)Strtoi (Param3);
|
||||
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)Sata;
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user