From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4999721167472 for ; Thu, 11 Oct 2018 19:18:57 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 19:18:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,370,1534834800"; d="scan'208";a="271717368" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga006.fm.intel.com with ESMTP; 11 Oct 2018 19:18:56 -0700 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Ruiyu Ni , Michael D Kinney , Liming Gao Date: Fri, 12 Oct 2018 10:18:28 +0800 Message-Id: <20181012021828.30432-4-dandan.bi@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 In-Reply-To: <20181012021828.30432-1-dandan.bi@intel.com> References: <20181012021828.30432-1-dandan.bi@intel.com> Subject: [patch 3/3] MdePkg: Handle AcpiExp device path when optional para is not specified X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2018 02:18:57 -0000 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1243 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. Cc: Ruiyu Ni Cc: Michael D Kinney Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- .../UefiDevicePathLib/DevicePathFromText.c | 11 ++++++++- .../UefiDevicePathLib/DevicePathToText.c | 23 +++++++++++++------ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c index 4b49e341c7..b759146b72 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c @@ -917,11 +917,20 @@ DevPathFromTextAcpiExp ( ACPI_EXTENDED_DP, Length ); AcpiEx->HID = EisaIdFromText (HIDStr); - AcpiEx->CID = EisaIdFromText (CIDStr); + // + // According to UEFI spec, the CID parametr is optional and has a default value of 0. + // So when the CID parametr 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 == L'\0' || *CIDStr == L'0') { + AcpiEx->CID = 0; + } else { + AcpiEx->CID = EisaIdFromText (CIDStr); + } AcpiEx->UID = 0; AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH)); // // HID string is NULL diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c index 7ad9eadf6c..cdcdb3623a 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c @@ -478,17 +478,26 @@ DevPathToTextAcpiEx ( if ((*HIDStr == '\0') && (*CIDStr == '\0') && (*UIDStr != '\0')) { // // use AcpiExp() // - UefiDevicePathLibCatPrint ( - Str, - L"AcpiExp(%s,%s,%a)", - HIDText, - CIDText, - UIDStr - ); + if (AcpiEx->CID == 0) { + UefiDevicePathLibCatPrint ( + Str, + L"AcpiExp(%s,0,%a)", + HIDText, + UIDStr + ); + } else { + UefiDevicePathLibCatPrint ( + Str, + L"AcpiExp(%s,%s,%a)", + HIDText, + CIDText, + UIDStr + ); + } } else { if (AllowShortcuts) { // // display only // -- 2.18.0.windows.1