From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: bob.c.feng@intel.com) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by groups.io with SMTP; Thu, 05 Sep 2019 02:45:17 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2019 02:45:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,470,1559545200"; d="scan'208";a="187924152" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga006.jf.intel.com with ESMTP; 05 Sep 2019 02:45:12 -0700 From: "Bob Feng" To: devel@edk2.groups.io Cc: Liming Gao , Bob Feng Subject: [Patch 1/1] BaseTools: Fix a bug for Hii Pcd override Date: Thu, 5 Sep 2019 17:45:10 +0800 Message-Id: <20190905094510.19080-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2157 Hii Pcd links to a efi variable. The Variable default value is evaluated by related Hii Pcds setting. If multiple Hii Pcds links to one variable, and the offset overlap, the later Hii Pcds setting should be effective. There is a tool bug that is if the Pcds are in different dsc file which are included into the platform dsc file, build tool does not get the Pcds relative position correctly. That means build tool does not know which Pcd is the later one. As the result, the variable default value will be incorrect. This patch is to fix this bug. Cc: Liming Gao Signed-off-by: Bob Feng --- BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index d2b5ccbb7a30..9192077f9064 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -3012,11 +3012,11 @@ class DscBuildData(PlatformBuildClassObject): PcdList.append((PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy5)) PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid, DefaultStore] = Setting # Remove redundant PCD candidates, per the ARCH and SKU - for PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4 in PcdList: + for index,(PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4) in enumerate(PcdList): Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid, DefaultStore] if Setting is None: continue VariableName, VariableGuid, VariableOffset, DefaultValue, VarAttribute = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4) @@ -3081,11 +3081,11 @@ class DscBuildData(PlatformBuildClassObject): IsDsc=True) if (PcdCName, TokenSpaceGuid) in UserDefinedDefaultStores: PcdClassObj.UserDefinedDefaultStoresFlag = True Pcds[PcdCName, TokenSpaceGuid] = PcdClassObj - Pcds[PcdCName, TokenSpaceGuid].CustomAttribute['DscPosition'] = int(Dummy4) + Pcds[PcdCName, TokenSpaceGuid].CustomAttribute['DscPosition'] = index if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue: Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {} Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName] = {} Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][DefaultStore] = DefaultValue Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName][DefaultStore] = (self.MetaFile.File,Dummy4) -- 2.20.1.windows.1