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.151; helo=mga17.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 93D4F226847A5 for ; Wed, 25 Apr 2018 01:50:16 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Apr 2018 01:50:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,325,1520924400"; d="scan'208";a="53480908" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 25 Apr 2018 01:50:15 -0700 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 25 Apr 2018 01:50:15 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 25 Apr 2018 01:50:14 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.210]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.240]) with mapi id 14.03.0319.002; Wed, 25 Apr 2018 16:50:12 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH v1 05/27] BaseTools: Autogen - replace string constants with those from DataType Thread-Index: AQHT2L+G39cYMN84b0qUCwaGOiLa16QRM1NQ Date: Wed, 25 Apr 2018 08:50:11 +0000 Message-ID: References: <8584f8145e185f1c1e3e2c1e0d412aff2956441e.1524239027.git.jaben.carsey@intel.com> In-Reply-To: <8584f8145e185f1c1e3e2c1e0d412aff2956441e.1524239027.git.jaben.carsey@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 v1 05/27] BaseTools: Autogen - replace string constants with those from DataType X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2018 08:50:16 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Friday, April 20, 2018 11:51 PM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Zhu, Yonghong Subject: [PATCH v1 05/27] BaseTools: Autogen - replace string constants wit= h those from DataType Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 68 ++++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 6152225943cf..3a2976181ac1 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -259,7 +259,7 @@ class WorkspaceAutoGen(AutoGen): self.BuildDatabase =3D MetaFileDb self.MetaFile =3D ActivePlatform self.WorkspaceDir =3D WorkspaceDir - self.Platform =3D self.BuildDatabase[self.MetaFile, TAB_COMM= ON, Target, Toolchain] + self.Platform =3D self.BuildDatabase[self.MetaFile, TAB_ARCH= _COMMON, Target, Toolchain] GlobalData.gActivePlatform =3D self.Platform self.BuildTarget =3D Target self.ToolChain =3D Toolchain @@ -405,8 +405,8 @@ class WorkspaceAutoGen(AutoGen): Platform =3D self.BuildDatabase[self.MetaFile, Arch, Target, T= oolchain] PlatformPcds =3D Platform.Pcds self._GuidDict =3D Platform._GuidDict - SourcePcdDict =3D {'DynamicEx':set(), 'PatchableInModule':set(= ),'Dynamic':set(),'FixedAtBuild':set()} - BinaryPcdDict =3D {'DynamicEx':set(), 'PatchableInModule':set(= )} + SourcePcdDict =3D {TAB_PCDS_DYNAMIC_EX:set(), TAB_PCDS_PATCHAB= LE_IN_MODULE:set(),TAB_PCDS_DYNAMIC:set(),TAB_PCDS_FIXED_AT_BUILD:set()} + BinaryPcdDict =3D {TAB_PCDS_DYNAMIC_EX:set(),=20 + TAB_PCDS_PATCHABLE_IN_MODULE:set()} SourcePcdDict_Keys =3D SourcePcdDict.keys() BinaryPcdDict_Keys =3D BinaryPcdDict.keys() =20 @@ -430,23 +430,23 @@ class WorkspaceAutoGen(AutoGen): if PcdInPlatform.Type not in [None, ''= ]: BuildData.Pcds[key].Type =3D PcdIn= Platform.Type =20 - if 'DynamicEx' in BuildData.Pcds[key].Type: + if TAB_PCDS_DYNAMIC_EX in BuildData.Pcds[key].Type= : if BuildData.IsBinaryModule: - BinaryPcdDict['DynamicEx'].add((BuildData.= Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + =20 + BinaryPcdDict[TAB_PCDS_DYNAMIC_EX].add((BuildData.Pcds[key].TokenCName + , BuildData.Pcds[key].TokenSpaceGuidCName)) else: - SourcePcdDict['DynamicEx'].add((BuildData.= Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + =20 + SourcePcdDict[TAB_PCDS_DYNAMIC_EX].add((BuildData.Pcds[key].TokenCName + , BuildData.Pcds[key].TokenSpaceGuidCName)) =20 - elif 'PatchableInModule' in BuildData.Pcds[key].Ty= pe: + elif TAB_PCDS_PATCHABLE_IN_MODULE in BuildData.Pcd= s[key].Type: if BuildData.MetaFile.Ext =3D=3D '.inf': if BuildData.IsBinaryModule: - BinaryPcdDict['PatchableInModule'].add= ((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + =20 + BinaryPcdDict[TAB_PCDS_PATCHABLE_IN_MODULE].add((BuildData.Pcds[key].T + okenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) else: - SourcePcdDict['PatchableInModule'].add= ((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + =20 + SourcePcdDict[TAB_PCDS_PATCHABLE_IN_MODULE].add((BuildData.Pcds[key].T + okenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) =20 - elif 'Dynamic' in BuildData.Pcds[key].Type: - SourcePcdDict['Dynamic'].add((BuildData.Pcds[k= ey].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) - elif 'FixedAtBuild' in BuildData.Pcds[key].Type: - SourcePcdDict['FixedAtBuild'].add((BuildData.P= cds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + elif TAB_PCDS_DYNAMIC in BuildData.Pcds[key].Type: + SourcePcdDict[TAB_PCDS_DYNAMIC].add((BuildData= .Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + elif TAB_PCDS_FIXED_AT_BUILD in BuildData.Pcds[key= ].Type: + =20 + SourcePcdDict[TAB_PCDS_FIXED_AT_BUILD].add((BuildData.Pcds[key].TokenC + Name, BuildData.Pcds[key].TokenSpaceGuidCName)) else: pass # @@ -788,7 +788,7 @@ class WorkspaceAutoGen(AutoGen): # Here we just need to get FILE_GUID from INF = file, use 'COMMON' as ARCH attribute. and use=20 # BuildObject from one of AutoGenObjectList is= enough. # - InfObj =3D self.AutoGenObjectList[0].BuildData= base.WorkspaceDb.BuildObject[PathClassObj, TAB_COMMON, self.BuildTarget, se= lf.ToolChain] + InfObj =3D=20 + self.AutoGenObjectList[0].BuildDatabase.WorkspaceDb.BuildObject[PathCl + assObj, TAB_ARCH_COMMON, self.BuildTarget, self.ToolChain] if InfObj.Guid.upper() not in _GuidDict: _GuidDict[InfObj.Guid.upper()] =3D FfsFile else: @@ -869,9 +869,9 @@ class WorkspaceAutoGen(AutoGen): =20 def _CheckPcdDefineAndType(self): PcdTypeList =3D [ - "FixedAtBuild", "PatchableInModule", "FeatureFlag", - "Dynamic", #"DynamicHii", "DynamicVpd", - "DynamicEx", # "DynamicExHii", "DynamicExVpd" + TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCD= S_FEATURE_FLAG, + TAB_PCDS_DYNAMIC, #"DynamicHii", "DynamicVpd", + TAB_PCDS_DYNAMIC_EX, # "DynamicExHii", "DynamicExVpd" ] =20 # This dict store PCDs which are not used by any modules with spec= ified arches @@ -886,10 +886,10 @@ class WorkspaceAutoGen(AutoGen): continue =20 # Try to remove Hii and Vpd suffix - if PcdType.startswith("DynamicEx"): - PcdType =3D "DynamicEx" - elif PcdType.startswith("Dynamic"): - PcdType =3D "Dynamic" + if PcdType.startswith(TAB_PCDS_DYNAMIC_EX): + PcdType =3D TAB_PCDS_DYNAMIC_EX + elif PcdType.startswith(TAB_PCDS_DYNAMIC): + PcdType =3D TAB_PCDS_DYNAMIC =20 for Package in Pa.PackageList: # Key of DEC's Pcds dictionary is PcdCName, TokenSpace= Guid, PcdType @@ -1286,7 +1286,7 @@ class PlatformAutoGen(AutoGen): continue else: DscPcd =3D self.NonDynamicPcdDict[(Pcd.TokenCName,Pcd.= TokenSpaceGuidCName)] - if DscPcd.Type !=3D "FixedAtBuild": + if DscPcd.Type !=3D TAB_PCDS_FIXED_AT_BUILD: continue if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtB= uildPcdsSameValue[key]: =20 LibAuto.ConstPcd[key] =3D FixedAtBuildPcds[key] @@ -20= 66,28 +2066,28 @@ class PlatformAutoGen(AutoGen): # for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "PEI": - if Pcd.Type in ["Dynamic", "DynamicDefault", "DynamicV= pd", "DynamicHii"]: + if Pcd.Type in [TAB_PCDS_DYNAMIC, "DynamicDefault", "D= ynamicVpd", "DynamicHii"]: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "PEI": - if Pcd.Type in ["DynamicEx", "DynamicExDefault", "Dyna= micExVpd", "DynamicExHii"]: + if Pcd.Type in [TAB_PCDS_DYNAMIC_EX, "DynamicExDefault= ", "DynamicExVpd", "DynamicExHii"]: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "DXE": - if Pcd.Type in ["Dynamic", "DynamicDefault", "DynamicV= pd", "DynamicHii"]: + if Pcd.Type in [TAB_PCDS_DYNAMIC, "DynamicDefault", "D= ynamicVpd", "DynamicHii"]: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "DXE": - if Pcd.Type in ["DynamicEx", "DynamicExDefault", "Dyna= micExVpd", "DynamicExHii"]: + if Pcd.Type in [TAB_PCDS_DYNAMIC_EX, "DynamicExDefault= ", "DynamicExVpd", "DynamicExHii"]: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 @@ -2331,7 +2331,7 @@ class Pla= tformAutoGen(AutoGen): ToPcd.Type =3D FromPcd.Type elif (ToPcd.Type not in [None, '']) and (FromPcd.Type not in [= None, ''])\ and (ToPcd.Type !=3D FromPcd.Type) and (ToPcd.Type in From= Pcd.Type): - if ToPcd.Type.strip() =3D=3D "DynamicEx": + if ToPcd.Type.strip() =3D=3D TAB_PCDS_DYNAMIC_EX: ToPcd.Type =3D FromPcd.Type elif ToPcd.Type not in [None, ''] and FromPcd.Type not in [Non= e, ''] \ and ToPcd.Type !=3D FromPcd.Type: @@ -2881,7 +2881,7 @@ class ModuleAutoGen(AutoGen): if self._FixedAtBuildPcds: return self._FixedAtBuildPcds for Pcd in self.ModulePcdList: - if Pcd.Type !=3D "FixedAtBuild": + if Pcd.Type !=3D TAB_PCDS_FIXED_AT_BUILD: continue if Pcd not in self._FixedAtBuildPcds: self._FixedAtBuildPcds.append(Pcd) @@ -3418,7 +3418,7 @@ class ModuleAutoGen(AutoGen): if self._BinaryFileList is None: self._BinaryFileList =3D [] for F in self.Module.Binaries: - if F.Target not in [TAB_COMMON, '*'] and F.Target !=3D sel= f.BuildTarget: + if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target != =3D self.BuildTarget: continue self._BinaryFileList.append(F) self._ApplyBuildRule(F, F.Type) @@ -3931,12 +3931,12 @@ cl= ass ModuleAutoGen(AutoGen): for Pcd in self.ModulePcdList + self.LibraryPcdList: if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE: PatchablePcds +=3D [Pcd] - PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCNa= me, 'PatchableInModule')) + PcdCheckList.append((Pcd.TokenCName,=20 + Pcd.TokenSpaceGuidCName, TAB_PCDS_PATCHABLE_IN_MODULE)) elif Pcd.Type in GenC.gDynamicExPcd: if Pcd not in Pcds: Pcds +=3D [Pcd] - PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, 'DynamicEx')) - PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, 'Dynamic')) + PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, TAB_PCDS_DYNAMIC_EX)) + PcdCheckList.append((Pcd.TokenCName,=20 + Pcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC)) PcdTokenSpaceList.append(Pcd.TokenSpaceGuidCName) GuidList =3D OrderedDict() GuidList.update(self.GuidList) @@ -3964,8 +3964,8 @@ class ModuleAutoGen(AutoGen): if Pkg in Packages: continue for VfrPcd in VfrPcds: - if ((VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, 'Dynam= icEx') in Pkg.Pcds or - (VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, 'Dynam= ic') in Pkg.Pcds): + if ((VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PC= DS_DYNAMIC_EX) in Pkg.Pcds or + (VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PC= DS_DYNAMIC) in Pkg.Pcds): Packages +=3D [Pkg] break =20 -- 2.16.2.windows.1