From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3E8D922618174 for ; Tue, 10 Apr 2018 18:07:41 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2018 18:07:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,434,1517904000"; d="scan'208";a="219418775" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga006.fm.intel.com with ESMTP; 10 Apr 2018 18:07:40 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 10 Apr 2018 18:07:40 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 10 Apr 2018 18:07:40 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.151]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.149]) with mapi id 14.03.0319.002; Wed, 11 Apr 2018 09:07:37 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH v1 3/3] BaseTools: use existing contrants to replace raw strings in python code. Thread-Index: AQHT0NcS7JeBtqFnqEOlmPm4j8IiBaP6v4iQ Date: Wed, 11 Apr 2018 01:07:37 +0000 Message-ID: References: <5fcb2d09d32b4ebe8dfd5d38f8e2099247ef9bd8.1523369916.git.jaben.carsey@intel.com> In-Reply-To: <5fcb2d09d32b4ebe8dfd5d38f8e2099247ef9bd8.1523369916.git.jaben.carsey@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v1 3/3] BaseTools: use existing contrants to replace raw strings in python code. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2018 01:07:41 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Jaben, Seems only replaced 'UEFI_APPLICATION', what about others, eg ' DXE_SMM_DRI= VER' ? Do you have plan to update it ? Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Tuesday, April 10, 2018 10:20 PM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Zhu, Yonghong Subject: [PATCH v1 3/3] BaseTools: use existing contrants to replace raw st= rings in python code. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/GenC.py | 13 +++++++------ BaseTools/Source/Python/AutoGen/GenDepex.py | 3 ++- BaseTools/Source/Python/GenFds/Ffs.py | 3 ++- BaseTools/Source/Python/Workspace/InfBuildData.py | 4 ++-- BaseTools/Source/Python/build/BuildReport.py | 5 +++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 4d9ea1b2a8b1..4a9657420897 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -25,6 +25,7 @@ from Common.String import StringToArray from StrGather i= mport * from GenPcdDb import CreatePcdDatabaseCode from IdfClassObject im= port * +from Common.DataType import SUP_MODULE_UEFI_APPLICATION =20 ## PCD type string gItemTypeStringDatabase =3D { @@ -782,7 +783,7 @@ gModuleTypeHeaderFile =3D { "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"], + SUP_MODULE_UEFI_APPLICATION : ["Uefi.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplic= ationEntryPoint.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"], @@ -1386,7 +1387,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Auto= GenH): 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']: + 'DXE_SAL_DRIVER','UEFI_DRIVER',SUP_MODULE_= UEFI_APPLICATION,'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']: @@ -1415,7 +1416,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Auto= GenH): elif Info.ModuleType in ['PEI_CORE','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']: + 'DXE_SAL_DRIVER','UEFI_DRIVER',SUP_MODULE= _UEFI_APPLICATION,'SMM_CORE']: AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) elif Info.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']: AutoGenC.Append(gLibraryString['MM'].Replace(Dict)) @@ -1448,7 +1449,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoG= enH): 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']: + 'DXE_SAL_DRIVER','UEFI_DRIVER',SUP_MODULE_= UEFI_APPLICATION, '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']: @@ -1477,7 +1478,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoG= enH): elif Info.ModuleType in ['PEI_CORE','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']: + 'DXE_SAL_DRIVER','UEFI_DRIVER',SUP_MODULE= _UEFI_APPLICATION,'SMM_CORE']: AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) elif Info.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']: AutoGenC.Append(gLibraryString['MM'].Replace(Dict)) @@ -1556,7 +1557,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): 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: diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py b/BaseTools/Source= /Python/AutoGen/GenDepex.py index 9acea8f6bfed..8896ad65bfe6 100644 --- a/BaseTools/Source/Python/AutoGen/GenDepex.py +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py @@ -24,6 +24,7 @@ from Common.Misc import SaveFileOnChange from Common.Mis= c import GuidStructureStringToGuidString from Common import EdkLogger as E= dkLogger from Common.BuildVersion import gBUILD_VERSION +from Common.DataType import SUP_MODULE_UEFI_APPLICATION =20 ## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END" gStartClosePattern =3D re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*"= , re.S) @@ -40,7 +41,7 @@ gType2Phase =3D { "DXE_RUNTIME_DRIVER": "DXE", "DXE_SAL_DRIVER" : "DXE", "UEFI_DRIVER" : "DXE", - "UEFI_APPLICATION" : "DXE", + SUP_MODULE_UEFI_APPLICATION : "DXE", "SMM_CORE" : "DXE", "MM_STANDALONE" : "MM", "MM_CORE_STANDALONE" : "MM", diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Pytho= n/GenFds/Ffs.py index a4178121118b..e5b180eb9324 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 SUP_MODULE_UEFI_APPLICATION =20 ## generate FFS # @@ -33,7 +34,7 @@ class Ffs(FDClassObject): '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', + SUP_MODULE_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' diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index 53aa6acf5862..c1841487f64f 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -17,7 +17,7 @@ from Common.DataType import * from Common.Misc import * = from types import * from MetaFileParser import * -from Common.DataType im= port TAB_ARCH_COMMON,TAB_ARCH_COMMON +from Common.DataType import=20 +TAB_ARCH_COMMON,TAB_ARCH_COMMON,SUP_MODULE_UEFI_APPLICATION =20 from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClas= sObject, PcdClassObject ## Module build information from INF file @@ -82,7= +82,7 @@ class InfBuildData(ModuleBuildClassObject): # "SMM_DRIVER" : "DXE_SMM_DRIVER", # "BS_DRIVER" : "DXE_SMM_DRIVER", # "BS_DRIVER" : "UEFI_DRIVER", - "APPLICATION" : "UEFI_APPLICATION", + "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, "LOGO" : "BASE", } =20 diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index 966a2aa5abf1..190b58cfa44e 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -47,6 +47,7 @@ from Common.String import NormPath from Common.DataType = import * import collections from Common.Expression import * +from Common.DataType import SUP_MODULE_UEFI_APPLICATION =20 ## Pattern to extract contents in EDK DXS files gDxsDependencyPattern =3D= re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL) @@ -117,7 +11= 8,7 @@ gDriverTypeMap =3D { 'DXE_SMM_DRIVER' : '0x7 (DRIVER)', 'DXE_RUNTIME_DRIVER': '0x7 (DRIVER)', 'UEFI_DRIVER' : '0x7 (DRIVER)', - 'UEFI_APPLICATION' : '0x9 (APPLICATION)', + SUP_MODULE_UEFI_APPLICATION : '0x9 (APPLICATION)', '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)', @@ -410,7 +411,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 ["SEC", "PEI_CORE", "DXE_CORE", "SMM_CORE", "MM_C= ORE_STANDALONE", SUP_MODULE_UEFI_APPLICATION]: return =20 for Source in M.SourceFileList: -- 2.16.2.windows.1