git: ac2b16d3b11b - main - libefivar: Correct condition check for AcpiExp text format

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

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

commit ac2b16d3b11b88ba1f3023de3645575542be4ca3
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-02-23 16:38:58 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-02-27 16:13:04 +0000

    libefivar: Correct condition check for AcpiExp text format
    
    According to UEFI Spec, for ACPI Expanded Device Path,
    when HIDSTR=empty, CIDSTR=empty, UID STR!=empty,
    the ACPI Expanded Device Path node can be displayed as
    AcpiExp(HID,CID,UIDSTR) format.
    And if UID is 0 and UIDSTR is empty, then use AcpiEx format.
    
    This patch is to correct the condition check to follow UEFI
    Spec when convert the device path node to the AcpiExp text
    format.
    
    Upstream Bug:   https://bugzilla.tianocore.org/show_bug.cgi?id=1226
    Obtained from:  https://github.com/tianocore/edk2/commit/fb4bea551e5b7e16e54676bca3d1ccde65f57c77
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
---
 lib/libefivar/efivar-dp-format.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libefivar/efivar-dp-format.c b/lib/libefivar/efivar-dp-format.c
index 7abbce033f1d..24f4cdc94d98 100644
--- a/lib/libefivar/efivar-dp-format.c
+++ b/lib/libefivar/efivar-dp-format.c
@@ -514,7 +514,7 @@ DevPathToTextAcpiEx (
     (AcpiEx->CID >> 16) & 0xFFFF
     );
 
-  if ((*HIDStr == '\0') && (*CIDStr == '\0') && (AcpiEx->UID == 0)) {
+  if ((*HIDStr == '\0') && (*CIDStr == '\0') && (*UIDStr != '\0')) {
     //
     // use AcpiExp()
     //