* [PATCH v2 13/27] BaseTools: replace string constants used for module types
[not found] <cover.1524761578.git.jaben.carsey@intel.com>
@ 2018-04-26 16:57 ` Jaben Carsey
2018-04-27 9:53 ` Zhu, Yonghong
2018-04-26 16:57 ` [PATCH v2 16/27] BaseTools: Replace EDK Component strings with predefined constant Jaben Carsey
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Jaben Carsey @ 2018-04-26 16:57 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu
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 <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
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 database.
# The default Phase is DXE
#
- if M.ModuleType in ["PEIM", "PEI_CORE"]:
+ if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE]:
PcdFromModule.Phase = "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 MaxDatumSize set
if PcdFromModule.DatumType == TAB_VOID and PcdFromModule.MaxDatumSize in [None, '']:
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName))
- if M.ModuleType in ["PEIM", "PEI_CORE"]:
+ if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE]:
PcdFromModule.Phase = "PEI"
if PcdFromModule not in self._DynaPcdList_ and PcdFromModule.Type in GenC.gDynamicExPcd:
self._DynaPcdList_.append(PcdFromModule)
@@ -2203,7 +2203,7 @@ class PlatformAutoGen(AutoGen):
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
elif LibraryModule.LibraryClass is None \
or len(LibraryModule.LibraryClass) == 0 \
- or (ModuleType != 'USER_DEFINED'
+ or (ModuleType != SUP_MODULE_USER_DEFINED
and ModuleType not in LibraryModule.LibraryClass[0].SupModList):
# only USER_DEFINED can link against any library instance despite of its SupModList
EdkLogger.error("build", OPTION_MISSING,
@@ -3969,8 +3969,8 @@ class ModuleAutoGen(AutoGen):
break
ModuleType = self.ModuleType
- if ModuleType == 'UEFI_DRIVER' and self.DepexGenerated:
- ModuleType = 'DXE_DRIVER'
+ if ModuleType == SUP_MODULE_UEFI_DRIVER and self.DepexGenerated:
+ ModuleType = SUP_MODULE_DXE_DRIVER
DriverType = ''
if self.PcdIsDriver != '':
@@ -4047,11 +4047,11 @@ class ModuleAutoGen(AutoGen):
AsBuiltInfDict['binary_item'] += ['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'] += ['PEI_DEPEX|' + self.Name + '.depex']
- if self.ModuleType in ['DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'UEFI_DRIVER']:
+ if self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]:
AsBuiltInfDict['binary_item'] += ['DXE_DEPEX|' + self.Name + '.depex']
- if self.ModuleType in ['DXE_SMM_DRIVER']:
+ if self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]:
AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + '.depex']
Bin = self._GenOffsetBin()
@@ -4377,8 +4377,8 @@ class ModuleAutoGen(AutoGen):
return
for ModuleType in self.DepexList:
- # Ignore empty [depex] section or [depex] section for "USER_DEFINED" module
- if len(self.DepexList[ModuleType]) == 0 or ModuleType == "USER_DEFINED":
+ # Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module
+ if len(self.DepexList[ModuleType]) == 0 or ModuleType == SUP_MODULE_USER_DEFINED:
continue
Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)
diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/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__ == '__main__':
EdkLogger.Initialize()
if len(sys.argv) > 1:
Br = 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__ == '__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])
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/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}
]
gLibraryStructorPrototype = {
-'BASE' : TemplateString("""${BEGIN}
+SUP_MODULE_BASE : TemplateString("""${BEGIN}
RETURN_STATUS
EFIAPI
${Function} (
@@ -686,7 +686,7 @@ ${Function} (
}
gLibraryStructorCall = {
-'BASE' : TemplateString("""${BEGIN}
+SUP_MODULE_BASE : TemplateString("""${BEGIN}
Status = ${Function} ();
ASSERT_EFI_ERROR (Status);${END}
"""),
@@ -709,7 +709,7 @@ gLibraryStructorCall = {
## Library Constructor and Destructor Templates
gLibraryString = {
-'BASE' : TemplateString("""
+SUP_MODULE_BASE : TemplateString("""
${BEGIN}${FunctionPrototype}${END}
VOID
@@ -772,21 +772,21 @@ ${FunctionCall}${END}
gBasicHeaderFile = "Base.h"
gModuleTypeHeaderFile = {
- "BASE" : [gBasicHeaderFile],
- "SEC" : ["PiPei.h", "Library/DebugLib.h"],
- "PEI_CORE" : ["PiPei.h", "Library/DebugLib.h", "Library/PeiCoreEntryPoint.h"],
- "PEIM" : ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"],
- "DXE_CORE" : ["PiDxe.h", "Library/DebugLib.h", "Library/DxeCoreEntryPoint.h"],
- "DXE_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
- "DXE_SMM_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
- "DXE_RUNTIME_DRIVER": ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
- "DXE_SAL_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
- "UEFI_DRIVER" : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
- "UEFI_APPLICATION" : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"],
- "SMM_CORE" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
- "MM_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmDriverStandaloneEntryPoint.h"],
- "MM_CORE_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.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", "Library/PeiCoreEntryPoint.h"],
+ SUP_MODULE_PEIM : ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"],
+ SUP_MODULE_DXE_CORE : ["PiDxe.h", "Library/DebugLib.h", "Library/DxeCoreEntryPoint.h"],
+ SUP_MODULE_DXE_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_DXE_SMM_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_DXE_RUNTIME_DRIVER: ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_DXE_SAL_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_UEFI_DRIVER : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_UEFI_APPLICATION : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"],
+ SUP_MODULE_SMM_CORE : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_MM_STANDALONE : ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmDriverStandaloneEntryPoint.h"],
+ SUP_MODULE_MM_CORE_STANDALONE : ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmCoreStandaloneEntryPoint.h"],
+ SUP_MODULE_USER_DEFINED : [gBasicHeaderFile]
}
## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName
@@ -1406,17 +1406,17 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
if len(Lib.ConstructorList) <= 0:
continue
Dict = {'Function':Lib.ConstructorList}
- if Lib.ModuleType in ['BASE', 'SEC']:
- ConstructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict))
- ConstructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict))
- elif Lib.ModuleType in ['PEI_CORE','PEIM']:
+ if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
+ ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
+ ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
+ elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:
ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
- elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
- 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','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['DXE'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
- elif Lib.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']:
+ elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CORE_STANDALONE]:
ConstructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict))
@@ -1437,14 +1437,14 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
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_APPLICATION','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_CORE_STANDALONE]:
AutoGenC.Append(gLibraryString['MM'].Replace(Dict))
## Create code for library destructor
@@ -1468,17 +1468,17 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
if len(Lib.DestructorList) <= 0:
continue
Dict = {'Function':Lib.DestructorList}
- if Lib.ModuleType in ['BASE', 'SEC']:
- DestructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict))
- DestructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(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['PEI'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
- elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
- 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', '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['DXE'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
- elif Lib.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']:
+ elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CORE_STANDALONE]:
DestructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict))
@@ -1499,14 +1499,14 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
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_APPLICATION','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_CORE_STANDALONE]:
AutoGenC.Append(gLibraryString['MM'].Replace(Dict))
@@ -1517,7 +1517,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
# @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, AutoGenH):
'UefiSpecVersion': UefiSpecVersion + 'U'
}
- if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE', 'MM_CORE_STANDALONE']:
+ if Info.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE]:
if Info.SourceFileList:
if NumEntryPoints != 1:
EdkLogger.error(
@@ -1547,43 +1547,43 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
File=str(Info),
ExtraData= ", ".join(Info.Module.ModuleEntryPointList)
)
- if Info.ModuleType == 'PEI_CORE':
+ if Info.ModuleType == SUP_MODULE_PEI_CORE:
AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))
AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'DXE_CORE':
+ elif Info.ModuleType == SUP_MODULE_DXE_CORE:
AutoGenC.Append(gDxeCoreEntryPointString.Replace(Dict))
AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'SMM_CORE':
+ elif Info.ModuleType == SUP_MODULE_SMM_CORE:
AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict))
AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'MM_CORE_STANDALONE':
+ elif Info.ModuleType == SUP_MODULE_MM_CORE_STANDALONE:
AutoGenC.Append(gMmCoreStandaloneEntryPointString.Replace(Dict))
AutoGenH.Append(gMmCoreStandaloneEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'PEIM':
+ elif Info.ModuleType == 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_DRIVER','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].Replace(Dict))
else:
AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict))
AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'DXE_SMM_DRIVER':
+ elif Info.ModuleType == SUP_MODULE_DXE_SMM_DRIVER:
if NumEntryPoints == 0:
AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict))
else:
AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict))
AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'MM_STANDALONE':
+ elif Info.ModuleType == 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 == 'UEFI_APPLICATION':
+ elif Info.ModuleType == SUP_MODULE_UEFI_APPLICATION:
if NumEntryPoints < 2:
AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(Dict))
else:
@@ -1597,7 +1597,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
# @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, AutoGenH):
# @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 = "GUID"
else:
GuidType = "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 = "GUID"
else:
GuidType = "EFI_GUID"
@@ -1665,7 +1665,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
# @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 = "GUID"
else:
GuidType = "EFI_GUID"
@@ -1702,7 +1702,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
# Add extern declarations to AutoGen.h if one or more Token Space GUIDs 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 = "GUID"
else:
GuidType = "EFI_GUID"
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 *
## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END"
gStartClosePattern = re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*", re.S)
## Mapping between module type and EFI phase
gType2Phase = {
- "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",
}
## Convert dependency expression string into EFI internal representation
@@ -299,12 +300,12 @@ class DependencyExpression:
NewOperand.append(Token)
# don't generate depex if only TRUE operand left
- if self.ModuleType == 'PEIM' and len(NewOperand) == 1 and NewOperand[0] == 'TRUE':
+ if self.ModuleType == SUP_MODULE_PEIM and len(NewOperand) == 1 and NewOperand[0] == 'TRUE':
self.PostfixNotation = []
return
# don't generate depex if all operands are architecture protocols
- if self.ModuleType in ['UEFI_DRIVER', 'DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER', 'MM_STANDALONE'] and \
+ if self.ModuleType in [SUP_MODULE_UEFI_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_MM_STANDALONE] and \
Op == 'AND' and \
self.ArchProtocols == set([GuidStructureStringToGuidString(Guid) for Guid in AllOperand]):
self.PostfixNotation = []
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 = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
EDK_COMPONENT_TYPE_SECUARITY_CORE = 'SECUARITY_CORE'
-EDK_COMPONENT_TYPE_PEI_CORE = 'PEI_CORE'
+EDK_COMPONENT_TYPE_PEI_CORE = SUP_MODULE_PEI_CORE
EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER'
EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM'
EDK_COMPONENT_TYPE_RELOCATABLE_PEIM = '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.<BR>
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -744,7 +744,7 @@ class Check(object):
if Item not in LibraryClasses[List[0]]:
LibraryClasses[List[0]].append(Item)
- if Record[2] != 'BASE' and Record[2] not in SupModType:
+ if Record[2] != DT.SUP_MODULE_BASE and Record[2] not in SupModType:
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2, OtherMsg="The Library Class '%s' does not specify its supported module types" % (List[0]), BelongsToTable='Inf', BelongsToItem=Record[0])
SqlCommand = """select A.ID, A.Value1, B.Value3 from Inf as A left join Inf as B
@@ -763,7 +763,7 @@ class Check(object):
for Record in RecordSet:
if Record[1] in LibraryClasses:
- if Record[2] not in LibraryClasses[Record[1]] and 'BASE' not in RecordDict[Record[1]]:
+ if Record[2] not in LibraryClasses[Record[1]] and DT.SUP_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="The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[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 *
## generate compress section
#
@@ -82,7 +83,7 @@ class CompressSection (CompressSectionClassObject) :
OutputFile = OutputPath + \
os.sep + \
ModuleName + \
- 'SEC' + \
+ SUP_MODULE_SEC + \
SecNum + \
Ffs.SectionSuffix['COMPRESS']
OutputFile = os.path.normpath(OutputFile)
diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/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.<BR>
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD 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 *
## generate data section
#
@@ -119,7 +120,7 @@ class DataSection (DataSectionClassObject):
)
self.SectFileName = TeFile
- OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get(self.SecType))
+ OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get(self.SecType))
OutputFile = os.path.normpath(OutputFile)
GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile)
FileList = [OutputFile]
diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/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 *
## generate data section
#
@@ -94,24 +95,24 @@ class DepexSection (DepexSectionClassObject):
self.ExpressionProcessed = True
if self.DepexType == 'PEI_DEPEX_EXP':
- ModuleType = 'PEIM'
+ ModuleType = SUP_MODULE_PEIM
SecType = 'PEI_DEPEX'
elif self.DepexType == 'DXE_DEPEX_EXP':
- ModuleType = 'DXE_DRIVER'
+ ModuleType = SUP_MODULE_DXE_DRIVER
SecType = 'DXE_DEPEX'
elif self.DepexType == 'SMM_DEPEX_EXP':
- ModuleType = 'DXE_SMM_DRIVER'
+ ModuleType = SUP_MODULE_DXE_SMM_DRIVER
SecType = 'SMM_DEPEX'
else:
EdkLogger.error("GenFds", FORMAT_INVALID,
"Depex type %s is not valid for module %s" % (self.DepexType, ModuleName))
- InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex')
+ InputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.depex')
InputFile = os.path.normpath(InputFile)
Depex = DependencyExpression(self.Expression, ModuleType)
Depex.Generate(InputFile)
- OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')
+ OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.dpx')
OutputFile = os.path.normpath(OutputFile)
GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)
diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/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 *
## generate rule section
#
@@ -66,7 +67,7 @@ class EfiSection (EfiSectionClassObject):
StringData = FfsInf.__ExtendMacro__(self.StringData)
ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
NoStrip = True
- if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType 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 = FfsInf.KeepReloc
elif FfsInf.KeepRelocFromRule is not None:
@@ -122,7 +123,7 @@ class EfiSection (EfiSectionClassObject):
BuildNumTuple = tuple()
Num = SecNum
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
#Ui=StringData,
Ver=BuildNum,
@@ -133,7 +134,7 @@ class EfiSection (EfiSectionClassObject):
for File in FileList:
Index = Index + 1
Num = '%s.%d' %(SecNum , Index)
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
f = open(File, 'r')
VerString = 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 = SecNum
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
#Ui=VerString,
Ver=BuildNum,
@@ -183,7 +184,7 @@ class EfiSection (EfiSectionClassObject):
Num = SecNum
if IsMakefile and StringData == ModuleNameStr:
StringData = "$(MODULE_NAME)"
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=StringData, IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
@@ -192,7 +193,7 @@ class EfiSection (EfiSectionClassObject):
for File in FileList:
Index = Index + 1
Num = '%s.%d' %(SecNum , Index)
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
f = open(File, 'r')
UiString = f.read()
f.close()
@@ -216,7 +217,7 @@ class EfiSection (EfiSectionClassObject):
Num = SecNum
if IsMakefile and StringData == ModuleNameStr:
StringData = "$(MODULE_NAME)"
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=StringData, IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
@@ -237,7 +238,7 @@ class EfiSection (EfiSectionClassObject):
""" Copy Map file to FFS output path """
Index = Index + 1
Num = '%s.%d' %(SecNum , Index)
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
File = GenFdsGlobalVariable.MacroExtend(File, Dict)
#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_PEIM, 'PEI_DXE_COMBO'):
return True
else:
return False
@@ -3626,12 +3626,12 @@ class FdfParser:
if not self.__GetNextWord():
raise Warning("expected Module type", self.FileName, self.CurrentLineNumber)
- if self.__Token.upper() not in ("SEC", "PEI_CORE", "PEIM", "DXE_CORE", \
- "DXE_DRIVER", "DXE_SAL_DRIVER", \
- "DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \
- "UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \
+ if self.__Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, \
+ SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, \
+ SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, \
+ SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \
"SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \
- "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALONE"):
+ "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "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
@@ -3673,8 +3673,8 @@ class FdfParser:
raise Warning("expected FFS type", self.FileName, self.CurrentLineNumber)
Type = self.__Token.strip().upper()
- if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\
- "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALONE"):
+ if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,\
+ "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
if not self.__IsToken("="):
diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Python/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 *
## generate FFS
#
@@ -24,27 +25,27 @@ class Ffs(FDClassObject):
# mapping between MODULE type in FDF (from INF) and file type for GenFfs
ModuleTypeToFileType = {
- '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_STANDALONE'
}
# mapping between FILE type in FDF and file type for GenFfs
FdfFvFileTypeToFileType = {
- '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_STANDALONE'
}
# 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)
# Check if current INF module has DEPEX
- if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != "USER_DEFINED" \
+ if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
ModuleType = self.InfModule.ModuleType
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
@@ -224,10 +224,10 @@ class FfsInfStatement(FfsInfStatementClassObject):
if len(self.SourceFileList) != 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))
- if self.ModuleType == 'SMM_CORE' and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if self.ModuleType == SUP_MODULE_SMM_CORE and int(self.PiSpecVersion, 16) < 0x0001000A:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.InfFileName)
- if self.ModuleType == 'MM_CORE_STANDALONE' and int(self.PiSpecVersion, 16) < 0x00010032:
+ if self.ModuleType == SUP_MODULE_MM_CORE_STANDALONE and int(self.PiSpecVersion, 16) < 0x00010032:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.InfFileName)
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_DEFINED
#
- if FileType != 'PE32' and self.ModuleType != "USER_DEFINED":
+ if FileType != 'PE32' and self.ModuleType != SUP_MODULE_USER_DEFINED:
return EfiFile
#
@@ -488,14 +488,14 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
# Convert Fv File Type for PI1.1 SMM driver.
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
if Rule.FvFileType == 'DRIVER':
Rule.FvFileType = 'SMM'
#
# Framework SMM Driver has no SMM FV file type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
- if Rule.FvFileType == 'SMM' or Rule.FvFileType == 'SMM_CORE':
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if Rule.FvFileType == 'SMM' or Rule.FvFileType == SUP_MODULE_SMM_CORE:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName)
#
# 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 == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
if SectionType == 'DXE_DEPEX':
SectionType = 'SMM_DEPEX'
#
# Framework SMM Driver has no SMM_DEPEX section type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
if SectionType == 'SMM_DEPEX':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
NoStrip = True
- if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
+ if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):
if self.KeepReloc is not None:
NoStrip = self.KeepReloc
elif Rule.KeepReloc is not None:
@@ -761,7 +761,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
SecNum = '%d' %Index
GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \
- Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum
+ Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum
Index = Index + 1
OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)
File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch)
@@ -804,7 +804,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
else:
SecNum = '%d' %Index
GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \
- Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum
+ Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum
OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)
GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch)
@@ -902,7 +902,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
# @retval string File name of the generated section file
#
def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):
- if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
+ if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):
if Rule.KeepReloc is not None:
self.KeepRelocFromRule = Rule.KeepReloc
SectFiles = []
@@ -941,13 +941,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
# Convert Fv Section Type for PI1.1 SMM driver.
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
if Sect.SectionType == 'DXE_DEPEX':
Sect.SectionType = 'SMM_DEPEX'
#
# Framework SMM Driver has no SMM_DEPEX section type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
if Sect.SectionType == 'SMM_DEPEX':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
#
diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/Source/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 *
## generate FV image section
#
@@ -74,7 +75,7 @@ class FvImageSection(FvImageSectionClassObject):
if FvAlignmentValue > MaxFvAlignment:
MaxFvAlignment = FvAlignmentValue
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get("FV_IMAGE"))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get("FV_IMAGE"))
GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
@@ -138,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject):
#
# Prepare the parameter of GenSection
#
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))
GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/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 *
## generate GUIDed section
#
@@ -121,7 +122,7 @@ class GuidSection(GuidSectionClassObject) :
OutputFile = OutputPath + \
os.sep + \
ModuleName + \
- 'SEC' + \
+ SUP_MODULE_SEC + \
SecNum + \
Ffs.SectionSuffix['GUIDED']
OutputFile = os.path.normpath(OutputFile)
@@ -156,7 +157,7 @@ class GuidSection(GuidSectionClassObject) :
TempFile = OutputPath + \
os.sep + \
ModuleName + \
- 'SEC' + \
+ SUP_MODULE_SEC + \
SecNum + \
'.tmp'
TempFile = 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
## generate UI section
#
@@ -57,7 +58,7 @@ class UiSection (UiSectionClassObject):
self.StringData = FfsInf.__ExtendMacro__(self.StringData)
self.FileName = FfsInf.__ExtendMacro__(self.FileName)
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('UI'))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('UI'))
if self.StringData is not None :
NameString = self.StringData
diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Source/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
## generate version section
#
@@ -59,7 +60,7 @@ class VerSection (VerSectionClassObject):
self.FileName = FfsInf.__ExtendMacro__(self.FileName)
OutputFile = os.path.join(OutputPath,
- ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('VERSION'))
+ ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('VERSION'))
OutputFile = os.path.normpath(OutputFile)
# 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):
# dict used to convert Component type to Module type
_MODULE_TYPE_ = {
- "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,
}
# regular expression for converting XXX_FLAGS in [nmake] section to new type
@@ -461,9 +461,9 @@ class InfBuildData(ModuleBuildClassObject):
if self._Header_ is None:
self._GetHeaderInfo()
if self._ModuleType is None:
- self._ModuleType = 'BASE'
+ self._ModuleType = SUP_MODULE_BASE
if self._ModuleType not in SUP_MODULE_LIST:
- self._ModuleType = "USER_DEFINED"
+ self._ModuleType = SUP_MODULE_USER_DEFINED
return self._ModuleType
## Retrieve COMPONENT_TYPE
@@ -472,7 +472,7 @@ class InfBuildData(ModuleBuildClassObject):
if self._Header_ is None:
self._GetHeaderInfo()
if self._ComponentType is None:
- self._ComponentType = 'USER_DEFINED'
+ self._ComponentType = SUP_MODULE_USER_DEFINED
return self._ComponentType
## Retrieve "BUILD_TYPE"
@@ -481,7 +481,7 @@ class InfBuildData(ModuleBuildClassObject):
if self._Header_ is None:
self._GetHeaderInfo()
if not self._BuildType:
- self._BuildType = "BASE"
+ self._BuildType = SUP_MODULE_BASE
return self._BuildType
## Retrieve file guid
@@ -899,14 +899,14 @@ class InfBuildData(ModuleBuildClassObject):
# PEIM and DXE drivers must have a valid [Depex] section
if len(self.LibraryClass) == 0 and len(RecordList) == 0:
- if self.ModuleType == 'DXE_DRIVER' or self.ModuleType == 'PEIM' or self.ModuleType == 'DXE_SMM_DRIVER' or \
- self.ModuleType == 'DXE_SAL_DRIVER' or self.ModuleType == 'DXE_RUNTIME_DRIVER':
+ if self.ModuleType == SUP_MODULE_DXE_DRIVER or self.ModuleType == SUP_MODULE_PEIM or self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER or \
+ self.ModuleType == SUP_MODULE_DXE_SAL_DRIVER or self.ModuleType == 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=self.MetaFile)
- if len(RecordList) != 0 and self.ModuleType == 'USER_DEFINED':
+ if len(RecordList) != 0 and self.ModuleType == SUP_MODULE_USER_DEFINED:
for Record in RecordList:
- if Record[4] not in ['PEIM', 'DXE_DRIVER', 'DXE_SMM_DRIVER']:
+ if Record[4] not in [SUP_MODULE_PEIM, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER]:
EdkLogger.error('build', FORMAT_INVALID,
"'%s' module must specify the type of [Depex] section" % self.ModuleType,
File=self.MetaFile)
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/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, BuildDatabase, Arch, Target, To
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
elif LibraryModule.LibraryClass is None \
or len(LibraryModule.LibraryClass) == 0 \
- or (ModuleType != 'USER_DEFINED'
+ or (ModuleType != SUP_MODULE_USER_DEFINED
and ModuleType not in LibraryModule.LibraryClass[0].SupModList):
# only USER_DEFINED can link against any library instance despite of its SupModList
return []
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/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 *
gComponentType2ModuleType = {
- "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,
}
## Pattern to extract contents in EDK DXS files
@@ -122,20 +122,20 @@ gPcdTypeMap = {
## The look up table to map module type to driver type
gDriverTypeMap = {
- '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)'
}
## The look up table of the supported opcode in the dependency expression binaries
@@ -424,7 +424,7 @@ class DepexReport(object):
if not ModuleType:
ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
- if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE", "SMM_CORE", "MM_CORE_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_UEFI_APPLICATION]:
return
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 == "DXE_SMM_DRIVER":
+ if ModuleType == SUP_MODULE_DXE_SMM_DRIVER:
PiSpec = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000")
if int(PiSpec, 0) >= 0x0001000A:
ModuleType = "SMM_DRIVER"
@@ -1382,7 +1382,7 @@ class PredictionReport(object):
# their source code to find PPI/Protocol produce or consume
# information.
#
- if Module.ModuleType == "BASE":
+ if Module.ModuleType == SUP_MODULE_BASE:
continue
#
# Add module referenced source files
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/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, ExtraData=ImageClass.ErrorInfo)
ImageInfo = PeImageInfo(Module.Name, Module.Guid, Module.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_MODULE_PEIM, 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', SUP_MODULE_DXE_CORE]:
PeiModuleList[Module.MetaFile] = ImageInfo
PeiSize += 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] = ImageInfo
BtSize += ImageInfo.Image.Size
- elif Module.ModuleType in ['DXE_RUNTIME_DRIVER', 'RT_DRIVER', 'DXE_SAL_DRIVER', 'SAL_RT_DRIVER']:
+ elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, 'RT_DRIVER', SUP_MODULE_DXE_SAL_DRIVER, 'SAL_RT_DRIVER']:
RtModuleList[Module.MetaFile] = ImageInfo
#IPF runtime driver needs to be at 2 page alignment.
if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0:
ImageInfo.Image.Size = (ImageInfo.Image.Size / 0x2000 + 1) * 0x2000
RtSize += 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_MODULE_DXE_SMM_DRIVER, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]:
SmmModuleList[Module.MetaFile] = ImageInfo
SmmSize += ImageInfo.Image.Size
- if Module.ModuleType == 'DXE_SMM_DRIVER':
+ if Module.ModuleType == SUP_MODULE_DXE_SMM_DRIVER:
PiSpecVersion = 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:
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 13/27] BaseTools: replace string constants used for module types
2018-04-26 16:57 ` [PATCH v2 13/27] BaseTools: replace string constants used for module types Jaben Carsey
@ 2018-04-27 9:53 ` Zhu, Yonghong
0 siblings, 0 replies; 9+ messages in thread
From: Zhu, Yonghong @ 2018-04-27 9:53 UTC (permalink / raw)
To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Carsey, Jaben
Sent: Friday, April 27, 2018 12:58 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [PATCH v2 13/27] BaseTools: replace string constants used for module 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 <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
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 database.
# The default Phase is DXE
#
- if M.ModuleType in ["PEIM", "PEI_CORE"]:
+ if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE]:
PcdFromModule.Phase = "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 MaxDatumSize set
if PcdFromModule.DatumType == TAB_VOID and PcdFromModule.MaxDatumSize in [None, '']:
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName))
- if M.ModuleType in ["PEIM", "PEI_CORE"]:
+ if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE]:
PcdFromModule.Phase = "PEI"
if PcdFromModule not in self._DynaPcdList_ and PcdFromModule.Type in GenC.gDynamicExPcd:
self._DynaPcdList_.append(PcdFromModule)
@@ -2203,7 +2203,7 @@ class PlatformAutoGen(AutoGen):
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
elif LibraryModule.LibraryClass is None \
or len(LibraryModule.LibraryClass) == 0 \
- or (ModuleType != 'USER_DEFINED'
+ or (ModuleType != SUP_MODULE_USER_DEFINED
and ModuleType not in LibraryModule.LibraryClass[0].SupModList):
# only USER_DEFINED can link against any library instance despite of its SupModList
EdkLogger.error("build", OPTION_MISSING,
@@ -3969,8 +3969,8 @@ class ModuleAutoGen(AutoGen):
break
ModuleType = self.ModuleType
- if ModuleType == 'UEFI_DRIVER' and self.DepexGenerated:
- ModuleType = 'DXE_DRIVER'
+ if ModuleType == SUP_MODULE_UEFI_DRIVER and self.DepexGenerated:
+ ModuleType = SUP_MODULE_DXE_DRIVER
DriverType = ''
if self.PcdIsDriver != '':
@@ -4047,11 +4047,11 @@ class ModuleAutoGen(AutoGen):
AsBuiltInfDict['binary_item'] += ['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'] += ['PEI_DEPEX|' + self.Name + '.depex']
- if self.ModuleType in ['DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'UEFI_DRIVER']:
+ if self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]:
AsBuiltInfDict['binary_item'] += ['DXE_DEPEX|' + self.Name + '.depex']
- if self.ModuleType in ['DXE_SMM_DRIVER']:
+ if self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]:
AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + '.depex']
Bin = self._GenOffsetBin()
@@ -4377,8 +4377,8 @@ class ModuleAutoGen(AutoGen):
return
for ModuleType in self.DepexList:
- # Ignore empty [depex] section or [depex] section for "USER_DEFINED" module
- if len(self.DepexList[ModuleType]) == 0 or ModuleType == "USER_DEFINED":
+ # Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module
+ if len(self.DepexList[ModuleType]) == 0 or ModuleType == SUP_MODULE_USER_DEFINED:
continue
Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)
diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/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__ == '__main__':
EdkLogger.Initialize()
if len(sys.argv) > 1:
Br = 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__ == '__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])
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/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}
]
gLibraryStructorPrototype = {
-'BASE' : TemplateString("""${BEGIN}
+SUP_MODULE_BASE : TemplateString("""${BEGIN}
RETURN_STATUS
EFIAPI
${Function} (
@@ -686,7 +686,7 @@ ${Function} (
}
gLibraryStructorCall = {
-'BASE' : TemplateString("""${BEGIN}
+SUP_MODULE_BASE : TemplateString("""${BEGIN}
Status = ${Function} ();
ASSERT_EFI_ERROR (Status);${END}
"""),
@@ -709,7 +709,7 @@ gLibraryStructorCall = {
## Library Constructor and Destructor Templates
gLibraryString = {
-'BASE' : TemplateString("""
+SUP_MODULE_BASE : TemplateString("""
${BEGIN}${FunctionPrototype}${END}
VOID
@@ -772,21 +772,21 @@ ${FunctionCall}${END}
gBasicHeaderFile = "Base.h"
gModuleTypeHeaderFile = {
- "BASE" : [gBasicHeaderFile],
- "SEC" : ["PiPei.h", "Library/DebugLib.h"],
- "PEI_CORE" : ["PiPei.h", "Library/DebugLib.h", "Library/PeiCoreEntryPoint.h"],
- "PEIM" : ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"],
- "DXE_CORE" : ["PiDxe.h", "Library/DebugLib.h", "Library/DxeCoreEntryPoint.h"],
- "DXE_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
- "DXE_SMM_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
- "DXE_RUNTIME_DRIVER": ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
- "DXE_SAL_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
- "UEFI_DRIVER" : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
- "UEFI_APPLICATION" : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"],
- "SMM_CORE" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
- "MM_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmDriverStandaloneEntryPoint.h"],
- "MM_CORE_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.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", "Library/PeiCoreEntryPoint.h"],
+ SUP_MODULE_PEIM : ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"],
+ SUP_MODULE_DXE_CORE : ["PiDxe.h", "Library/DebugLib.h", "Library/DxeCoreEntryPoint.h"],
+ SUP_MODULE_DXE_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_DXE_SMM_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_DXE_RUNTIME_DRIVER: ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_DXE_SAL_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_UEFI_DRIVER : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_UEFI_APPLICATION : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"],
+ SUP_MODULE_SMM_CORE : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_MM_STANDALONE : ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmDriverStandaloneEntryPoint.h"],
+ SUP_MODULE_MM_CORE_STANDALONE : ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmCoreStandaloneEntryPoint.h"],
+ SUP_MODULE_USER_DEFINED : [gBasicHeaderFile]
}
## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName
@@ -1406,17 +1406,17 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
if len(Lib.ConstructorList) <= 0:
continue
Dict = {'Function':Lib.ConstructorList}
- if Lib.ModuleType in ['BASE', 'SEC']:
- ConstructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict))
- ConstructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict))
- elif Lib.ModuleType in ['PEI_CORE','PEIM']:
+ if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
+ ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
+ ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
+ elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:
ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
- elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
- 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','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['DXE'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
- elif Lib.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']:
+ elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CORE_STANDALONE]:
ConstructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict))
@@ -1437,14 +1437,14 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
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_APPLICATION','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_CORE_STANDALONE]:
AutoGenC.Append(gLibraryString['MM'].Replace(Dict))
## Create code for library destructor
@@ -1468,17 +1468,17 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
if len(Lib.DestructorList) <= 0:
continue
Dict = {'Function':Lib.DestructorList}
- if Lib.ModuleType in ['BASE', 'SEC']:
- DestructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict))
- DestructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(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['PEI'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
- elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
- 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', '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['DXE'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
- elif Lib.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']:
+ elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CORE_STANDALONE]:
DestructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict))
@@ -1499,14 +1499,14 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
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_APPLICATION','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_CORE_STANDALONE]:
AutoGenC.Append(gLibraryString['MM'].Replace(Dict))
@@ -1517,7 +1517,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
# @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, AutoGenH):
'UefiSpecVersion': UefiSpecVersion + 'U'
}
- if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE', 'MM_CORE_STANDALONE']:
+ if Info.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE]:
if Info.SourceFileList:
if NumEntryPoints != 1:
EdkLogger.error(
@@ -1547,43 +1547,43 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
File=str(Info),
ExtraData= ", ".join(Info.Module.ModuleEntryPointList)
)
- if Info.ModuleType == 'PEI_CORE':
+ if Info.ModuleType == SUP_MODULE_PEI_CORE:
AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))
AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'DXE_CORE':
+ elif Info.ModuleType == SUP_MODULE_DXE_CORE:
AutoGenC.Append(gDxeCoreEntryPointString.Replace(Dict))
AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'SMM_CORE':
+ elif Info.ModuleType == SUP_MODULE_SMM_CORE:
AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict))
AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'MM_CORE_STANDALONE':
+ elif Info.ModuleType == SUP_MODULE_MM_CORE_STANDALONE:
AutoGenC.Append(gMmCoreStandaloneEntryPointString.Replace(Dict))
AutoGenH.Append(gMmCoreStandaloneEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'PEIM':
+ elif Info.ModuleType == 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_DRIVER','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].Replace(Dict))
else:
AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict))
AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'DXE_SMM_DRIVER':
+ elif Info.ModuleType == SUP_MODULE_DXE_SMM_DRIVER:
if NumEntryPoints == 0:
AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict))
else:
AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict))
AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType == 'MM_STANDALONE':
+ elif Info.ModuleType == 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 == 'UEFI_APPLICATION':
+ elif Info.ModuleType == SUP_MODULE_UEFI_APPLICATION:
if NumEntryPoints < 2:
AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(Dict))
else:
@@ -1597,7 +1597,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
# @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, AutoGenH):
# @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 = "GUID"
else:
GuidType = "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 = "GUID"
else:
GuidType = "EFI_GUID"
@@ -1665,7 +1665,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
# @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 = "GUID"
else:
GuidType = "EFI_GUID"
@@ -1702,7 +1702,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
# Add extern declarations to AutoGen.h if one or more Token Space GUIDs 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 = "GUID"
else:
GuidType = "EFI_GUID"
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 *
## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END"
gStartClosePattern = re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*", re.S)
## Mapping between module type and EFI phase
gType2Phase = {
- "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",
}
## Convert dependency expression string into EFI internal representation
@@ -299,12 +300,12 @@ class DependencyExpression:
NewOperand.append(Token)
# don't generate depex if only TRUE operand left
- if self.ModuleType == 'PEIM' and len(NewOperand) == 1 and NewOperand[0] == 'TRUE':
+ if self.ModuleType == SUP_MODULE_PEIM and len(NewOperand) == 1 and NewOperand[0] == 'TRUE':
self.PostfixNotation = []
return
# don't generate depex if all operands are architecture protocols
- if self.ModuleType in ['UEFI_DRIVER', 'DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER', 'MM_STANDALONE'] and \
+ if self.ModuleType in [SUP_MODULE_UEFI_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_MM_STANDALONE] and \
Op == 'AND' and \
self.ArchProtocols == set([GuidStructureStringToGuidString(Guid) for Guid in AllOperand]):
self.PostfixNotation = []
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 = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
EDK_COMPONENT_TYPE_SECUARITY_CORE = 'SECUARITY_CORE'
-EDK_COMPONENT_TYPE_PEI_CORE = 'PEI_CORE'
+EDK_COMPONENT_TYPE_PEI_CORE = SUP_MODULE_PEI_CORE
EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER'
EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM'
EDK_COMPONENT_TYPE_RELOCATABLE_PEIM = '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.<BR>
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -744,7 +744,7 @@ class Check(object):
if Item not in LibraryClasses[List[0]]:
LibraryClasses[List[0]].append(Item)
- if Record[2] != 'BASE' and Record[2] not in SupModType:
+ if Record[2] != DT.SUP_MODULE_BASE and Record[2] not in SupModType:
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2, OtherMsg="The Library Class '%s' does not specify its supported module types" % (List[0]), BelongsToTable='Inf', BelongsToItem=Record[0])
SqlCommand = """select A.ID, A.Value1, B.Value3 from Inf as A left join Inf as B
@@ -763,7 +763,7 @@ class Check(object):
for Record in RecordSet:
if Record[1] in LibraryClasses:
- if Record[2] not in LibraryClasses[Record[1]] and 'BASE' not in RecordDict[Record[1]]:
+ if Record[2] not in LibraryClasses[Record[1]] and DT.SUP_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="The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[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 *
## generate compress section
#
@@ -82,7 +83,7 @@ class CompressSection (CompressSectionClassObject) :
OutputFile = OutputPath + \
os.sep + \
ModuleName + \
- 'SEC' + \
+ SUP_MODULE_SEC + \
SecNum + \
Ffs.SectionSuffix['COMPRESS']
OutputFile = os.path.normpath(OutputFile)
diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/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.<BR>
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD 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 *
## generate data section
#
@@ -119,7 +120,7 @@ class DataSection (DataSectionClassObject):
)
self.SectFileName = TeFile
- OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get(self.SecType))
+ OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get(self.SecType))
OutputFile = os.path.normpath(OutputFile)
GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile)
FileList = [OutputFile]
diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/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 *
## generate data section
#
@@ -94,24 +95,24 @@ class DepexSection (DepexSectionClassObject):
self.ExpressionProcessed = True
if self.DepexType == 'PEI_DEPEX_EXP':
- ModuleType = 'PEIM'
+ ModuleType = SUP_MODULE_PEIM
SecType = 'PEI_DEPEX'
elif self.DepexType == 'DXE_DEPEX_EXP':
- ModuleType = 'DXE_DRIVER'
+ ModuleType = SUP_MODULE_DXE_DRIVER
SecType = 'DXE_DEPEX'
elif self.DepexType == 'SMM_DEPEX_EXP':
- ModuleType = 'DXE_SMM_DRIVER'
+ ModuleType = SUP_MODULE_DXE_SMM_DRIVER
SecType = 'SMM_DEPEX'
else:
EdkLogger.error("GenFds", FORMAT_INVALID,
"Depex type %s is not valid for module %s" % (self.DepexType, ModuleName))
- InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex')
+ InputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.depex')
InputFile = os.path.normpath(InputFile)
Depex = DependencyExpression(self.Expression, ModuleType)
Depex.Generate(InputFile)
- OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')
+ OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.dpx')
OutputFile = os.path.normpath(OutputFile)
GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)
diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/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 *
## generate rule section
#
@@ -66,7 +67,7 @@ class EfiSection (EfiSectionClassObject):
StringData = FfsInf.__ExtendMacro__(self.StringData)
ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
NoStrip = True
- if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType 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 = FfsInf.KeepReloc
elif FfsInf.KeepRelocFromRule is not None:
@@ -122,7 +123,7 @@ class EfiSection (EfiSectionClassObject):
BuildNumTuple = tuple()
Num = SecNum
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
#Ui=StringData,
Ver=BuildNum,
@@ -133,7 +134,7 @@ class EfiSection (EfiSectionClassObject):
for File in FileList:
Index = Index + 1
Num = '%s.%d' %(SecNum , Index)
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
f = open(File, 'r')
VerString = 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 = SecNum
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
#Ui=VerString,
Ver=BuildNum,
@@ -183,7 +184,7 @@ class EfiSection (EfiSectionClassObject):
Num = SecNum
if IsMakefile and StringData == ModuleNameStr:
StringData = "$(MODULE_NAME)"
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=StringData, IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
@@ -192,7 +193,7 @@ class EfiSection (EfiSectionClassObject):
for File in FileList:
Index = Index + 1
Num = '%s.%d' %(SecNum , Index)
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
f = open(File, 'r')
UiString = f.read()
f.close()
@@ -216,7 +217,7 @@ class EfiSection (EfiSectionClassObject):
Num = SecNum
if IsMakefile and StringData == ModuleNameStr:
StringData = "$(MODULE_NAME)"
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=StringData, IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
@@ -237,7 +238,7 @@ class EfiSection (EfiSectionClassObject):
""" Copy Map file to FFS output path """
Index = Index + 1
Num = '%s.%d' %(SecNum , Index)
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
File = GenFdsGlobalVariable.MacroExtend(File, Dict)
#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_PEIM, 'PEI_DXE_COMBO'):
return True
else:
return False
@@ -3626,12 +3626,12 @@ class FdfParser:
if not self.__GetNextWord():
raise Warning("expected Module type", self.FileName, self.CurrentLineNumber)
- if self.__Token.upper() not in ("SEC", "PEI_CORE", "PEIM", "DXE_CORE", \
- "DXE_DRIVER", "DXE_SAL_DRIVER", \
- "DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \
- "UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \
+ if self.__Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, \
+ SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, \
+ SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, \
+ SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \
"SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \
- "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALONE"):
+ "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "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
@@ -3673,8 +3673,8 @@ class FdfParser:
raise Warning("expected FFS type", self.FileName, self.CurrentLineNumber)
Type = self.__Token.strip().upper()
- if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\
- "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALONE"):
+ if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,\
+ "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
if not self.__IsToken("="):
diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Python/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 *
## generate FFS
#
@@ -24,27 +25,27 @@ class Ffs(FDClassObject):
# mapping between MODULE type in FDF (from INF) and file type for GenFfs
ModuleTypeToFileType = {
- '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_STANDALONE'
}
# mapping between FILE type in FDF and file type for GenFfs
FdfFvFileTypeToFileType = {
- '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_STANDALONE'
}
# 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)
# Check if current INF module has DEPEX
- if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != "USER_DEFINED" \
+ if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
ModuleType = self.InfModule.ModuleType
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
@@ -224,10 +224,10 @@ class FfsInfStatement(FfsInfStatementClassObject):
if len(self.SourceFileList) != 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))
- if self.ModuleType == 'SMM_CORE' and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if self.ModuleType == SUP_MODULE_SMM_CORE and int(self.PiSpecVersion, 16) < 0x0001000A:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.InfFileName)
- if self.ModuleType == 'MM_CORE_STANDALONE' and int(self.PiSpecVersion, 16) < 0x00010032:
+ if self.ModuleType == SUP_MODULE_MM_CORE_STANDALONE and int(self.PiSpecVersion, 16) < 0x00010032:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.InfFileName)
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_DEFINED
#
- if FileType != 'PE32' and self.ModuleType != "USER_DEFINED":
+ if FileType != 'PE32' and self.ModuleType != SUP_MODULE_USER_DEFINED:
return EfiFile
#
@@ -488,14 +488,14 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
# Convert Fv File Type for PI1.1 SMM driver.
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
if Rule.FvFileType == 'DRIVER':
Rule.FvFileType = 'SMM'
#
# Framework SMM Driver has no SMM FV file type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
- if Rule.FvFileType == 'SMM' or Rule.FvFileType == 'SMM_CORE':
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if Rule.FvFileType == 'SMM' or Rule.FvFileType == SUP_MODULE_SMM_CORE:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName)
#
# 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 == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
if SectionType == 'DXE_DEPEX':
SectionType = 'SMM_DEPEX'
#
# Framework SMM Driver has no SMM_DEPEX section type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
if SectionType == 'SMM_DEPEX':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
NoStrip = True
- if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
+ if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):
if self.KeepReloc is not None:
NoStrip = self.KeepReloc
elif Rule.KeepReloc is not None:
@@ -761,7 +761,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
SecNum = '%d' %Index
GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \
- Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum
+ Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum
Index = Index + 1
OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)
File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch)
@@ -804,7 +804,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
else:
SecNum = '%d' %Index
GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \
- Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum
+ Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum
OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)
GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch)
@@ -902,7 +902,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
# @retval string File name of the generated section file
#
def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):
- if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
+ if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):
if Rule.KeepReloc is not None:
self.KeepRelocFromRule = Rule.KeepReloc
SectFiles = []
@@ -941,13 +941,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
# Convert Fv Section Type for PI1.1 SMM driver.
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
if Sect.SectionType == 'DXE_DEPEX':
Sect.SectionType = 'SMM_DEPEX'
#
# Framework SMM Driver has no SMM_DEPEX section type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
if Sect.SectionType == 'SMM_DEPEX':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
#
diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/Source/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 *
## generate FV image section
#
@@ -74,7 +75,7 @@ class FvImageSection(FvImageSectionClassObject):
if FvAlignmentValue > MaxFvAlignment:
MaxFvAlignment = FvAlignmentValue
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get("FV_IMAGE"))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get("FV_IMAGE"))
GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
@@ -138,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject):
#
# Prepare the parameter of GenSection
#
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))
GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/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 *
## generate GUIDed section
#
@@ -121,7 +122,7 @@ class GuidSection(GuidSectionClassObject) :
OutputFile = OutputPath + \
os.sep + \
ModuleName + \
- 'SEC' + \
+ SUP_MODULE_SEC + \
SecNum + \
Ffs.SectionSuffix['GUIDED']
OutputFile = os.path.normpath(OutputFile)
@@ -156,7 +157,7 @@ class GuidSection(GuidSectionClassObject) :
TempFile = OutputPath + \
os.sep + \
ModuleName + \
- 'SEC' + \
+ SUP_MODULE_SEC + \
SecNum + \
'.tmp'
TempFile = 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
## generate UI section
#
@@ -57,7 +58,7 @@ class UiSection (UiSectionClassObject):
self.StringData = FfsInf.__ExtendMacro__(self.StringData)
self.FileName = FfsInf.__ExtendMacro__(self.FileName)
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('UI'))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('UI'))
if self.StringData is not None :
NameString = self.StringData
diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Source/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
## generate version section
#
@@ -59,7 +60,7 @@ class VerSection (VerSectionClassObject):
self.FileName = FfsInf.__ExtendMacro__(self.FileName)
OutputFile = os.path.join(OutputPath,
- ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('VERSION'))
+ ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('VERSION'))
OutputFile = os.path.normpath(OutputFile)
# 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):
# dict used to convert Component type to Module type
_MODULE_TYPE_ = {
- "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,
}
# regular expression for converting XXX_FLAGS in [nmake] section to new type
@@ -461,9 +461,9 @@ class InfBuildData(ModuleBuildClassObject):
if self._Header_ is None:
self._GetHeaderInfo()
if self._ModuleType is None:
- self._ModuleType = 'BASE'
+ self._ModuleType = SUP_MODULE_BASE
if self._ModuleType not in SUP_MODULE_LIST:
- self._ModuleType = "USER_DEFINED"
+ self._ModuleType = SUP_MODULE_USER_DEFINED
return self._ModuleType
## Retrieve COMPONENT_TYPE
@@ -472,7 +472,7 @@ class InfBuildData(ModuleBuildClassObject):
if self._Header_ is None:
self._GetHeaderInfo()
if self._ComponentType is None:
- self._ComponentType = 'USER_DEFINED'
+ self._ComponentType = SUP_MODULE_USER_DEFINED
return self._ComponentType
## Retrieve "BUILD_TYPE"
@@ -481,7 +481,7 @@ class InfBuildData(ModuleBuildClassObject):
if self._Header_ is None:
self._GetHeaderInfo()
if not self._BuildType:
- self._BuildType = "BASE"
+ self._BuildType = SUP_MODULE_BASE
return self._BuildType
## Retrieve file guid
@@ -899,14 +899,14 @@ class InfBuildData(ModuleBuildClassObject):
# PEIM and DXE drivers must have a valid [Depex] section
if len(self.LibraryClass) == 0 and len(RecordList) == 0:
- if self.ModuleType == 'DXE_DRIVER' or self.ModuleType == 'PEIM' or self.ModuleType == 'DXE_SMM_DRIVER' or \
- self.ModuleType == 'DXE_SAL_DRIVER' or self.ModuleType == 'DXE_RUNTIME_DRIVER':
+ if self.ModuleType == SUP_MODULE_DXE_DRIVER or self.ModuleType == SUP_MODULE_PEIM or self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER or \
+ self.ModuleType == SUP_MODULE_DXE_SAL_DRIVER or self.ModuleType == 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=self.MetaFile)
- if len(RecordList) != 0 and self.ModuleType == 'USER_DEFINED':
+ if len(RecordList) != 0 and self.ModuleType == SUP_MODULE_USER_DEFINED:
for Record in RecordList:
- if Record[4] not in ['PEIM', 'DXE_DRIVER', 'DXE_SMM_DRIVER']:
+ if Record[4] not in [SUP_MODULE_PEIM, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER]:
EdkLogger.error('build', FORMAT_INVALID,
"'%s' module must specify the type of [Depex] section" % self.ModuleType,
File=self.MetaFile)
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/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, BuildDatabase, Arch, Target, To
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
elif LibraryModule.LibraryClass is None \
or len(LibraryModule.LibraryClass) == 0 \
- or (ModuleType != 'USER_DEFINED'
+ or (ModuleType != SUP_MODULE_USER_DEFINED
and ModuleType not in LibraryModule.LibraryClass[0].SupModList):
# only USER_DEFINED can link against any library instance despite of its SupModList
return []
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/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 *
gComponentType2ModuleType = {
- "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,
}
## Pattern to extract contents in EDK DXS files
@@ -122,20 +122,20 @@ gPcdTypeMap = {
## The look up table to map module type to driver type
gDriverTypeMap = {
- '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)'
}
## The look up table of the supported opcode in the dependency expression binaries
@@ -424,7 +424,7 @@ class DepexReport(object):
if not ModuleType:
ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
- if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE", "SMM_CORE", "MM_CORE_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_UEFI_APPLICATION]:
return
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 == "DXE_SMM_DRIVER":
+ if ModuleType == SUP_MODULE_DXE_SMM_DRIVER:
PiSpec = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000")
if int(PiSpec, 0) >= 0x0001000A:
ModuleType = "SMM_DRIVER"
@@ -1382,7 +1382,7 @@ class PredictionReport(object):
# their source code to find PPI/Protocol produce or consume
# information.
#
- if Module.ModuleType == "BASE":
+ if Module.ModuleType == SUP_MODULE_BASE:
continue
#
# Add module referenced source files
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/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, ExtraData=ImageClass.ErrorInfo)
ImageInfo = PeImageInfo(Module.Name, Module.Guid, Module.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_MODULE_PEIM, 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', SUP_MODULE_DXE_CORE]:
PeiModuleList[Module.MetaFile] = ImageInfo
PeiSize += 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] = ImageInfo
BtSize += ImageInfo.Image.Size
- elif Module.ModuleType in ['DXE_RUNTIME_DRIVER', 'RT_DRIVER', 'DXE_SAL_DRIVER', 'SAL_RT_DRIVER']:
+ elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, 'RT_DRIVER', SUP_MODULE_DXE_SAL_DRIVER, 'SAL_RT_DRIVER']:
RtModuleList[Module.MetaFile] = ImageInfo
#IPF runtime driver needs to be at 2 page alignment.
if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0:
ImageInfo.Image.Size = (ImageInfo.Image.Size / 0x2000 + 1) * 0x2000
RtSize += 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_MODULE_DXE_SMM_DRIVER, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]:
SmmModuleList[Module.MetaFile] = ImageInfo
SmmSize += ImageInfo.Image.Size
- if Module.ModuleType == 'DXE_SMM_DRIVER':
+ if Module.ModuleType == SUP_MODULE_DXE_SMM_DRIVER:
PiSpecVersion = 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:
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 16/27] BaseTools: Replace EDK Component strings with predefined constant
[not found] <cover.1524761578.git.jaben.carsey@intel.com>
2018-04-26 16:57 ` [PATCH v2 13/27] BaseTools: replace string constants used for module types Jaben Carsey
@ 2018-04-26 16:57 ` Jaben Carsey
2018-04-26 16:57 ` [PATCH v2 18/27] BaseTools: Replace PCD type " Jaben Carsey
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Jaben Carsey @ 2018-04-26 16:57 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu
EDK_COMPONENT_TYPE_LIBRARY was 'LIBRARY'
EDK_COMPONENT_TYPE_SECURITY_CORE was 'SECURITY_CORE'
EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER was 'COMBINED_PEIM_DRIVER'
EDK_COMPONENT_TYPE_PIC_PEIM was 'PIC_PEIM'
EDK_COMPONENT_TYPE_RELOCATABLE_PEIM was 'RELOCATABLE_PEIM'
EDK_COMPONENT_TYPE_BS_DRIVER was 'BS_DRIVER'
EDK_COMPONENT_TYPE_RT_DRIVER was 'RT_DRIVER'
EDK_COMPONENT_TYPE_SAL_RT_DRIVER was 'SAL_RT_DRIVER'
EDK_COMPONENT_TYPE_APPLICATION was 'APPLICATION'
v2 - revert 2 files. will update later in own patches.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
BaseTools/Source/Python/Common/DataType.py | 28 ++++++++++----------
BaseTools/Source/Python/GenFds/FdfParser.py | 6 ++---
BaseTools/Source/Python/GenFds/Ffs.py | 2 +-
BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +-
BaseTools/Source/Python/build/BuildReport.py | 6 ++---
BaseTools/Source/Python/build/build.py | 8 +++---
6 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index cac455f9f7cf..ffd73d6852d1 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -84,7 +84,7 @@ SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE}
EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
-EDK_COMPONENT_TYPE_SECUARITY_CORE = 'SECUARITY_CORE'
+EDK_COMPONENT_TYPE_SECURITY_CORE = 'SECURITY_CORE'
EDK_COMPONENT_TYPE_PEI_CORE = SUP_MODULE_PEI_CORE
EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER'
EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM'
@@ -97,18 +97,18 @@ EDK_NAME = 'EDK'
EDKII_NAME = 'EDKII'
COMPONENT_TO_MODULE_MAP_DICT = {
- "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,
+ EDK_COMPONENT_TYPE_LIBRARY : SUP_MODULE_BASE,
+ EDK_COMPONENT_TYPE_SECURITY_CORE : SUP_MODULE_SEC,
+ EDK_COMPONENT_TYPE_PEI_CORE : SUP_MODULE_PEI_CORE,
+ EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER : SUP_MODULE_PEIM,
+ EDK_COMPONENT_TYPE_PIC_PEIM : SUP_MODULE_PEIM,
+ EDK_COMPONENT_TYPE_RELOCATABLE_PEIM : SUP_MODULE_PEIM,
+ "PE32_PEIM" : SUP_MODULE_PEIM,
+ EDK_COMPONENT_TYPE_BS_DRIVER : SUP_MODULE_DXE_DRIVER,
+ EDK_COMPONENT_TYPE_RT_DRIVER : SUP_MODULE_DXE_RUNTIME_DRIVER,
+ EDK_COMPONENT_TYPE_SAL_RT_DRIVER : SUP_MODULE_DXE_SAL_DRIVER,
+ EDK_COMPONENT_TYPE_APPLICATION : SUP_MODULE_UEFI_APPLICATION,
+ "LOGO" : SUP_MODULE_BASE,
}
BINARY_FILE_TYPE_FW = 'FW'
@@ -129,7 +129,7 @@ BINARY_FILE_TYPE_UI = 'UI'
BINARY_FILE_TYPE_BIN = 'BIN'
BINARY_FILE_TYPE_FV = 'FV'
-PLATFORM_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
+PLATFORM_COMPONENT_TYPE_LIBRARY = EDK_COMPONENT_TYPE_LIBRARY
PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS = 'LIBRARY_CLASS'
PLATFORM_COMPONENT_TYPE_MODULE = 'MODULE'
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index db8947e4b453..d15656c5fc6c 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -3630,8 +3630,8 @@ class FdfParser:
SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, \
SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, \
SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \
- "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \
- "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
+ EDK_COMPONENT_TYPE_SECURITY_CORE, EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, \
+ "PE32_PEIM", EDK_COMPONENT_TYPE_BS_DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER, EDK_COMPONENT_TYPE_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
@@ -3674,7 +3674,7 @@ class FdfParser:
Type = self.__Token.strip().upper()
if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,\
- "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
+ "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, EDK_COMPONENT_TYPE_APPLICATION, "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
if not self.__IsToken("="):
diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Python/GenFds/Ffs.py
index fc760ae8beda..f15d2330ce58 100644
--- a/BaseTools/Source/Python/GenFds/Ffs.py
+++ b/BaseTools/Source/Python/GenFds/Ffs.py
@@ -48,7 +48,7 @@ class Ffs(FDClassObject):
SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE',
'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM',
'DRIVER' : 'EFI_FV_FILETYPE_DRIVER',
- 'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION',
+ EDK_COMPONENT_TYPE_APPLICATION : 'EFI_FV_FILETYPE_APPLICATION',
'FV_IMAGE' : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE',
'RAW' : 'EFI_FV_FILETYPE_RAW',
'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER',
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index d64a281a98f7..27ef163eb40c 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -344,7 +344,7 @@ class InfBuildData(ModuleBuildClassObject):
self._BuildType = self._ComponentType.upper()
if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT:
self._ModuleType = COMPONENT_TO_MODULE_MAP_DICT[self._ComponentType]
- if self._ComponentType == 'LIBRARY':
+ if self._ComponentType == EDK_COMPONENT_TYPE_LIBRARY:
self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)]
# make use some [nmake] section macros
Macros = self._Macros
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index b25350e4bf9d..05d4f4d5dca8 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -599,7 +599,7 @@ class ModuleReport(object):
self.ModulePcdSet.setdefault((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Type), (Pcd.InfDefaultValue, Pcd.DefaultValue))
self.LibraryReport = None
- if "LIBRARY" in ReportType:
+ if EDK_COMPONENT_TYPE_LIBRARY in ReportType:
self.LibraryReport = LibraryReport(M)
self.DepexReport = None
@@ -702,7 +702,7 @@ class ModuleReport(object):
if "PCD" in ReportType:
GlobalPcdReport.GenerateReport(File, self.ModulePcdSet)
- if "LIBRARY" in ReportType:
+ if EDK_COMPONENT_TYPE_LIBRARY in ReportType:
self.LibraryReport.GenerateReport(File)
if "DEPEX" in ReportType:
@@ -2097,7 +2097,7 @@ class BuildReport(object):
if ReportTypeItem not in self.ReportType:
self.ReportType.append(ReportTypeItem)
else:
- self.ReportType = ["PCD", "LIBRARY", "BUILD_FLAGS", "DEPEX", "HASH", "FLASH", "FIXED_ADDRESS"]
+ self.ReportType = ["PCD", EDK_COMPONENT_TYPE_LIBRARY, "BUILD_FLAGS", "DEPEX", "HASH", "FLASH", "FIXED_ADDRESS"]
##
# Adds platform report to the list
#
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 81d59dd3eedf..29ad0c7228c7 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -1587,13 +1587,13 @@ class Build():
if not ImageClass.IsValid:
EdkLogger.error("build", FILE_PARSE_FAILURE, ExtraData=ImageClass.ErrorInfo)
ImageInfo = PeImageInfo(Module.Name, Module.Guid, Module.Arch, Module.OutputDir, Module.DebugDir, ImageClass)
- if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', SUP_MODULE_DXE_CORE]:
+ if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, SUP_MODULE_DXE_CORE]:
PeiModuleList[Module.MetaFile] = ImageInfo
PeiSize += ImageInfo.Image.Size
- elif Module.ModuleType in ['BS_DRIVER', SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]:
+ elif Module.ModuleType in [EDK_COMPONENT_TYPE_BS_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]:
BtModuleList[Module.MetaFile] = ImageInfo
BtSize += ImageInfo.Image.Size
- elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, 'RT_DRIVER', SUP_MODULE_DXE_SAL_DRIVER, 'SAL_RT_DRIVER']:
+ elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER]:
RtModuleList[Module.MetaFile] = ImageInfo
#IPF runtime driver needs to be at 2 page alignment.
if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0:
@@ -2356,7 +2356,7 @@ def MyOptionParser():
Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")
Parser.add_option("-y", "--report-file", action="store", dest="ReportFile", help="Create/overwrite the report to the specified filename.")
- Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['PCD','LIBRARY','FLASH','DEPEX','BUILD_FLAGS','FIXED_ADDRESS','HASH','EXECUTION_ORDER'], dest="ReportType", default=[],
+ Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['PCD',EDK_COMPONENT_TYPE_LIBRARY,'FLASH','DEPEX','BUILD_FLAGS','FIXED_ADDRESS','HASH','EXECUTION_ORDER'], dest="ReportType", default=[],
help="Flags that control the type of build report to generate. Must be one of: [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS, HASH, EXECUTION_ORDER]. "\
"To specify more than one flag, repeat this option on the command line and the default flag set is [PCD, LIBRARY, FLASH, DEPEX, HASH, BUILD_FLAGS, FIXED_ADDRESS]")
Parser.add_option("-F", "--flag", action="store", type="string", dest="Flag",
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 18/27] BaseTools: Replace PCD type strings with predefined constant
[not found] <cover.1524761578.git.jaben.carsey@intel.com>
2018-04-26 16:57 ` [PATCH v2 13/27] BaseTools: replace string constants used for module types Jaben Carsey
2018-04-26 16:57 ` [PATCH v2 16/27] BaseTools: Replace EDK Component strings with predefined constant Jaben Carsey
@ 2018-04-26 16:57 ` Jaben Carsey
2018-04-27 9:54 ` Zhu, Yonghong
2018-04-26 16:57 ` [PATCH v2 19/27] BaseTools: Replace Binary File " Jaben Carsey
2018-04-26 16:57 ` [PATCH v2 21/27] BaseTools: replace string " Jaben Carsey
4 siblings, 1 reply; 9+ messages in thread
From: Jaben Carsey @ 2018-04-26 16:57 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu
v2 - fix YongHong's comment.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
BaseTools/Source/Python/AutoGen/AutoGen.py | 4 +--
BaseTools/Source/Python/AutoGen/GenC.py | 4 +--
BaseTools/Source/Python/AutoGen/GenPcdDb.py | 2 +-
BaseTools/Source/Python/Common/DataType.py | 3 ++
BaseTools/Source/Python/Common/MigrationUtilities.py | 2 +-
BaseTools/Source/Python/GenFds/FfsInfStatement.py | 2 +-
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 4 +--
BaseTools/Source/Python/Workspace/DecBuildData.py | 22 +++++++-------
BaseTools/Source/Python/Workspace/DscBuildData.py | 22 +++++++-------
BaseTools/Source/Python/Workspace/InfBuildData.py | 26 ++++++++---------
BaseTools/Source/Python/build/BuildReport.py | 30 ++++++++++----------
11 files changed, 62 insertions(+), 59 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 86caeacb4874..2a6fa05ab819 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -869,8 +869,8 @@ class WorkspaceAutoGen(AutoGen):
def _CheckPcdDefineAndType(self):
PcdTypeList = [
TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG,
- TAB_PCDS_DYNAMIC, #"DynamicHii", "DynamicVpd",
- TAB_PCDS_DYNAMIC_EX, # "DynamicExHii", "DynamicExVpd"
+ TAB_PCDS_DYNAMIC, #TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_VPD,
+ TAB_PCDS_DYNAMIC_EX, # TAB_PCDS_DYNAMIC_EX_HII, TAB_PCDS_DYNAMIC_EX_VPD
]
# This dict store PCDs which are not used by any modules with specified arches
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 34cb789cecb7..73cda208a7eb 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -28,8 +28,8 @@ from IdfClassObject import *
## PCD type string
gItemTypeStringDatabase = {
- TAB_PCDS_FEATURE_FLAG : 'FixedAtBuild',
- TAB_PCDS_FIXED_AT_BUILD : 'FixedAtBuild',
+ TAB_PCDS_FEATURE_FLAG : TAB_PCDS_FIXED_AT_BUILD,
+ TAB_PCDS_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
TAB_PCDS_PATCHABLE_IN_MODULE: 'BinaryPatch',
TAB_PCDS_DYNAMIC : '',
TAB_PCDS_DYNAMIC_DEFAULT : '',
diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index e0d1918e9805..b48ddcd59ec8 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -1217,7 +1217,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
Pcd.InitString = 'UNINIT'
if Pcd.DatumType == TAB_VOID:
- if Pcd.Type not in ["DynamicVpd", "DynamicExVpd"]:
+ if Pcd.Type not in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
Pcd.TokenTypeList = ['PCD_TYPE_STRING']
else:
Pcd.TokenTypeList = []
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 77d76066f71a..2662132e5106 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -220,6 +220,9 @@ TAB_PCDS_DYNAMIC_HII = 'DynamicHii'
PCD_DYNAMIC_TYPE_SET = {TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII}
PCD_DYNAMIC_EX_TYPE_SET = {TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII}
+# leave as a list for order
+PCD_TYPE_LIST = [TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX]
+
TAB_PCDS_FIXED_AT_BUILD_NULL = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD
TAB_PCDS_FIXED_AT_BUILD_COMMON = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_COMMON
TAB_PCDS_FIXED_AT_BUILD_IA32 = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_IA32
diff --git a/BaseTools/Source/Python/Common/MigrationUtilities.py b/BaseTools/Source/Python/Common/MigrationUtilities.py
index e9f1cabcb794..0c93c72a60f6 100644
--- a/BaseTools/Source/Python/Common/MigrationUtilities.py
+++ b/BaseTools/Source/Python/Common/MigrationUtilities.py
@@ -34,7 +34,7 @@ def SetCommon(Common, XmlCommon):
XmlTag = "Usage"
Common.Usage = XmlAttribute(XmlCommon, XmlTag).split()
- XmlTag = "FeatureFlag"
+ XmlTag = TAB_PCDS_FEATURE_FLAG
Common.FeatureFlag = XmlAttribute(XmlCommon, XmlTag)
XmlTag = "SupArchList"
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index f973cf2f0b76..9068157ba616 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -249,7 +249,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
Pcd = InfPcds[PcdKey]
if not hasattr(Pcd, 'Offset'):
continue
- if Pcd.Type != 'PatchableInModule':
+ if Pcd.Type != TAB_PCDS_PATCHABLE_IN_MODULE:
continue
# Override Patchable PCD value by the value from DSC
PatchPcd = None
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index 6745a89514b7..909d043c2a22 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -809,7 +809,7 @@ class GenFdsGlobalVariable:
for Key in PcdDict:
PcdObj = PcdDict[Key]
if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
- if PcdObj.Type != 'FixedAtBuild':
+ if PcdObj.Type != DataType.TAB_PCDS_FIXED_AT_BUILD:
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
if PcdObj.DatumType != DataType.TAB_VOID:
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
@@ -825,7 +825,7 @@ class GenFdsGlobalVariable:
for Key in PcdDict:
PcdObj = PcdDict[Key]
if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
- if PcdObj.Type != 'FixedAtBuild':
+ if PcdObj.Type != DataType.TAB_PCDS_FIXED_AT_BUILD:
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
if PcdObj.DatumType != DataType.TAB_VOID:
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py
index 31870e078cec..1fbd095f743c 100644
--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -27,17 +27,17 @@ from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, Pc
class DecBuildData(PackageBuildClassObject):
# dict used to convert PCD type in database to string used by build tool
_PCD_TYPE_STRING_ = {
- MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild",
- MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule",
- MODEL_PCD_FEATURE_FLAG : "FeatureFlag",
- MODEL_PCD_DYNAMIC : "Dynamic",
- MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic",
- MODEL_PCD_DYNAMIC_HII : "DynamicHii",
- MODEL_PCD_DYNAMIC_VPD : "DynamicVpd",
- MODEL_PCD_DYNAMIC_EX : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii",
- MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd",
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
}
# dict used to convert part of [Defines] to members of DecBuildData directly
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1446af99b11e..bc9726202d3c 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -163,17 +163,17 @@ def GetDependencyList(FileStack,SearchPathList):
class DscBuildData(PlatformBuildClassObject):
# dict used to convert PCD type in database to string used by build tool
_PCD_TYPE_STRING_ = {
- MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild",
- MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule",
- MODEL_PCD_FEATURE_FLAG : "FeatureFlag",
- MODEL_PCD_DYNAMIC : "Dynamic",
- MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic",
- MODEL_PCD_DYNAMIC_HII : "DynamicHii",
- MODEL_PCD_DYNAMIC_VPD : "DynamicVpd",
- MODEL_PCD_DYNAMIC_EX : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii",
- MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd",
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
}
# dict used to convert part of [Defines] to members of DscBuildData directly
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 94f142e8e617..157f7a2d2de8 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -28,17 +28,17 @@ from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClassObjec
class InfBuildData(ModuleBuildClassObject):
# dict used to convert PCD type in database to string used by build tool
_PCD_TYPE_STRING_ = {
- MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild",
- MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule",
- MODEL_PCD_FEATURE_FLAG : "FeatureFlag",
- MODEL_PCD_DYNAMIC : "Dynamic",
- MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic",
- MODEL_PCD_DYNAMIC_HII : "DynamicHii",
- MODEL_PCD_DYNAMIC_VPD : "DynamicVpd",
- MODEL_PCD_DYNAMIC_EX : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii",
- MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd",
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
}
# dict used to convert part of [Defines] to members of InfBuildData directly
@@ -1026,13 +1026,13 @@ class InfBuildData(ModuleBuildClassObject):
# if platform doesn't give its type, use 'lowest' one in the
# following order, if any
#
- # "FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"
+ # TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX
#
_GuidDict.update(Package.Guids)
PcdType = self._PCD_TYPE_STRING_[Type]
if Type == MODEL_PCD_DYNAMIC:
Pcd.Pending = True
- for T in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
+ for T in PCD_TYPE_LIST:
if (PcdRealName, TokenSpaceGuid) in GlobalData.MixedPcd:
for item in GlobalData.MixedPcd[(PcdRealName, TokenSpaceGuid)]:
if str(item[0]).endswith(T) and (item[0], item[1], T) in Package.Pcds:
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 05d4f4d5dca8..a771b5b3c739 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -94,15 +94,15 @@ gSubSectionSep = "-" * gLineMaxLength
## The look up table to map PCD type to pair of report display type and DEC type
gPcdTypeMap = {
- 'FixedAtBuild' : ('FIXED', 'FixedAtBuild'),
- 'PatchableInModule': ('PATCH', 'PatchableInModule'),
- 'FeatureFlag' : ('FLAG', 'FeatureFlag'),
- 'Dynamic' : ('DYN', 'Dynamic'),
- 'DynamicHii' : ('DYNHII', 'Dynamic'),
- 'DynamicVpd' : ('DYNVPD', 'Dynamic'),
- 'DynamicEx' : ('DEX', 'DynamicEx'),
- 'DynamicExHii' : ('DEXHII', 'DynamicEx'),
- 'DynamicExVpd' : ('DEXVPD', 'DynamicEx'),
+ TAB_PCDS_FIXED_AT_BUILD : ('FIXED', TAB_PCDS_FIXED_AT_BUILD),
+ TAB_PCDS_PATCHABLE_IN_MODULE: ('PATCH', TAB_PCDS_PATCHABLE_IN_MODULE),
+ TAB_PCDS_FEATURE_FLAG : ('FLAG', TAB_PCDS_FEATURE_FLAG),
+ TAB_PCDS_DYNAMIC : ('DYN', TAB_PCDS_DYNAMIC),
+ TAB_PCDS_DYNAMIC_HII : ('DYNHII', TAB_PCDS_DYNAMIC),
+ TAB_PCDS_DYNAMIC_VPD : ('DYNVPD', TAB_PCDS_DYNAMIC),
+ TAB_PCDS_DYNAMIC_EX : ('DEX', TAB_PCDS_DYNAMIC_EX),
+ TAB_PCDS_DYNAMIC_EX_HII : ('DEXHII', TAB_PCDS_DYNAMIC_EX),
+ TAB_PCDS_DYNAMIC_EX_VPD : ('DEXVPD', TAB_PCDS_DYNAMIC_EX),
}
## The look up table to map module type to driver type
@@ -784,7 +784,7 @@ class PcdReport(object):
Pcd = Pa.Platform.Pcds[item]
if not Pcd.Type:
# check the Pcd in FDF file, whether it is used in module first
- for T in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
+ for T in PCD_TYPE_LIST:
PcdList = self.AllPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(T, [])
if Pcd in PcdList:
Pcd.Type = T
@@ -792,7 +792,7 @@ class PcdReport(object):
if not Pcd.Type:
PcdTypeFlag = False
for package in Pa.PackageList:
- for T in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
+ for T in PCD_TYPE_LIST:
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, T) in package.Pcds:
Pcd.Type = T
PcdTypeFlag = True
@@ -804,10 +804,10 @@ class PcdReport(object):
if not Pcd.DatumType:
PcdType = Pcd.Type
# Try to remove Hii and Vpd suffix
- if PcdType.startswith("DynamicEx"):
- PcdType = "DynamicEx"
- elif PcdType.startswith("Dynamic"):
- PcdType = "Dynamic"
+ if PcdType.startswith(TAB_PCDS_DYNAMIC_EX):
+ PcdType = TAB_PCDS_DYNAMIC_EX
+ elif PcdType.startswith(TAB_PCDS_DYNAMIC):
+ PcdType = TAB_PCDS_DYNAMIC
for package in Pa.PackageList:
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType) in package.Pcds:
Pcd.DatumType = package.Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType)].DatumType
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 18/27] BaseTools: Replace PCD type strings with predefined constant
2018-04-26 16:57 ` [PATCH v2 18/27] BaseTools: Replace PCD type " Jaben Carsey
@ 2018-04-27 9:54 ` Zhu, Yonghong
0 siblings, 0 replies; 9+ messages in thread
From: Zhu, Yonghong @ 2018-04-27 9:54 UTC (permalink / raw)
To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Carsey, Jaben
Sent: Friday, April 27, 2018 12:58 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [PATCH v2 18/27] BaseTools: Replace PCD type strings with predefined constant
v2 - fix YongHong's comment.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
BaseTools/Source/Python/AutoGen/AutoGen.py | 4 +--
BaseTools/Source/Python/AutoGen/GenC.py | 4 +--
BaseTools/Source/Python/AutoGen/GenPcdDb.py | 2 +-
BaseTools/Source/Python/Common/DataType.py | 3 ++
BaseTools/Source/Python/Common/MigrationUtilities.py | 2 +-
BaseTools/Source/Python/GenFds/FfsInfStatement.py | 2 +-
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 4 +--
BaseTools/Source/Python/Workspace/DecBuildData.py | 22 +++++++-------
BaseTools/Source/Python/Workspace/DscBuildData.py | 22 +++++++-------
BaseTools/Source/Python/Workspace/InfBuildData.py | 26 ++++++++---------
BaseTools/Source/Python/build/BuildReport.py | 30 ++++++++++----------
11 files changed, 62 insertions(+), 59 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 86caeacb4874..2a6fa05ab819 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -869,8 +869,8 @@ class WorkspaceAutoGen(AutoGen):
def _CheckPcdDefineAndType(self):
PcdTypeList = [
TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG,
- TAB_PCDS_DYNAMIC, #"DynamicHii", "DynamicVpd",
- TAB_PCDS_DYNAMIC_EX, # "DynamicExHii", "DynamicExVpd"
+ TAB_PCDS_DYNAMIC, #TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_VPD,
+ TAB_PCDS_DYNAMIC_EX, # TAB_PCDS_DYNAMIC_EX_HII,
+ TAB_PCDS_DYNAMIC_EX_VPD
]
# This dict store PCDs which are not used by any modules with specified arches diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 34cb789cecb7..73cda208a7eb 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -28,8 +28,8 @@ from IdfClassObject import *
## PCD type string
gItemTypeStringDatabase = {
- TAB_PCDS_FEATURE_FLAG : 'FixedAtBuild',
- TAB_PCDS_FIXED_AT_BUILD : 'FixedAtBuild',
+ TAB_PCDS_FEATURE_FLAG : TAB_PCDS_FIXED_AT_BUILD,
+ TAB_PCDS_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
TAB_PCDS_PATCHABLE_IN_MODULE: 'BinaryPatch',
TAB_PCDS_DYNAMIC : '',
TAB_PCDS_DYNAMIC_DEFAULT : '',
diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index e0d1918e9805..b48ddcd59ec8 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -1217,7 +1217,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
Pcd.InitString = 'UNINIT'
if Pcd.DatumType == TAB_VOID:
- if Pcd.Type not in ["DynamicVpd", "DynamicExVpd"]:
+ if Pcd.Type not in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
Pcd.TokenTypeList = ['PCD_TYPE_STRING']
else:
Pcd.TokenTypeList = []
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 77d76066f71a..2662132e5106 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -220,6 +220,9 @@ TAB_PCDS_DYNAMIC_HII = 'DynamicHii'
PCD_DYNAMIC_TYPE_SET = {TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII} PCD_DYNAMIC_EX_TYPE_SET = {TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII}
+# leave as a list for order
+PCD_TYPE_LIST = [TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE,
+TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX]
+
TAB_PCDS_FIXED_AT_BUILD_NULL = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD TAB_PCDS_FIXED_AT_BUILD_COMMON = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_COMMON
TAB_PCDS_FIXED_AT_BUILD_IA32 = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_IA32 diff --git a/BaseTools/Source/Python/Common/MigrationUtilities.py b/BaseTools/Source/Python/Common/MigrationUtilities.py
index e9f1cabcb794..0c93c72a60f6 100644
--- a/BaseTools/Source/Python/Common/MigrationUtilities.py
+++ b/BaseTools/Source/Python/Common/MigrationUtilities.py
@@ -34,7 +34,7 @@ def SetCommon(Common, XmlCommon):
XmlTag = "Usage"
Common.Usage = XmlAttribute(XmlCommon, XmlTag).split()
- XmlTag = "FeatureFlag"
+ XmlTag = TAB_PCDS_FEATURE_FLAG
Common.FeatureFlag = XmlAttribute(XmlCommon, XmlTag)
XmlTag = "SupArchList"
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index f973cf2f0b76..9068157ba616 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -249,7 +249,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
Pcd = InfPcds[PcdKey]
if not hasattr(Pcd, 'Offset'):
continue
- if Pcd.Type != 'PatchableInModule':
+ if Pcd.Type != TAB_PCDS_PATCHABLE_IN_MODULE:
continue
# Override Patchable PCD value by the value from DSC
PatchPcd = None
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index 6745a89514b7..909d043c2a22 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -809,7 +809,7 @@ class GenFdsGlobalVariable:
for Key in PcdDict:
PcdObj = PcdDict[Key]
if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
- if PcdObj.Type != 'FixedAtBuild':
+ if PcdObj.Type != DataType.TAB_PCDS_FIXED_AT_BUILD:
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
if PcdObj.DatumType != DataType.TAB_VOID:
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern) @@ -825,7 +825,7 @@ class GenFdsGlobalVariable:
for Key in PcdDict:
PcdObj = PcdDict[Key]
if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
- if PcdObj.Type != 'FixedAtBuild':
+ if PcdObj.Type != DataType.TAB_PCDS_FIXED_AT_BUILD:
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
if PcdObj.DatumType != DataType.TAB_VOID:
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern) diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py
index 31870e078cec..1fbd095f743c 100644
--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -27,17 +27,17 @@ from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, Pc class DecBuildData(PackageBuildClassObject):
# dict used to convert PCD type in database to string used by build tool
_PCD_TYPE_STRING_ = {
- MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild",
- MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule",
- MODEL_PCD_FEATURE_FLAG : "FeatureFlag",
- MODEL_PCD_DYNAMIC : "Dynamic",
- MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic",
- MODEL_PCD_DYNAMIC_HII : "DynamicHii",
- MODEL_PCD_DYNAMIC_VPD : "DynamicVpd",
- MODEL_PCD_DYNAMIC_EX : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii",
- MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd",
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
}
# dict used to convert part of [Defines] to members of DecBuildData directly diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1446af99b11e..bc9726202d3c 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -163,17 +163,17 @@ def GetDependencyList(FileStack,SearchPathList):
class DscBuildData(PlatformBuildClassObject):
# dict used to convert PCD type in database to string used by build tool
_PCD_TYPE_STRING_ = {
- MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild",
- MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule",
- MODEL_PCD_FEATURE_FLAG : "FeatureFlag",
- MODEL_PCD_DYNAMIC : "Dynamic",
- MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic",
- MODEL_PCD_DYNAMIC_HII : "DynamicHii",
- MODEL_PCD_DYNAMIC_VPD : "DynamicVpd",
- MODEL_PCD_DYNAMIC_EX : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii",
- MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd",
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
}
# dict used to convert part of [Defines] to members of DscBuildData directly diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 94f142e8e617..157f7a2d2de8 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -28,17 +28,17 @@ from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClassObjec class InfBuildData(ModuleBuildClassObject):
# dict used to convert PCD type in database to string used by build tool
_PCD_TYPE_STRING_ = {
- MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild",
- MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule",
- MODEL_PCD_FEATURE_FLAG : "FeatureFlag",
- MODEL_PCD_DYNAMIC : "Dynamic",
- MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic",
- MODEL_PCD_DYNAMIC_HII : "DynamicHii",
- MODEL_PCD_DYNAMIC_VPD : "DynamicVpd",
- MODEL_PCD_DYNAMIC_EX : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx",
- MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii",
- MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd",
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
}
# dict used to convert part of [Defines] to members of InfBuildData directly @@ -1026,13 +1026,13 @@ class InfBuildData(ModuleBuildClassObject):
# if platform doesn't give its type, use 'lowest' one in the
# following order, if any
#
- # "FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"
+ # TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX
#
_GuidDict.update(Package.Guids)
PcdType = self._PCD_TYPE_STRING_[Type]
if Type == MODEL_PCD_DYNAMIC:
Pcd.Pending = True
- for T in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
+ for T in PCD_TYPE_LIST:
if (PcdRealName, TokenSpaceGuid) in GlobalData.MixedPcd:
for item in GlobalData.MixedPcd[(PcdRealName, TokenSpaceGuid)]:
if str(item[0]).endswith(T) and (item[0], item[1], T) in Package.Pcds:
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 05d4f4d5dca8..a771b5b3c739 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -94,15 +94,15 @@ gSubSectionSep = "-" * gLineMaxLength
## The look up table to map PCD type to pair of report display type and DEC type gPcdTypeMap = {
- 'FixedAtBuild' : ('FIXED', 'FixedAtBuild'),
- 'PatchableInModule': ('PATCH', 'PatchableInModule'),
- 'FeatureFlag' : ('FLAG', 'FeatureFlag'),
- 'Dynamic' : ('DYN', 'Dynamic'),
- 'DynamicHii' : ('DYNHII', 'Dynamic'),
- 'DynamicVpd' : ('DYNVPD', 'Dynamic'),
- 'DynamicEx' : ('DEX', 'DynamicEx'),
- 'DynamicExHii' : ('DEXHII', 'DynamicEx'),
- 'DynamicExVpd' : ('DEXVPD', 'DynamicEx'),
+ TAB_PCDS_FIXED_AT_BUILD : ('FIXED', TAB_PCDS_FIXED_AT_BUILD),
+ TAB_PCDS_PATCHABLE_IN_MODULE: ('PATCH', TAB_PCDS_PATCHABLE_IN_MODULE),
+ TAB_PCDS_FEATURE_FLAG : ('FLAG', TAB_PCDS_FEATURE_FLAG),
+ TAB_PCDS_DYNAMIC : ('DYN', TAB_PCDS_DYNAMIC),
+ TAB_PCDS_DYNAMIC_HII : ('DYNHII', TAB_PCDS_DYNAMIC),
+ TAB_PCDS_DYNAMIC_VPD : ('DYNVPD', TAB_PCDS_DYNAMIC),
+ TAB_PCDS_DYNAMIC_EX : ('DEX', TAB_PCDS_DYNAMIC_EX),
+ TAB_PCDS_DYNAMIC_EX_HII : ('DEXHII', TAB_PCDS_DYNAMIC_EX),
+ TAB_PCDS_DYNAMIC_EX_VPD : ('DEXVPD', TAB_PCDS_DYNAMIC_EX),
}
## The look up table to map module type to driver type @@ -784,7 +784,7 @@ class PcdReport(object):
Pcd = Pa.Platform.Pcds[item]
if not Pcd.Type:
# check the Pcd in FDF file, whether it is used in module first
- for T in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
+ for T in PCD_TYPE_LIST:
PcdList = self.AllPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(T, [])
if Pcd in PcdList:
Pcd.Type = T @@ -792,7 +792,7 @@ class PcdReport(object):
if not Pcd.Type:
PcdTypeFlag = False
for package in Pa.PackageList:
- for T in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
+ for T in PCD_TYPE_LIST:
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, T) in package.Pcds:
Pcd.Type = T
PcdTypeFlag = True @@ -804,10 +804,10 @@ class PcdReport(object):
if not Pcd.DatumType:
PcdType = Pcd.Type
# Try to remove Hii and Vpd suffix
- if PcdType.startswith("DynamicEx"):
- PcdType = "DynamicEx"
- elif PcdType.startswith("Dynamic"):
- PcdType = "Dynamic"
+ if PcdType.startswith(TAB_PCDS_DYNAMIC_EX):
+ PcdType = TAB_PCDS_DYNAMIC_EX
+ elif PcdType.startswith(TAB_PCDS_DYNAMIC):
+ PcdType = TAB_PCDS_DYNAMIC
for package in Pa.PackageList:
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType) in package.Pcds:
Pcd.DatumType = package.Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType)].DatumType
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 19/27] BaseTools: Replace Binary File type strings with predefined constant
[not found] <cover.1524761578.git.jaben.carsey@intel.com>
` (2 preceding siblings ...)
2018-04-26 16:57 ` [PATCH v2 18/27] BaseTools: Replace PCD type " Jaben Carsey
@ 2018-04-26 16:57 ` Jaben Carsey
2018-05-02 7:04 ` Zhu, Yonghong
2018-04-26 16:57 ` [PATCH v2 21/27] BaseTools: replace string " Jaben Carsey
4 siblings, 1 reply; 9+ messages in thread
From: Jaben Carsey @ 2018-04-26 16:57 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu
BINARY_FILE_TYPE_FW was 'FW'
BINARY_FILE_TYPE_GUID was 'GUID'
BINARY_FILE_TYPE_PREEFORM was 'PREEFORM'
BINARY_FILE_TYPE_UEFI_APP was 'UEFI_APP'
BINARY_FILE_TYPE_UNI_UI was 'UNI_UI'
BINARY_FILE_TYPE_UNI_VER was 'UNI_VER'
BINARY_FILE_TYPE_LIB was 'LIB'
BINARY_FILE_TYPE_PE32 was 'PE32'
BINARY_FILE_TYPE_PIC was 'PIC'
BINARY_FILE_TYPE_PEI_DEPEX was 'PEI_DEPEX'
BINARY_FILE_TYPE_DXE_DEPEX was 'DXE_DEPEX'
BINARY_FILE_TYPE_SMM_DEPEX was 'SMM_DEPEX'
BINARY_FILE_TYPE_TE was 'TE'
BINARY_FILE_TYPE_VER was 'VER'
BINARY_FILE_TYPE_UI was 'UI'
BINARY_FILE_TYPE_BIN was 'BIN'
BINARY_FILE_TYPE_FV was 'FV'
v2 - split apart FV and GUID types with different meanings.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
BaseTools/Source/Python/AutoGen/AutoGen.py | 12 +--
BaseTools/Source/Python/AutoGen/GenC.py | 8 +-
BaseTools/Source/Python/AutoGen/GenPcdDb.py | 4 +-
BaseTools/Source/Python/Common/DataType.py | 2 +
BaseTools/Source/Python/Common/Expression.py | 2 +-
BaseTools/Source/Python/Common/Misc.py | 4 +-
BaseTools/Source/Python/GenFds/DataSection.py | 6 +-
BaseTools/Source/Python/GenFds/DepexSection.py | 6 +-
BaseTools/Source/Python/GenFds/EfiSection.py | 10 +--
BaseTools/Source/Python/GenFds/Fd.py | 3 +-
BaseTools/Source/Python/GenFds/FdfParser.py | 92 ++++++++++----------
BaseTools/Source/Python/GenFds/Ffs.py | 14 +--
BaseTools/Source/Python/GenFds/FfsInfStatement.py | 22 ++---
BaseTools/Source/Python/GenFds/Fv.py | 4 +-
BaseTools/Source/Python/GenFds/GenFds.py | 10 +--
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 4 +-
BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 2 +-
BaseTools/Source/Python/GenFds/Region.py | 5 +-
BaseTools/Source/Python/GenFds/Section.py | 46 +++++-----
BaseTools/Source/Python/GenFds/UiSection.py | 2 +-
BaseTools/Source/Python/Trim/Trim.py | 2 +-
BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +-
BaseTools/Source/Python/build/BuildReport.py | 12 +--
24 files changed, 140 insertions(+), 136 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 2a6fa05ab819..671f02133aca 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -922,7 +922,7 @@ class WorkspaceAutoGen(AutoGen):
## Return the directory to store FV files
def _GetFvDir(self):
if self._FvDir is None:
- self._FvDir = path.join(self.BuildDir, 'FV')
+ self._FvDir = path.join(self.BuildDir, TAB_FV_DIRECTORY)
return self._FvDir
## Return the directory to store all intermediate and final files built
@@ -1325,7 +1325,7 @@ class PlatformAutoGen(AutoGen):
def UpdateNVStoreMaxSize(self,OrgVpdFile):
if self.VariableInfo:
- VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid)
+ VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)
PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if item.TokenCName == "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName == "gEfiMdeModulePkgTokenSpaceGuid"]
if PcdNvStoreDfBuffer:
@@ -1718,7 +1718,7 @@ class PlatformAutoGen(AutoGen):
# Process VPD map file generated by third party BPDG tool
if NeedProcessVpdMapFile:
- VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid)
+ VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)
if os.path.exists(VpdMapFilePath):
VpdFile.Read(VpdMapFilePath)
@@ -1769,7 +1769,7 @@ class PlatformAutoGen(AutoGen):
self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList
def FixVpdOffset(self,VpdFile ):
- FvPath = os.path.join(self.BuildDir, "FV")
+ FvPath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY)
if not os.path.exists(FvPath):
try:
os.makedirs(FvPath)
@@ -1782,7 +1782,7 @@ class PlatformAutoGen(AutoGen):
# retrieve BPDG tool's path from tool_def.txt according to VPD_TOOL_GUID defined in DSC file.
BPDGToolName = None
for ToolDef in self.ToolDefinition.values():
- if ToolDef.has_key("GUID") and ToolDef["GUID"] == self.Platform.VpdToolGuid:
+ if ToolDef.has_key(TAB_GUID) and ToolDef[TAB_GUID] == self.Platform.VpdToolGuid:
if not ToolDef.has_key("PATH"):
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "PATH attribute was not provided for BPDG guid tool %s in tools_def.txt" % self.Platform.VpdToolGuid)
BPDGToolName = ToolDef["PATH"]
@@ -3031,7 +3031,7 @@ class ModuleAutoGen(AutoGen):
def _GetFfsOutputDir(self):
if self._FfsOutputDir is None:
if GlobalData.gFdfParser is not None:
- self._FfsOutputDir = path.join(self.PlatformInfo.BuildDir, "FV", "Ffs", self.Guid + self.Name)
+ self._FfsOutputDir = path.join(self.PlatformInfo.BuildDir, TAB_FV_DIRECTORY, "Ffs", self.Guid + self.Name)
else:
self._FfsOutputDir = ''
return self._FfsOutputDir
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 73cda208a7eb..4ceadd449222 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1612,7 +1612,7 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
#
def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
- GuidType = "GUID"
+ GuidType = TAB_GUID
else:
GuidType = "EFI_GUID"
@@ -1636,7 +1636,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
#
def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
- GuidType = "GUID"
+ GuidType = TAB_GUID
else:
GuidType = "EFI_GUID"
@@ -1660,7 +1660,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
#
def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
- GuidType = "GUID"
+ GuidType = TAB_GUID
else:
GuidType = "EFI_GUID"
@@ -1697,7 +1697,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
if TokenSpaceList:
AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in this module\n\n")
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
- GuidType = "GUID"
+ GuidType = TAB_GUID
else:
GuidType = "EFI_GUID"
for Item in TokenSpaceList:
diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index b48ddcd59ec8..fab6859edb2f 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -972,7 +972,7 @@ def CreatePcdDatabaseCode (Info, AutoGenC, AutoGenH):
AutoGenC.Append(AdditionalAutoGenC.String)
if Info.IsBinaryModule:
- DbFileName = os.path.join(Info.PlatformInfo.BuildDir, "FV", Phase + "PcdDataBase.raw")
+ DbFileName = os.path.join(Info.PlatformInfo.BuildDir, TAB_FV_DIRECTORY, Phase + "PcdDataBase.raw")
else:
DbFileName = os.path.join(Info.OutputDir, Phase + "PcdDataBase.raw")
DbFile = StringIO()
@@ -1054,7 +1054,7 @@ def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform,Phase):
PcdDriverAutoGenData[(skuname,skuid)] = (AdditionalAutoGenH, AdditionalAutoGenC)
VarCheckTableData[(skuname,skuid)] = VarCheckTab
if Platform.Platform.VarCheckFlag:
- dest = os.path.join(Platform.BuildDir, 'FV')
+ dest = os.path.join(Platform.BuildDir, TAB_FV_DIRECTORY)
VarCheckTable = CreateVarCheckBin(VarCheckTableData)
VarCheckTable.dump(dest, Phase)
AdditionalAutoGenH, AdditionalAutoGenC = CreateAutoGen(PcdDriverAutoGenData)
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 2662132e5106..5030df27b4da 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -40,6 +40,7 @@ TAB_UINT16 = 'UINT16'
TAB_UINT32 = 'UINT32'
TAB_UINT64 = 'UINT64'
TAB_VOID = 'VOID*'
+TAB_GUID = 'GUID'
TAB_PCD_CLEAN_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64}
TAB_PCD_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN'}
@@ -48,6 +49,7 @@ TAB_PCD_NUMERIC_TYPES_VOID = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BO
TAB_EDK_SOURCE = '$(EDK_SOURCE)'
TAB_EFI_SOURCE = '$(EFI_SOURCE)'
TAB_WORKSPACE = '$(WORKSPACE)'
+TAB_FV_DIRECTORY = 'FV'
TAB_ARCH_NULL = ''
TAB_ARCH_COMMON = 'COMMON'
diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py
index 53504c110d6d..9fec10d2bb9c 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -951,7 +951,7 @@ class ValueExpressionEx(ValueExpression):
Size = 0
ValueStr = ''
TokenSpaceGuidName = ''
- if Item.startswith('GUID') and Item.endswith(')'):
+ if Item.startswith(TAB_GUID) and Item.endswith(')'):
try:
TokenSpaceGuidName = re.search('GUID\((\w+)\)', Item).group(1)
except:
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index f05ae39ebb29..3d205197abfc 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1219,7 +1219,7 @@ class tdict:
def IsFieldValueAnArray (Value):
Value = Value.strip()
- if Value.startswith('GUID') and Value.endswith(')'):
+ if Value.startswith(TAB_GUID) and Value.endswith(')'):
return True
if Value.startswith('L"') and Value.endswith('"') and len(list(Value[2:-1])) > 1:
return True
@@ -1316,7 +1316,7 @@ def ParseFieldValue (Value):
if Size > 8:
raise BadExpression('Value (%s) Size larger than %d' % (Value, Size))
return Value, 8
- if Value.startswith('GUID') and Value.endswith(')'):
+ if Value.startswith(TAB_GUID) and Value.endswith(')'):
Value = Value.split('(', 1)[1][:-1].strip()
if Value[0] == '{' and Value[-1] == '}':
TmpValue = GuidStructureStringToGuidString(Value)
diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/Python/GenFds/DataSection.py
index 99d7392aaab3..29caa00c0d8d 100644
--- a/BaseTools/Source/Python/GenFds/DataSection.py
+++ b/BaseTools/Source/Python/GenFds/DataSection.py
@@ -82,7 +82,7 @@ class DataSection (DataSectionClassObject):
CopyLongFilePath(MapFile, CopyMapFile)
#Get PE Section alignment when align is set to AUTO
- if self.Alignment == 'Auto' and self.SecType in ('TE', 'PE32'):
+ if self.Alignment == 'Auto' and self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
ImageObj = PeImageClass (Filename)
if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment)
@@ -92,7 +92,7 @@ class DataSection (DataSectionClassObject):
self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'
NoStrip = True
- if self.SecType in ('TE', 'PE32'):
+ if self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
if self.KeepReloc is not None:
NoStrip = self.KeepReloc
@@ -110,7 +110,7 @@ class DataSection (DataSectionClassObject):
)
self.SectFileName = StrippedFile
- if self.SecType == 'TE':
+ if self.SecType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile,
diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/Python/GenFds/DepexSection.py
index d04160e890f1..f42162d5a27e 100644
--- a/BaseTools/Source/Python/GenFds/DepexSection.py
+++ b/BaseTools/Source/Python/GenFds/DepexSection.py
@@ -96,13 +96,13 @@ class DepexSection (DepexSectionClassObject):
if self.DepexType == 'PEI_DEPEX_EXP':
ModuleType = SUP_MODULE_PEIM
- SecType = 'PEI_DEPEX'
+ SecType = BINARY_FILE_TYPE_PEI_DEPEX
elif self.DepexType == 'DXE_DEPEX_EXP':
ModuleType = SUP_MODULE_DXE_DRIVER
- SecType = 'DXE_DEPEX'
+ SecType = BINARY_FILE_TYPE_DXE_DEPEX
elif self.DepexType == 'SMM_DEPEX_EXP':
ModuleType = SUP_MODULE_DXE_SMM_DRIVER
- SecType = 'SMM_DEPEX'
+ SecType = BINARY_FILE_TYPE_SMM_DEPEX
else:
EdkLogger.error("GenFds", FORMAT_INVALID,
"Depex type %s is not valid for module %s" % (self.DepexType, ModuleName))
diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py
index 1be23b4bf7fd..5405d0a8da13 100644
--- a/BaseTools/Source/Python/GenFds/EfiSection.py
+++ b/BaseTools/Source/Python/GenFds/EfiSection.py
@@ -67,7 +67,7 @@ class EfiSection (EfiSectionClassObject):
StringData = FfsInf.__ExtendMacro__(self.StringData)
ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
NoStrip = True
- if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM) and SectionType in ('TE', 'PE32'):
+ if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM) and SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
if FfsInf.KeepReloc is not None:
NoStrip = FfsInf.KeepReloc
elif FfsInf.KeepRelocFromRule is not None:
@@ -171,9 +171,9 @@ class EfiSection (EfiSectionClassObject):
OutputFileList.append(OutputFile)
#
- # If Section Type is 'UI'
+ # If Section Type is BINARY_FILE_TYPE_UI
#
- elif SectionType == 'UI':
+ elif SectionType == BINARY_FILE_TYPE_UI:
InfOverrideUiString = False
if FfsInf.Ui is not None:
@@ -242,7 +242,7 @@ class EfiSection (EfiSectionClassObject):
File = GenFdsGlobalVariable.MacroExtend(File, Dict)
#Get PE Section alignment when align is set to AUTO
- if self.Alignment == 'Auto' and (SectionType == 'PE32' or SectionType == 'TE'):
+ if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):
ImageObj = PeImageClass (File)
if ImageObj.SectionAlignment < 0x400:
Align = str (ImageObj.SectionAlignment)
@@ -287,7 +287,7 @@ class EfiSection (EfiSectionClassObject):
"""For TE Section call GenFw to generate TE image"""
- if SectionType == 'TE':
+ if SectionType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile,
diff --git a/BaseTools/Source/Python/GenFds/Fd.py b/BaseTools/Source/Python/GenFds/Fd.py
index cc4124ad902e..188ca28cd7ce 100644
--- a/BaseTools/Source/Python/GenFds/Fd.py
+++ b/BaseTools/Source/Python/GenFds/Fd.py
@@ -27,6 +27,7 @@ from Common import EdkLogger
from Common.BuildToolError import *
from Common.Misc import SaveFileOnChange
from GenFds import GenFds
+from Common.DataType import BINARY_FILE_TYPE_FV
## generate FD
#
@@ -158,7 +159,7 @@ class FD(FDClassObject):
FvAddDict ={}
FvList = []
for RegionObj in self.RegionList:
- if RegionObj.RegionType == 'FV':
+ if RegionObj.RegionType == BINARY_FILE_TYPE_FV:
if len(RegionObj.RegionDataList) == 1:
RegionData = RegionObj.RegionDataList[0]
FvList.append(RegionData.upper())
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 469cb128ba5f..49ed4041a287 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -1843,7 +1843,7 @@ class FdfParser:
if not self.__GetNextWord():
return True
- if not self.__Token in ("SET", "FV", "FILE", "DATA", "CAPSULE", "INF"):
+ if not self.__Token in ("SET", BINARY_FILE_TYPE_FV, "FILE", "DATA", "CAPSULE", "INF"):
#
# If next token is a word which is not a valid FV type, it might be part of [PcdOffset[|PcdSize]]
# Or it might be next region's offset described by an expression which starts with a PCD.
@@ -1874,7 +1874,7 @@ class FdfParser:
if not self.__GetNextWord():
return True
- elif self.__Token == "FV":
+ elif self.__Token == BINARY_FILE_TYPE_FV:
self.__UndoToken()
self.__GetRegionFvType( RegionObj)
@@ -1918,8 +1918,8 @@ class FdfParser:
#
def __GetRegionFvType(self, RegionObj):
- if not self.__IsKeyword( "FV"):
- raise Warning("expected Keyword 'FV'", self.FileName, self.CurrentLineNumber)
+ if not self.__IsKeyword( BINARY_FILE_TYPE_FV):
+ raise Warning("expected Keyword BINARY_FILE_TYPE_FV", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
@@ -1927,10 +1927,10 @@ class FdfParser:
if not self.__GetNextToken():
raise Warning("expected FV name", self.FileName, self.CurrentLineNumber)
- RegionObj.RegionType = "FV"
+ RegionObj.RegionType = BINARY_FILE_TYPE_FV
RegionObj.RegionDataList.append((self.__Token).upper())
- while self.__IsKeyword( "FV"):
+ while self.__IsKeyword( BINARY_FILE_TYPE_FV):
if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
@@ -2528,7 +2528,7 @@ class FdfParser:
if self.__GetStringData():
FfsInfObj.Version = self.__Token
- if self.__IsKeyword( "UI"):
+ if self.__IsKeyword( BINARY_FILE_TYPE_UI):
if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
@@ -2641,7 +2641,7 @@ class FdfParser:
#
@staticmethod
def __SectionCouldHaveRelocFlag (SectionType):
- if SectionType in ('TE', 'PE32'):
+ if SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
return True
else:
return False
@@ -2674,7 +2674,7 @@ class FdfParser:
if not self.__GetNextToken():
raise Warning("expected File name or section data", self.FileName, self.CurrentLineNumber)
- if self.__Token == "FV":
+ if self.__Token == BINARY_FILE_TYPE_FV:
if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
@@ -2881,7 +2881,7 @@ class FdfParser:
VerSectionObj.FileName = self.__Token
Obj.SectionList.append(VerSectionObj)
- elif self.__IsKeyword( "UI"):
+ elif self.__IsKeyword( BINARY_FILE_TYPE_UI):
if AlignValue == 'Auto':
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="):
@@ -2965,10 +2965,10 @@ class FdfParser:
self.SetFileBufferPos(OldPos)
return False
- if self.__Token not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
- "UI", "VERSION", "PEI_DEPEX", "SUBTYPE_GUID", "SMM_DEPEX"):
+ if self.__Token not in ("COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, "SUBTYPE_GUID", BINARY_FILE_TYPE_SMM_DEPEX):
raise Warning("Unknown section type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
- if AlignValue == 'Auto'and (not self.__Token == 'PE32') and (not self.__Token == 'TE'):
+ if AlignValue == 'Auto'and (not self.__Token == BINARY_FILE_TYPE_PE32) and (not self.__Token == BINARY_FILE_TYPE_TE):
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
# DataSection
@@ -3386,7 +3386,7 @@ class FdfParser:
#
def __GetFvStatement(self, CapsuleObj, FMPCapsule = False):
- if not self.__IsKeyword("FV"):
+ if not self.__IsKeyword(BINARY_FILE_TYPE_FV):
return False
if not self.__IsToken("="):
@@ -3534,7 +3534,7 @@ class FdfParser:
AfileBaseName = os.path.basename(AfileName)
if os.path.splitext(AfileBaseName)[1] not in [".bin",".BIN",".Bin",".dat",".DAT",".Dat",".data",".DATA",".Data"]:
- raise Warning('invalid binary file type, should be one of "bin","BIN","Bin","dat","DAT","Dat","data","DATA","Data"', \
+ raise Warning('invalid binary file type, should be one of "bin",BINARY_FILE_TYPE_BIN,"Bin","dat","DAT","Dat","data","DATA","Data"', \
self.FileName, self.CurrentLineNumber)
if not os.path.isabs(AfileName):
@@ -3767,8 +3767,8 @@ class FdfParser:
SectionName = self.__Token
- if SectionName not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
- "UI", "PEI_DEPEX", "VERSION", "SUBTYPE_GUID", "SMM_DEPEX"):
+ if SectionName not in ("COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, BINARY_FILE_TYPE_PEI_DEPEX, "VERSION", "SUBTYPE_GUID", BINARY_FILE_TYPE_SMM_DEPEX):
raise Warning("Unknown leaf section name '%s'" % SectionName, self.FileName, self.CurrentLineNumber)
@@ -3783,7 +3783,7 @@ class FdfParser:
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
- if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):
+ if self.__Token == 'Auto' and (not SectionName == BINARY_FILE_TYPE_PE32) and (not SectionName == BINARY_FILE_TYPE_TE):
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
SectAlignment = self.__Token
@@ -3824,8 +3824,8 @@ class FdfParser:
return False
SectionName = self.__Token
- if SectionName not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
- "UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_DEPEX"):
+ if SectionName not in ("COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX):
self.__UndoToken()
return False
@@ -3855,8 +3855,8 @@ class FdfParser:
FvImageSectionObj.FvName = None
else:
- if not self.__IsKeyword("FV"):
- raise Warning("expected 'FV'", self.FileName, self.CurrentLineNumber)
+ if not self.__IsKeyword(BINARY_FILE_TYPE_FV):
+ raise Warning("expected BINARY_FILE_TYPE_FV", self.FileName, self.CurrentLineNumber)
FvImageSectionObj.FvFileType = self.__Token
if self.__GetAlignment():
@@ -3868,8 +3868,8 @@ class FdfParser:
if self.__IsToken('|'):
FvImageSectionObj.FvFileExtension = self.__GetFileExtension()
elif self.__GetNextToken():
- if self.__Token not in ("}", "COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
- "UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_DEPEX"):
+ if self.__Token not in ("}", "COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX):
FvImageSectionObj.FvFileName = self.__Token
else:
self.__UndoToken()
@@ -3931,7 +3931,7 @@ class FdfParser:
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
- if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):
+ if self.__Token == 'Auto' and (not SectionName == BINARY_FILE_TYPE_PE32) and (not SectionName == BINARY_FILE_TYPE_TE):
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
EfiSectionObj.Alignment = self.__Token
@@ -3950,8 +3950,8 @@ class FdfParser:
if self.__IsToken('|'):
EfiSectionObj.FileExtension = self.__GetFileExtension()
elif self.__GetNextToken():
- if self.__Token not in ("}", "COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
- "UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_DEPEX"):
+ if self.__Token not in ("}", "COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX):
if self.__Token.startswith('PCD'):
self.__UndoToken()
@@ -3985,7 +3985,7 @@ class FdfParser:
#
@staticmethod
def __RuleSectionCouldBeOptional(SectionType):
- if SectionType in ("DXE_DEPEX", "UI", "VERSION", "PEI_DEPEX", "RAW", "SMM_DEPEX"):
+ if SectionType in (BINARY_FILE_TYPE_DXE_DEPEX, BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, "RAW", BINARY_FILE_TYPE_SMM_DEPEX):
return True
else:
return False
@@ -4015,7 +4015,7 @@ class FdfParser:
#
@staticmethod
def __RuleSectionCouldHaveString(SectionType):
- if SectionType in ("UI", "VERSION"):
+ if SectionType in (BINARY_FILE_TYPE_UI, "VERSION"):
return True
else:
return False
@@ -4032,32 +4032,32 @@ class FdfParser:
if SectionType == "COMPAT16":
if FileType not in ("COMPAT16", "SEC_COMPAT16"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "PE32":
- if FileType not in ("PE32", "SEC_PE32"):
+ elif SectionType == BINARY_FILE_TYPE_PE32:
+ if FileType not in (BINARY_FILE_TYPE_PE32, "SEC_PE32"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "PIC":
- if FileType not in ("PIC", "PIC"):
+ elif SectionType == BINARY_FILE_TYPE_PIC:
+ if FileType not in (BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_PIC):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "TE":
- if FileType not in ("TE", "SEC_TE"):
+ elif SectionType == BINARY_FILE_TYPE_TE:
+ if FileType not in (BINARY_FILE_TYPE_TE, "SEC_TE"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "RAW":
- if FileType not in ("BIN", "SEC_BIN", "RAW", "ASL", "ACPI"):
+ if FileType not in (BINARY_FILE_TYPE_BIN, "SEC_BIN", "RAW", "ASL", "ACPI"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "DXE_DEPEX" or SectionType == "SMM_DEPEX":
- if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX", "SMM_DEPEX"):
+ elif SectionType == BINARY_FILE_TYPE_DXE_DEPEX or SectionType == BINARY_FILE_TYPE_SMM_DEPEX:
+ if FileType not in (BINARY_FILE_TYPE_DXE_DEPEX, "SEC_DXE_DEPEX", BINARY_FILE_TYPE_SMM_DEPEX):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "UI":
- if FileType not in ("UI", "SEC_UI"):
+ elif SectionType == BINARY_FILE_TYPE_UI:
+ if FileType not in (BINARY_FILE_TYPE_UI, "SEC_UI"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "VERSION":
if FileType not in ("VERSION", "SEC_VERSION"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "PEI_DEPEX":
- if FileType not in ("PEI_DEPEX", "SEC_PEI_DEPEX"):
+ elif SectionType == BINARY_FILE_TYPE_PEI_DEPEX:
+ if FileType not in (BINARY_FILE_TYPE_PEI_DEPEX, "SEC_PEI_DEPEX"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "GUID":
- if FileType not in ("PE32", "SEC_GUID"):
+ elif SectionType == BINARY_FILE_TYPE_GUID:
+ if FileType not in (BINARY_FILE_TYPE_PE32, "SEC_GUID"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
## __GetRuleEncapsulationSection() method
@@ -4494,7 +4494,7 @@ class FdfParser:
FfsFileObj = OptRomFileStatement.OptRomFileStatement()
- if not self.__IsKeyword("EFI") and not self.__IsKeyword("BIN"):
+ if not self.__IsKeyword("EFI") and not self.__IsKeyword(BINARY_FILE_TYPE_BIN):
raise Warning("expected Binary type (EFI/BIN)", self.FileName, self.CurrentLineNumber)
FfsFileObj.FileType = self.__Token
@@ -4575,7 +4575,7 @@ class FdfParser:
if FdName.upper() in self.Profile.FdDict:
FdObj = self.Profile.FdDict[FdName.upper()]
for elementRegion in FdObj.RegionList:
- if elementRegion.RegionType == 'FV':
+ if elementRegion.RegionType == BINARY_FILE_TYPE_FV:
for elementRegionData in elementRegion.RegionDataList:
if elementRegionData.endswith(".fv"):
continue
diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Python/GenFds/Ffs.py
index f6a7f4b007f9..44ad01cb7354 100644
--- a/BaseTools/Source/Python/GenFds/Ffs.py
+++ b/BaseTools/Source/Python/GenFds/Ffs.py
@@ -42,12 +42,12 @@ class Ffs(FDClassObject):
# mapping between section type in FDF and file suffix
SectionSuffix = {
- 'PE32' : '.pe32',
- 'PIC' : '.pic',
- 'TE' : '.te',
- 'DXE_DEPEX' : '.dpx',
+ BINARY_FILE_TYPE_PE32 : '.pe32',
+ BINARY_FILE_TYPE_PIC : '.pic',
+ BINARY_FILE_TYPE_TE : '.te',
+ BINARY_FILE_TYPE_DXE_DEPEX : '.dpx',
'VERSION' : '.ver',
- 'UI' : '.ui',
+ BINARY_FILE_TYPE_UI : '.ui',
'COMPAT16' : '.com16',
'RAW' : '.raw',
'FREEFORM_SUBTYPE_GUID': '.guid',
@@ -55,8 +55,8 @@ class Ffs(FDClassObject):
'FV_IMAGE' : 'fv.sec',
'COMPRESS' : '.com',
'GUIDED' : '.guided',
- 'PEI_DEPEX' : '.dpx',
- 'SMM_DEPEX' : '.dpx'
+ BINARY_FILE_TYPE_PEI_DEPEX : '.dpx',
+ BINARY_FILE_TYPE_SMM_DEPEX : '.dpx'
}
## The constructor
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 9068157ba616..728997f17d1a 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -381,7 +381,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
# Only patch file if FileType is PE32 or ModuleType is USER_DEFINED
#
- if FileType != 'PE32' and self.ModuleType != SUP_MODULE_USER_DEFINED:
+ if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType != SUP_MODULE_USER_DEFINED:
return EfiFile
#
@@ -739,13 +739,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
# Convert Fv Section Type for PI1.1 SMM driver.
#
if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
- if SectionType == 'DXE_DEPEX':
- SectionType = 'SMM_DEPEX'
+ if SectionType == BINARY_FILE_TYPE_DXE_DEPEX:
+ SectionType = BINARY_FILE_TYPE_SMM_DEPEX
#
# Framework SMM Driver has no SMM_DEPEX section type
#
if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
- if SectionType == 'SMM_DEPEX':
+ if SectionType == BINARY_FILE_TYPE_SMM_DEPEX:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
NoStrip = True
if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):
@@ -767,7 +767,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch)
#Get PE Section alignment when align is set to AUTO
- if self.Alignment == 'Auto' and (SectionType == 'PE32' or SectionType == 'TE'):
+ if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):
ImageObj = PeImageClass (File)
if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment)
@@ -790,7 +790,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
)
File = StrippedFile
- if SectionType == 'TE':
+ if SectionType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile,
@@ -809,7 +809,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch)
#Get PE Section alignment when align is set to AUTO
- if self.Alignment == 'Auto' and (SectionType == 'PE32' or SectionType == 'TE'):
+ if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):
ImageObj = PeImageClass (GenSecInputFile)
if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment)
@@ -833,7 +833,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
)
GenSecInputFile = StrippedFile
- if SectionType == 'TE':
+ if SectionType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile,
@@ -942,13 +942,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
# Convert Fv Section Type for PI1.1 SMM driver.
#
if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
- if Sect.SectionType == 'DXE_DEPEX':
- Sect.SectionType = 'SMM_DEPEX'
+ if Sect.SectionType == BINARY_FILE_TYPE_DXE_DEPEX:
+ Sect.SectionType = BINARY_FILE_TYPE_SMM_DEPEX
#
# Framework SMM Driver has no SMM_DEPEX section type
#
if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
- if Sect.SectionType == 'SMM_DEPEX':
+ if Sect.SectionType == BINARY_FILE_TYPE_SMM_DEPEX:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
#
# process the inside FvImage from FvSection or GuidSection
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index 0fb2bd456a6d..37ad57d797d0 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -80,7 +80,7 @@ class FV (FvClassObject):
if self.CapsuleName is not None:
for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
for RegionObj in FdObj.RegionList:
- if RegionObj.RegionType == 'FV':
+ if RegionObj.RegionType == BINARY_FILE_TYPE_FV:
for RegionData in RegionObj.RegionDataList:
if RegionData.endswith(".fv"):
continue
@@ -236,7 +236,7 @@ class FV (FvClassObject):
for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
for RegionObj in FdObj.RegionList:
- if RegionObj.RegionType != 'FV':
+ if RegionObj.RegionType != BINARY_FILE_TYPE_FV:
continue
for RegionData in RegionObj.RegionDataList:
#
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 54c7d828305f..ccd137955dd8 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -315,7 +315,7 @@ def main():
for Fd in FdfParserObj.Profile.FdDict:
FdObj = FdfParserObj.Profile.FdDict[Fd]
for RegionObj in FdObj.RegionList:
- if RegionObj.RegionType != 'FV':
+ if RegionObj.RegionType != BINARY_FILE_TYPE_FV:
continue
for RegionData in RegionObj.RegionDataList:
if FvObj.UiFvName.upper() == RegionData.upper():
@@ -405,7 +405,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
KeyList[1] + \
'_' + \
KeyList[2]
- if Key in KeyStringList and KeyList[4] == 'GUID':
+ if Key in KeyStringList and KeyList[4] == TAB_GUID:
ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
ToolPath = ToolDefinition.get(ToolPathKey)
@@ -447,7 +447,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
if NameGuid == BuildOption[Op]:
KeyList = Op.split('_')
Key = KeyList[0] + '_' + KeyList[1] +'_' + KeyList[2]
- if Key in KeyStringList and KeyList[4] == 'GUID':
+ if Key in KeyStringList and KeyList[4] == TAB_GUID:
ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
if ToolPathKey in BuildOption:
@@ -589,7 +589,7 @@ class GenFds :
if FdObj is None:
for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
for ElementRegion in ElementFd.RegionList:
- if ElementRegion.RegionType == 'FV':
+ if ElementRegion.RegionType == BINARY_FILE_TYPE_FV:
for ElementRegionData in ElementRegion.RegionDataList:
if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:
if FvObj.BlockSizeList != []:
@@ -601,7 +601,7 @@ class GenFds :
return DefaultBlockSize
else:
for ElementRegion in FdObj.RegionList:
- if ElementRegion.RegionType == 'FV':
+ if ElementRegion.RegionType == BINARY_FILE_TYPE_FV:
for ElementRegionData in ElementRegion.RegionDataList:
if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:
if FvObj.BlockSizeList != []:
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index 909d043c2a22..2fb98007ab37 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -288,7 +288,7 @@ class GenFdsGlobalVariable:
# GenFdsGlobalVariable.OutputDirDict = OutputDir
GenFdsGlobalVariable.FdfParser = FdfParser
GenFdsGlobalVariable.WorkSpace = WorkSpace
- GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], 'FV')
+ GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], DataType.TAB_FV_DIRECTORY)
if not os.path.exists(GenFdsGlobalVariable.FvDir) :
os.makedirs(GenFdsGlobalVariable.FvDir)
GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
@@ -349,7 +349,7 @@ class GenFdsGlobalVariable:
GenFdsGlobalVariable.PlatformName = WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
GlobalData.gGlobalDefines['TARGET'],
GlobalData.gGlobalDefines['TOOLCHAIN']].PlatformName
- GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], 'FV')
+ GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], DataType.TAB_FV_DIRECTORY)
if not os.path.exists(GenFdsGlobalVariable.FvDir):
os.makedirs(GenFdsGlobalVariable.FvDir)
GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
index 8f8761b20589..a865ac4436d5 100644
--- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
@@ -141,7 +141,7 @@ class OptRomInfStatement (FfsInfStatement):
OutputFileList = []
for Sect in Rule.SectionList:
- if Sect.SectionType == 'PE32':
+ if Sect.SectionType == BINARY_FILE_TYPE_PE32:
if Sect.FileName is not None:
GenSecInputFile = self.__ExtendMacro__(Sect.FileName)
OutputFileList.append(GenSecInputFile)
diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py
index 44f122a71216..9d632b6321e2 100644
--- a/BaseTools/Source/Python/GenFds/Region.py
+++ b/BaseTools/Source/Python/GenFds/Region.py
@@ -26,6 +26,7 @@ from Common import EdkLogger
from Common.BuildToolError import *
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Common.DataType import BINARY_FILE_TYPE_FV
## generate Region
#
@@ -80,10 +81,10 @@ class Region(RegionClassObject):
GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" % Size)
GenFdsGlobalVariable.SharpCounter = 0
- if Flag and (self.RegionType != 'FV'):
+ if Flag and (self.RegionType != BINARY_FILE_TYPE_FV):
return
- if self.RegionType == 'FV':
+ if self.RegionType == BINARY_FILE_TYPE_FV:
#
# Get Fv from FvDict
#
diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py
index 4b368b3ada9d..5895998158b6 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -20,7 +20,7 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable
import Common.LongFilePathOs as os, glob
from Common import EdkLogger
from Common.BuildToolError import *
-from Common.DataType import TAB_ARCH_COMMON
+from Common.DataType import *
## section base class
#
@@ -29,37 +29,37 @@ class Section (SectionClassObject):
SectionType = {
'RAW' : 'EFI_SECTION_RAW',
'FREEFORM' : 'EFI_SECTION_FREEFORM_SUBTYPE_GUID',
- 'PE32' : 'EFI_SECTION_PE32',
- 'PIC' : 'EFI_SECTION_PIC',
- 'TE' : 'EFI_SECTION_TE',
+ BINARY_FILE_TYPE_PE32 : 'EFI_SECTION_PE32',
+ BINARY_FILE_TYPE_PIC : 'EFI_SECTION_PIC',
+ BINARY_FILE_TYPE_TE : 'EFI_SECTION_TE',
'FV_IMAGE' : 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE',
- 'DXE_DEPEX' : 'EFI_SECTION_DXE_DEPEX',
- 'PEI_DEPEX' : 'EFI_SECTION_PEI_DEPEX',
+ BINARY_FILE_TYPE_DXE_DEPEX : 'EFI_SECTION_DXE_DEPEX',
+ BINARY_FILE_TYPE_PEI_DEPEX : 'EFI_SECTION_PEI_DEPEX',
'GUIDED' : 'EFI_SECTION_GUID_DEFINED',
'COMPRESS' : 'EFI_SECTION_COMPRESSION',
- 'UI' : 'EFI_SECTION_USER_INTERFACE',
- 'SMM_DEPEX' : 'EFI_SECTION_SMM_DEPEX'
+ BINARY_FILE_TYPE_UI : 'EFI_SECTION_USER_INTERFACE',
+ BINARY_FILE_TYPE_SMM_DEPEX : 'EFI_SECTION_SMM_DEPEX'
}
BinFileType = {
- 'GUID' : '.guid',
+ BINARY_FILE_TYPE_GUID : '.guid',
'ACPI' : '.acpi',
'ASL' : '.asl' ,
- 'UEFI_APP' : '.app',
- 'LIB' : '.lib',
- 'PE32' : '.pe32',
- 'PIC' : '.pic',
- 'PEI_DEPEX' : '.depex',
+ BINARY_FILE_TYPE_UEFI_APP : '.app',
+ BINARY_FILE_TYPE_LIB : '.lib',
+ BINARY_FILE_TYPE_PE32 : '.pe32',
+ BINARY_FILE_TYPE_PIC : '.pic',
+ BINARY_FILE_TYPE_PEI_DEPEX : '.depex',
'SEC_PEI_DEPEX' : '.depex',
- 'TE' : '.te',
- 'UNI_VER' : '.ver',
- 'VER' : '.ver',
- 'UNI_UI' : '.ui',
- 'UI' : '.ui',
- 'BIN' : '.bin',
+ BINARY_FILE_TYPE_TE : '.te',
+ BINARY_FILE_TYPE_UNI_VER : '.ver',
+ BINARY_FILE_TYPE_VER : '.ver',
+ BINARY_FILE_TYPE_UNI_UI : '.ui',
+ BINARY_FILE_TYPE_UI : '.ui',
+ BINARY_FILE_TYPE_BIN : '.bin',
'RAW' : '.raw',
'COMPAT16' : '.comp16',
- 'FV' : '.fv'
+ BINARY_FILE_TYPE_FV : '.fv'
}
SectFileType = {
@@ -128,8 +128,8 @@ class Section (SectionClassObject):
for File in FfsInf.BinFileList:
if File.Arch == TAB_ARCH_COMMON or FfsInf.CurrentArch == File.Arch:
if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
- and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX') \
- or (FileType == 'TE'and File.Type == 'PE32'):
+ and FileType == 'DXE_DPEX' and File.Type == BINARY_FILE_TYPE_SMM_DEPEX) \
+ or (FileType == BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32):
if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
else:
diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/Source/Python/GenFds/UiSection.py
index 084f761e1285..31d3edebb4ef 100644
--- a/BaseTools/Source/Python/GenFds/UiSection.py
+++ b/BaseTools/Source/Python/GenFds/UiSection.py
@@ -58,7 +58,7 @@ class UiSection (UiSectionClassObject):
self.StringData = FfsInf.__ExtendMacro__(self.StringData)
self.FileName = FfsInf.__ExtendMacro__(self.FileName)
- OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('UI'))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get(BINARY_FILE_TYPE_UI))
if self.StringData is not None :
NameString = self.StringData
diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py
index 3eb7fa39209d..0503b5a28d1b 100644
--- a/BaseTools/Source/Python/Trim/Trim.py
+++ b/BaseTools/Source/Python/Trim/Trim.py
@@ -303,7 +303,7 @@ def TrimPreprocessedVfr(Source, Target):
FoundTypedef = False
TypedefEnd = Index
# keep all "typedef struct" except to GUID, EFI_PLABEL and PAL_CALL_RETURN
- if Line.strip("} ;\r\n") in ["GUID", "EFI_PLABEL", "PAL_CALL_RETURN"]:
+ if Line.strip("} ;\r\n") in [TAB_GUID, "EFI_PLABEL", "PAL_CALL_RETURN"]:
for i in range(TypedefStart, TypedefEnd+1):
Lines[i] = "\n"
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index bc9726202d3c..0432ef7d2a0f 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1505,7 +1505,7 @@ class DscBuildData(PlatformBuildClassObject):
def get_length(value):
Value = value.strip()
if len(value) > 1:
- if Value.startswith('GUID') and Value.endswith(')'):
+ if Value.startswith(TAB_GUID) and Value.endswith(')'):
return 16
if Value.startswith('L"') and Value.endswith('"'):
return len(Value[2:-1])
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 157f7a2d2de8..cf5e1df3a523 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -71,7 +71,7 @@ class InfBuildData(ModuleBuildClassObject):
# dict used to convert old tool name used in [nmake] section to new ones
_TOOL_CODE_ = {
"C" : "CC",
- "LIB" : "SLINK",
+ BINARY_FILE_TYPE_LIB : "SLINK",
"LINK" : "DLINK",
}
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index a771b5b3c739..c33703ce0747 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -208,7 +208,7 @@ def FindIncludeFiles(Source, IncludePathList, IncludeFiles):
FileName = "Protocol/%(Key)s/%(Key)s.h" % {"Key" : Key}
elif "PPI" in Type:
FileName = "Ppi/%(Key)s/%(Key)s.h" % {"Key" : Key}
- elif "GUID" in Type:
+ elif TAB_GUID in Type:
FileName = "Guid/%(Key)s/%(Key)s.h" % {"Key" : Key}
else:
continue
@@ -1410,7 +1410,7 @@ class PredictionReport(object):
if Wa.FdfProfile:
for Fd in Wa.FdfProfile.FdDict:
for FdRegion in Wa.FdfProfile.FdDict[Fd].RegionList:
- if FdRegion.RegionType != "FV":
+ if FdRegion.RegionType != BINARY_FILE_TYPE_FV:
continue
for FvName in FdRegion.RegionDataList:
if FvName in self._FvList:
@@ -1686,7 +1686,7 @@ class FdRegionReport(object):
# If the input FdRegion is not a firmware volume,
# we are done.
#
- if self.Type != "FV":
+ if self.Type != BINARY_FILE_TYPE_FV:
return
#
@@ -1780,7 +1780,7 @@ class FdRegionReport(object):
FileWrite(File, "Type: %s" % Type)
FileWrite(File, "Base Address: 0x%X" % BaseAddress)
- if self.Type == "FV":
+ if self.Type == BINARY_FILE_TYPE_FV:
FvTotalSize = 0
FvTakenSize = 0
FvFreeSize = 0
@@ -1843,7 +1843,7 @@ class FdRegionReport(object):
if (len(self.FvList) > 0):
for FvItem in self.FvList:
Info = self.FvInfo[FvItem]
- self._GenerateReport(File, Info[0], "FV", Info[1], Info[2], FvItem)
+ self._GenerateReport(File, Info[0], TAB_FV_DIRECTORY, Info[1], Info[2], FvItem)
else:
self._GenerateReport(File, "FD Region", self.Type, self.BaseAddress, self.Size)
@@ -1869,7 +1869,7 @@ class FdReport(object):
self.BaseAddress = Fd.BaseAddress
self.Size = Fd.Size
self.FdRegionList = [FdRegionReport(FdRegion, Wa) for FdRegion in Fd.RegionList]
- self.FvPath = os.path.join(Wa.BuildDir, "FV")
+ self.FvPath = os.path.join(Wa.BuildDir, TAB_FV_DIRECTORY)
self.VpdFilePath = os.path.join(self.FvPath, "%s.map" % Wa.Platform.VpdToolGuid)
self.VPDBaseAddress = 0
self.VPDSize = 0
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 19/27] BaseTools: Replace Binary File type strings with predefined constant
2018-04-26 16:57 ` [PATCH v2 19/27] BaseTools: Replace Binary File " Jaben Carsey
@ 2018-05-02 7:04 ` Zhu, Yonghong
0 siblings, 0 replies; 9+ messages in thread
From: Zhu, Yonghong @ 2018-05-02 7:04 UTC (permalink / raw)
To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Carsey, Jaben
Sent: Friday, April 27, 2018 12:58 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [PATCH v2 19/27] BaseTools: Replace Binary File type strings with predefined constant
BINARY_FILE_TYPE_FW was 'FW'
BINARY_FILE_TYPE_GUID was 'GUID'
BINARY_FILE_TYPE_PREEFORM was 'PREEFORM'
BINARY_FILE_TYPE_UEFI_APP was 'UEFI_APP'
BINARY_FILE_TYPE_UNI_UI was 'UNI_UI'
BINARY_FILE_TYPE_UNI_VER was 'UNI_VER'
BINARY_FILE_TYPE_LIB was 'LIB'
BINARY_FILE_TYPE_PE32 was 'PE32'
BINARY_FILE_TYPE_PIC was 'PIC'
BINARY_FILE_TYPE_PEI_DEPEX was 'PEI_DEPEX'
BINARY_FILE_TYPE_DXE_DEPEX was 'DXE_DEPEX'
BINARY_FILE_TYPE_SMM_DEPEX was 'SMM_DEPEX'
BINARY_FILE_TYPE_TE was 'TE'
BINARY_FILE_TYPE_VER was 'VER'
BINARY_FILE_TYPE_UI was 'UI'
BINARY_FILE_TYPE_BIN was 'BIN'
BINARY_FILE_TYPE_FV was 'FV'
v2 - split apart FV and GUID types with different meanings.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
BaseTools/Source/Python/AutoGen/AutoGen.py | 12 +--
BaseTools/Source/Python/AutoGen/GenC.py | 8 +-
BaseTools/Source/Python/AutoGen/GenPcdDb.py | 4 +-
BaseTools/Source/Python/Common/DataType.py | 2 +
BaseTools/Source/Python/Common/Expression.py | 2 +-
BaseTools/Source/Python/Common/Misc.py | 4 +-
BaseTools/Source/Python/GenFds/DataSection.py | 6 +-
BaseTools/Source/Python/GenFds/DepexSection.py | 6 +-
BaseTools/Source/Python/GenFds/EfiSection.py | 10 +--
BaseTools/Source/Python/GenFds/Fd.py | 3 +-
BaseTools/Source/Python/GenFds/FdfParser.py | 92 ++++++++++----------
BaseTools/Source/Python/GenFds/Ffs.py | 14 +--
BaseTools/Source/Python/GenFds/FfsInfStatement.py | 22 ++---
BaseTools/Source/Python/GenFds/Fv.py | 4 +-
BaseTools/Source/Python/GenFds/GenFds.py | 10 +--
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 4 +-
BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 2 +-
BaseTools/Source/Python/GenFds/Region.py | 5 +-
BaseTools/Source/Python/GenFds/Section.py | 46 +++++-----
BaseTools/Source/Python/GenFds/UiSection.py | 2 +-
BaseTools/Source/Python/Trim/Trim.py | 2 +-
BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +-
BaseTools/Source/Python/build/BuildReport.py | 12 +--
24 files changed, 140 insertions(+), 136 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 2a6fa05ab819..671f02133aca 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -922,7 +922,7 @@ class WorkspaceAutoGen(AutoGen):
## Return the directory to store FV files
def _GetFvDir(self):
if self._FvDir is None:
- self._FvDir = path.join(self.BuildDir, 'FV')
+ self._FvDir = path.join(self.BuildDir, TAB_FV_DIRECTORY)
return self._FvDir
## Return the directory to store all intermediate and final files built
@@ -1325,7 +1325,7 @@ class PlatformAutoGen(AutoGen):
def UpdateNVStoreMaxSize(self,OrgVpdFile):
if self.VariableInfo:
- VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid)
+ VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)
PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if item.TokenCName == "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName == "gEfiMdeModulePkgTokenSpaceGuid"]
if PcdNvStoreDfBuffer:
@@ -1718,7 +1718,7 @@ class PlatformAutoGen(AutoGen):
# Process VPD map file generated by third party BPDG tool
if NeedProcessVpdMapFile:
- VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid)
+ VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)
if os.path.exists(VpdMapFilePath):
VpdFile.Read(VpdMapFilePath)
@@ -1769,7 +1769,7 @@ class PlatformAutoGen(AutoGen):
self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList
def FixVpdOffset(self,VpdFile ):
- FvPath = os.path.join(self.BuildDir, "FV")
+ FvPath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY)
if not os.path.exists(FvPath):
try:
os.makedirs(FvPath)
@@ -1782,7 +1782,7 @@ class PlatformAutoGen(AutoGen):
# retrieve BPDG tool's path from tool_def.txt according to VPD_TOOL_GUID defined in DSC file.
BPDGToolName = None
for ToolDef in self.ToolDefinition.values():
- if ToolDef.has_key("GUID") and ToolDef["GUID"] == self.Platform.VpdToolGuid:
+ if ToolDef.has_key(TAB_GUID) and ToolDef[TAB_GUID] == self.Platform.VpdToolGuid:
if not ToolDef.has_key("PATH"):
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "PATH attribute was not provided for BPDG guid tool %s in tools_def.txt" % self.Platform.VpdToolGuid)
BPDGToolName = ToolDef["PATH"]
@@ -3031,7 +3031,7 @@ class ModuleAutoGen(AutoGen):
def _GetFfsOutputDir(self):
if self._FfsOutputDir is None:
if GlobalData.gFdfParser is not None:
- self._FfsOutputDir = path.join(self.PlatformInfo.BuildDir, "FV", "Ffs", self.Guid + self.Name)
+ self._FfsOutputDir = path.join(self.PlatformInfo.BuildDir, TAB_FV_DIRECTORY, "Ffs", self.Guid + self.Name)
else:
self._FfsOutputDir = ''
return self._FfsOutputDir
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 73cda208a7eb..4ceadd449222 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1612,7 +1612,7 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
#
def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
- GuidType = "GUID"
+ GuidType = TAB_GUID
else:
GuidType = "EFI_GUID"
@@ -1636,7 +1636,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
#
def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
- GuidType = "GUID"
+ GuidType = TAB_GUID
else:
GuidType = "EFI_GUID"
@@ -1660,7 +1660,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
#
def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
- GuidType = "GUID"
+ GuidType = TAB_GUID
else:
GuidType = "EFI_GUID"
@@ -1697,7 +1697,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
if TokenSpaceList:
AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in this module\n\n")
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
- GuidType = "GUID"
+ GuidType = TAB_GUID
else:
GuidType = "EFI_GUID"
for Item in TokenSpaceList:
diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index b48ddcd59ec8..fab6859edb2f 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -972,7 +972,7 @@ def CreatePcdDatabaseCode (Info, AutoGenC, AutoGenH):
AutoGenC.Append(AdditionalAutoGenC.String)
if Info.IsBinaryModule:
- DbFileName = os.path.join(Info.PlatformInfo.BuildDir, "FV", Phase + "PcdDataBase.raw")
+ DbFileName = os.path.join(Info.PlatformInfo.BuildDir, TAB_FV_DIRECTORY, Phase + "PcdDataBase.raw")
else:
DbFileName = os.path.join(Info.OutputDir, Phase + "PcdDataBase.raw")
DbFile = StringIO()
@@ -1054,7 +1054,7 @@ def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform,Phase):
PcdDriverAutoGenData[(skuname,skuid)] = (AdditionalAutoGenH, AdditionalAutoGenC)
VarCheckTableData[(skuname,skuid)] = VarCheckTab
if Platform.Platform.VarCheckFlag:
- dest = os.path.join(Platform.BuildDir, 'FV')
+ dest = os.path.join(Platform.BuildDir, TAB_FV_DIRECTORY)
VarCheckTable = CreateVarCheckBin(VarCheckTableData)
VarCheckTable.dump(dest, Phase)
AdditionalAutoGenH, AdditionalAutoGenC = CreateAutoGen(PcdDriverAutoGenData)
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 2662132e5106..5030df27b4da 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -40,6 +40,7 @@ TAB_UINT16 = 'UINT16'
TAB_UINT32 = 'UINT32'
TAB_UINT64 = 'UINT64'
TAB_VOID = 'VOID*'
+TAB_GUID = 'GUID'
TAB_PCD_CLEAN_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64}
TAB_PCD_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN'}
@@ -48,6 +49,7 @@ TAB_PCD_NUMERIC_TYPES_VOID = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BO
TAB_EDK_SOURCE = '$(EDK_SOURCE)'
TAB_EFI_SOURCE = '$(EFI_SOURCE)'
TAB_WORKSPACE = '$(WORKSPACE)'
+TAB_FV_DIRECTORY = 'FV'
TAB_ARCH_NULL = ''
TAB_ARCH_COMMON = 'COMMON'
diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py
index 53504c110d6d..9fec10d2bb9c 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -951,7 +951,7 @@ class ValueExpressionEx(ValueExpression):
Size = 0
ValueStr = ''
TokenSpaceGuidName = ''
- if Item.startswith('GUID') and Item.endswith(')'):
+ if Item.startswith(TAB_GUID) and Item.endswith(')'):
try:
TokenSpaceGuidName = re.search('GUID\((\w+)\)', Item).group(1)
except:
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index f05ae39ebb29..3d205197abfc 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1219,7 +1219,7 @@ class tdict:
def IsFieldValueAnArray (Value):
Value = Value.strip()
- if Value.startswith('GUID') and Value.endswith(')'):
+ if Value.startswith(TAB_GUID) and Value.endswith(')'):
return True
if Value.startswith('L"') and Value.endswith('"') and len(list(Value[2:-1])) > 1:
return True
@@ -1316,7 +1316,7 @@ def ParseFieldValue (Value):
if Size > 8:
raise BadExpression('Value (%s) Size larger than %d' % (Value, Size))
return Value, 8
- if Value.startswith('GUID') and Value.endswith(')'):
+ if Value.startswith(TAB_GUID) and Value.endswith(')'):
Value = Value.split('(', 1)[1][:-1].strip()
if Value[0] == '{' and Value[-1] == '}':
TmpValue = GuidStructureStringToGuidString(Value)
diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/Python/GenFds/DataSection.py
index 99d7392aaab3..29caa00c0d8d 100644
--- a/BaseTools/Source/Python/GenFds/DataSection.py
+++ b/BaseTools/Source/Python/GenFds/DataSection.py
@@ -82,7 +82,7 @@ class DataSection (DataSectionClassObject):
CopyLongFilePath(MapFile, CopyMapFile)
#Get PE Section alignment when align is set to AUTO
- if self.Alignment == 'Auto' and self.SecType in ('TE', 'PE32'):
+ if self.Alignment == 'Auto' and self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
ImageObj = PeImageClass (Filename)
if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment)
@@ -92,7 +92,7 @@ class DataSection (DataSectionClassObject):
self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'
NoStrip = True
- if self.SecType in ('TE', 'PE32'):
+ if self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
if self.KeepReloc is not None:
NoStrip = self.KeepReloc
@@ -110,7 +110,7 @@ class DataSection (DataSectionClassObject):
)
self.SectFileName = StrippedFile
- if self.SecType == 'TE':
+ if self.SecType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile,
diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/Python/GenFds/DepexSection.py
index d04160e890f1..f42162d5a27e 100644
--- a/BaseTools/Source/Python/GenFds/DepexSection.py
+++ b/BaseTools/Source/Python/GenFds/DepexSection.py
@@ -96,13 +96,13 @@ class DepexSection (DepexSectionClassObject):
if self.DepexType == 'PEI_DEPEX_EXP':
ModuleType = SUP_MODULE_PEIM
- SecType = 'PEI_DEPEX'
+ SecType = BINARY_FILE_TYPE_PEI_DEPEX
elif self.DepexType == 'DXE_DEPEX_EXP':
ModuleType = SUP_MODULE_DXE_DRIVER
- SecType = 'DXE_DEPEX'
+ SecType = BINARY_FILE_TYPE_DXE_DEPEX
elif self.DepexType == 'SMM_DEPEX_EXP':
ModuleType = SUP_MODULE_DXE_SMM_DRIVER
- SecType = 'SMM_DEPEX'
+ SecType = BINARY_FILE_TYPE_SMM_DEPEX
else:
EdkLogger.error("GenFds", FORMAT_INVALID,
"Depex type %s is not valid for module %s" % (self.DepexType, ModuleName))
diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py
index 1be23b4bf7fd..5405d0a8da13 100644
--- a/BaseTools/Source/Python/GenFds/EfiSection.py
+++ b/BaseTools/Source/Python/GenFds/EfiSection.py
@@ -67,7 +67,7 @@ class EfiSection (EfiSectionClassObject):
StringData = FfsInf.__ExtendMacro__(self.StringData)
ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
NoStrip = True
- if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM) and SectionType in ('TE', 'PE32'):
+ if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM) and SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
if FfsInf.KeepReloc is not None:
NoStrip = FfsInf.KeepReloc
elif FfsInf.KeepRelocFromRule is not None:
@@ -171,9 +171,9 @@ class EfiSection (EfiSectionClassObject):
OutputFileList.append(OutputFile)
#
- # If Section Type is 'UI'
+ # If Section Type is BINARY_FILE_TYPE_UI
#
- elif SectionType == 'UI':
+ elif SectionType == BINARY_FILE_TYPE_UI:
InfOverrideUiString = False
if FfsInf.Ui is not None:
@@ -242,7 +242,7 @@ class EfiSection (EfiSectionClassObject):
File = GenFdsGlobalVariable.MacroExtend(File, Dict)
#Get PE Section alignment when align is set to AUTO
- if self.Alignment == 'Auto' and (SectionType == 'PE32' or SectionType == 'TE'):
+ if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):
ImageObj = PeImageClass (File)
if ImageObj.SectionAlignment < 0x400:
Align = str (ImageObj.SectionAlignment)
@@ -287,7 +287,7 @@ class EfiSection (EfiSectionClassObject):
"""For TE Section call GenFw to generate TE image"""
- if SectionType == 'TE':
+ if SectionType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile,
diff --git a/BaseTools/Source/Python/GenFds/Fd.py b/BaseTools/Source/Python/GenFds/Fd.py
index cc4124ad902e..188ca28cd7ce 100644
--- a/BaseTools/Source/Python/GenFds/Fd.py
+++ b/BaseTools/Source/Python/GenFds/Fd.py
@@ -27,6 +27,7 @@ from Common import EdkLogger
from Common.BuildToolError import *
from Common.Misc import SaveFileOnChange
from GenFds import GenFds
+from Common.DataType import BINARY_FILE_TYPE_FV
## generate FD
#
@@ -158,7 +159,7 @@ class FD(FDClassObject):
FvAddDict ={}
FvList = []
for RegionObj in self.RegionList:
- if RegionObj.RegionType == 'FV':
+ if RegionObj.RegionType == BINARY_FILE_TYPE_FV:
if len(RegionObj.RegionDataList) == 1:
RegionData = RegionObj.RegionDataList[0]
FvList.append(RegionData.upper())
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 469cb128ba5f..49ed4041a287 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -1843,7 +1843,7 @@ class FdfParser:
if not self.__GetNextWord():
return True
- if not self.__Token in ("SET", "FV", "FILE", "DATA", "CAPSULE", "INF"):
+ if not self.__Token in ("SET", BINARY_FILE_TYPE_FV, "FILE", "DATA", "CAPSULE", "INF"):
#
# If next token is a word which is not a valid FV type, it might be part of [PcdOffset[|PcdSize]]
# Or it might be next region's offset described by an expression which starts with a PCD.
@@ -1874,7 +1874,7 @@ class FdfParser:
if not self.__GetNextWord():
return True
- elif self.__Token == "FV":
+ elif self.__Token == BINARY_FILE_TYPE_FV:
self.__UndoToken()
self.__GetRegionFvType( RegionObj)
@@ -1918,8 +1918,8 @@ class FdfParser:
#
def __GetRegionFvType(self, RegionObj):
- if not self.__IsKeyword( "FV"):
- raise Warning("expected Keyword 'FV'", self.FileName, self.CurrentLineNumber)
+ if not self.__IsKeyword( BINARY_FILE_TYPE_FV):
+ raise Warning("expected Keyword BINARY_FILE_TYPE_FV", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
@@ -1927,10 +1927,10 @@ class FdfParser:
if not self.__GetNextToken():
raise Warning("expected FV name", self.FileName, self.CurrentLineNumber)
- RegionObj.RegionType = "FV"
+ RegionObj.RegionType = BINARY_FILE_TYPE_FV
RegionObj.RegionDataList.append((self.__Token).upper())
- while self.__IsKeyword( "FV"):
+ while self.__IsKeyword( BINARY_FILE_TYPE_FV):
if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
@@ -2528,7 +2528,7 @@ class FdfParser:
if self.__GetStringData():
FfsInfObj.Version = self.__Token
- if self.__IsKeyword( "UI"):
+ if self.__IsKeyword( BINARY_FILE_TYPE_UI):
if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
@@ -2641,7 +2641,7 @@ class FdfParser:
#
@staticmethod
def __SectionCouldHaveRelocFlag (SectionType):
- if SectionType in ('TE', 'PE32'):
+ if SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
return True
else:
return False
@@ -2674,7 +2674,7 @@ class FdfParser:
if not self.__GetNextToken():
raise Warning("expected File name or section data", self.FileName, self.CurrentLineNumber)
- if self.__Token == "FV":
+ if self.__Token == BINARY_FILE_TYPE_FV:
if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
@@ -2881,7 +2881,7 @@ class FdfParser:
VerSectionObj.FileName = self.__Token
Obj.SectionList.append(VerSectionObj)
- elif self.__IsKeyword( "UI"):
+ elif self.__IsKeyword( BINARY_FILE_TYPE_UI):
if AlignValue == 'Auto':
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="):
@@ -2965,10 +2965,10 @@ class FdfParser:
self.SetFileBufferPos(OldPos)
return False
- if self.__Token not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
- "UI", "VERSION", "PEI_DEPEX", "SUBTYPE_GUID", "SMM_DEPEX"):
+ if self.__Token not in ("COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, "SUBTYPE_GUID", BINARY_FILE_TYPE_SMM_DEPEX):
raise Warning("Unknown section type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
- if AlignValue == 'Auto'and (not self.__Token == 'PE32') and (not self.__Token == 'TE'):
+ if AlignValue == 'Auto'and (not self.__Token == BINARY_FILE_TYPE_PE32) and (not self.__Token == BINARY_FILE_TYPE_TE):
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
# DataSection
@@ -3386,7 +3386,7 @@ class FdfParser:
#
def __GetFvStatement(self, CapsuleObj, FMPCapsule = False):
- if not self.__IsKeyword("FV"):
+ if not self.__IsKeyword(BINARY_FILE_TYPE_FV):
return False
if not self.__IsToken("="):
@@ -3534,7 +3534,7 @@ class FdfParser:
AfileBaseName = os.path.basename(AfileName)
if os.path.splitext(AfileBaseName)[1] not in [".bin",".BIN",".Bin",".dat",".DAT",".Dat",".data",".DATA",".Data"]:
- raise Warning('invalid binary file type, should be one of "bin","BIN","Bin","dat","DAT","Dat","data","DATA","Data"', \
+ raise Warning('invalid binary file type, should be one of "bin",BINARY_FILE_TYPE_BIN,"Bin","dat","DAT","Dat","data","DATA","Data"', \
self.FileName, self.CurrentLineNumber)
if not os.path.isabs(AfileName):
@@ -3767,8 +3767,8 @@ class FdfParser:
SectionName = self.__Token
- if SectionName not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
- "UI", "PEI_DEPEX", "VERSION", "SUBTYPE_GUID", "SMM_DEPEX"):
+ if SectionName not in ("COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, BINARY_FILE_TYPE_PEI_DEPEX, "VERSION", "SUBTYPE_GUID", BINARY_FILE_TYPE_SMM_DEPEX):
raise Warning("Unknown leaf section name '%s'" % SectionName, self.FileName, self.CurrentLineNumber)
@@ -3783,7 +3783,7 @@ class FdfParser:
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
- if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):
+ if self.__Token == 'Auto' and (not SectionName == BINARY_FILE_TYPE_PE32) and (not SectionName == BINARY_FILE_TYPE_TE):
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
SectAlignment = self.__Token
@@ -3824,8 +3824,8 @@ class FdfParser:
return False
SectionName = self.__Token
- if SectionName not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
- "UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_DEPEX"):
+ if SectionName not in ("COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX):
self.__UndoToken()
return False
@@ -3855,8 +3855,8 @@ class FdfParser:
FvImageSectionObj.FvName = None
else:
- if not self.__IsKeyword("FV"):
- raise Warning("expected 'FV'", self.FileName, self.CurrentLineNumber)
+ if not self.__IsKeyword(BINARY_FILE_TYPE_FV):
+ raise Warning("expected BINARY_FILE_TYPE_FV", self.FileName, self.CurrentLineNumber)
FvImageSectionObj.FvFileType = self.__Token
if self.__GetAlignment():
@@ -3868,8 +3868,8 @@ class FdfParser:
if self.__IsToken('|'):
FvImageSectionObj.FvFileExtension = self.__GetFileExtension()
elif self.__GetNextToken():
- if self.__Token not in ("}", "COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
- "UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_DEPEX"):
+ if self.__Token not in ("}", "COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX):
FvImageSectionObj.FvFileName = self.__Token
else:
self.__UndoToken()
@@ -3931,7 +3931,7 @@ class FdfParser:
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
- if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):
+ if self.__Token == 'Auto' and (not SectionName == BINARY_FILE_TYPE_PE32) and (not SectionName == BINARY_FILE_TYPE_TE):
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
EfiSectionObj.Alignment = self.__Token
@@ -3950,8 +3950,8 @@ class FdfParser:
if self.__IsToken('|'):
EfiSectionObj.FileExtension = self.__GetFileExtension()
elif self.__GetNextToken():
- if self.__Token not in ("}", "COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
- "UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_DEPEX"):
+ if self.__Token not in ("}", "COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX):
if self.__Token.startswith('PCD'):
self.__UndoToken()
@@ -3985,7 +3985,7 @@ class FdfParser:
#
@staticmethod
def __RuleSectionCouldBeOptional(SectionType):
- if SectionType in ("DXE_DEPEX", "UI", "VERSION", "PEI_DEPEX", "RAW", "SMM_DEPEX"):
+ if SectionType in (BINARY_FILE_TYPE_DXE_DEPEX, BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, "RAW", BINARY_FILE_TYPE_SMM_DEPEX):
return True
else:
return False
@@ -4015,7 +4015,7 @@ class FdfParser:
#
@staticmethod
def __RuleSectionCouldHaveString(SectionType):
- if SectionType in ("UI", "VERSION"):
+ if SectionType in (BINARY_FILE_TYPE_UI, "VERSION"):
return True
else:
return False
@@ -4032,32 +4032,32 @@ class FdfParser:
if SectionType == "COMPAT16":
if FileType not in ("COMPAT16", "SEC_COMPAT16"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "PE32":
- if FileType not in ("PE32", "SEC_PE32"):
+ elif SectionType == BINARY_FILE_TYPE_PE32:
+ if FileType not in (BINARY_FILE_TYPE_PE32, "SEC_PE32"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "PIC":
- if FileType not in ("PIC", "PIC"):
+ elif SectionType == BINARY_FILE_TYPE_PIC:
+ if FileType not in (BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_PIC):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "TE":
- if FileType not in ("TE", "SEC_TE"):
+ elif SectionType == BINARY_FILE_TYPE_TE:
+ if FileType not in (BINARY_FILE_TYPE_TE, "SEC_TE"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "RAW":
- if FileType not in ("BIN", "SEC_BIN", "RAW", "ASL", "ACPI"):
+ if FileType not in (BINARY_FILE_TYPE_BIN, "SEC_BIN", "RAW", "ASL", "ACPI"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "DXE_DEPEX" or SectionType == "SMM_DEPEX":
- if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX", "SMM_DEPEX"):
+ elif SectionType == BINARY_FILE_TYPE_DXE_DEPEX or SectionType == BINARY_FILE_TYPE_SMM_DEPEX:
+ if FileType not in (BINARY_FILE_TYPE_DXE_DEPEX, "SEC_DXE_DEPEX", BINARY_FILE_TYPE_SMM_DEPEX):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "UI":
- if FileType not in ("UI", "SEC_UI"):
+ elif SectionType == BINARY_FILE_TYPE_UI:
+ if FileType not in (BINARY_FILE_TYPE_UI, "SEC_UI"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "VERSION":
if FileType not in ("VERSION", "SEC_VERSION"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "PEI_DEPEX":
- if FileType not in ("PEI_DEPEX", "SEC_PEI_DEPEX"):
+ elif SectionType == BINARY_FILE_TYPE_PEI_DEPEX:
+ if FileType not in (BINARY_FILE_TYPE_PEI_DEPEX, "SEC_PEI_DEPEX"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "GUID":
- if FileType not in ("PE32", "SEC_GUID"):
+ elif SectionType == BINARY_FILE_TYPE_GUID:
+ if FileType not in (BINARY_FILE_TYPE_PE32, "SEC_GUID"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
## __GetRuleEncapsulationSection() method
@@ -4494,7 +4494,7 @@ class FdfParser:
FfsFileObj = OptRomFileStatement.OptRomFileStatement()
- if not self.__IsKeyword("EFI") and not self.__IsKeyword("BIN"):
+ if not self.__IsKeyword("EFI") and not self.__IsKeyword(BINARY_FILE_TYPE_BIN):
raise Warning("expected Binary type (EFI/BIN)", self.FileName, self.CurrentLineNumber)
FfsFileObj.FileType = self.__Token
@@ -4575,7 +4575,7 @@ class FdfParser:
if FdName.upper() in self.Profile.FdDict:
FdObj = self.Profile.FdDict[FdName.upper()]
for elementRegion in FdObj.RegionList:
- if elementRegion.RegionType == 'FV':
+ if elementRegion.RegionType == BINARY_FILE_TYPE_FV:
for elementRegionData in elementRegion.RegionDataList:
if elementRegionData.endswith(".fv"):
continue
diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Python/GenFds/Ffs.py
index f6a7f4b007f9..44ad01cb7354 100644
--- a/BaseTools/Source/Python/GenFds/Ffs.py
+++ b/BaseTools/Source/Python/GenFds/Ffs.py
@@ -42,12 +42,12 @@ class Ffs(FDClassObject):
# mapping between section type in FDF and file suffix
SectionSuffix = {
- 'PE32' : '.pe32',
- 'PIC' : '.pic',
- 'TE' : '.te',
- 'DXE_DEPEX' : '.dpx',
+ BINARY_FILE_TYPE_PE32 : '.pe32',
+ BINARY_FILE_TYPE_PIC : '.pic',
+ BINARY_FILE_TYPE_TE : '.te',
+ BINARY_FILE_TYPE_DXE_DEPEX : '.dpx',
'VERSION' : '.ver',
- 'UI' : '.ui',
+ BINARY_FILE_TYPE_UI : '.ui',
'COMPAT16' : '.com16',
'RAW' : '.raw',
'FREEFORM_SUBTYPE_GUID': '.guid',
@@ -55,8 +55,8 @@ class Ffs(FDClassObject):
'FV_IMAGE' : 'fv.sec',
'COMPRESS' : '.com',
'GUIDED' : '.guided',
- 'PEI_DEPEX' : '.dpx',
- 'SMM_DEPEX' : '.dpx'
+ BINARY_FILE_TYPE_PEI_DEPEX : '.dpx',
+ BINARY_FILE_TYPE_SMM_DEPEX : '.dpx'
}
## The constructor
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 9068157ba616..728997f17d1a 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -381,7 +381,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
# Only patch file if FileType is PE32 or ModuleType is USER_DEFINED
#
- if FileType != 'PE32' and self.ModuleType != SUP_MODULE_USER_DEFINED:
+ if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType != SUP_MODULE_USER_DEFINED:
return EfiFile
#
@@ -739,13 +739,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
# Convert Fv Section Type for PI1.1 SMM driver.
#
if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
- if SectionType == 'DXE_DEPEX':
- SectionType = 'SMM_DEPEX'
+ if SectionType == BINARY_FILE_TYPE_DXE_DEPEX:
+ SectionType = BINARY_FILE_TYPE_SMM_DEPEX
#
# Framework SMM Driver has no SMM_DEPEX section type
#
if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
- if SectionType == 'SMM_DEPEX':
+ if SectionType == BINARY_FILE_TYPE_SMM_DEPEX:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
NoStrip = True
if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):
@@ -767,7 +767,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch)
#Get PE Section alignment when align is set to AUTO
- if self.Alignment == 'Auto' and (SectionType == 'PE32' or SectionType == 'TE'):
+ if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):
ImageObj = PeImageClass (File)
if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment)
@@ -790,7 +790,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
)
File = StrippedFile
- if SectionType == 'TE':
+ if SectionType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile,
@@ -809,7 +809,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch)
#Get PE Section alignment when align is set to AUTO
- if self.Alignment == 'Auto' and (SectionType == 'PE32' or SectionType == 'TE'):
+ if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):
ImageObj = PeImageClass (GenSecInputFile)
if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment)
@@ -833,7 +833,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
)
GenSecInputFile = StrippedFile
- if SectionType == 'TE':
+ if SectionType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile,
@@ -942,13 +942,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
# Convert Fv Section Type for PI1.1 SMM driver.
#
if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
- if Sect.SectionType == 'DXE_DEPEX':
- Sect.SectionType = 'SMM_DEPEX'
+ if Sect.SectionType == BINARY_FILE_TYPE_DXE_DEPEX:
+ Sect.SectionType = BINARY_FILE_TYPE_SMM_DEPEX
#
# Framework SMM Driver has no SMM_DEPEX section type
#
if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
- if Sect.SectionType == 'SMM_DEPEX':
+ if Sect.SectionType == BINARY_FILE_TYPE_SMM_DEPEX:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
#
# process the inside FvImage from FvSection or GuidSection
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index 0fb2bd456a6d..37ad57d797d0 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -80,7 +80,7 @@ class FV (FvClassObject):
if self.CapsuleName is not None:
for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
for RegionObj in FdObj.RegionList:
- if RegionObj.RegionType == 'FV':
+ if RegionObj.RegionType == BINARY_FILE_TYPE_FV:
for RegionData in RegionObj.RegionDataList:
if RegionData.endswith(".fv"):
continue
@@ -236,7 +236,7 @@ class FV (FvClassObject):
for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
for RegionObj in FdObj.RegionList:
- if RegionObj.RegionType != 'FV':
+ if RegionObj.RegionType != BINARY_FILE_TYPE_FV:
continue
for RegionData in RegionObj.RegionDataList:
#
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 54c7d828305f..ccd137955dd8 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -315,7 +315,7 @@ def main():
for Fd in FdfParserObj.Profile.FdDict:
FdObj = FdfParserObj.Profile.FdDict[Fd]
for RegionObj in FdObj.RegionList:
- if RegionObj.RegionType != 'FV':
+ if RegionObj.RegionType != BINARY_FILE_TYPE_FV:
continue
for RegionData in RegionObj.RegionDataList:
if FvObj.UiFvName.upper() == RegionData.upper():
@@ -405,7 +405,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
KeyList[1] + \
'_' + \
KeyList[2]
- if Key in KeyStringList and KeyList[4] == 'GUID':
+ if Key in KeyStringList and KeyList[4] == TAB_GUID:
ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
ToolPath = ToolDefinition.get(ToolPathKey)
@@ -447,7 +447,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
if NameGuid == BuildOption[Op]:
KeyList = Op.split('_')
Key = KeyList[0] + '_' + KeyList[1] +'_' + KeyList[2]
- if Key in KeyStringList and KeyList[4] == 'GUID':
+ if Key in KeyStringList and KeyList[4] == TAB_GUID:
ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
if ToolPathKey in BuildOption:
@@ -589,7 +589,7 @@ class GenFds :
if FdObj is None:
for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
for ElementRegion in ElementFd.RegionList:
- if ElementRegion.RegionType == 'FV':
+ if ElementRegion.RegionType == BINARY_FILE_TYPE_FV:
for ElementRegionData in ElementRegion.RegionDataList:
if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:
if FvObj.BlockSizeList != []:
@@ -601,7 +601,7 @@ class GenFds :
return DefaultBlockSize
else:
for ElementRegion in FdObj.RegionList:
- if ElementRegion.RegionType == 'FV':
+ if ElementRegion.RegionType == BINARY_FILE_TYPE_FV:
for ElementRegionData in ElementRegion.RegionDataList:
if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:
if FvObj.BlockSizeList != []:
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index 909d043c2a22..2fb98007ab37 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -288,7 +288,7 @@ class GenFdsGlobalVariable:
# GenFdsGlobalVariable.OutputDirDict = OutputDir
GenFdsGlobalVariable.FdfParser = FdfParser
GenFdsGlobalVariable.WorkSpace = WorkSpace
- GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], 'FV')
+ GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], DataType.TAB_FV_DIRECTORY)
if not os.path.exists(GenFdsGlobalVariable.FvDir) :
os.makedirs(GenFdsGlobalVariable.FvDir)
GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
@@ -349,7 +349,7 @@ class GenFdsGlobalVariable:
GenFdsGlobalVariable.PlatformName = WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
GlobalData.gGlobalDefines['TARGET'],
GlobalData.gGlobalDefines['TOOLCHAIN']].PlatformName
- GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], 'FV')
+ GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], DataType.TAB_FV_DIRECTORY)
if not os.path.exists(GenFdsGlobalVariable.FvDir):
os.makedirs(GenFdsGlobalVariable.FvDir)
GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
index 8f8761b20589..a865ac4436d5 100644
--- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
@@ -141,7 +141,7 @@ class OptRomInfStatement (FfsInfStatement):
OutputFileList = []
for Sect in Rule.SectionList:
- if Sect.SectionType == 'PE32':
+ if Sect.SectionType == BINARY_FILE_TYPE_PE32:
if Sect.FileName is not None:
GenSecInputFile = self.__ExtendMacro__(Sect.FileName)
OutputFileList.append(GenSecInputFile)
diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py
index 44f122a71216..9d632b6321e2 100644
--- a/BaseTools/Source/Python/GenFds/Region.py
+++ b/BaseTools/Source/Python/GenFds/Region.py
@@ -26,6 +26,7 @@ from Common import EdkLogger
from Common.BuildToolError import *
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Common.DataType import BINARY_FILE_TYPE_FV
## generate Region
#
@@ -80,10 +81,10 @@ class Region(RegionClassObject):
GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" % Size)
GenFdsGlobalVariable.SharpCounter = 0
- if Flag and (self.RegionType != 'FV'):
+ if Flag and (self.RegionType != BINARY_FILE_TYPE_FV):
return
- if self.RegionType == 'FV':
+ if self.RegionType == BINARY_FILE_TYPE_FV:
#
# Get Fv from FvDict
#
diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py
index 4b368b3ada9d..5895998158b6 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -20,7 +20,7 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable
import Common.LongFilePathOs as os, glob
from Common import EdkLogger
from Common.BuildToolError import *
-from Common.DataType import TAB_ARCH_COMMON
+from Common.DataType import *
## section base class
#
@@ -29,37 +29,37 @@ class Section (SectionClassObject):
SectionType = {
'RAW' : 'EFI_SECTION_RAW',
'FREEFORM' : 'EFI_SECTION_FREEFORM_SUBTYPE_GUID',
- 'PE32' : 'EFI_SECTION_PE32',
- 'PIC' : 'EFI_SECTION_PIC',
- 'TE' : 'EFI_SECTION_TE',
+ BINARY_FILE_TYPE_PE32 : 'EFI_SECTION_PE32',
+ BINARY_FILE_TYPE_PIC : 'EFI_SECTION_PIC',
+ BINARY_FILE_TYPE_TE : 'EFI_SECTION_TE',
'FV_IMAGE' : 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE',
- 'DXE_DEPEX' : 'EFI_SECTION_DXE_DEPEX',
- 'PEI_DEPEX' : 'EFI_SECTION_PEI_DEPEX',
+ BINARY_FILE_TYPE_DXE_DEPEX : 'EFI_SECTION_DXE_DEPEX',
+ BINARY_FILE_TYPE_PEI_DEPEX : 'EFI_SECTION_PEI_DEPEX',
'GUIDED' : 'EFI_SECTION_GUID_DEFINED',
'COMPRESS' : 'EFI_SECTION_COMPRESSION',
- 'UI' : 'EFI_SECTION_USER_INTERFACE',
- 'SMM_DEPEX' : 'EFI_SECTION_SMM_DEPEX'
+ BINARY_FILE_TYPE_UI : 'EFI_SECTION_USER_INTERFACE',
+ BINARY_FILE_TYPE_SMM_DEPEX : 'EFI_SECTION_SMM_DEPEX'
}
BinFileType = {
- 'GUID' : '.guid',
+ BINARY_FILE_TYPE_GUID : '.guid',
'ACPI' : '.acpi',
'ASL' : '.asl' ,
- 'UEFI_APP' : '.app',
- 'LIB' : '.lib',
- 'PE32' : '.pe32',
- 'PIC' : '.pic',
- 'PEI_DEPEX' : '.depex',
+ BINARY_FILE_TYPE_UEFI_APP : '.app',
+ BINARY_FILE_TYPE_LIB : '.lib',
+ BINARY_FILE_TYPE_PE32 : '.pe32',
+ BINARY_FILE_TYPE_PIC : '.pic',
+ BINARY_FILE_TYPE_PEI_DEPEX : '.depex',
'SEC_PEI_DEPEX' : '.depex',
- 'TE' : '.te',
- 'UNI_VER' : '.ver',
- 'VER' : '.ver',
- 'UNI_UI' : '.ui',
- 'UI' : '.ui',
- 'BIN' : '.bin',
+ BINARY_FILE_TYPE_TE : '.te',
+ BINARY_FILE_TYPE_UNI_VER : '.ver',
+ BINARY_FILE_TYPE_VER : '.ver',
+ BINARY_FILE_TYPE_UNI_UI : '.ui',
+ BINARY_FILE_TYPE_UI : '.ui',
+ BINARY_FILE_TYPE_BIN : '.bin',
'RAW' : '.raw',
'COMPAT16' : '.comp16',
- 'FV' : '.fv'
+ BINARY_FILE_TYPE_FV : '.fv'
}
SectFileType = {
@@ -128,8 +128,8 @@ class Section (SectionClassObject):
for File in FfsInf.BinFileList:
if File.Arch == TAB_ARCH_COMMON or FfsInf.CurrentArch == File.Arch:
if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
- and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX') \
- or (FileType == 'TE'and File.Type == 'PE32'):
+ and FileType == 'DXE_DPEX' and File.Type == BINARY_FILE_TYPE_SMM_DEPEX) \
+ or (FileType == BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32):
if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
else:
diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/Source/Python/GenFds/UiSection.py
index 084f761e1285..31d3edebb4ef 100644
--- a/BaseTools/Source/Python/GenFds/UiSection.py
+++ b/BaseTools/Source/Python/GenFds/UiSection.py
@@ -58,7 +58,7 @@ class UiSection (UiSectionClassObject):
self.StringData = FfsInf.__ExtendMacro__(self.StringData)
self.FileName = FfsInf.__ExtendMacro__(self.FileName)
- OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('UI'))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get(BINARY_FILE_TYPE_UI))
if self.StringData is not None :
NameString = self.StringData
diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py
index 3eb7fa39209d..0503b5a28d1b 100644
--- a/BaseTools/Source/Python/Trim/Trim.py
+++ b/BaseTools/Source/Python/Trim/Trim.py
@@ -303,7 +303,7 @@ def TrimPreprocessedVfr(Source, Target):
FoundTypedef = False
TypedefEnd = Index
# keep all "typedef struct" except to GUID, EFI_PLABEL and PAL_CALL_RETURN
- if Line.strip("} ;\r\n") in ["GUID", "EFI_PLABEL", "PAL_CALL_RETURN"]:
+ if Line.strip("} ;\r\n") in [TAB_GUID, "EFI_PLABEL", "PAL_CALL_RETURN"]:
for i in range(TypedefStart, TypedefEnd+1):
Lines[i] = "\n"
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index bc9726202d3c..0432ef7d2a0f 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1505,7 +1505,7 @@ class DscBuildData(PlatformBuildClassObject):
def get_length(value):
Value = value.strip()
if len(value) > 1:
- if Value.startswith('GUID') and Value.endswith(')'):
+ if Value.startswith(TAB_GUID) and Value.endswith(')'):
return 16
if Value.startswith('L"') and Value.endswith('"'):
return len(Value[2:-1])
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 157f7a2d2de8..cf5e1df3a523 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -71,7 +71,7 @@ class InfBuildData(ModuleBuildClassObject):
# dict used to convert old tool name used in [nmake] section to new ones
_TOOL_CODE_ = {
"C" : "CC",
- "LIB" : "SLINK",
+ BINARY_FILE_TYPE_LIB : "SLINK",
"LINK" : "DLINK",
}
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index a771b5b3c739..c33703ce0747 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -208,7 +208,7 @@ def FindIncludeFiles(Source, IncludePathList, IncludeFiles):
FileName = "Protocol/%(Key)s/%(Key)s.h" % {"Key" : Key}
elif "PPI" in Type:
FileName = "Ppi/%(Key)s/%(Key)s.h" % {"Key" : Key}
- elif "GUID" in Type:
+ elif TAB_GUID in Type:
FileName = "Guid/%(Key)s/%(Key)s.h" % {"Key" : Key}
else:
continue
@@ -1410,7 +1410,7 @@ class PredictionReport(object):
if Wa.FdfProfile:
for Fd in Wa.FdfProfile.FdDict:
for FdRegion in Wa.FdfProfile.FdDict[Fd].RegionList:
- if FdRegion.RegionType != "FV":
+ if FdRegion.RegionType != BINARY_FILE_TYPE_FV:
continue
for FvName in FdRegion.RegionDataList:
if FvName in self._FvList:
@@ -1686,7 +1686,7 @@ class FdRegionReport(object):
# If the input FdRegion is not a firmware volume,
# we are done.
#
- if self.Type != "FV":
+ if self.Type != BINARY_FILE_TYPE_FV:
return
#
@@ -1780,7 +1780,7 @@ class FdRegionReport(object):
FileWrite(File, "Type: %s" % Type)
FileWrite(File, "Base Address: 0x%X" % BaseAddress)
- if self.Type == "FV":
+ if self.Type == BINARY_FILE_TYPE_FV:
FvTotalSize = 0
FvTakenSize = 0
FvFreeSize = 0
@@ -1843,7 +1843,7 @@ class FdRegionReport(object):
if (len(self.FvList) > 0):
for FvItem in self.FvList:
Info = self.FvInfo[FvItem]
- self._GenerateReport(File, Info[0], "FV", Info[1], Info[2], FvItem)
+ self._GenerateReport(File, Info[0], TAB_FV_DIRECTORY, Info[1], Info[2], FvItem)
else:
self._GenerateReport(File, "FD Region", self.Type, self.BaseAddress, self.Size)
@@ -1869,7 +1869,7 @@ class FdReport(object):
self.BaseAddress = Fd.BaseAddress
self.Size = Fd.Size
self.FdRegionList = [FdRegionReport(FdRegion, Wa) for FdRegion in Fd.RegionList]
- self.FvPath = os.path.join(Wa.BuildDir, "FV")
+ self.FvPath = os.path.join(Wa.BuildDir, TAB_FV_DIRECTORY)
self.VpdFilePath = os.path.join(self.FvPath, "%s.map" % Wa.Platform.VpdToolGuid)
self.VPDBaseAddress = 0
self.VPDSize = 0
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 21/27] BaseTools: replace string with predefined constant
[not found] <cover.1524761578.git.jaben.carsey@intel.com>
` (3 preceding siblings ...)
2018-04-26 16:57 ` [PATCH v2 19/27] BaseTools: Replace Binary File " Jaben Carsey
@ 2018-04-26 16:57 ` Jaben Carsey
2018-04-27 9:54 ` Zhu, Yonghong
4 siblings, 1 reply; 9+ messages in thread
From: Jaben Carsey @ 2018-04-26 16:57 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu
v2 - add missing namespace.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
BaseTools/Source/Python/Ecc/Check.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 089d42a6d181..dde7d7841082 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -787,7 +787,7 @@ class Check(object):
continue
SqlCommand = """select Value3 from Inf where BelongsToFile =
(select ID from File where lower(FullPath) = lower('%s'))
- and Value2 = '%s'""" % (LibraryIns, 'LIBRARY_CLASS')
+ and Value2 = '%s'""" % (LibraryIns, DT.PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS)
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
IsFound = False
for Record in RecordSet:
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 21/27] BaseTools: replace string with predefined constant
2018-04-26 16:57 ` [PATCH v2 21/27] BaseTools: replace string " Jaben Carsey
@ 2018-04-27 9:54 ` Zhu, Yonghong
0 siblings, 0 replies; 9+ messages in thread
From: Zhu, Yonghong @ 2018-04-27 9:54 UTC (permalink / raw)
To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Carsey, Jaben
Sent: Friday, April 27, 2018 12:58 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [PATCH v2 21/27] BaseTools: replace string with predefined constant
v2 - add missing namespace.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
BaseTools/Source/Python/Ecc/Check.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 089d42a6d181..dde7d7841082 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -787,7 +787,7 @@ class Check(object):
continue
SqlCommand = """select Value3 from Inf where BelongsToFile =
(select ID from File where lower(FullPath) = lower('%s'))
- and Value2 = '%s'""" % (LibraryIns, 'LIBRARY_CLASS')
+ and Value2 = '%s'""" % (LibraryIns, DT.PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS)
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
IsFound = False
for Record in RecordSet:
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread