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.88; helo=mga01.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 1725E22280C23 for ; Tue, 26 Dec 2017 21:58:43 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Dec 2017 22:03:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,462,1508828400"; d="scan'208";a="190050218" Received: from shwdeopenpsi105.ccr.corp.intel.com ([10.239.9.129]) by fmsmga005.fm.intel.com with ESMTP; 26 Dec 2017 22:03:38 -0800 From: BobCF To: edk2-devel@lists.01.org Date: Wed, 27 Dec 2017 14:03:34 +0800 Message-Id: <20171227060335.1744-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.14.3.windows.1 Subject: [Patch] BaseTools: Fix Sku inherit issue. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Dec 2017 05:58:44 -0000 The final Pcd value should only be override by its parents. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Feng Bob C Reviewed-by: Liming Gao --- BaseTools/Source/Python/Common/Misc.py | 2 ++ BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 0374be0631..dc214dbfa8 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -2198,10 +2198,12 @@ class SkuClass(): for item in self.SkuData.values(): self.__SkuInherit[item[1]]=item[2] if item[2] else "DEFAULT" return self.__SkuInherit.get(skuname,"DEFAULT") def GetSkuChain(self,sku): + if sku == "DEFAULT": + return ["DEFAULT"] skulist = [sku] nextsku = sku while 1: nextsku = self.GetNextSkuId(nextsku) skulist.append(nextsku) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 929c317957..5e052eca7c 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1319,11 +1319,11 @@ class DscBuildData(PlatformBuildClassObject): FieldName = FieldName.split(']', 1)[1] FieldName = NewFieldName + FieldName while '[' in FieldName: FieldName = FieldName.rsplit('[', 1)[0] CApp = CApp + ' __FLEXIBLE_SIZE(Size, %s, %s, %d);\n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1) - for skuname in self.SkuIdMgr.SkuOverrideOrder(): + for skuname in self.SkuIdMgr.GetSkuChain(SkuName): inherit_OverrideValues = Pcd.SkuOverrideValues[skuname] for FieldList in [inherit_OverrideValues.get(DefaultStoreName)]: if not FieldList: continue for FieldName in FieldList: @@ -1383,11 +1383,11 @@ class DscBuildData(PlatformBuildClassObject): else: if ValueSize > 4: CApp = CApp + ' Pcd->%s = %dULL; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0]) else: CApp = CApp + ' Pcd->%s = %d; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0]) - for skuname in self.SkuIdMgr.SkuOverrideOrder(): + for skuname in self.SkuIdMgr.GetSkuChain(SkuName): inherit_OverrideValues = Pcd.SkuOverrideValues[skuname] for FieldList in [Pcd.DefaultFromDSC,inherit_OverrideValues.get(DefaultStoreName)]: if not FieldList: continue if Pcd.DefaultFromDSC and FieldList == Pcd.DefaultFromDSC: -- 2.14.3.windows.1