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.115; helo=mga14.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 716FC22361E49 for ; Wed, 7 Feb 2018 19:01:41 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Feb 2018 19:07:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,476,1511856000"; d="scan'208";a="16843478" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga006.jf.intel.com with ESMTP; 07 Feb 2018 19:07:25 -0800 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 7 Feb 2018 19:07:24 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 7 Feb 2018 19:07:24 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.125]) by shsmsx102.ccr.corp.intel.com ([169.254.2.124]) with mapi id 14.03.0319.002; Thu, 8 Feb 2018 11:07:22 +0800 From: "Gao, Liming" To: "Feng, Bob C" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTools: Fixed incorrect Structure Pcd Value. Thread-Index: AQHTn8mdb6rSZJRAGESrTRpnVjysjaOZ1EoQ Date: Thu, 8 Feb 2018 03:07:22 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1C993F@SHSMSX104.ccr.corp.intel.com> References: <20180207041029.12688-1-bob.c.feng@intel.com> In-Reply-To: <20180207041029.12688-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Thu, 08 Feb 2018 03:01:41 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Feng, Bob C >Sent: Wednesday, February 07, 2018 12:10 PM >To: edk2-devel@lists.01.org >Cc: Feng, Bob C ; Gao, Liming >Subject: [Patch] BaseTools: Fixed incorrect Structure Pcd Value. > >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 >--- > 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.Defaul= tValue >+ if str_pcd_obj.Type in >[self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], >self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: >+ str_pcd_obj_str.DefaultFromDSC =3D {skuname:{defaults= tore: >str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, >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:{defaults= tore: >str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, >str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in >DefaultStores} 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_data[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_ob= j.DefaultValue >+ if str_pcd_obj.Type in >[self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], >self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: >+ str_pcd_obj_str.DefaultFromDSC =3D {skuname:{= defaultstore: >str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, >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:{= defaultstore: >str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, >str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in >DefaultStores} 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_OverrideValues.get(defaultstorenameitem)]: >+ pcddefaultvalue =3D >Pcd.DefaultFromDSC.get(skuname,{}).get(defaultstorenameitem, >Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue >+ for FieldList in >[pcddefaultvalue,inherit_OverrideValues.get(defaultstorenameitem)]: > if not FieldList: > continue >- if Pcd.DefaultFromDSC and FieldList =3D=3D Pcd.De= faultFromDSC: >+ if pcddefaultvalue and FieldList =3D=3D pcddefaul= tvalue: > IsArray =3D self.IsFieldValueAnArray(FieldLis= t) > if IsArray: > try: > FieldList =3D ValueExpressionEx(Field= List, "VOID*")(True) > except BadExpression: > EdkLogger.error("Build", FORMAT_INVAL= ID, "Invalid value >format for %s.%s, from DSC: %s" % > (Pcd.TokenSpaceGuidCN= ame, Pcd.TokenCName, >FieldList)) > Value, ValueSize =3D ParseFieldValue (FieldLi= st) > if isinstance(Value, str): >- CApp =3D CApp + ' Pcd =3D %s; // From DS= C Default Value %s\n' % >(Value, Pcd.DefaultFromDSC) >+ CApp =3D CApp + ' Pcd =3D %s; // From DS= C Default Value %s\n' % >(Value, Pcd.DefaultFromDSC.get(skuname,{}).get(defaultstorenameitem, >Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue) > elif IsArray: > # > # Use memcpy() to copy value into field > # >- CApp =3D CApp + ' Value =3D %s; // F= rom DSC Default >Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC) >+ CApp =3D CApp + ' Value =3D %s; // F= rom DSC Default >Value %s\n' % (self.IntToCString(Value, ValueSize), >Pcd.DefaultFromDSC.get(skuname,{}).get(defaultstorenameitem, >Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue) > CApp =3D CApp + ' memcpy (Pcd, Value, %d= );\n' % (ValueSize) > continue > for FieldName in FieldList: > IsArray =3D self.IsFieldValueAnArray(FieldLis= t[FieldName][0]) > if IsArray: >-- >2.14.3.windows.1