From nobody Sun Feb 27 16:47:58 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D6B9E19EA67C; Sun, 27 Feb 2022 16:48:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K68Zl5LcRz4m8h; Sun, 27 Feb 2022 16:47:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645980479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gglsLgza4PUq0MypDwzDPBzpHsg3YrHDTnEjW6kH6ZU=; b=kFQXhKHRvDyu7tg0QkRd3EIO6GaoIX0Hqvga77+Yod5woK7a8c+eUSWpnmB8iyQdLQlde8 YuQ+6cCzLWj8i2quWEgd9UNHwSvxdo+R5HDNx7btrMDgkFXes3+/Rag2T2H7gvvnB9tILR +FP+oRvvJZHgbfjnzIUh7WU4saUUOml2fZoC/iQjtXZxhzFcuWH3W7IzLxxEgnSdXB2Wa1 aKUrzixnfpja8i+AU+IJX6fiCSt+N1NY5Oa6yiI0ZTPQ4aZPEIkrjTPhW+6aUuEePPx+pP AVm266yTAbvDIBu6/Sx/83XMOBhiwF+jnCQUFxQn87uG+S70GVqeUvFuPwL05A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E607F2A57; Sun, 27 Feb 2022 16:47:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21RGlwIc037153; Sun, 27 Feb 2022 16:47:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21RGlwIF037152; Sun, 27 Feb 2022 16:47:58 GMT (envelope-from git) Date: Sun, 27 Feb 2022 16:47:58 GMT Message-Id: <202202271647.21RGlwIF037152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 5754f5823bbc - main - libefivar: Apply uncrustify changes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5754f5823bbca3e6ebefbe1ff38fe4cad8b641fe Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645980479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gglsLgza4PUq0MypDwzDPBzpHsg3YrHDTnEjW6kH6ZU=; b=M3T/7vSx+ShbDex8I8ey+8eEZGcjDDl/f6wZnrYmHl9wDzSkEyAciGf1Xx7XXBwmbI1L+w tng7gOvuklnKpRIhDv0tBxmoYXtFVpZbe/9fUUq2orWuU0kJLhLa3FUudVxihgnoBMBQgP +iM2ApH4FMAlt9EB0xm06JlGTLS9VzNyI5/vQZs50C2MGIW54TiPHO+UftgEyYdWeTy1km WW3/IQZv3bFjXEWJy1tNPgQPVo/WjUHnN6NBITXoJWCN5dUqYBnXlZxmCOlDeDwnSe4xjZ Esh/WDhfccYsuXY804j29/z8rmQnOZFpnpaE+z9d1f8qG6V51PVhxRhaLYIZGQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645980479; a=rsa-sha256; cv=none; b=OOC2d71uercrNx/RQ6T9Xnqme0SjHkhXRnUOPROjpGpMo6/3Ok8XLe+O+ZvCuO/AlXMpWF wd5TY0ctx0Nig7SbmIz82y9QjW32HgPY/b2jIThtklbq3AkRdwbgZFTqdDMxlpf6A/zfq/ rj8eiK/16+Mozspb44HOjc9ECYKtFuairnmYV5YMCzOUKuEDsjFnyml8Ld3yYRUzlf9Eww RPsECTamf+j3WMm5KPxUsLy6U2iVwqsYBEbDc5PJEDtW9i8Er9m+VGVlWDRXiz+kbkxb64 QJkz0QtaSRrUramhCZcQLfEVGTWx6OjvOjvgGN5mI+TY9YhMEGXpPTuhXMZnGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5754f5823bbca3e6ebefbe1ff38fe4cad8b641fe commit 5754f5823bbca3e6ebefbe1ff38fe4cad8b641fe Author: Jose Luis Duran AuthorDate: 2022-02-24 01:23:57 +0000 Commit: Warner Losh CommitDate: 2022-02-27 16:45:34 +0000 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: https://github.com/tianocore/edk2/commit/2f88bd3a1296c522317f1c21377876de63de5be7 Pull Request: https://github.com/freebsd/freebsd-src/pull/581 --- lib/libefivar/FreeBSD-update | 52 +- lib/libefivar/efivar-dp-format.c | 854 +++++++++-------- lib/libefivar/efivar-dp-parse.c | 1917 +++++++++++++++++++------------------- lib/libefivar/uefi-dplib.h | 152 ++- lib/libefivar/uefi-guid.c | 18 +- 5 files changed, 1519 insertions(+), 1474 deletions(-) diff --git a/lib/libefivar/FreeBSD-update b/lib/libefivar/FreeBSD-update index 8b45dce8c3a0..375f9ceb9536 100644 --- a/lib/libefivar/FreeBSD-update +++ b/lib/libefivar/FreeBSD-update @@ -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). - -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. - -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. +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 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. 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. diff --git a/lib/libefivar/efivar-dp-format.c b/lib/libefivar/efivar-dp-format.c index f70a59a62c83..9003b156f7fe 100644 --- a/lib/libefivar/efivar-dp-format.c +++ b/lib/libefivar/efivar-dp-format.c @@ -89,25 +89,29 @@ SPDX-License-Identifier: BSD-2-Clause-Patent static char * EFIAPI UefiDevicePathLibCatPrint ( - IN OUT POOL_PRINT *Str, - IN const char *Fmt, + IN OUT POOL_PRINT *Str, + IN const char *Fmt, ... ) { - UINTN Count; - VA_LIST Args; + UINTN Count; + 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); @@ -135,7 +139,7 @@ DevPathToTextPci ( IN BOOLEAN AllowShortcuts ) { - PCI_DEVICE_PATH *Pci; + PCI_DEVICE_PATH *Pci; Pci = DevPath; UefiDevicePathLibCatPrint (Str, "Pci(0x%x,0x%x)", Pci->Device, Pci->Function); @@ -229,94 +233,95 @@ 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"; - break; - - case MESSAGING_DEVICE_PATH: - Type = "Msg"; - if (AllowShortcuts) { - if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) { - UefiDevicePathLibCatPrint (Str, "VenPcAnsi()"); - return ; - } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) { - UefiDevicePathLibCatPrint (Str, "VenVt100()"); - return ; - } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) { - UefiDevicePathLibCatPrint (Str, "VenVt100Plus()"); - return ; - } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) { - UefiDevicePathLibCatPrint (Str, "VenUtf8()"); - return ; - } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) { - FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap); - switch (FlowControlMap & 0x00000003) { - case 0: - UefiDevicePathLibCatPrint (Str, "UartFlowCtrl(%s)", "None"); - break; - - case 1: - UefiDevicePathLibCatPrint (Str, "UartFlowCtrl(%s)", "Hardware"); - break; - - case 2: - UefiDevicePathLibCatPrint (Str, "UartFlowCtrl(%s)", "XonXoff"); - break; - - default: - break; - } + case HARDWARE_DEVICE_PATH: + Type = "Hw"; + break; - 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 - ); - 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)) { + case MESSAGING_DEVICE_PATH: + Type = "Msg"; + if (AllowShortcuts) { + if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) { + UefiDevicePathLibCatPrint (Str, "VenPcAnsi()"); + return; + } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) { + UefiDevicePathLibCatPrint (Str, "VenVt100()"); + return; + } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) { + UefiDevicePathLibCatPrint (Str, "VenVt100Plus()"); + return; + } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) { + UefiDevicePathLibCatPrint (Str, "VenUtf8()"); + return; + } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) { + FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *)Vendor)->FlowControlMap); + switch (FlowControlMap & 0x00000003) { + case 0: + UefiDevicePathLibCatPrint (Str, "UartFlowCtrl(%s)", "None"); + break; + + case 1: + UefiDevicePathLibCatPrint (Str, "UartFlowCtrl(%s)", "Hardware"); + break; + + case 2: + UefiDevicePathLibCatPrint (Str, "UartFlowCtrl(%s)", "XonXoff"); + break; + + default: + break; + } + + return; + } else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) { UefiDevicePathLibCatPrint ( Str, - "%s,%s,%s,", - ((Info & BIT4) != 0) ? "SATA" : "SAS", - ((Info & BIT5) != 0) ? "External" : "Internal", - ((Info & BIT6) != 0) ? "Expanded" : "Direct" + "SAS(0x%lx,0x%lx,0x%x,", + ((SAS_DEVICE_PATH *)Vendor)->SasAddress, + ((SAS_DEVICE_PATH *)Vendor)->Lun, + ((SAS_DEVICE_PATH *)Vendor)->RelativeTargetPort ); - if ((Info & 0x0f) == 1) { - UefiDevicePathLibCatPrint (Str, "0,"); + 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)) { + UefiDevicePathLibCatPrint ( + Str, + "%s,%s,%s,", + ((Info & BIT4) != 0) ? "SATA" : "SAS", + ((Info & BIT5) != 0) ? "External" : "Internal", + ((Info & BIT6) != 0) ? "Expanded" : "Direct" + ); + if ((Info & 0x0f) == 1) { + UefiDevicePathLibCatPrint (Str, "0,"); + } else { + // + // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256 + // + UefiDevicePathLibCatPrint (Str, "0x%x,", ((Info >> 8) & 0xff) + 1); + } } else { - // - // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256 - // - UefiDevicePathLibCatPrint (Str, "0x%x,", ((Info >> 8) & 0xff) + 1); + UefiDevicePathLibCatPrint (Str, "0x%x,0,0,0,", Info); } - } else { - UefiDevicePathLibCatPrint (Str, "0x%x,0,0,0,", Info); - } - UefiDevicePathLibCatPrint (Str, "0x%x)", ((SAS_DEVICE_PATH *) Vendor)->Reserved); - return ; - } else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) { - UefiDevicePathLibCatPrint (Str, "DebugPort()"); - return ; + UefiDevicePathLibCatPrint (Str, "0x%x)", ((SAS_DEVICE_PATH *)Vendor)->Reserved); + return; + } else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) { + UefiDevicePathLibCatPrint (Str, "DebugPort()"); + return; + } } - } - break; - case MEDIA_DEVICE_PATH: - Type = "Media"; - break; + break; - default: - Type = "?"; - break; + case MEDIA_DEVICE_PATH: + Type = "Media"; + break; + + default: + Type = "?"; + break; } DataLength = DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_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]); } } @@ -383,7 +388,7 @@ DevPathToTextBmc ( IN BOOLEAN AllowShortcuts ) { - BMC_DEVICE_PATH *Bmc; + BMC_DEVICE_PATH *Bmc; Bmc = DevPath; UefiDevicePathLibCatPrint ( @@ -420,33 +425,33 @@ DevPathToTextAcpi ( Acpi = DevPath; if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { switch (EISA_ID_TO_NUM (Acpi->HID)) { - case 0x0a03: - UefiDevicePathLibCatPrint (Str, "PciRoot(0x%x)", Acpi->UID); - break; + case 0x0a03: + UefiDevicePathLibCatPrint (Str, "PciRoot(0x%x)", Acpi->UID); + break; - case 0x0a08: - UefiDevicePathLibCatPrint (Str, "PcieRoot(0x%x)", Acpi->UID); - break; + case 0x0a08: + UefiDevicePathLibCatPrint (Str, "PcieRoot(0x%x)", Acpi->UID); + break; - case 0x0604: - UefiDevicePathLibCatPrint (Str, "Floppy(0x%x)", Acpi->UID); - break; + case 0x0604: + UefiDevicePathLibCatPrint (Str, "Floppy(0x%x)", Acpi->UID); + break; - case 0x0301: - UefiDevicePathLibCatPrint (Str, "Keyboard(0x%x)", Acpi->UID); - break; + case 0x0301: + UefiDevicePathLibCatPrint (Str, "Keyboard(0x%x)", Acpi->UID); + break; - case 0x0501: - UefiDevicePathLibCatPrint (Str, "Serial(0x%x)", Acpi->UID); - break; + case 0x0501: + UefiDevicePathLibCatPrint (Str, "Serial(0x%x)", Acpi->UID); + break; - case 0x0401: - UefiDevicePathLibCatPrint (Str, "ParallelPort(0x%x)", Acpi->UID); - break; + case 0x0401: + UefiDevicePathLibCatPrint (Str, "ParallelPort(0x%x)", Acpi->UID); + break; - default: - UefiDevicePathLibCatPrint (Str, "Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID); - break; + default: + UefiDevicePathLibCatPrint (Str, "Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID); + break; } } else { UefiDevicePathLibCatPrint (Str, "Acpi(0x%08x,0x%x)", Acpi->HID, Acpi->UID); @@ -482,30 +487,33 @@ 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)) { - 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 (AcpiEx->UID == 0) { - UefiDevicePathLibCatPrint (Str, "PcieRoot(%s)", UIDStr); - } else { - UefiDevicePathLibCatPrint (Str, "PcieRoot(0x%x)", AcpiEx->UID); - } - return; - } - } + if ((EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A03) || + ((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 (AcpiEx->UID == 0) { + UefiDevicePathLibCatPrint (Str, "PcieRoot(%s)", UIDStr); + } else { + UefiDevicePathLibCatPrint (Str, "PcieRoot(0x%x)", AcpiEx->UID); + } + + return; + } + } // // Converts EISA identification to string. @@ -535,10 +543,10 @@ DevPathToTextAcpiEx ( // if (AcpiEx->CID == 0) { UefiDevicePathLibCatPrint ( - Str, - "AcpiExp(%s,0,%s)", - HIDText, - UIDStr + Str, + "AcpiExp(%s,0,%s)", + HIDText, + UIDStr ); } else { UefiDevicePathLibCatPrint ( @@ -607,21 +615,22 @@ DevPathToTextAcpiAdr ( IN BOOLEAN AllowShortcuts ) { - ACPI_ADR_DEVICE_PATH *AcpiAdr; - UINT32 *Addr; - UINT16 Index; - UINT16 Length; - UINT16 AdditionalAdrCount; + ACPI_ADR_DEVICE_PATH *AcpiAdr; + UINT32 *Addr; + UINT16 Index; + UINT16 Length; + 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, ")"); } @@ -646,7 +655,7 @@ DevPathToTextAtapi ( IN BOOLEAN AllowShortcuts ) { - ATAPI_DEVICE_PATH *Atapi; + ATAPI_DEVICE_PATH *Atapi; Atapi = DevPath; @@ -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; } /** @@ -837,17 +849,23 @@ DevPathToTextNVMe ( IN BOOLEAN AllowShortcuts ) { - NVME_NAMESPACE_DEVICE_PATH *Nvme; - UINT8 *Uuid; + NVME_NAMESPACE_DEVICE_PATH *Nvme; + 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] ); } @@ -899,7 +917,7 @@ DevPathToTextSd ( IN BOOLEAN AllowShortcuts ) { - SD_DEVICE_PATH *Sd; + SD_DEVICE_PATH *Sd; Sd = DevPath; UefiDevicePathLibCatPrint ( @@ -930,7 +948,7 @@ DevPathToTextEmmc ( IN BOOLEAN AllowShortcuts ) { - EMMC_DEVICE_PATH *Emmc; + EMMC_DEVICE_PATH *Emmc; Emmc = DevPath; UefiDevicePathLibCatPrint ( @@ -961,7 +979,7 @@ DevPathToText1394 ( IN BOOLEAN AllowShortcuts ) { - F1394_DEVICE_PATH *F1394DevPath; + F1394_DEVICE_PATH *F1394DevPath; F1394DevPath = DevPath; // @@ -991,7 +1009,7 @@ DevPathToTextUsb ( IN BOOLEAN AllowShortcuts ) { - USB_DEVICE_PATH *Usb; + USB_DEVICE_PATH *Usb; Usb = DevPath; UefiDevicePathLibCatPrint (Str, "USB(0x%x,0x%x)", Usb->ParentPortNumber, Usb->InterfaceNumber); @@ -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; } @@ -1068,7 +1086,7 @@ DevPathToTextLogicalUnit ( IN BOOLEAN AllowShortcuts ) { - DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit; + DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit; LogicalUnit = DevPath; UefiDevicePathLibCatPrint (Str, "Unit(0x%x)", LogicalUnit->Lun); @@ -1095,65 +1113,64 @@ DevPathToTextUsbClass ( IN BOOLEAN AllowShortcuts ) { - USB_CLASS_DEVICE_PATH *UsbClass; - BOOLEAN IsKnownSubClass; - + USB_CLASS_DEVICE_PATH *UsbClass; + BOOLEAN IsKnownSubClass; UsbClass = DevPath; IsKnownSubClass = TRUE; switch (UsbClass->DeviceClass) { - case USB_CLASS_AUDIO: - UefiDevicePathLibCatPrint (Str, "UsbAudio"); - break; + case USB_CLASS_AUDIO: + UefiDevicePathLibCatPrint (Str, "UsbAudio"); + break; - case USB_CLASS_CDCCONTROL: - UefiDevicePathLibCatPrint (Str, "UsbCDCControl"); - break; + case USB_CLASS_CDCCONTROL: + UefiDevicePathLibCatPrint (Str, "UsbCDCControl"); + break; - case USB_CLASS_HID: - UefiDevicePathLibCatPrint (Str, "UsbHID"); - break; + case USB_CLASS_HID: + UefiDevicePathLibCatPrint (Str, "UsbHID"); + break; - case USB_CLASS_IMAGE: - UefiDevicePathLibCatPrint (Str, "UsbImage"); - break; + case USB_CLASS_IMAGE: + UefiDevicePathLibCatPrint (Str, "UsbImage"); + break; - case USB_CLASS_PRINTER: - UefiDevicePathLibCatPrint (Str, "UsbPrinter"); - break; + case USB_CLASS_PRINTER: + UefiDevicePathLibCatPrint (Str, "UsbPrinter"); + break; - case USB_CLASS_MASS_STORAGE: - UefiDevicePathLibCatPrint (Str, "UsbMassStorage"); - break; + case USB_CLASS_MASS_STORAGE: + UefiDevicePathLibCatPrint (Str, "UsbMassStorage"); + break; - case USB_CLASS_HUB: - UefiDevicePathLibCatPrint (Str, "UsbHub"); - break; + case USB_CLASS_HUB: + UefiDevicePathLibCatPrint (Str, "UsbHub"); + break; - case USB_CLASS_CDCDATA: - UefiDevicePathLibCatPrint (Str, "UsbCDCData"); - break; + case USB_CLASS_CDCDATA: + UefiDevicePathLibCatPrint (Str, "UsbCDCData"); + break; - case USB_CLASS_SMART_CARD: - UefiDevicePathLibCatPrint (Str, "UsbSmartCard"); - break; + case USB_CLASS_SMART_CARD: + UefiDevicePathLibCatPrint (Str, "UsbSmartCard"); + break; - case USB_CLASS_VIDEO: - UefiDevicePathLibCatPrint (Str, "UsbVideo"); - break; + case USB_CLASS_VIDEO: + UefiDevicePathLibCatPrint (Str, "UsbVideo"); + break; - case USB_CLASS_DIAGNOSTIC: - UefiDevicePathLibCatPrint (Str, "UsbDiagnostic"); - break; + case USB_CLASS_DIAGNOSTIC: + UefiDevicePathLibCatPrint (Str, "UsbDiagnostic"); + break; - case USB_CLASS_WIRELESS: - UefiDevicePathLibCatPrint (Str, "UsbWireless"); - break; + case USB_CLASS_WIRELESS: + UefiDevicePathLibCatPrint (Str, "UsbWireless"); + break; - default: - IsKnownSubClass = FALSE; - break; + default: + IsKnownSubClass = FALSE; + break; } if (IsKnownSubClass) { @@ -1231,7 +1248,7 @@ DevPathToTextSata ( IN BOOLEAN AllowShortcuts ) { - SATA_DEVICE_PATH *Sata; + SATA_DEVICE_PATH *Sata; Sata = DevPath; UefiDevicePathLibCatPrint ( @@ -1264,7 +1281,7 @@ DevPathToTextI2O ( IN BOOLEAN AllowShortcuts ) { - I2O_DEVICE_PATH *I2ODevPath; + I2O_DEVICE_PATH *I2ODevPath; I2ODevPath = DevPath; UefiDevicePathLibCatPrint (Str, "I2O(0x%x)", I2ODevPath->Tid); @@ -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; } @@ -1341,8 +1358,8 @@ CatNetworkProtocol ( **/ static VOID CatIPv4Address ( - IN OUT POOL_PRINT *Str, - IN EFI_IPv4_ADDRESS *Address + IN OUT POOL_PRINT *Str, + IN EFI_IPv4_ADDRESS *Address ) { UefiDevicePathLibCatPrint (Str, "%d.%d.%d.%d", Address->Addr[0], Address->Addr[1], Address->Addr[2], Address->Addr[3]); @@ -1356,21 +1373,30 @@ CatIPv4Address ( **/ static VOID CatIPv6Address ( - IN OUT POOL_PRINT *Str, - IN EFI_IPv6_ADDRESS *Address + IN OUT POOL_PRINT *Str, + IN EFI_IPv6_ADDRESS *Address ) { 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, ")"); } @@ -1535,33 +1563,33 @@ DevPathToTextUart ( Uart = DevPath; switch (Uart->Parity) { - case 0: - Parity = 'D'; - break; + case 0: + Parity = 'D'; + break; - case 1: - Parity = 'N'; - break; + case 1: + Parity = 'N'; + break; - case 2: - Parity = 'E'; - break; + case 2: + Parity = 'E'; + break; - case 3: - Parity = 'O'; - break; + case 3: + Parity = 'O'; + break; - case 4: - Parity = 'M'; - break; + case 4: + Parity = 'M'; + break; - case 5: - Parity = 'S'; - break; + case 5: + Parity = 'S'; + break; - default: - Parity = 'x'; - break; + default: + Parity = 'x'; + break; } if (Uart->BaudRate == 0) { @@ -1579,25 +1607,25 @@ DevPathToTextUart ( UefiDevicePathLibCatPrint (Str, "%c,", Parity); switch (Uart->StopBits) { - case 0: - UefiDevicePathLibCatPrint (Str, "D)"); - break; + case 0: + UefiDevicePathLibCatPrint (Str, "D)"); + break; - case 1: - UefiDevicePathLibCatPrint (Str, "1)"); - break; + case 1: + UefiDevicePathLibCatPrint (Str, "1)"); + break; - case 2: - UefiDevicePathLibCatPrint (Str, "1.5)"); - break; + case 2: + UefiDevicePathLibCatPrint (Str, "1.5)"); + break; - case 3: - UefiDevicePathLibCatPrint (Str, "2)"); - break; + case 3: + UefiDevicePathLibCatPrint (Str, "2)"); + break; - default: - UefiDevicePathLibCatPrint (Str, "x)"); - break; + default: + UefiDevicePathLibCatPrint (Str, "x)"); + break; } } @@ -1622,9 +1650,9 @@ DevPathToTextiSCSI ( IN BOOLEAN AllowShortcuts ) { - ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath; - UINT16 Options; - UINTN Index; + ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath; + UINT16 Options; + UINTN Index; ISCSIDevPath = DevPath; UefiDevicePathLibCatPrint ( @@ -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"); @@ -1735,8 +1763,8 @@ DevPathToTextWiFi ( IN BOOLEAN AllowShortcuts ) { - WIFI_DEVICE_PATH *WiFi; - UINT8 SSId[33]; *** 4295 LINES SKIPPED ***