From nobody Sun Feb 27 16:47:52 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 7C63419EA3C3; Sun, 27 Feb 2022 16:47:54 +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 4K68Zd3bvbz4m3c; Sun, 27 Feb 2022 16:47:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645980473; 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=8tHO5rTMyo1jwUMuiV4c53xJmcvxDi5/Spvs+iTvPyw=; b=BOIg57v9bPigbebNn4jNZCjPZnWpyoTLO1UtZLH5oK445C8v7WdnmnNYDtlzPkFIvkeFma RRm9KES4Hu6ek7smRyiltK88h1+Nubpg9Cm8Mdy9HEEbQi+Kix/BP3Z/pp+NdPTpLPpnfD xA0BJDCepLG2m8UGV0vG/speKcd0tYUyzXJzmYVrxoYsHSA3AXh1Q2ksOCO4ou9E/FLrp7 +VYB963GKfC/rfOxgMrH3GDJRByNONzEb6BCAs9y6ws4V5gUEBIrdMgxhWwSXzSxItGAY3 dK4zUXmdwOUSdSkt3SAUaELE7qF3JfJTt27kT5PX1ZV6WRahNRxAdTZYG0c6kQ== 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 17D092D2D; Sun, 27 Feb 2022 16:47:53 +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 21RGlrN8037027; Sun, 27 Feb 2022 16:47:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21RGlqKw037026; Sun, 27 Feb 2022 16:47:52 GMT (envelope-from git) Date: Sun, 27 Feb 2022 16:47:52 GMT Message-Id: <202202271647.21RGlqKw037026@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: 492d9953fa2a - main - libefivar: Handle AcpiExp device path when optional para is not specified 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: 492d9953fa2a2bfe961e3f361462f0a97bec1ee7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645980473; 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=8tHO5rTMyo1jwUMuiV4c53xJmcvxDi5/Spvs+iTvPyw=; b=ECFGhJQmVAr7vcIdJKfcjXeU7oIrU2Z7OX+r8im1wjXqa9VTP9ivtI7TGc4c9pQmCKco86 9uDwQPo4RDCSMlxiMnvk0J49n+ovp76pJqlx8l9LZylIUPyCCSU01jFiXhfn8lNQ9AnwCh yk9N3DXQd7JtgFWXqHjh0jcdFEYtFp92zvXr7UrBU6RQFBaHRYSOO7oeCFkDRKdS3RXO5A /eFPtwcN1m0x3Oa121OuTmH38iwix/6TXAuRuuyBNmoeGx7G2+htKDEDY1Oa5fz1hDSjmy vBiKEGvckUXHIUhbh1B9EkkuNcmG9nBOOI2xnUPppx5AKSi/ZF8hl5Of3333xQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645980473; a=rsa-sha256; cv=none; b=Nr3TEZ8QI7Jwb3QH9AH9Gwg+Rl/HPHcHdC9+ienmwX/BvAyOMQHJUoFExU0ihGZmi86T6r 2k06NiC0e7YX+dlTEM4vWzFVT1Ep5SqDjZqCUYXDmgOCt6g31gYbTk25NR46d0e9kj8oVl WQDmADluVof5q71fYZzGZ7m6HozdTAJlZve+IvZj6DE2pbDOByyNYpfcTmBPETfO++Z4x5 lJ7K5uYX5rR+7doWcgGURRBSuR05yqzWzehTmx3OxP4g7CfKfjWeJd/kXZeQQUi5QQCGcP FruP36TjUOZHQh4YoTyyUgqtid54v923CGCjCe9N0XHCV9xY1NOZ4k+u1mJvNw== 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=492d9953fa2a2bfe961e3f361462f0a97bec1ee7 commit 492d9953fa2a2bfe961e3f361462f0a97bec1ee7 Author: Jose Luis Duran AuthorDate: 2022-02-23 17:04:02 +0000 Commit: Warner Losh CommitDate: 2022-02-27 16:13:31 +0000 libefivar: Handle AcpiExp device path when optional para is not specified AcpiExp text device path: AcpiExp(HID,CID,UIDSTR) And according to UEFI spec, the CID parameter is optional and has a default value of 0. But current implementation miss to check following cases for the AcpiExp. FromText: when text device is AcpiExp(HID,,UIDSTR)/AcpiExp(HID,0,UIDSTR) ToText: when the CID is 0 in the node structure This commit is to do the enhancement. Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1243 Obtained from: https://github.com/tianocore/edk2/commit/a8b5750901faa63ff5570634851e648b8e335e5a Pull Request: https://github.com/freebsd/freebsd-src/pull/581 --- lib/libefivar/efivar-dp-format.c | 23 ++++++++++++++++------- lib/libefivar/efivar-dp-parse.c | 11 ++++++++++- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/lib/libefivar/efivar-dp-format.c b/lib/libefivar/efivar-dp-format.c index e2a5e666ce7b..0062216ac307 100644 --- a/lib/libefivar/efivar-dp-format.c +++ b/lib/libefivar/efivar-dp-format.c @@ -539,13 +539,22 @@ DevPathToTextAcpiEx ( // // use AcpiExp() // - UefiDevicePathLibCatPrint ( - Str, - "AcpiExp(%s,%s,%s)", - HIDText, - CIDText, - UIDStr - ); + if (AcpiEx->CID == 0) { + UefiDevicePathLibCatPrint ( + Str, + "AcpiExp(%s,0,%s)", + HIDText, + UIDStr + ); + } else { + UefiDevicePathLibCatPrint ( + Str, + "AcpiExp(%s,%s,%s)", + HIDText, + CIDText, + UIDStr + ); + } } else { if (AllowShortcuts) { // diff --git a/lib/libefivar/efivar-dp-parse.c b/lib/libefivar/efivar-dp-parse.c index a4c7cff57c06..c6ea7bc00a57 100644 --- a/lib/libefivar/efivar-dp-parse.c +++ b/lib/libefivar/efivar-dp-parse.c @@ -1014,7 +1014,16 @@ DevPathFromTextAcpiExp ( ); AcpiEx->HID = EisaIdFromText (HIDStr); - AcpiEx->CID = EisaIdFromText (CIDStr); + // + // According to UEFI spec, the CID parameter is optional and has a default value of 0. + // 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') { + AcpiEx->CID = 0; + } else { + AcpiEx->CID = EisaIdFromText (CIDStr); + } AcpiEx->UID = 0; AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));