From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 896982035214D for ; Fri, 27 Apr 2018 02:53:50 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Apr 2018 02:53:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,334,1520924400"; d="scan'208";a="219810388" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga005.jf.intel.com with ESMTP; 27 Apr 2018 02:53:49 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 27 Apr 2018 02:53:49 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 27 Apr 2018 02:53:48 -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; Fri, 27 Apr 2018 17:53:45 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH v2 13/27] BaseTools: replace string constants used for module types Thread-Index: AQHT3X/hfefS9CY6x0yA7IzX6htbTqQUYCew Date: Fri, 27 Apr 2018 09:53:45 +0000 Message-ID: References: In-Reply-To: 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 v2 13/27] BaseTools: replace string constants used for module types 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: Fri, 27 Apr 2018 09:53:50 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Friday, April 27, 2018 12:58 AM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Zhu, Yonghong Subject: [PATCH v2 13/27] BaseTools: replace string constants used for modu= le types replace raw strings in the code (note: except UPT) with constants. SUP_MODULE_BASE was 'BASE' SUP_MODULE_SEC was 'SEC' SUP_MODULE_PEI_CORE was 'PEI_CORE' SUP_MODULE_PEIM was 'PEIM' SUP_MODULE_DXE_CORE was 'DXE_CORE' SUP_MODULE_DXE_DRIVER was 'DXE_DRIVER' SUP_MODULE_DXE_RUNTIME_DRIVER was 'DXE_RUNTIME_DRIVER' SUP_MODULE_DXE_SAL_DRIVER was 'DXE_SAL_DRIVER' SUP_MODULE_DXE_SMM_DRIVER was 'DXE_SMM_DRIVER' SUP_MODULE_UEFI_DRIVER was 'UEFI_DRIVER' SUP_MODULE_UEFI_APPLICATION was 'UEFI_APPLICATION' SUP_MODULE_USER_DEFINED was 'USER_DEFINED' SUP_MODULE_SMM_CORE was 'SMM_CORE' SUP_MODULE_MM_STANDALONE was 'MM_STANDALONE' SUP_MODULE_MM_CORE_STANDALONE was 'MM_CORE_STANDALONE' v2 - fix Yonghong's comments. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 20 ++-- BaseTools/Source/Python/AutoGen/BuildEngine.py | 10 +- BaseTools/Source/Python/AutoGen/GenC.py | 120 ++++++++++-----= ----- BaseTools/Source/Python/AutoGen/GenDepex.py | 33 +++--- BaseTools/Source/Python/Common/DataType.py | 2 +- BaseTools/Source/Python/Ecc/Check.py | 6 +- BaseTools/Source/Python/GenFds/CompressSection.py | 3 +- BaseTools/Source/Python/GenFds/DataSection.py | 5 +- BaseTools/Source/Python/GenFds/DepexSection.py | 11 +- BaseTools/Source/Python/GenFds/EfiSection.py | 17 +-- BaseTools/Source/Python/GenFds/FdfParser.py | 16 +-- BaseTools/Source/Python/GenFds/Ffs.py | 41 +++---- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 30 ++--- BaseTools/Source/Python/GenFds/FvImageSection.py | 5 +- BaseTools/Source/Python/GenFds/GuidSection.py | 5 +- BaseTools/Source/Python/GenFds/UiSection.py | 3 +- BaseTools/Source/Python/GenFds/VerSection.py | 3 +- BaseTools/Source/Python/Workspace/InfBuildData.py | 48 ++++---- BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 2 +- BaseTools/Source/Python/build/BuildReport.py | 56 ++++----- BaseTools/Source/Python/build/build.py | 10 +- 21 files changed, 228 insertions(+), 218 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index dc82075c5876..2811952fe1d3 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1430,7 +1430,7 @@ class PlatformAutoGen(AutoGen): # used by DXE module, it should be stored in DXE PCD d= atabase. # The default Phase is DXE # - if M.ModuleType in ["PEIM", "PEI_CORE"]: + if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CO= RE]: PcdFromModule.Phase =3D "PEI" if PcdFromModule not in self._DynaPcdList_: self._DynaPcdList_.append(PcdFromModule) @@ -1472,7 +1472,7 @@ class PlatformAutoGen(AutoGen): # make sure that the "VOID*" kind of datum has MaxDatu= mSize set if PcdFromModule.DatumType =3D=3D TAB_VOID and PcdFrom= Module.MaxDatumSize in [None, '']: NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModu= le.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName)) - if M.ModuleType in ["PEIM", "PEI_CORE"]: + if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CO= RE]: PcdFromModule.Phase =3D "PEI" if PcdFromModule not in self._DynaPcdList_ and PcdFrom= Module.Type in GenC.gDynamicExPcd: self._DynaPcdList_.append(PcdFromModule) @@ -2203,7 +2203,7 @@ class PlatformAutoGen(AutoGen): LibraryModule.LibraryClass.append(LibraryClassObje= ct(LibraryClassName, [ModuleType])) elif LibraryModule.LibraryClass is None \ or len(LibraryModule.LibraryClass) =3D=3D 0 \ - or (ModuleType !=3D 'USER_DEFINED' + or (ModuleType !=3D SUP_MODULE_USER_DEFINED and ModuleType not in LibraryModule.LibraryCl= ass[0].SupModList): # only USER_DEFINED can link against any library i= nstance despite of its SupModList EdkLogger.error("build", OPTION_MISSING, @@ -3969,8 +3969,8 @@ class ModuleAutoGen(AutoGen): break =20 ModuleType =3D self.ModuleType - if ModuleType =3D=3D 'UEFI_DRIVER' and self.DepexGenerated: - ModuleType =3D 'DXE_DRIVER' + if ModuleType =3D=3D SUP_MODULE_UEFI_DRIVER and self.DepexGenerate= d: + ModuleType =3D SUP_MODULE_DXE_DRIVER =20 DriverType =3D '' if self.PcdIsDriver !=3D '': @@ -4047,11 +4047,11 @@ class ModuleAutoGen(AutoGen): AsBuiltInfDict['binary_item'] +=3D ['BIN|' + File] if self.DepexGenerated: self.OutputFile.add(self.Name + '.depex') - if self.ModuleType in ['PEIM']: + if self.ModuleType in [SUP_MODULE_PEIM]: AsBuiltInfDict['binary_item'] +=3D ['PEI_DEPEX|' + self.Na= me + '.depex'] - if self.ModuleType in ['DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DX= E_SAL_DRIVER', 'UEFI_DRIVER']: + if self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_R= UNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]: AsBuiltInfDict['binary_item'] +=3D ['DXE_DEPEX|' + self.Na= me + '.depex'] - if self.ModuleType in ['DXE_SMM_DRIVER']: + if self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]: AsBuiltInfDict['binary_item'] +=3D ['SMM_DEPEX|' + self.Na= me + '.depex'] =20 Bin =3D self._GenOffsetBin() @@ -4377,8 +4377,8 @@ class ModuleAutoGen(AutoGen): return =20 for ModuleType in self.DepexList: - # Ignore empty [depex] section or [depex] section for "USER_DE= FINED" module - if len(self.DepexList[ModuleType]) =3D=3D 0 or ModuleType =3D= =3D "USER_DEFINED": + # Ignore empty [depex] section or [depex] section for SUP_MODU= LE_USER_DEFINED module + if len(self.DepexList[ModuleType]) =3D=3D 0 or ModuleType =3D= =3D SUP_MODULE_USER_DEFINED: continue =20 Dpx =3D GenDepex.DependencyExpression(self.DepexList[ModuleTyp= e], ModuleType, True) diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Sou= rce/Python/AutoGen/BuildEngine.py index bbd1a4d5b257..a4f39b0b2925 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -612,11 +612,11 @@ if __name__ =3D=3D '__main__': EdkLogger.Initialize() if len(sys.argv) > 1: Br =3D BuildRule(sys.argv[1]) - print str(Br[".c", "DXE_DRIVER", "IA32", "MSFT"][1]) + print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1]) print - print str(Br[".c", "DXE_DRIVER", "IA32", "INTEL"][1]) + print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1]) print - print str(Br[".c", "DXE_DRIVER", "IA32", "GCC"][1]) + print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1]) print print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) print @@ -624,7 +624,7 @@ if __name__ =3D=3D '__main__': print print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) print - print str(Br[".s", "SEC", "IPF", "COMMON"][1]) + print str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1]) print - print str(Br[".s", "SEC"][1]) + print str(Br[".s", SUP_MODULE_SEC][1]) =20 diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 73d7699ad01b..26f6aca0e63f 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -649,7 +649,7 @@ ${END} ] =20 gLibraryStructorPrototype =3D { -'BASE' : TemplateString("""${BEGIN} +SUP_MODULE_BASE : TemplateString("""${BEGIN} RETURN_STATUS EFIAPI ${Function} ( @@ -686,7 +686,7 @@ ${Function} ( } =20 gLibraryStructorCall =3D { -'BASE' : TemplateString("""${BEGIN} +SUP_MODULE_BASE : TemplateString("""${BEGIN} Status =3D ${Function} (); ASSERT_EFI_ERROR (Status);${END} """), @@ -709,7 +709,7 @@ gLibraryStructorCall =3D { =20 ## Library Constructor and Destructor Templates gLibraryString =3D { -'BASE' : TemplateString(""" +SUP_MODULE_BASE : TemplateString(""" ${BEGIN}${FunctionPrototype}${END} =20 VOID @@ -772,21 +772,21 @@ ${FunctionCall}${END} gBasicHeaderFile =3D "Base.h" =20 gModuleTypeHeaderFile =3D { - "BASE" : [gBasicHeaderFile], - "SEC" : ["PiPei.h", "Library/DebugLib.h"], - "PEI_CORE" : ["PiPei.h", "Library/DebugLib.h", "Library/Pei= CoreEntryPoint.h"], - "PEIM" : ["PiPei.h", "Library/DebugLib.h", "Library/Pei= mEntryPoint.h"], - "DXE_CORE" : ["PiDxe.h", "Library/DebugLib.h", "Library/Dxe= CoreEntryPoint.h"], - "DXE_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], - "DXE_SMM_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], - "DXE_RUNTIME_DRIVER": ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], - "DXE_SAL_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], - "UEFI_DRIVER" : ["Uefi.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], - "UEFI_APPLICATION" : ["Uefi.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntr= yPoint.h"], - "SMM_CORE" : ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiDriverEntryPoint.h"], - "MM_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/SmmDriverStandaloneEntryPoint.h"], - "MM_CORE_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/SmmCoreStandaloneEntryPoint.h"], - "USER_DEFINED" : [gBasicHeaderFile] + SUP_MODULE_BASE : [gBasicHeaderFile], + SUP_MODULE_SEC : ["PiPei.h", "Library/DebugLib.h"], + SUP_MODULE_PEI_CORE : ["PiPei.h", "Library/DebugLib.h", "Li= brary/PeiCoreEntryPoint.h"], + SUP_MODULE_PEIM : ["PiPei.h", "Library/DebugLib.h", "Li= brary/PeimEntryPoint.h"], + SUP_MODULE_DXE_CORE : ["PiDxe.h", "Library/DebugLib.h", "Li= brary/DxeCoreEntryPoint.h"], + SUP_MODULE_DXE_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriver= EntryPoint.h"], + SUP_MODULE_DXE_SMM_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriver= EntryPoint.h"], + SUP_MODULE_DXE_RUNTIME_DRIVER: ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriver= EntryPoint.h"], + SUP_MODULE_DXE_SAL_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriver= EntryPoint.h"], + SUP_MODULE_UEFI_DRIVER : ["Uefi.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriver= EntryPoint.h"], + SUP_MODULE_UEFI_APPLICATION : ["Uefi.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplic= ationEntryPoint.h"], + SUP_MODULE_SMM_CORE : ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiDriverEntryPoint.h"], + SUP_MODULE_MM_STANDALONE : ["PiSmm.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/SmmDriverStandaloneEntryPoint.h"], + SUP_MODULE_MM_CORE_STANDALONE : ["PiSmm.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/SmmCoreStandaloneEntryPoint.h"], + SUP_MODULE_USER_DEFINED : [gBasicHeaderFile] } =20 ## Autogen internal worker macro to define DynamicEx PCD name includes bot= h the TokenSpaceGuidName=20 @@ -1406,17 +1406,17 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Au= toGenH): if len(Lib.ConstructorList) <=3D 0: continue Dict =3D {'Function':Lib.ConstructorList} - if Lib.ModuleType in ['BASE', 'SEC']: - ConstructorPrototypeString.Append(gLibraryStructorPrototype['B= ASE'].Replace(Dict)) - ConstructorCallingString.Append(gLibraryStructorCall['BASE'].R= eplace(Dict)) - elif Lib.ModuleType in ['PEI_CORE','PEIM']: + if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: + ConstructorPrototypeString.Append(gLibraryStructorPrototype[SU= P_MODULE_BASE].Replace(Dict)) + ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODUL= E_BASE].Replace(Dict)) + elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: ConstructorPrototypeString.Append(gLibraryStructorPrototype['P= EI'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Re= place(Dict)) - elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','= DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLI= CATION','SMM_CORE']: + elif Lib.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,= SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, + SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_= DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]: ConstructorPrototypeString.Append(gLibraryStructorPrototype['D= XE'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Re= place(Dict)) - elif Lib.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']: + elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_COR= E_STANDALONE]: ConstructorPrototypeString.Append(gLibraryStructorPrototype['M= M'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall['MM'].Rep= lace(Dict)) =20 @@ -1437,14 +1437,14 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Au= toGenH): if Info.IsLibrary: AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) else: - if Info.ModuleType in ['BASE', 'SEC']: - AutoGenC.Append(gLibraryString['BASE'].Replace(Dict)) - elif Info.ModuleType in ['PEI_CORE','PEIM']: + if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: + AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict)) + elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) - elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER',= 'DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPL= ICATION','SMM_CORE']: + elif Info.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER= ,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, + SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI= _DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]: AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) - elif Info.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']: + elif Info.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CO= RE_STANDALONE]: AutoGenC.Append(gLibraryString['MM'].Replace(Dict)) =20 ## Create code for library destructor @@ -1468,17 +1468,17 @@ def CreateLibraryDestructorCode(Info, AutoGenC, Aut= oGenH): if len(Lib.DestructorList) <=3D 0: continue Dict =3D {'Function':Lib.DestructorList} - if Lib.ModuleType in ['BASE', 'SEC']: - DestructorPrototypeString.Append(gLibraryStructorPrototype['BA= SE'].Replace(Dict)) - DestructorCallingString.Append(gLibraryStructorCall['BASE'].Re= place(Dict)) - elif Lib.ModuleType in ['PEI_CORE','PEIM']: + if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: + DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP= _MODULE_BASE].Replace(Dict)) + DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE= _BASE].Replace(Dict)) + elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: DestructorPrototypeString.Append(gLibraryStructorPrototype['PE= I'].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall['PEI'].Rep= lace(Dict)) - elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','= DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLI= CATION', 'SMM_CORE']: + elif Lib.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,= SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, + SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_= DRIVER,SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]: DestructorPrototypeString.Append(gLibraryStructorPrototype['DX= E'].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall['DXE'].Rep= lace(Dict)) - elif Lib.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']: + elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_COR= E_STANDALONE]: DestructorPrototypeString.Append(gLibraryStructorPrototype['MM= '].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall['MM'].Repl= ace(Dict)) =20 @@ -1499,14 +1499,14 @@ def CreateLibraryDestructorCode(Info, AutoGenC, Aut= oGenH): if Info.IsLibrary: AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) else: - if Info.ModuleType in ['BASE', 'SEC']: - AutoGenC.Append(gLibraryString['BASE'].Replace(Dict)) - elif Info.ModuleType in ['PEI_CORE','PEIM']: + if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: + AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict)) + elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) - elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER',= 'DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPL= ICATION','SMM_CORE']: + elif Info.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER= ,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, + SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI= _DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]: AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) - elif Info.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']: + elif Info.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CO= RE_STANDALONE]: AutoGenC.Append(gLibraryString['MM'].Replace(Dict)) =20 =20 @@ -1517,7 +1517,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoG= enH): # @param AutoGenH The TemplateString object for header file # def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']: + if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_= MODULE_SEC]: return # # Module Entry Points @@ -1537,7 +1537,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): 'UefiSpecVersion': UefiSpecVersion + 'U' } =20 - if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE', 'MM_CORE_ST= ANDALONE']: + if Info.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_M= ODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE]: if Info.SourceFileList: if NumEntryPoints !=3D 1: EdkLogger.error( @@ -1547,43 +1547,43 @@ def CreateModuleEntryPointCode(Info, AutoGenC, Auto= GenH): File=3Dstr(Info), ExtraData=3D ", ".join(Info.Module.ModuleEntryPointList) ) - if Info.ModuleType =3D=3D 'PEI_CORE': + if Info.ModuleType =3D=3D SUP_MODULE_PEI_CORE: AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict)) AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'DXE_CORE': + elif Info.ModuleType =3D=3D SUP_MODULE_DXE_CORE: AutoGenC.Append(gDxeCoreEntryPointString.Replace(Dict)) AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'SMM_CORE': + elif Info.ModuleType =3D=3D SUP_MODULE_SMM_CORE: AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict)) AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'MM_CORE_STANDALONE': + elif Info.ModuleType =3D=3D SUP_MODULE_MM_CORE_STANDALONE: AutoGenC.Append(gMmCoreStandaloneEntryPointString.Replace(Dict)) AutoGenH.Append(gMmCoreStandaloneEntryPointPrototype.Replace(Dict)= ) - elif Info.ModuleType =3D=3D 'PEIM': + elif Info.ModuleType =3D=3D SUP_MODULE_PEIM: if NumEntryPoints < 2: AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(= Dict)) else: AutoGenC.Append(gPeimEntryPointString[2].Replace(Dict)) AutoGenH.Append(gPeimEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType in ['DXE_RUNTIME_DRIVER','DXE_DRIVER','DXE_SAL_DR= IVER','UEFI_DRIVER']: + elif Info.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER,SUP_MODULE_DXE_= DRIVER,SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER]: if NumEntryPoints < 2: AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Re= place(Dict)) else: AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict)) AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'DXE_SMM_DRIVER': + elif Info.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER: if NumEntryPoints =3D=3D 0: AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict)) else: AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict)) AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'MM_STANDALONE': + elif Info.ModuleType =3D=3D SUP_MODULE_MM_STANDALONE: if NumEntryPoints < 2: AutoGenC.Append(gMmStandaloneEntryPointString[NumEntryPoints].= Replace(Dict)) else: AutoGenC.Append(gMmStandaloneEntryPointString[2].Replace(Dict)= ) AutoGenH.Append(gMmStandaloneEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'UEFI_APPLICATION': + elif Info.ModuleType =3D=3D SUP_MODULE_UEFI_APPLICATION: if NumEntryPoints < 2: AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoint= s].Replace(Dict)) else: @@ -1597,7 +1597,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): # @param AutoGenH The TemplateString object for header file # def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']: + if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_= MODULE_SEC]: return # # Unload Image Handlers @@ -1617,7 +1617,7 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoG= enH): # @param AutoGenH The TemplateString object for header file # def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.ModuleType in ["USER_DEFINED", "BASE"]: + if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: GuidType =3D "GUID" else: GuidType =3D "EFI_GUID" @@ -1641,7 +1641,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH= ): # @param AutoGenH The TemplateString object for header file # def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.ModuleType in ["USER_DEFINED", "BASE"]: + if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: GuidType =3D "GUID" else: GuidType =3D "EFI_GUID" @@ -1665,7 +1665,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, Auto= GenH): # @param AutoGenH The TemplateString object for header file # def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.ModuleType in ["USER_DEFINED", "BASE"]: + if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: GuidType =3D "GUID" else: GuidType =3D "EFI_GUID" @@ -1702,7 +1702,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH): # Add extern declarations to AutoGen.h if one or more Token Space GUID= s were found if TokenSpaceList: AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in = this module\n\n") - if Info.ModuleType in ["USER_DEFINED", "BASE"]: + if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: GuidType =3D "GUID" else: GuidType =3D "EFI_GUID" =20 diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py b/BaseTools/Source= /Python/AutoGen/GenDepex.py index 9acea8f6bfed..100f1250b31f 100644 --- a/BaseTools/Source/Python/AutoGen/GenDepex.py +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py @@ -24,26 +24,27 @@ from Common.Misc import SaveFileOnChange from Common.Misc import GuidStructureStringToGuidString from Common import EdkLogger as EdkLogger from Common.BuildVersion import gBUILD_VERSION +from Common.DataType import * =20 ## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END" gStartClosePattern =3D re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*"= , re.S) =20 ## Mapping between module type and EFI phase gType2Phase =3D { - "BASE" : None, - "SEC" : "PEI", - "PEI_CORE" : "PEI", - "PEIM" : "PEI", - "DXE_CORE" : "DXE", - "DXE_DRIVER" : "DXE", - "DXE_SMM_DRIVER" : "DXE", - "DXE_RUNTIME_DRIVER": "DXE", - "DXE_SAL_DRIVER" : "DXE", - "UEFI_DRIVER" : "DXE", - "UEFI_APPLICATION" : "DXE", - "SMM_CORE" : "DXE", - "MM_STANDALONE" : "MM", - "MM_CORE_STANDALONE" : "MM", + SUP_MODULE_BASE : None, + SUP_MODULE_SEC : "PEI", + SUP_MODULE_PEI_CORE : "PEI", + SUP_MODULE_PEIM : "PEI", + SUP_MODULE_DXE_CORE : "DXE", + SUP_MODULE_DXE_DRIVER : "DXE", + SUP_MODULE_DXE_SMM_DRIVER : "DXE", + SUP_MODULE_DXE_RUNTIME_DRIVER: "DXE", + SUP_MODULE_DXE_SAL_DRIVER : "DXE", + SUP_MODULE_UEFI_DRIVER : "DXE", + SUP_MODULE_UEFI_APPLICATION : "DXE", + SUP_MODULE_SMM_CORE : "DXE", + SUP_MODULE_MM_STANDALONE : "MM", + SUP_MODULE_MM_CORE_STANDALONE : "MM", } =20 ## Convert dependency expression string into EFI internal representation @@ -299,12 +300,12 @@ class DependencyExpression: NewOperand.append(Token) =20 # don't generate depex if only TRUE operand left - if self.ModuleType =3D=3D 'PEIM' and len(NewOperand) =3D=3D 1 and = NewOperand[0] =3D=3D 'TRUE': + if self.ModuleType =3D=3D SUP_MODULE_PEIM and len(NewOperand) =3D= =3D 1 and NewOperand[0] =3D=3D 'TRUE': self.PostfixNotation =3D [] return =20 # don't generate depex if all operands are architecture protocols - if self.ModuleType in ['UEFI_DRIVER', 'DXE_DRIVER', 'DXE_RUNTIME_D= RIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER', 'MM_STANDALONE'] and \ + if self.ModuleType in [SUP_MODULE_UEFI_DRIVER, SUP_MODULE_DXE_DRIV= ER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DX= E_SMM_DRIVER, SUP_MODULE_MM_STANDALONE] and \ Op =3D=3D 'AND' and \ self.ArchProtocols =3D=3D set([GuidStructureStringToGuidString(= Guid) for Guid in AllOperand]): self.PostfixNotation =3D [] diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index 20f31ce4b72f..ea2eafb94477 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -84,7 +84,7 @@ SUP_MODULE_LIST_STRING =3D TAB_VALUE_SPLIT.join(SUP_MODUL= E_LIST) =20 EDK_COMPONENT_TYPE_LIBRARY =3D 'LIBRARY' EDK_COMPONENT_TYPE_SECUARITY_CORE =3D 'SECUARITY_CORE' -EDK_COMPONENT_TYPE_PEI_CORE =3D 'PEI_CORE' +EDK_COMPONENT_TYPE_PEI_CORE =3D SUP_MODULE_PEI_CORE EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER =3D 'COMBINED_PEIM_DRIVER' EDK_COMPONENT_TYPE_PIC_PEIM =3D 'PIC_PEIM' EDK_COMPONENT_TYPE_RELOCATABLE_PEIM =3D 'RELOCATABLE_PEIM' diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python= /Ecc/Check.py index 27783e617b92..089d42a6d181 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -1,7 +1,7 @@ ## @file # This file is used to define checkpoints used by ECC tool # -# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License # which accompanies this distribution. The full text of the license may b= e found at @@ -744,7 +744,7 @@ class Check(object): if Item not in LibraryClasses[List[0]]: LibraryClasses[List[0]].append(Item) =20 - if Record[2] !=3D 'BASE' and Record[2] not in SupModType: + if Record[2] !=3D DT.SUP_MODULE_BASE and Record[2] not in = SupModType: EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FIL= E_CHECK_LIBRARY_INSTANCE_2, OtherMsg=3D"The Library Class '%s' does not spe= cify its supported module types" % (List[0]), BelongsToTable=3D'Inf', Belon= gsToItem=3DRecord[0]) =20 SqlCommand =3D """select A.ID, A.Value1, B.Value3 from Inf as = A left join Inf as B @@ -763,7 +763,7 @@ class Check(object): =20 for Record in RecordSet: if Record[1] in LibraryClasses: - if Record[2] not in LibraryClasses[Record[1]] and 'BAS= E' not in RecordDict[Record[1]]: + if Record[2] not in LibraryClasses[Record[1]] and DT.S= UP_MODULE_BASE not in RecordDict[Record[1]]: if not EccGlobalData.gException.IsException(ERROR_= META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]): EccGlobalData.gDb.TblReport.Insert(ERROR_META_= DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg=3D"The type of Library Class [= %s] defined in Inf file does not match the type of the module" % (Record[1]= ), BelongsToTable=3D'Inf', BelongsToItem=3DRecord[0]) else: diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/= Source/Python/GenFds/CompressSection.py index 08ab48669f45..4ae14f27b3e1 100644 --- a/BaseTools/Source/Python/GenFds/CompressSection.py +++ b/BaseTools/Source/Python/GenFds/CompressSection.py @@ -21,6 +21,7 @@ import subprocess import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import CompressSectionClassObject +from Common.DataType import * =20 ## generate compress section # @@ -82,7 +83,7 @@ class CompressSection (CompressSectionClassObject) : OutputFile =3D OutputPath + \ os.sep + \ ModuleName + \ - 'SEC' + \ + SUP_MODULE_SEC + \ SecNum + \ Ffs.SectionSuffix['COMPRESS'] OutputFile =3D os.path.normpath(OutputFile) diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Sour= ce/Python/GenFds/DataSection.py index 40e345eee77e..99d7392aaab3 100644 --- a/BaseTools/Source/Python/GenFds/DataSection.py +++ b/BaseTools/Source/Python/GenFds/DataSection.py @@ -1,7 +1,7 @@ ## @file # process data section generation # -# Copyright (c) 2007 - 2017, 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 @@ -23,6 +23,7 @@ import Common.LongFilePathOs as os from CommonDataClass.FdfClass import DataSectionClassObject from Common.Misc import PeImageClass from Common.LongFilePathSupport import CopyLongFilePath +from Common.DataType import * =20 ## generate data section # @@ -119,7 +120,7 @@ class DataSection (DataSectionClassObject): ) self.SectFileName =3D TeFile =20 - OutputFile =3D os.path.join (OutputPath, ModuleName + 'SEC' + SecN= um + Ffs.SectionSuffix.get(self.SecType)) + OutputFile =3D os.path.join (OutputPath, ModuleName + SUP_MODULE_S= EC + SecNum + Ffs.SectionSuffix.get(self.SecType)) OutputFile =3D os.path.normpath(OutputFile) GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileNam= e], Section.Section.SectionType.get(self.SecType), IsMakefile =3D IsMakefil= e) FileList =3D [OutputFile] diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Sou= rce/Python/GenFds/DepexSection.py index 4ed1aa779292..d04160e890f1 100644 --- a/BaseTools/Source/Python/GenFds/DepexSection.py +++ b/BaseTools/Source/Python/GenFds/DepexSection.py @@ -25,6 +25,7 @@ from AutoGen.GenDepex import DependencyExpression from Common import EdkLogger from Common.BuildToolError import * from Common.Misc import PathClass +from Common.DataType import * =20 ## generate data section # @@ -94,24 +95,24 @@ class DepexSection (DepexSectionClassObject): self.ExpressionProcessed =3D True =20 if self.DepexType =3D=3D 'PEI_DEPEX_EXP': - ModuleType =3D 'PEIM' + ModuleType =3D SUP_MODULE_PEIM SecType =3D 'PEI_DEPEX' elif self.DepexType =3D=3D 'DXE_DEPEX_EXP': - ModuleType =3D 'DXE_DRIVER' + ModuleType =3D SUP_MODULE_DXE_DRIVER SecType =3D 'DXE_DEPEX' elif self.DepexType =3D=3D 'SMM_DEPEX_EXP': - ModuleType =3D 'DXE_SMM_DRIVER' + ModuleType =3D SUP_MODULE_DXE_SMM_DRIVER SecType =3D 'SMM_DEPEX' else: EdkLogger.error("GenFds", FORMAT_INVALID, "Depex type %s is not valid for module %s" % (= self.DepexType, ModuleName)) =20 - InputFile =3D os.path.join (OutputPath, ModuleName + 'SEC' + SecNu= m + '.depex') + InputFile =3D os.path.join (OutputPath, ModuleName + SUP_MODULE_SE= C + SecNum + '.depex') InputFile =3D os.path.normpath(InputFile) Depex =3D DependencyExpression(self.Expression, ModuleType) Depex.Generate(InputFile) =20 - OutputFile =3D os.path.join (OutputPath, ModuleName + 'SEC' + SecN= um + '.dpx') + OutputFile =3D os.path.join (OutputPath, ModuleName + SUP_MODULE_S= EC + SecNum + '.dpx') OutputFile =3D os.path.normpath(OutputFile) =20 GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Sect= ion.Section.SectionType.get (SecType), IsMakefile=3DIsMakefile) diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Sourc= e/Python/GenFds/EfiSection.py index 5bb1ae6f664c..1be23b4bf7fd 100644 --- a/BaseTools/Source/Python/GenFds/EfiSection.py +++ b/BaseTools/Source/Python/GenFds/EfiSection.py @@ -27,6 +27,7 @@ from Common.BuildToolError import * from Common.Misc import PeImageClass from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import CopyLongFilePath +from Common.DataType import * =20 ## generate rule section # @@ -66,7 +67,7 @@ class EfiSection (EfiSectionClassObject): StringData =3D FfsInf.__ExtendMacro__(self.StringData) ModuleNameStr =3D FfsInf.__ExtendMacro__('$(MODULE_NAME)') NoStrip =3D True - if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and Sectio= nType in ('TE', 'PE32'): + if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, = SUP_MODULE_PEIM) and SectionType in ('TE', 'PE32'): if FfsInf.KeepReloc is not None: NoStrip =3D FfsInf.KeepReloc elif FfsInf.KeepRelocFromRule is not None: @@ -122,7 +123,7 @@ class EfiSection (EfiSectionClassObject): BuildNumTuple =3D tuple() =20 Num =3D SecNum - OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_VERSION', #Ui=3DStringData, Ver=3DBuildNum, @@ -133,7 +134,7 @@ class EfiSection (EfiSectionClassObject): for File in FileList: Index =3D Index + 1 Num =3D '%s.%d' %(SecNum , Index) - OutputFile =3D os.path.join(OutputPath, ModuleName + '= SEC' + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join(OutputPath, ModuleName + S= UP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) f =3D open(File, 'r') VerString =3D f.read() f.close() @@ -162,7 +163,7 @@ class EfiSection (EfiSectionClassObject): else: EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s = miss Version Section value" %InfFileName) Num =3D SecNum - OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_VERSION', #Ui=3DVerString, Ver=3DBuildNum, @@ -183,7 +184,7 @@ class EfiSection (EfiSectionClassObject): Num =3D SecNum if IsMakefile and StringData =3D=3D ModuleNameStr: StringData =3D "$(MODULE_NAME)" - OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_USER_INTERFACE', Ui=3DStringData, IsMa= kefile=3DIsMakefile) OutputFileList.append(OutputFile) @@ -192,7 +193,7 @@ class EfiSection (EfiSectionClassObject): for File in FileList: Index =3D Index + 1 Num =3D '%s.%d' %(SecNum , Index) - OutputFile =3D os.path.join(OutputPath, ModuleName + '= SEC' + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join(OutputPath, ModuleName + S= UP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) f =3D open(File, 'r') UiString =3D f.read() f.close() @@ -216,7 +217,7 @@ class EfiSection (EfiSectionClassObject): Num =3D SecNum if IsMakefile and StringData =3D=3D ModuleNameStr: StringData =3D "$(MODULE_NAME)" - OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_USER_INTERFACE', Ui=3DStringData, IsMa= kefile=3DIsMakefile) OutputFileList.append(OutputFile) @@ -237,7 +238,7 @@ class EfiSection (EfiSectionClassObject): """ Copy Map file to FFS output path """ Index =3D Index + 1 Num =3D '%s.%d' %(SecNum , Index) - OutputFile =3D os.path.join( OutputPath, ModuleName + = 'SEC' + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) File =3D GenFdsGlobalVariable.MacroExtend(File, Dict) =20 #Get PE Section alignment when align is set to AUTO diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 25755a9778f2..db8947e4b453 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -2626,7 +2626,7 @@ class FdfParser: # @staticmethod def __FileCouldHaveRelocFlag (FileType): - if FileType in ('SEC', 'PEI_CORE', 'PEIM', 'PEI_DXE_COMBO'): + if FileType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PE= IM, 'PEI_DXE_COMBO'): return True else: return False @@ -3626,12 +3626,12 @@ class FdfParser: =20 if not self.__GetNextWord(): raise Warning("expected Module type", self.FileName, self.Curr= entLineNumber) - if self.__Token.upper() not in ("SEC", "PEI_CORE", "PEIM", "DXE_CO= RE", \ - "DXE_DRIVER", "DXE_SAL_DRIVER", \ - "DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \ - "UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFI= NED", "DEFAULT", "BASE", \ + if self.__Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PEI_COR= E, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, \ + SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRI= VER, \ + SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUN= TIME_DRIVER, \ + SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLI= CATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \ "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC= _PEIM", "RELOCATABLE_PEIM", \ - "PE32_PEIM", "BS_DRIVER", "RT_DRIV= ER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE", "MM_STANDALON= E", "MM_CORE_STANDALONE"): + "PE32_PEIM", "BS_DRIVER", "RT_DRIV= ER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_= MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): raise Warning("Unknown Module type '%s'" % self.__Token, self.= FileName, self.CurrentLineNumber) return self.__Token =20 @@ -3673,8 +3673,8 @@ class FdfParser: raise Warning("expected FFS type", self.FileName, self.Current= LineNumber) =20 Type =3D self.__Token.strip().upper() - if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\ - "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLI= CATION", "FV_IMAGE", "SMM", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALON= E"): + if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_= CORE, SUP_MODULE_PEIM,\ + "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_COR= E, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STA= NDALONE, SUP_MODULE_MM_CORE_STANDALONE): raise Warning("Unknown FV type '%s'" % self.__Token, self.File= Name, self.CurrentLineNumber) =20 if not self.__IsToken("=3D"): diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Pytho= n/GenFds/Ffs.py index a4178121118b..fc760ae8beda 100644 --- a/BaseTools/Source/Python/GenFds/Ffs.py +++ b/BaseTools/Source/Python/GenFds/Ffs.py @@ -16,6 +16,7 @@ # Import Modules # from CommonDataClass.FdfClass import FDClassObject +from Common.DataType import * =20 ## generate FFS # @@ -24,27 +25,27 @@ class Ffs(FDClassObject): =20 # mapping between MODULE type in FDF (from INF) and file type for GenF= fs ModuleTypeToFileType =3D { - 'SEC' : 'EFI_FV_FILETYPE_SECURITY_CORE', - 'PEI_CORE' : 'EFI_FV_FILETYPE_PEI_CORE', - 'PEIM' : 'EFI_FV_FILETYPE_PEIM', - 'DXE_CORE' : 'EFI_FV_FILETYPE_DXE_CORE', - 'DXE_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', - 'DXE_SAL_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', - 'DXE_SMM_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', - 'DXE_RUNTIME_DRIVER': 'EFI_FV_FILETYPE_DRIVER', - 'UEFI_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', - 'UEFI_APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', - 'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE', - 'MM_STANDALONE' : 'EFI_FV_FILETYPE_MM_STANDALONE', - 'MM_CORE_STANDALONE' : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE' + 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 { - 'SEC' : 'EFI_FV_FILETYPE_SECURITY_CORE', - 'PEI_CORE' : 'EFI_FV_FILETYPE_PEI_CORE', - 'PEIM' : 'EFI_FV_FILETYPE_PEIM', - 'DXE_CORE' : 'EFI_FV_FILETYPE_DXE_CORE', + 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', 'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM', 'DRIVER' : 'EFI_FV_FILETYPE_DRIVER', 'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', @@ -52,9 +53,9 @@ class Ffs(FDClassObject): 'RAW' : 'EFI_FV_FILETYPE_RAW', 'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER', 'SMM' : 'EFI_FV_FILETYPE_SMM', - 'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE', - 'MM_STANDALONE' : 'EFI_FV_FILETYPE_MM_STANDALONE', - 'MM_CORE_STANDALONE' : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE' + 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 section type in FDF and file suffix diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/= Source/Python/GenFds/FfsInfStatement.py index 3c5eef40222b..f973cf2f0b76 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -88,7 +88,7 @@ class FfsInfStatement(FfsInfStatementClassObject): self.FinalTargetSuffixMap.setdefault(os.path.splitext(File= )[1], []).append(File) =20 # Check if current INF module has DEPEX - if '.depex' not in self.FinalTargetSuffixMap and self.InfModul= e.ModuleType !=3D "USER_DEFINED" \ + if '.depex' not in self.FinalTargetSuffixMap and self.InfModul= e.ModuleType !=3D SUP_MODULE_USER_DEFINED \ and not self.InfModule.DxsFile and not self.InfModule.Libr= aryClass: ModuleType =3D self.InfModule.ModuleType PlatformDataBase =3D GenFdsGlobalVariable.WorkSpace.BuildO= bject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVa= riable.TargetName, GenFdsGlobalVariable.ToolChainTag] @@ -224,10 +224,10 @@ class FfsInfStatement(FfsInfStatementClassObject): if len(self.SourceFileList) !=3D 0 and not self.InDsc: EdkLogger.warn("GenFds", GENFDS_ERROR, "Module %s NOT found in= DSC file; Is it really a binary module?" % (self.InfFileName)) =20 - if self.ModuleType =3D=3D 'SMM_CORE' and int(self.PiSpecVersion, 1= 6) < 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_SMM_CORE and int(self.PiSpecV= ersion, 16) < 0x0001000A: EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE modu= le type can't be used in the module with PI_SPECIFICATION_VERSION less than= 0x0001000A", File=3Dself.InfFileName) =20 =20 - if self.ModuleType =3D=3D 'MM_CORE_STANDALONE' and int(self.PiSpec= Version, 16) < 0x00010032: + if self.ModuleType =3D=3D SUP_MODULE_MM_CORE_STANDALONE and int(se= lf.PiSpecVersion, 16) < 0x00010032: EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "MM_CORE_STAND= ALONE module type can't be used in the module with PI_SPECIFICATION_VERSION= less than 0x00010032", File=3Dself.InfFileName) =20 if Inf._Defs is not None and len(Inf._Defs) > 0: @@ -381,7 +381,7 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Only patch file if FileType is PE32 or ModuleType is USER_DEFINE= D # =20 - if FileType !=3D 'PE32' and self.ModuleType !=3D "USER_DEFINED": + if FileType !=3D 'PE32' and self.ModuleType !=3D SUP_MODULE_USER_D= EFINED: return EfiFile =20 # @@ -488,14 +488,14 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Convert Fv File Type for PI1.1 SMM driver. # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpecVers= ion, 16) >=3D 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(self.P= iSpecVersion, 16) >=3D 0x0001000A: if Rule.FvFileType =3D=3D 'DRIVER': Rule.FvFileType =3D 'SMM' # # Framework SMM Driver has no SMM FV file type # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpecVers= ion, 16) < 0x0001000A: - if Rule.FvFileType =3D=3D 'SMM' or Rule.FvFileType =3D=3D 'SMM= _CORE': + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(self.P= iSpecVersion, 16) < 0x0001000A: + if Rule.FvFileType =3D=3D 'SMM' or Rule.FvFileType =3D=3D SUP_= MODULE_SMM_CORE: EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework= SMM module doesn't support SMM or SMM_CORE FV file type", File=3Dself.InfF= ileName) # # For the rule only has simpleFile @@ -738,17 +738,17 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Convert Fv Section Type for PI1.1 SMM driver. # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpecVers= ion, 16) >=3D 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(self.P= iSpecVersion, 16) >=3D 0x0001000A: if SectionType =3D=3D 'DXE_DEPEX': SectionType =3D 'SMM_DEPEX' # # Framework SMM Driver has no SMM_DEPEX section type # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpecVers= ion, 16) < 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(self.P= iSpecVersion, 16) < 0x0001000A: if SectionType =3D=3D 'SMM_DEPEX': EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework= SMM module doesn't support SMM_DEPEX section type", File=3Dself.InfFileNam= e) NoStrip =3D True - if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'): + if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MO= DULE_PEIM): if self.KeepReloc is not None: NoStrip =3D self.KeepReloc elif Rule.KeepReloc is not None: @@ -761,7 +761,7 @@ class FfsInfStatement(FfsInfStatementClassObject): =20 SecNum =3D '%d' %Index GenSecOutputFile=3D self.__ExtendMacro__(Rule.NameGuid) + = \ - Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' += SecNum + Ffs.Ffs.SectionSuffix[SectionType] + SUP_MOD= ULE_SEC + SecNum Index =3D Index + 1 OutputFile =3D os.path.join(self.OutputPath, GenSecOutputF= ile) File =3D GenFdsGlobalVariable.MacroExtend(File, Dict, self= .CurrentArch) @@ -804,7 +804,7 @@ class FfsInfStatement(FfsInfStatementClassObject): else: SecNum =3D '%d' %Index GenSecOutputFile=3D self.__ExtendMacro__(Rule.NameGuid) + \ - Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' += SecNum + Ffs.Ffs.SectionSuffix[SectionType] + SUP_MOD= ULE_SEC + SecNum OutputFile =3D os.path.join(self.OutputPath, GenSecOutputFile) GenSecInputFile =3D GenFdsGlobalVariable.MacroExtend(GenSecInp= utFile, Dict, self.CurrentArch) =20 @@ -902,7 +902,7 @@ class FfsInfStatement(FfsInfStatementClassObject): # @retval string File name of the generated section file # def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, I= sMakefile =3D False): - if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'): + if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MO= DULE_PEIM): if Rule.KeepReloc is not None: self.KeepRelocFromRule =3D Rule.KeepReloc SectFiles =3D [] @@ -941,13 +941,13 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Convert Fv Section Type for PI1.1 SMM driver. # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpec= Version, 16) >=3D 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(se= lf.PiSpecVersion, 16) >=3D 0x0001000A: if Sect.SectionType =3D=3D 'DXE_DEPEX': Sect.SectionType =3D 'SMM_DEPEX' # # Framework SMM Driver has no SMM_DEPEX section type # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpec= Version, 16) < 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(se= lf.PiSpecVersion, 16) < 0x0001000A: if Sect.SectionType =3D=3D 'SMM_DEPEX': EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Frame= work SMM module doesn't support SMM_DEPEX section type", File=3Dself.InfFil= eName) # diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/S= ource/Python/GenFds/FvImageSection.py index 5026a3ffca2f..eb84b44bbec4 100644 --- a/BaseTools/Source/Python/GenFds/FvImageSection.py +++ b/BaseTools/Source/Python/GenFds/FvImageSection.py @@ -24,6 +24,7 @@ import Common.LongFilePathOs as os from CommonDataClass.FdfClass import FvImageSectionClassObject from Common import EdkLogger from Common.BuildToolError import * +from Common.DataType import * =20 ## generate FV image section # @@ -74,7 +75,7 @@ class FvImageSection(FvImageSectionClassObject): if FvAlignmentValue > MaxFvAlignment: MaxFvAlignment =3D FvAlignmentValue =20 - OutputFile =3D os.path.join(OutputPath, ModuleName + 'SEC'= + Num + Ffs.SectionSuffix.get("FV_IMAGE")) + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_M= ODULE_SEC + Num + Ffs.SectionSuffix.get("FV_IMAGE")) GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileNa= me], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=3DIsMakefile) OutputFileList.append(OutputFile) =20 @@ -138,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject): # # Prepare the parameter of GenSection # - OutputFile =3D os.path.join(OutputPath, ModuleName + 'SEC' + S= ecNum + Ffs.SectionSuffix.get("FV_IMAGE")) + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MODUL= E_SEC + SecNum + Ffs.SectionSuffix.get("FV_IMAGE")) GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName],= 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=3DIsMakefile) OutputFileList.append(OutputFile) =20 diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Sour= ce/Python/GenFds/GuidSection.py index 08665a3d4d49..1105689e0d79 100644 --- a/BaseTools/Source/Python/GenFds/GuidSection.py +++ b/BaseTools/Source/Python/GenFds/GuidSection.py @@ -28,6 +28,7 @@ from Common.BuildToolError import * from FvImageSection import FvImageSection from Common.LongFilePathSupport import OpenLongFilePath as open from GenFds import FindExtendTool +from Common.DataType import * =20 ## generate GUIDed section # @@ -121,7 +122,7 @@ class GuidSection(GuidSectionClassObject) : OutputFile =3D OutputPath + \ os.sep + \ ModuleName + \ - 'SEC' + \ + SUP_MODULE_SEC + \ SecNum + \ Ffs.SectionSuffix['GUIDED'] OutputFile =3D os.path.normpath(OutputFile) @@ -156,7 +157,7 @@ class GuidSection(GuidSectionClassObject) : TempFile =3D OutputPath + \ os.sep + \ ModuleName + \ - 'SEC' + \ + SUP_MODULE_SEC + \ SecNum + \ '.tmp' TempFile =3D os.path.normpath(TempFile) diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/Source= /Python/GenFds/UiSection.py index 6340520602ee..084f761e1285 100644 --- a/BaseTools/Source/Python/GenFds/UiSection.py +++ b/BaseTools/Source/Python/GenFds/UiSection.py @@ -22,6 +22,7 @@ import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import UiSectionClassObject from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.DataType import SUP_MODULE_SEC =20 ## generate UI section # @@ -57,7 +58,7 @@ class UiSection (UiSectionClassObject): self.StringData =3D FfsInf.__ExtendMacro__(self.StringData) self.FileName =3D FfsInf.__ExtendMacro__(self.FileName) =20 - OutputFile =3D os.path.join(OutputPath, ModuleName + 'SEC' + SecNu= m + Ffs.SectionSuffix.get('UI')) + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MODULE_SE= C + SecNum + Ffs.SectionSuffix.get('UI')) =20 if self.StringData is not None : NameString =3D self.StringData diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Sourc= e/Python/GenFds/VerSection.py index 11e974b9936e..456a430079bb 100644 --- a/BaseTools/Source/Python/GenFds/VerSection.py +++ b/BaseTools/Source/Python/GenFds/VerSection.py @@ -22,6 +22,7 @@ import subprocess from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import VerSectionClassObject from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.DataType import SUP_MODULE_SEC =20 ## generate version section # @@ -59,7 +60,7 @@ class VerSection (VerSectionClassObject): self.FileName =3D FfsInf.__ExtendMacro__(self.FileName) =20 OutputFile =3D os.path.join(OutputPath, - ModuleName + 'SEC' + SecNum + Ffs.Sectio= nSuffix.get('VERSION')) + ModuleName + SUP_MODULE_SEC + SecNum + F= fs.SectionSuffix.get('VERSION')) OutputFile =3D os.path.normpath(OutputFile) =20 # Get String Data diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index a725a2a2a772..f2d36d0ee0d4 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -68,22 +68,22 @@ class InfBuildData(ModuleBuildClassObject): =20 # dict used to convert Component type to Module type _MODULE_TYPE_ =3D { - "LIBRARY" : "BASE", - "SECURITY_CORE" : "SEC", - "PEI_CORE" : "PEI_CORE", - "COMBINED_PEIM_DRIVER" : "PEIM", - "PIC_PEIM" : "PEIM", - "RELOCATABLE_PEIM" : "PEIM", - "PE32_PEIM" : "PEIM", - "BS_DRIVER" : "DXE_DRIVER", - "RT_DRIVER" : "DXE_RUNTIME_DRIVER", - "SAL_RT_DRIVER" : "DXE_SAL_DRIVER", - "DXE_SMM_DRIVER" : "DXE_SMM_DRIVER", - # "SMM_DRIVER" : "DXE_SMM_DRIVER", - # "BS_DRIVER" : "DXE_SMM_DRIVER", - # "BS_DRIVER" : "UEFI_DRIVER", - "APPLICATION" : "UEFI_APPLICATION", - "LOGO" : "BASE", + "LIBRARY" : SUP_MODULE_BASE, + "SECURITY_CORE" : SUP_MODULE_SEC, + SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE, + "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM, + "PIC_PEIM" : SUP_MODULE_PEIM, + "RELOCATABLE_PEIM" : SUP_MODULE_PEIM, + "PE32_PEIM" : SUP_MODULE_PEIM, + "BS_DRIVER" : SUP_MODULE_DXE_DRIVER, + "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER, + "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER, + SUP_MODULE_DXE_SMM_DRIVER : SUP_MODULE_DXE_SMM_DRIVER, + # "SMM_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER, + # "BS_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER, + # "BS_DRIVER" : SUP_MODULE_UEFI_DRIVER, + "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, + "LOGO" : SUP_MODULE_BASE, } =20 # regular expression for converting XXX_FLAGS in [nmake] section to ne= w type @@ -461,9 +461,9 @@ class InfBuildData(ModuleBuildClassObject): if self._Header_ is None: self._GetHeaderInfo() if self._ModuleType is None: - self._ModuleType =3D 'BASE' + self._ModuleType =3D SUP_MODULE_BASE if self._ModuleType not in SUP_MODULE_LIST: - self._ModuleType =3D "USER_DEFINED" + self._ModuleType =3D SUP_MODULE_USER_DEFINED return self._ModuleType =20 ## Retrieve COMPONENT_TYPE @@ -472,7 +472,7 @@ class InfBuildData(ModuleBuildClassObject): if self._Header_ is None: self._GetHeaderInfo() if self._ComponentType is None: - self._ComponentType =3D 'USER_DEFINED' + self._ComponentType =3D SUP_MODULE_USER_DEFINED return self._ComponentType =20 ## Retrieve "BUILD_TYPE" @@ -481,7 +481,7 @@ class InfBuildData(ModuleBuildClassObject): if self._Header_ is None: self._GetHeaderInfo() if not self._BuildType: - self._BuildType =3D "BASE" + self._BuildType =3D SUP_MODULE_BASE return self._BuildType =20 ## Retrieve file guid @@ -899,14 +899,14 @@ class InfBuildData(ModuleBuildClassObject): =20 # PEIM and DXE drivers must have a valid [Depex] section if len(self.LibraryClass) =3D=3D 0 and len(RecordList) =3D=3D = 0: - if self.ModuleType =3D=3D 'DXE_DRIVER' or self.ModuleType = =3D=3D 'PEIM' or self.ModuleType =3D=3D 'DXE_SMM_DRIVER' or \ - self.ModuleType =3D=3D 'DXE_SAL_DRIVER' or self.Module= Type =3D=3D 'DXE_RUNTIME_DRIVER': + if self.ModuleType =3D=3D SUP_MODULE_DXE_DRIVER or self.Mo= duleType =3D=3D SUP_MODULE_PEIM or self.ModuleType =3D=3D SUP_MODULE_DXE_SM= M_DRIVER or \ + self.ModuleType =3D=3D SUP_MODULE_DXE_SAL_DRIVER or se= lf.ModuleType =3D=3D SUP_MODULE_DXE_RUNTIME_DRIVER: EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [= Depex] section or no valid expression in [Depex] section for [%s] module" \ % self.ModuleType, File=3Dself.MetaFil= e) =20 - if len(RecordList) !=3D 0 and self.ModuleType =3D=3D 'USER_DEF= INED': + if len(RecordList) !=3D 0 and self.ModuleType =3D=3D SUP_MODUL= E_USER_DEFINED: for Record in RecordList: - if Record[4] not in ['PEIM', 'DXE_DRIVER', 'DXE_SMM_DR= IVER']: + if Record[4] not in [SUP_MODULE_PEIM, SUP_MODULE_DXE_D= RIVER, SUP_MODULE_DXE_SMM_DRIVER]: EdkLogger.error('build', FORMAT_INVALID, "'%s' module must specify the type= of [Depex] section" % self.ModuleType, File=3Dself.MetaFile) diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseToo= ls/Source/Python/Workspace/WorkspaceCommon.py index 736ef6253453..573100081815 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -134,7 +134,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To LibraryModule.LibraryClass.append(LibraryClassObject(L= ibraryClassName, [ModuleType])) elif LibraryModule.LibraryClass is None \ or len(LibraryModule.LibraryClass) =3D=3D 0 \ - or (ModuleType !=3D 'USER_DEFINED' + or (ModuleType !=3D SUP_MODULE_USER_DEFINED and ModuleType not in LibraryModule.LibraryClass[= 0].SupModList): # only USER_DEFINED can link against any library insta= nce despite of its SupModList return [] diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index c4647d068a6b..b2e5fd6fbf38 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -48,18 +48,18 @@ import collections from Common.Expression import * =20 gComponentType2ModuleType =3D { - "LIBRARY" : "BASE", - "SECURITY_CORE" : "SEC", - "PEI_CORE" : "PEI_CORE", - "COMBINED_PEIM_DRIVER" : "PEIM", - "PIC_PEIM" : "PEIM", - "RELOCATABLE_PEIM" : "PEIM", - "PE32_PEIM" : "PEIM", - "BS_DRIVER" : "DXE_DRIVER", - "RT_DRIVER" : "DXE_RUNTIME_DRIVER", - "SAL_RT_DRIVER" : "DXE_SAL_DRIVER", - "APPLICATION" : "UEFI_APPLICATION", - "LOGO" : "BASE", + "LIBRARY" : SUP_MODULE_BASE, + "SECURITY_CORE" : SUP_MODULE_SEC, + SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE, + "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM, + "PIC_PEIM" : SUP_MODULE_PEIM, + "RELOCATABLE_PEIM" : SUP_MODULE_PEIM, + "PE32_PEIM" : SUP_MODULE_PEIM, + "BS_DRIVER" : SUP_MODULE_DXE_DRIVER, + "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER, + "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER, + "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, + "LOGO" : SUP_MODULE_BASE, } =20 ## Pattern to extract contents in EDK DXS files @@ -122,20 +122,20 @@ gPcdTypeMap =3D { =20 ## The look up table to map module type to driver type gDriverTypeMap =3D { - 'SEC' : '0x3 (SECURITY_CORE)', - 'PEI_CORE' : '0x4 (PEI_CORE)', - 'PEIM' : '0x6 (PEIM)', - 'DXE_CORE' : '0x5 (DXE_CORE)', - 'DXE_DRIVER' : '0x7 (DRIVER)', - 'DXE_SAL_DRIVER' : '0x7 (DRIVER)', - 'DXE_SMM_DRIVER' : '0x7 (DRIVER)', - 'DXE_RUNTIME_DRIVER': '0x7 (DRIVER)', - 'UEFI_DRIVER' : '0x7 (DRIVER)', - 'UEFI_APPLICATION' : '0x9 (APPLICATION)', - 'SMM_CORE' : '0xD (SMM_CORE)', + SUP_MODULE_SEC : '0x3 (SECURITY_CORE)', + SUP_MODULE_PEI_CORE : '0x4 (PEI_CORE)', + SUP_MODULE_PEIM : '0x6 (PEIM)', + SUP_MODULE_DXE_CORE : '0x5 (DXE_CORE)', + SUP_MODULE_DXE_DRIVER : '0x7 (DRIVER)', + SUP_MODULE_DXE_SAL_DRIVER : '0x7 (DRIVER)', + SUP_MODULE_DXE_SMM_DRIVER : '0x7 (DRIVER)', + SUP_MODULE_DXE_RUNTIME_DRIVER: '0x7 (DRIVER)', + SUP_MODULE_UEFI_DRIVER : '0x7 (DRIVER)', + SUP_MODULE_UEFI_APPLICATION : '0x9 (APPLICATION)', + SUP_MODULE_SMM_CORE : '0xD (SMM_CORE)', 'SMM_DRIVER' : '0xA (SMM)', # Extension of module type to support= PI 1.1 SMM drivers - 'MM_STANDALONE' : '0xE (MM_STANDALONE)', - 'MM_CORE_STANDALONE' : '0xF (MM_CORE_STANDALONE)' + SUP_MODULE_MM_STANDALONE : '0xE (MM_STANDALONE)', + SUP_MODULE_MM_CORE_STANDALONE : '0xF (MM_CORE_STANDALONE)' } =20 ## The look up table of the supported opcode in the dependency expression = binaries @@ -424,7 +424,7 @@ class DepexReport(object): if not ModuleType: ModuleType =3D gComponentType2ModuleType.get(M.ComponentType, = "") =20 - if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE", "SMM_CORE", "MM_C= ORE_STANDALONE", "UEFI_APPLICATION"]: + if ModuleType in [SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_= DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE, SUP_MODULE_UE= FI_APPLICATION]: return =20 for Source in M.SourceFileList: @@ -591,7 +591,7 @@ class ModuleReport(object): # # If a module complies to PI 1.1, promote Module type to "SMM_= DRIVER" # - if ModuleType =3D=3D "DXE_SMM_DRIVER": + if ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER: PiSpec =3D M.Module.Specification.get("PI_SPECIFICATION_VE= RSION", "0x00010000") if int(PiSpec, 0) >=3D 0x0001000A: ModuleType =3D "SMM_DRIVER" @@ -1382,7 +1382,7 @@ class PredictionReport(object): # their source code to find PPI/Protocol produce or consum= e # information. # - if Module.ModuleType =3D=3D "BASE": + if Module.ModuleType =3D=3D SUP_MODULE_BASE: continue # # Add module referenced source files diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index 36bb1fecf7e5..81d59dd3eedf 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1587,22 +1587,22 @@ class Build(): if not ImageClass.IsValid: EdkLogger.error("build", FILE_PARSE_FAILURE, Extra= Data=3DImageClass.ErrorInfo) ImageInfo =3D PeImageInfo(Module.Name, Module.Guid, Mo= dule.Arch, Module.OutputDir, Module.DebugDir, ImageClass) - if Module.ModuleType in ['PEI_CORE', 'PEIM', 'COMBINED= _PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', 'DXE_CORE']: + if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODU= LE_PEIM, 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', SUP_MODULE= _DXE_CORE]: PeiModuleList[Module.MetaFile] =3D ImageInfo PeiSize +=3D ImageInfo.Image.Size - elif Module.ModuleType in ['BS_DRIVER', 'DXE_DRIVER', = 'UEFI_DRIVER']: + elif Module.ModuleType in ['BS_DRIVER', SUP_MODULE_DXE= _DRIVER, SUP_MODULE_UEFI_DRIVER]: BtModuleList[Module.MetaFile] =3D ImageInfo BtSize +=3D ImageInfo.Image.Size - elif Module.ModuleType in ['DXE_RUNTIME_DRIVER', 'RT_D= RIVER', 'DXE_SAL_DRIVER', 'SAL_RT_DRIVER']: + elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIV= ER, 'RT_DRIVER', SUP_MODULE_DXE_SAL_DRIVER, 'SAL_RT_DRIVER']: RtModuleList[Module.MetaFile] =3D ImageInfo #IPF runtime driver needs to be at 2 page alignmen= t. if IsIpfPlatform and ImageInfo.Image.Size % 0x2000= !=3D 0: ImageInfo.Image.Size =3D (ImageInfo.Image.Size= / 0x2000 + 1) * 0x2000 RtSize +=3D ImageInfo.Image.Size - elif Module.ModuleType in ['SMM_CORE', 'DXE_SMM_DRIVER= ', 'MM_STANDALONE', 'MM_CORE_STANDALONE']: + elif Module.ModuleType in [SUP_MODULE_SMM_CORE, SUP_MO= DULE_DXE_SMM_DRIVER, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALON= E]: SmmModuleList[Module.MetaFile] =3D ImageInfo SmmSize +=3D ImageInfo.Image.Size - if Module.ModuleType =3D=3D 'DXE_SMM_DRIVER': + if Module.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRI= VER: PiSpecVersion =3D Module.Module.Specification.= get('PI_SPECIFICATION_VERSION', '0x00000000') # for PI specification < PI1.1, DXE_SMM_DRIVER= also runs as BOOT time driver. if int(PiSpecVersion, 16) < 0x0001000A: --=20 2.16.2.windows.1