From nobody Tue Feb 10 08:03:54 2026 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 1524239609986424.4723045587672; Fri, 20 Apr 2018 08:53:29 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 87BC22279CEFF; Fri, 20 Apr 2018 08:52:02 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 A9970226EA5AB for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 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=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@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.49,302,1520924400"; d="scan'208";a="44811595" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:37 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 17/27] BaseTools: DataType - cleanup list constants 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: , 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" remove unused ones convert lists used for membership testing to sets use shared ones not local ones Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 32 ++++++++--------- BaseTools/Source/Python/AutoGen/GenC.py | 36 ++++++++--------= ---- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 4 +-- BaseTools/Source/Python/Common/DataType.py | 29 ++++++---------- BaseTools/Source/Python/Ecc/Configuration.py | 2 +- BaseTools/Source/Python/Ecc/c.py | 2 +- BaseTools/Source/Python/GenFds/FdfParser.py | 2 +- BaseTools/Source/Python/GenFds/Ffs.py | 20 +---------- BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 1 - BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +- BaseTools/Source/Python/Workspace/MetaFileParser.py | 4 +-- BaseTools/Source/Python/build/build.py | 4 +-- 12 files changed, 53 insertions(+), 85 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 60088c87a03b..2f60c17439c0 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -508,8 +508,8 @@ class WorkspaceAutoGen(AutoGen): if (BuildData.Pcds[key].TokenCName, BuildData.Pcds= [key].TokenSpaceGuidCName) =3D=3D SinglePcd: for item in GlobalData.MixedPcd[SinglePcd]: Pcd_Type =3D item[0].split('_')[-1] - if (Pcd_Type =3D=3D BuildData.Pcds[key].Ty= pe) or (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC_EX and BuildData.Pcds[key].Type in= GenC.gDynamicExPcd) or \ - (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC and B= uildData.Pcds[key].Type in GenC.gDynamicPcd): + if (Pcd_Type =3D=3D BuildData.Pcds[key].Ty= pe) or (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC_EX and BuildData.Pcds[key].Type in= PCD_DYNAMIC_EX_TYPE_SET) or \ + (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC and B= uildData.Pcds[key].Type in PCD_DYNAMIC_TYPE_SET): Value =3D BuildData.Pcds[key] Value.TokenCName =3D BuildData.Pcds[ke= y].TokenCName + '_' + Pcd_Type if len(key) =3D=3D 2: @@ -1363,8 +1363,8 @@ class PlatformAutoGen(AutoGen): if (self.Platform.Pcds[key].TokenCName, self.Platform.Pcds= [key].TokenSpaceGuidCName) =3D=3D SinglePcd: for item in GlobalData.MixedPcd[SinglePcd]: Pcd_Type =3D item[0].split('_')[-1] - if (Pcd_Type =3D=3D self.Platform.Pcds[key].Type) = or (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC_EX and self.Platform.Pcds[key].Type in= GenC.gDynamicExPcd) or \ - (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC and self.Plat= form.Pcds[key].Type in GenC.gDynamicPcd): + if (Pcd_Type =3D=3D self.Platform.Pcds[key].Type) = or (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC_EX and self.Platform.Pcds[key].Type in= PCD_DYNAMIC_EX_TYPE_SET) or \ + (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC and self.Plat= form.Pcds[key].Type in PCD_DYNAMIC_TYPE_SET): Value =3D self.Platform.Pcds[key] Value.TokenCName =3D self.Platform.Pcds[key].T= okenCName + '_' + Pcd_Type if len(key) =3D=3D 2: @@ -1404,7 +1404,7 @@ class PlatformAutoGen(AutoGen): # Check the PCD from DSC or not=20 PcdFromModule.IsFromDsc =3D (PcdFromModule.TokenCName, Pcd= FromModule.TokenSpaceGuidCName) in self.Platform.Pcds =20 - if PcdFromModule.Type in GenC.gDynamicPcd or PcdFromModule= .Type in GenC.gDynamicExPcd: + if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET or PcdFromMo= dule.Type in PCD_DYNAMIC_EX_TYPE_SET: if F.Path not in FdfModuleList: # If one of the Source built modules listed in the= DSC is not listed=20 # in FDF modules, and the INF lists a PCD can only= use the PcdsDynamic=20 @@ -1414,7 +1414,7 @@ class PlatformAutoGen(AutoGen): # be included in a flash image in order to be func= tional. These Dynamic=20 # PCD will not be added into the Database unless i= t is used by other=20 # modules that are included in the FDF file. - if PcdFromModule.Type in GenC.gDynamicPcd and \ + if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET and \ PcdFromModule.IsFromBinaryInf =3D=3D False: # Print warning message to let the developer m= ake a determine. continue @@ -1423,7 +1423,7 @@ class PlatformAutoGen(AutoGen): # access method (it is only listed in the DEC file= that declares the=20 # PCD as PcdsDynamicEx), then DO NOT break the bui= ld; DO NOT add the=20 # PCD to the Platform's PCD Database. - if PcdFromModule.Type in GenC.gDynamicExPcd: + if PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET: continue # # If a dynamic PCD used by a PEM module/PEI module & D= XE module, @@ -1465,7 +1465,7 @@ class PlatformAutoGen(AutoGen): PcdFromModule.IsFromBinaryInf =3D True PcdFromModule.IsFromDsc =3D False # Only allow the DynamicEx and Patchable PCD in AsBuil= d INF - if PcdFromModule.Type not in GenC.gDynamicExPcd and Pc= dFromModule.Type not in TAB_PCDS_PATCHABLE_IN_MODULE: + if PcdFromModule.Type not in PCD_DYNAMIC_EX_TYPE_SET a= nd PcdFromModule.Type not in TAB_PCDS_PATCHABLE_IN_MODULE: EdkLogger.error("build", AUTOGEN_ERROR, "PCD setti= ng error", File=3Dself.MetaFile, ExtraData=3D"\n\tExisted %s PCD %s= in:\n\t\t%s\n" @@ -1475,11 +1475,11 @@ class PlatformAutoGen(AutoGen): NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModu= le.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName)) if M.ModuleType in SUP_MODULE_SET_PEI: PcdFromModule.Phase =3D "PEI" - if PcdFromModule not in self._DynaPcdList_ and PcdFrom= Module.Type in GenC.gDynamicExPcd: + if PcdFromModule not in self._DynaPcdList_ and PcdFrom= Module.Type in PCD_DYNAMIC_EX_TYPE_SET: self._DynaPcdList_.append(PcdFromModule) elif PcdFromModule not in self._NonDynaPcdList_ and Pc= dFromModule.Type in TAB_PCDS_PATCHABLE_IN_MODULE: self._NonDynaPcdList_.append(PcdFromModule) - if PcdFromModule in self._DynaPcdList_ and PcdFromModu= le.Phase =3D=3D 'PEI' and PcdFromModule.Type in GenC.gDynamicExPcd: + if PcdFromModule in self._DynaPcdList_ and PcdFromModu= le.Phase =3D=3D 'PEI' and PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET: # Overwrite the phase of any the same PCD existing= , if Phase is PEI. # It is to solve the case that a dynamic PCD used = by a PEM module/PEI=20 # module & DXE module at a same time. @@ -2066,28 +2066,28 @@ class PlatformAutoGen(AutoGen): # for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "PEI": - if Pcd.Type in [TAB_PCDS_DYNAMIC, "DynamicDefault", "D= ynamicVpd", "DynamicHii"]: + if Pcd.Type in PCD_DYNAMIC_TYPE_SET: 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 [TAB_PCDS_DYNAMIC_EX, "DynamicExDefault= ", "DynamicExVpd", "DynamicExHii"]: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: 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 [TAB_PCDS_DYNAMIC, "DynamicDefault", "D= ynamicVpd", "DynamicHii"]: + if Pcd.Type in PCD_DYNAMIC_TYPE_SET: 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 [TAB_PCDS_DYNAMIC_EX, "DynamicExDefault= ", "DynamicExVpd", "DynamicExHii"]: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: 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 @@ -2383,7 +2383,7 @@ class PlatformAutoGen(AutoGen): ToPcd.MaxDatumSize =3D str(len(Value) - 1) =20 # apply default SKU for dynamic PCDS if specified one is not avail= able - if (ToPcd.Type in PCD_DYNAMIC_TYPE_LIST or ToPcd.Type in PCD_DYNAM= IC_EX_TYPE_LIST) \ + if (ToPcd.Type in PCD_DYNAMIC_TYPE_SET or ToPcd.Type in PCD_DYNAMI= C_EX_TYPE_SET) \ and ToPcd.SkuInfoList in [None, {}, '']: if self.Platform.SkuName in self.Platform.SkuIds: SkuName =3D self.Platform.SkuName @@ -3932,7 +3932,7 @@ class ModuleAutoGen(AutoGen): if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE: PatchablePcds +=3D [Pcd] PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCNa= me, TAB_PCDS_PATCHABLE_IN_MODULE)) - elif Pcd.Type in GenC.gDynamicExPcd: + elif Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: if Pcd not in Pcds: Pcds +=3D [Pcd] PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, TAB_PCDS_DYNAMIC_EX)) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 57ff699a968a..86b21de31eee 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -43,12 +43,6 @@ gItemTypeStringDatabase =3D { =20 _NumericDataTypesList =3D ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN= '] =20 -## Dynamic PCD types -gDynamicPcd =3D [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNA= MIC_VPD, TAB_PCDS_DYNAMIC_HII] - -## Dynamic-ex PCD types -gDynamicExPcd =3D [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_P= CDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII] - ## Datum size gDatumSizeStringDatabase =3D {'UINT8':'8','UINT16':'16','UINT32':'32','UIN= T64':'64','BOOLEAN':'BOOLEAN','VOID*':'8'} gDatumSizeStringDatabaseH =3D {'UINT8':'8','UINT16':'16','UINT32':'32','UI= NT64':'64','BOOLEAN':'BOOL','VOID*':'PTR'} @@ -804,7 +798,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH): # Even it is the Library, the PCD is saved in the ModulePcdList PcdList =3D Info.ModulePcdList for Pcd in PcdList: - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: ExTokenCNameList.append(Pcd.TokenCName) PcdExList.append(Pcd) if len(ExTokenCNameList) =3D=3D 0: @@ -850,7 +844,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH): if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData= .MixedPcd[PcdItem]: RealTokenCName =3D PcdItem[0] break - if Pcd.Type in gDynamicExPcd and Pcd.TokenCName =3D=3D TokenCN= ame: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCName =3D= =3D TokenCName: Index =3D Index + 1 if Index =3D=3D 1: AutoGenH.Append('\n#define __PCD_%s_VAL_CMP(GuidPtr) = (' % (RealTokenCName)) @@ -923,7 +917,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): if Pcd.PcdValueFromComm: Pcd.DefaultValue =3D Pcd.PcdValueFromComm =20 - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: TokenNumber =3D int(Pcd.TokenValue, 0) # Add TokenSpaceGuidValue value to PcdTokenName to discriminate th= e DynamicEx PCDs with=20 # different Guids but same TokenCName @@ -939,7 +933,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): # will not be added into the Database unless it is used by oth= er modules that are=20 # included in the FDF file.=20 # In this case, just assign an invalid token number to make it= pass build. - if Pcd.Type in PCD_DYNAMIC_TYPE_LIST: + if Pcd.Type in PCD_DYNAMIC_TYPE_SET: TokenNumber =3D 0 else: EdkLogger.error("build", AUTOGEN_ERROR, @@ -962,14 +956,14 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd= ): SetModeStatusName =3D '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd= .DatumType] + '_S_' + TokenCName if Pcd.DatumType in gDatumSizeStringDataba= seH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH['VOID*'] + '_S_' + To= kenCName GetModeSizeName =3D '_PCD_GET_MODE_SIZE' + '_' + TokenCName =20 - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: if Info.IsLibrary: PcdList =3D Info.LibraryPcdList else: PcdList =3D Info.ModulePcdList PcdExCNameTest =3D 0 for PcdModule in PcdList: - if PcdModule.Type in gDynamicExPcd and Pcd.TokenCName =3D=3D P= cdModule.TokenCName: + if PcdModule.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCNam= e =3D=3D PcdModule.TokenCName: PcdExCNameTest +=3D 1 # get out early once we found > 1... if PcdExCNameTest > 1: @@ -998,10 +992,10 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd= ): else: AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s,= (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdToke= nName)) AutoGenH.Append('#define %s(Value) LibPcdSetEx%sS(&%s, %s= , (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, = PcdTokenName)) - elif Pcd.Type in gDynamicPcd: + elif Pcd.Type in PCD_DYNAMIC_TYPE_SET: PcdCNameTest =3D 0 for PcdModule in Info.LibraryPcdList + Info.ModulePcdList: - if PcdModule.Type in gDynamicPcd and Pcd.TokenCName =3D=3D Pcd= Module.TokenCName: + if PcdModule.Type in PCD_DYNAMIC_TYPE_SET and Pcd.TokenCName = =3D=3D PcdModule.TokenCName: PcdCNameTest +=3D 1 # get out early once we found > 1... if PcdCNameTest > 1: @@ -1227,7 +1221,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): # # Write PCDs # - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: TokenNumber =3D int(Pcd.TokenValue, 0) else: if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber: @@ -1239,7 +1233,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): # will not be added into the Database unless it is used by oth= er modules that are=20 # included in the FDF file.=20 # In this case, just assign an invalid token number to make it= pass build. - if Pcd.Type in PCD_DYNAMIC_TYPE_LIST: + if Pcd.Type in PCD_DYNAMIC_TYPE_SET: TokenNumber =3D 0 else: EdkLogger.error("build", AUTOGEN_ERROR, @@ -1268,7 +1262,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): Type =3D '(VOID *)' Array =3D '[]' PcdItemType =3D Pcd.Type - if PcdItemType in gDynamicExPcd: + if PcdItemType in PCD_DYNAMIC_EX_TYPE_SET: PcdExTokenName =3D '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + Tok= enCName AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumb= er)) =20 @@ -1278,7 +1272,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): PcdList =3D Info.ModulePcdList PcdExCNameTest =3D 0 for PcdModule in PcdList: - if PcdModule.Type in gDynamicExPcd and Pcd.TokenCName =3D=3D P= cdModule.TokenCName: + if PcdModule.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCNam= e =3D=3D PcdModule.TokenCName: PcdExCNameTest +=3D 1 # get out early once we found > 1... if PcdExCNameTest > 1: @@ -1309,13 +1303,13 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, = Pcd): AutoGenH.Append('#define %s(Value) LibPcdSetEx%sS(&%s, %s= , (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, = PcdTokenName)) else: AutoGenH.Append('#define _PCD_TOKEN_%s %dU\n' % (TokenCName, Toke= nNumber)) - if PcdItemType in gDynamicPcd: + if PcdItemType in PCD_DYNAMIC_TYPE_SET: PcdList =3D [] PcdCNameList =3D [] PcdList.extend(Info.LibraryPcdList) PcdList.extend(Info.ModulePcdList) for PcdModule in PcdList: - if PcdModule.Type in gDynamicPcd: + if PcdModule.Type in PCD_DYNAMIC_TYPE_SET: PcdCNameList.append(PcdModule.TokenCName) if PcdCNameList.count(Pcd.TokenCName) > 1: EdkLogger.error("build", AUTOGEN_ERROR, "More than one Dynamic= Pcds [%s] are different Guids but same CName.They need to be changed to Dy= namicEx type to avoid the confliction.\n" % (TokenCName), ExtraData=3D"[%s]= " % str(Info.MetaFile.Path)) @@ -1695,7 +1689,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH): # Collect Token Space GUIDs used by DynamicEc PCDs TokenSpaceList =3D [] for Pcd in Info.ModulePcdList: - if Pcd.Type in gDynamicExPcd and Pcd.TokenSpaceGuidCName not in To= kenSpaceList: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenSpaceGuidCName= not in TokenSpaceList: TokenSpaceList +=3D [Pcd.TokenSpaceGuidCName] =20 SkuMgr =3D Info.Workspace.Platform.SkuIdMgr diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source= /Python/AutoGen/GenPcdDb.py index 4f4a8d856842..afd690bc5b1b 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -1200,7 +1200,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): # TokenSpaceGuidStructure =3D Pcd.TokenSpaceGuidValue TokenSpaceGuid =3D GuidStructureStringToGuidValueName(TokenSpaceGu= idStructure) - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: if TokenSpaceGuid not in GuidList: GuidList +=3D [TokenSpaceGuid] Dict['GUID_STRUCTURE'].append(TokenSpaceGuidStructure) @@ -1568,7 +1568,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): Dict['VARDEF_HEADER'][GeneratedTokenNumber] =3D '' =20 =20 - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: =20 if Phase =3D=3D 'DXE': GeneratedTokenNumber +=3D NumberOfPeiLocalTokens diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index 74ed711abc52..13e9c96dd51b 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -54,8 +54,7 @@ TAB_ARCH_ARM =3D 'ARM' TAB_ARCH_EBC =3D 'EBC' TAB_ARCH_AARCH64 =3D 'AARCH64' =20 -ARCH_LIST =3D [TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_IPF, TAB_ARCH_ARM, TA= B_ARCH_EBC, TAB_ARCH_AARCH64] -ARCH_LIST_FULL =3D [TAB_ARCH_COMMON] + ARCH_LIST +ARCH_SET_FULL =3D {TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_IPF, TAB_ARCH_ARM= , TAB_ARCH_EBC, TAB_ARCH_AARCH64, TAB_ARCH_COMMON} =20 SUP_MODULE_BASE =3D 'BASE' SUP_MODULE_SEC =3D 'SEC' @@ -216,11 +215,8 @@ TAB_PCDS_DYNAMIC_DEFAULT =3D 'DynamicDefault' TAB_PCDS_DYNAMIC_VPD =3D 'DynamicVpd' TAB_PCDS_DYNAMIC_HII =3D 'DynamicHii' =20 -PCD_DYNAMIC_TYPE_LIST =3D [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB= _PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII] -PCD_DYNAMIC_EX_TYPE_LIST =3D [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEF= AULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII] - -## Dynamic-ex PCD types -gDynamicExPcd =3D [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_P= CDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII] +PCD_DYNAMIC_TYPE_SET =3D {TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_= PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII} +PCD_DYNAMIC_EX_TYPE_SET =3D {TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFA= ULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII} =20 TAB_PCDS_FIXED_AT_BUILD_NULL =3D TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD TAB_PCDS_FIXED_AT_BUILD_COMMON =3D TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TA= B_SPLIT + TAB_ARCH_COMMON @@ -273,9 +269,6 @@ TAB_PCDS_DYNAMIC_ARM =3D TAB_PCDS + TAB_PCDS_DYNAMIC + = TAB_SPLIT + TAB_ARCH_ARM TAB_PCDS_DYNAMIC_EBC =3D TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARC= H_EBC TAB_PCDS_DYNAMIC_AARCH64 =3D TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB= _ARCH_AARCH64 =20 -TAB_PCD_DYNAMIC_TYPE_LIST =3D [TAB_PCDS_DYNAMIC_DEFAULT_NULL, TAB_PCDS_DYN= AMIC_VPD_NULL, TAB_PCDS_DYNAMIC_HII_NULL] -TAB_PCD_DYNAMIC_EX_TYPE_LIST =3D [TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL, TAB_PC= DS_DYNAMIC_EX_VPD_NULL, TAB_PCDS_DYNAMIC_EX_HII_NULL] - TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE =3D 'PcdLoadFixAddressPe= iCodePageNumber' TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE_DATA_TYPE =3D 'UINT32' TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE =3D 'PcdLoadFixAddressBo= otTimeCodePageNumber' @@ -284,10 +277,10 @@ TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE= =3D 'PcdLoadFixAddressRuntim TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE_DATA_TYPE =3D 'UINT3= 2' TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE =3D 'PcdLoadFixAddressSm= mCodePageNumber' TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE_DATA_TYPE =3D 'UINT32' -TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_LIST =3D [TAB_PCDS_PATCHABLE_LOAD_FIX_= ADDRESS_PEI_PAGE_SIZE, \ +TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SET =3D {TAB_PCDS_PATCHABLE_LOAD_FIX_= ADDRESS_PEI_PAGE_SIZE, \ TAB_PCDS_PATCHABLE_LOAD_FIX_AD= DRESS_DXE_PAGE_SIZE, \ TAB_PCDS_PATCHABLE_LOAD_FIX_AD= DRESS_RUNTIME_PAGE_SIZE, \ - TAB_PCDS_PATCHABLE_LOAD_FIX_AD= DRESS_SMM_PAGE_SIZE] + TAB_PCDS_PATCHABLE_LOAD_FIX_AD= DRESS_SMM_PAGE_SIZE} =20 ## The mapping dictionary from datum type to its maximum number. MAX_VAL_TYPE =3D {"BOOLEAN":0x01, TAB_UINT8:0xFF, TAB_UINT16:0xFFFF, TAB_U= INT32:0xFFFFFFFF, TAB_UINT64:0xFFFFFFFFFFFFFFFF} @@ -485,10 +478,10 @@ TAB_UNKNOWN =3D 'UNKNOWN' DATABASE_PATH =3D ":memory:" #"BuildDatabase.db" =20 # used by ECC -MODIFIER_LIST =3D ['IN', 'OUT', 'OPTIONAL', 'UNALIGNED', 'EFI_RUNTIMESERVI= CE', 'EFI_BOOTSERVICE', 'EFIAPI'] +MODIFIER_SET =3D {'IN', 'OUT', 'OPTIONAL', 'UNALIGNED', 'EFI_RUNTIMESERVIC= E', 'EFI_BOOTSERVICE', 'EFIAPI'} =20 # Dependency Expression -DEPEX_SUPPORTED_OPCODE =3D ["BEFORE", "AFTER", "PUSH", "AND", "OR", "NOT",= "END", "SOR", "TRUE", "FALSE", '(', ')'] +DEPEX_SUPPORTED_OPCODE_SET =3D {"BEFORE", "AFTER", "PUSH", "AND", "OR", "N= OT", "END", "SOR", "TRUE", "FALSE", '(', ')'} =20 TAB_STATIC_LIBRARY =3D "STATIC-LIBRARY-FILE" TAB_DYNAMIC_LIBRARY =3D "DYNAMIC-LIBRARY-FILE" @@ -520,10 +513,10 @@ PCDS_DYNAMICEX_DEFAULT =3D "PcdsDynamicExDefault" PCDS_DYNAMICEX_VPD =3D "PcdsDynamicExVpd" PCDS_DYNAMICEX_HII =3D "PcdsDynamicExHii" =20 -SECTIONS_HAVE_ITEM_PCD =3D [PCDS_DYNAMIC_DEFAULT.upper(),PCDS_DYNAMIC_VPD.= upper(),PCDS_DYNAMIC_HII.upper(), \ - PCDS_DYNAMICEX_DEFAULT.upper(),PCDS_DYNAMICEX_VP= D.upper(),PCDS_DYNAMICEX_HII.upper()] +SECTIONS_HAVE_ITEM_PCD_SET =3D {PCDS_DYNAMIC_DEFAULT.upper(),PCDS_DYNAMIC_= VPD.upper(),PCDS_DYNAMIC_HII.upper(), \ + PCDS_DYNAMICEX_DEFAULT.upper(),PCDS_DYNAMICE= X_VPD.upper(),PCDS_DYNAMICEX_HII.upper()} # Section allowed to have items after arch -SECTIONS_HAVE_ITEM_AFTER_ARCH =3D [TAB_LIBRARY_CLASSES.upper(), TAB_DEPEX.= upper(), TAB_USER_EXTENSIONS.upper(), +SECTIONS_HAVE_ITEM_AFTER_ARCH_SET =3D {TAB_LIBRARY_CLASSES.upper(), TAB_DE= PEX.upper(), TAB_USER_EXTENSIONS.upper(), PCDS_DYNAMIC_DEFAULT.upper(), PCDS_DYNAMIC_VPD.upper(), PCDS_DYNAMIC_HII.upper(), @@ -531,4 +524,4 @@ SECTIONS_HAVE_ITEM_AFTER_ARCH =3D [TAB_LIBRARY_CLASSES.= upper(), TAB_DEPEX.upper(), PCDS_DYNAMICEX_VPD.upper(), PCDS_DYNAMICEX_HII.upper(), TAB_BUILD_OPTIONS.upper(), - TAB_INCLUDES.upper()] + TAB_INCLUDES.upper()} diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Sourc= e/Python/Ecc/Configuration.py index b523858e1b1f..b5b583be8c4a 100644 --- a/BaseTools/Source/Python/Ecc/Configuration.py +++ b/BaseTools/Source/Python/Ecc/Configuration.py @@ -53,7 +53,7 @@ class Configuration(object): =20 # List customized Modifer here, split with ',' # Defaultly use the definition in class DataType - self.ModifierList =3D MODIFIER_LIST + self.ModifierSet =3D MODIFIER_SET =20 ## General Checking self.GeneralCheckAll =3D 0 diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc= /c.py index 175e2d2e0439..93ee1990ba28 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -830,7 +830,7 @@ def GetDataTypeFromModifier(ModifierStr): MList =3D ModifierStr.split() ReturnType =3D '' for M in MList: - if M in EccGlobalData.gConfig.ModifierList: + if M in EccGlobalData.gConfig.ModifierSet: continue # remove array sufix if M.startswith('[') or M.endswith(']'): diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index e117a3717d42..23c04123af1b 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -3587,7 +3587,7 @@ class FdfParser: raise Warning("expected '.'", self.FileName, self.CurrentLineN= umber) =20 Arch =3D self.__SkippedChars.rstrip(".") - if Arch.upper() not in ARCH_LIST_FULL: + if Arch.upper() not in ARCH_SET_FULL: raise Warning("Unknown Arch '%s'" % Arch, self.FileName, self.= CurrentLineNumber) =20 ModuleType =3D self.__GetModuleType() diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Pytho= n/GenFds/Ffs.py index f15d2330ce58..f6a7f4b007f9 100644 --- a/BaseTools/Source/Python/GenFds/Ffs.py +++ b/BaseTools/Source/Python/GenFds/Ffs.py @@ -1,7 +1,7 @@ ## @file # process FFS generation # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007-2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License @@ -22,24 +22,6 @@ from Common.DataType import * # # class Ffs(FDClassObject): - =20 - # mapping between MODULE type in FDF (from INF) and file type for GenF= fs - ModuleTypeToFileType =3D { - SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE', - SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE', - SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM', - SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE', - SUP_MODULE_DXE_DRIVER : 'EFI_FV_FILETYPE_DRIVER', - SUP_MODULE_DXE_SAL_DRIVER : 'EFI_FV_FILETYPE_DRIVER', - SUP_MODULE_DXE_SMM_DRIVER : 'EFI_FV_FILETYPE_DRIVER', - SUP_MODULE_DXE_RUNTIME_DRIVER: 'EFI_FV_FILETYPE_DRIVER', - SUP_MODULE_UEFI_DRIVER : 'EFI_FV_FILETYPE_DRIVER', - SUP_MODULE_UEFI_APPLICATION : 'EFI_FV_FILETYPE_APPLICATION', - SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE', - SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE', - SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALON= E' - } - =20 # mapping between FILE type in FDF and file type for GenFfs FdfFvFileTypeToFileType =3D { SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE', diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseToo= ls/Source/Python/GenFds/OptRomInfStatement.py index 62d731fb9cca..8f8761b20589 100644 --- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py +++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py @@ -93,7 +93,6 @@ class OptRomInfStatement (FfsInfStatement): # Rule =3D self.__GetRule__() GenFdsGlobalVariable.VerboseLogger( "Packing binaries from inf fil= e : %s" %self.InfFileName) - #FileType =3D Ffs.Ffs.ModuleTypeToFileType[Rule.ModuleType] # # For the rule only has simpleFile # diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index 27ef163eb40c..94f142e8e617 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -901,7 +901,7 @@ class InfBuildData(ModuleBuildClassObject): Depex[Arch, ModuleType] =3D [] DepexList =3D Depex[Arch, ModuleType] for Token in TokenList: - if Token in DEPEX_SUPPORTED_OPCODE: + if Token in DEPEX_SUPPORTED_OPCODE_SET: DepexList.append(Token) elif Token.endswith(".inf"): # module file name ModuleFile =3D os.path.normpath(Token) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index 99f6fcd0dc30..f0c8012f5eef 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -310,7 +310,7 @@ class MetaFileParser(object): if self._SectionName in self.DataType: self._SectionType =3D self.DataType[self._SectionName] # Check if the section name is valid - if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH = and len(ItemList) > 3: + if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH_= SET and len(ItemList) > 3: EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is= not a valid section name" % Item, self.MetaFile, self._LineIndex + 1, se= lf._CurrentLine) elif self._Version >=3D 0x00010005: @@ -328,7 +328,7 @@ class MetaFileParser(object): =20 # S2 may be Platform or ModuleType if len(ItemList) > 2: - if self._SectionName.upper() in SECTIONS_HAVE_ITEM_PCD: + if self._SectionName.upper() in SECTIONS_HAVE_ITEM_PCD_SET: S2 =3D ItemList[2] else: S2 =3D ItemList[2].upper() diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index 29ad0c7228c7..be56aecb79ef 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1616,12 +1616,12 @@ class Build(): if OutputImageFile !=3D '': ModuleIsPatch =3D False for Pcd in Module.ModulePcdList: - if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE and Pc= d.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_LIST: + if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE and Pc= d.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SET: ModuleIsPatch =3D True break if not ModuleIsPatch: for Pcd in Module.LibraryPcdList: - if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE an= d Pcd.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_LIST: + if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE an= d Pcd.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SET: ModuleIsPatch =3D True break =20 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel