git: a51ae7212d30 - main - libefivar: Add PciRoot/PcieRoot text for ACPI Expanded Device Path

From: Warner Losh <imp_at_FreeBSD.org>
Date: Sun, 27 Feb 2022 16:47:48 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=a51ae7212d30f3e2c1ae71419207d569fab97e88

commit a51ae7212d30f3e2c1ae71419207d569fab97e88
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-02-23 16:50:19 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-02-27 16:13:08 +0000

    libefivar: Add PciRoot/PcieRoot text for ACPI Expanded Device Path
    
    According to UEFI spec,for ACPI Expanded Device Path
    when HID=PNP0A03 or CID=PNP0A03 and HID != PNP0A08,
    the device path node can be displayed as: PciRoot(UID|UIDSTR)
    When HID=PNP0A08 or CID=PNP0A08, the device path node can be
    displayed as: PcieRoot(UID|UIDSTR). But current code miss the
    code logic.
    
    This commit is to do the enhancement.
    
    Upstream Bug:   https://bugzilla.tianocore.org/show_bug.cgi?id=1228
    Obtained from:  https://github.com/tianocore/edk2/commit/78af0984b45a780e45d57c22c85a1f594b969212
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
---
 lib/libefivar/efivar-dp-format.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lib/libefivar/efivar-dp-format.c b/lib/libefivar/efivar-dp-format.c
index 24f4cdc94d98..e2a5e666ce7b 100644
--- a/lib/libefivar/efivar-dp-format.c
+++ b/lib/libefivar/efivar-dp-format.c
@@ -492,6 +492,27 @@ DevPathToTextAcpiEx (
   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;
+     }
+   }
+
   //
   // Converts EISA identification to string.
   //