From nobody Mon Dec 23 09:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1517976637381651.381464339831; Tue, 6 Feb 2018 20:10:37 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BD8B821E0B9F2; Tue, 6 Feb 2018 20:04:50 -0800 (PST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 C9CD321F0DA5A for ; Tue, 6 Feb 2018 20:04:48 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2018 20:10:31 -0800 Received: from shwdeopenpsi105.ccr.corp.intel.com ([10.239.9.129]) by fmsmga001.fm.intel.com with ESMTP; 06 Feb 2018 20:10:29 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,471,1511856000"; d="scan'208";a="28760784" From: BobCF To: edk2-devel@lists.01.org Date: Wed, 7 Feb 2018 12:10:29 +0800 Message-Id: <20180207041029.12688-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.14.3.windows.1 Subject: [edk2] [Patch] BaseTools: Fixed incorrect Structure Pcd Value. 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: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When structurePCD only has overall value assigned in Dsc under different SKU, the value under default sku is used. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng Cc: Liming Gao Reviewed-by: Liming Gao --- BaseTools/Source/Python/Workspace/DscBuildData.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 8833034a1e..0da3efbb43 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1283,11 +1283,14 @@ class DscBuildData(PlatformBuildClassObject): if str_pcd_dec: str_pcd_obj_str =3D StructurePcd() str_pcd_obj_str.copy(str_pcd_dec) if str_pcd_obj: str_pcd_obj_str.copy(str_pcd_obj) - str_pcd_obj_str.DefaultFromDSC =3D str_pcd_obj_str.Default= Value + if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_D= YNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: + str_pcd_obj_str.DefaultFromDSC =3D {skuname:{defaultst= ore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, st= r_pcd_obj.SkuInfoList[skuname].HiiDefaultValue) for defaultstore in Default= Stores} for skuname in str_pcd_obj.SkuInfoList} + else: + str_pcd_obj_str.DefaultFromDSC =3D {skuname:{defaultst= ore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, st= r_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in DefaultSto= res} for skuname in str_pcd_obj.SkuInfoList} for str_pcd_data in StrPcdSet[str_pcd]: if str_pcd_data[3] in SkuIds: str_pcd_obj_str.AddOverrideValue(str_pcd_data[2], = str(str_pcd_data[6]), 'DEFAULT' if str_pcd_data[3] =3D=3D 'COMMON' else str= _pcd_data[3],'STANDARD' if str_pcd_data[4] =3D=3D 'COMMON' else str_pcd_dat= a[4], self.MetaFile.File,LineNo=3Dstr_pcd_data[5]) S_pcd_set[str_pcd[1], str_pcd[0]] =3D str_pcd_obj_str else: @@ -1301,12 +1304,14 @@ class DscBuildData(PlatformBuildClassObject): str_pcd_obj_str =3D StructurePcd() str_pcd_obj_str.copy(self._DecPcds[Pcd]) str_pcd_obj =3D Pcds.get(Pcd, None) if str_pcd_obj: str_pcd_obj_str.copy(str_pcd_obj) - if str_pcd_obj.DefaultValue: - str_pcd_obj_str.DefaultFromDSC =3D str_pcd_obj= .DefaultValue + if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MOD= EL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: + str_pcd_obj_str.DefaultFromDSC =3D {skuname:{d= efaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaults= tore, str_pcd_obj.SkuInfoList[skuname].HiiDefaultValue) for defaultstore in= DefaultStores} for skuname in str_pcd_obj.SkuInfoList} + else: + str_pcd_obj_str.DefaultFromDSC =3D {skuname:{d= efaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaults= tore, str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in De= faultStores} for skuname in str_pcd_obj.SkuInfoList} S_pcd_set[Pcd] =3D str_pcd_obj_str if S_pcd_set: GlobalData.gStructurePcd[self.Arch] =3D S_pcd_set for stru_pcd in S_pcd_set.values(): for skuid in SkuIds: @@ -1695,29 +1700,30 @@ class DscBuildData(PlatformBuildClassObject): for skuname in self.SkuIdMgr.GetSkuChain(SkuName): inherit_OverrideValues =3D Pcd.SkuOverrideValues[skuname] storeset =3D [DefaultStoreName] if DefaultStoreName =3D=3D= 'STANDARD' else ['STANDARD', DefaultStoreName] for defaultstorenameitem in storeset: CApp =3D CApp + "// SkuName: %s, DefaultStoreName: %s= \n" % (skuname, defaultstorenameitem) - for FieldList in [Pcd.DefaultFromDSC,inherit_OverrideV= alues.get(defaultstorenameitem)]: + pcddefaultvalue =3D Pcd.DefaultFromDSC.get(skuname,{})= .get(defaultstorenameitem, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd= .DefaultValue + for FieldList in [pcddefaultvalue,inherit_OverrideValu= es.get(defaultstorenameitem)]: if not FieldList: continue - if Pcd.DefaultFromDSC and FieldList =3D=3D Pcd.Def= aultFromDSC: + if pcddefaultvalue and FieldList =3D=3D pcddefault= value: IsArray =3D self.IsFieldValueAnArray(FieldList) if IsArray: try: FieldList =3D ValueExpressionEx(FieldL= ist, "VOID*")(True) except BadExpression: EdkLogger.error("Build", FORMAT_INVALI= D, "Invalid value format for %s.%s, from DSC: %s" % (Pcd.TokenSpaceGuidCNa= me, Pcd.TokenCName, FieldList)) Value, ValueSize =3D ParseFieldValue (FieldLis= t) if isinstance(Value, str): - CApp =3D CApp + ' Pcd =3D %s; // From DSC= Default Value %s\n' % (Value, Pcd.DefaultFromDSC) + CApp =3D CApp + ' Pcd =3D %s; // From DSC= Default Value %s\n' % (Value, Pcd.DefaultFromDSC.get(skuname,{}).get(defau= ltstorenameitem, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultVa= lue) elif IsArray: # # Use memcpy() to copy value into field # - CApp =3D CApp + ' Value =3D %s; // Fr= om DSC Default Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.Defa= ultFromDSC) + CApp =3D CApp + ' Value =3D %s; // Fr= om DSC Default Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.Defa= ultFromDSC.get(skuname,{}).get(defaultstorenameitem, Pcd.DefaultValue) if P= cd.DefaultFromDSC else Pcd.DefaultValue) CApp =3D CApp + ' memcpy (Pcd, Value, %d)= ;\n' % (ValueSize) continue for FieldName in FieldList: IsArray =3D self.IsFieldValueAnArray(FieldList= [FieldName][0]) if IsArray: --=20 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel