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'

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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Carsey, Jaben
2018-04-27 00:57:53 +08:00
committed by Yonghong Zhu
parent 50874612be
commit 8bb63e377b
21 changed files with 228 additions and 218 deletions

View File

@ -1430,7 +1430,7 @@ class PlatformAutoGen(AutoGen):
# used by DXE module, it should be stored in DXE PCD database. # used by DXE module, it should be stored in DXE PCD database.
# The default Phase is DXE # 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" PcdFromModule.Phase = "PEI"
if PcdFromModule not in self._DynaPcdList_: if PcdFromModule not in self._DynaPcdList_:
self._DynaPcdList_.append(PcdFromModule) self._DynaPcdList_.append(PcdFromModule)
@ -1472,7 +1472,7 @@ class PlatformAutoGen(AutoGen):
# make sure that the "VOID*" kind of datum has MaxDatumSize set # make sure that the "VOID*" kind of datum has MaxDatumSize set
if PcdFromModule.DatumType == TAB_VOID and PcdFromModule.MaxDatumSize in [None, '']: if PcdFromModule.DatumType == TAB_VOID and PcdFromModule.MaxDatumSize in [None, '']:
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName)) 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" PcdFromModule.Phase = "PEI"
if PcdFromModule not in self._DynaPcdList_ and PcdFromModule.Type in GenC.gDynamicExPcd: if PcdFromModule not in self._DynaPcdList_ and PcdFromModule.Type in GenC.gDynamicExPcd:
self._DynaPcdList_.append(PcdFromModule) self._DynaPcdList_.append(PcdFromModule)
@ -2203,7 +2203,7 @@ class PlatformAutoGen(AutoGen):
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType])) LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
elif LibraryModule.LibraryClass is None \ elif LibraryModule.LibraryClass is None \
or len(LibraryModule.LibraryClass) == 0 \ or len(LibraryModule.LibraryClass) == 0 \
or (ModuleType != 'USER_DEFINED' or (ModuleType != SUP_MODULE_USER_DEFINED
and ModuleType not in LibraryModule.LibraryClass[0].SupModList): and ModuleType not in LibraryModule.LibraryClass[0].SupModList):
# only USER_DEFINED can link against any library instance despite of its SupModList # only USER_DEFINED can link against any library instance despite of its SupModList
EdkLogger.error("build", OPTION_MISSING, EdkLogger.error("build", OPTION_MISSING,
@ -3969,8 +3969,8 @@ class ModuleAutoGen(AutoGen):
break break
ModuleType = self.ModuleType ModuleType = self.ModuleType
if ModuleType == 'UEFI_DRIVER' and self.DepexGenerated: if ModuleType == SUP_MODULE_UEFI_DRIVER and self.DepexGenerated:
ModuleType = 'DXE_DRIVER' ModuleType = SUP_MODULE_DXE_DRIVER
DriverType = '' DriverType = ''
if self.PcdIsDriver != '': if self.PcdIsDriver != '':
@ -4047,11 +4047,11 @@ class ModuleAutoGen(AutoGen):
AsBuiltInfDict['binary_item'] += ['BIN|' + File] AsBuiltInfDict['binary_item'] += ['BIN|' + File]
if self.DepexGenerated: if self.DepexGenerated:
self.OutputFile.add(self.Name + '.depex') 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'] 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'] 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'] AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + '.depex']
Bin = self._GenOffsetBin() Bin = self._GenOffsetBin()
@ -4377,8 +4377,8 @@ class ModuleAutoGen(AutoGen):
return return
for ModuleType in self.DepexList: for ModuleType in self.DepexList:
# Ignore empty [depex] section or [depex] section for "USER_DEFINED" module # Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module
if len(self.DepexList[ModuleType]) == 0 or ModuleType == "USER_DEFINED": if len(self.DepexList[ModuleType]) == 0 or ModuleType == SUP_MODULE_USER_DEFINED:
continue continue
Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True) Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)

View File

@ -612,11 +612,11 @@ if __name__ == '__main__':
EdkLogger.Initialize() EdkLogger.Initialize()
if len(sys.argv) > 1: if len(sys.argv) > 1:
Br = BuildRule(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
print str(Br[".c", "DXE_DRIVER", "IA32", "INTEL"][1]) print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1])
print print
print str(Br[".c", "DXE_DRIVER", "IA32", "GCC"][1]) print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1])
print print
print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])
print print
@ -624,7 +624,7 @@ if __name__ == '__main__':
print print
print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])
print print
print str(Br[".s", "SEC", "IPF", "COMMON"][1]) print str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1])
print print
print str(Br[".s", "SEC"][1]) print str(Br[".s", SUP_MODULE_SEC][1])

View File

@ -649,7 +649,7 @@ ${END}
] ]
gLibraryStructorPrototype = { gLibraryStructorPrototype = {
'BASE' : TemplateString("""${BEGIN} SUP_MODULE_BASE : TemplateString("""${BEGIN}
RETURN_STATUS RETURN_STATUS
EFIAPI EFIAPI
${Function} ( ${Function} (
@ -686,7 +686,7 @@ ${Function} (
} }
gLibraryStructorCall = { gLibraryStructorCall = {
'BASE' : TemplateString("""${BEGIN} SUP_MODULE_BASE : TemplateString("""${BEGIN}
Status = ${Function} (); Status = ${Function} ();
ASSERT_EFI_ERROR (Status);${END} ASSERT_EFI_ERROR (Status);${END}
"""), """),
@ -709,7 +709,7 @@ gLibraryStructorCall = {
## Library Constructor and Destructor Templates ## Library Constructor and Destructor Templates
gLibraryString = { gLibraryString = {
'BASE' : TemplateString(""" SUP_MODULE_BASE : TemplateString("""
${BEGIN}${FunctionPrototype}${END} ${BEGIN}${FunctionPrototype}${END}
VOID VOID
@ -772,21 +772,21 @@ ${FunctionCall}${END}
gBasicHeaderFile = "Base.h" gBasicHeaderFile = "Base.h"
gModuleTypeHeaderFile = { gModuleTypeHeaderFile = {
"BASE" : [gBasicHeaderFile], SUP_MODULE_BASE : [gBasicHeaderFile],
"SEC" : ["PiPei.h", "Library/DebugLib.h"], SUP_MODULE_SEC : ["PiPei.h", "Library/DebugLib.h"],
"PEI_CORE" : ["PiPei.h", "Library/DebugLib.h", "Library/PeiCoreEntryPoint.h"], SUP_MODULE_PEI_CORE : ["PiPei.h", "Library/DebugLib.h", "Library/PeiCoreEntryPoint.h"],
"PEIM" : ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"], SUP_MODULE_PEIM : ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"],
"DXE_CORE" : ["PiDxe.h", "Library/DebugLib.h", "Library/DxeCoreEntryPoint.h"], SUP_MODULE_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"], SUP_MODULE_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"], SUP_MODULE_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"], SUP_MODULE_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"], SUP_MODULE_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"], SUP_MODULE_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"], SUP_MODULE_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"], SUP_MODULE_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"], SUP_MODULE_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"], SUP_MODULE_MM_CORE_STANDALONE : ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmCoreStandaloneEntryPoint.h"],
"USER_DEFINED" : [gBasicHeaderFile] SUP_MODULE_USER_DEFINED : [gBasicHeaderFile]
} }
## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName ## 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: if len(Lib.ConstructorList) <= 0:
continue continue
Dict = {'Function':Lib.ConstructorList} Dict = {'Function':Lib.ConstructorList}
if Lib.ModuleType in ['BASE', 'SEC']: if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
ConstructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict)) ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
elif Lib.ModuleType in ['PEI_CORE','PEIM']: elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:
ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict)) ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', elif Lib.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,
'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]:
ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict)) ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['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)) ConstructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict))
@ -1437,14 +1437,14 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
if Info.IsLibrary: if Info.IsLibrary:
AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
else: else:
if Info.ModuleType in ['BASE', 'SEC']: if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
AutoGenC.Append(gLibraryString['BASE'].Replace(Dict)) AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
elif Info.ModuleType in ['PEI_CORE','PEIM']: elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:
AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', elif Info.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,
'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]:
AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) 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)) AutoGenC.Append(gLibraryString['MM'].Replace(Dict))
## Create code for library destructor ## Create code for library destructor
@ -1468,17 +1468,17 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
if len(Lib.DestructorList) <= 0: if len(Lib.DestructorList) <= 0:
continue continue
Dict = {'Function':Lib.DestructorList} Dict = {'Function':Lib.DestructorList}
if Lib.ModuleType in ['BASE', 'SEC']: if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
DestructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict)) DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
elif Lib.ModuleType in ['PEI_CORE','PEIM']: elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:
DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict)) DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', elif Lib.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,
'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_CORE']: SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER,SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]:
DestructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict)) DestructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['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)) DestructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict))
@ -1499,14 +1499,14 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
if Info.IsLibrary: if Info.IsLibrary:
AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
else: else:
if Info.ModuleType in ['BASE', 'SEC']: if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
AutoGenC.Append(gLibraryString['BASE'].Replace(Dict)) AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
elif Info.ModuleType in ['PEI_CORE','PEIM']: elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:
AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', elif Info.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,
'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]:
AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) 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)) AutoGenC.Append(gLibraryString['MM'].Replace(Dict))
@ -1517,7 +1517,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file # @param AutoGenH The TemplateString object for header file
# #
def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): 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 return
# #
# Module Entry Points # Module Entry Points
@ -1537,7 +1537,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
'UefiSpecVersion': UefiSpecVersion + 'U' '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 Info.SourceFileList:
if NumEntryPoints != 1: if NumEntryPoints != 1:
EdkLogger.error( EdkLogger.error(
@ -1547,43 +1547,43 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
File=str(Info), File=str(Info),
ExtraData= ", ".join(Info.Module.ModuleEntryPointList) ExtraData= ", ".join(Info.Module.ModuleEntryPointList)
) )
if Info.ModuleType == 'PEI_CORE': if Info.ModuleType == SUP_MODULE_PEI_CORE:
AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict)) AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))
AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict)) AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict))
elif Info.ModuleType == 'DXE_CORE': elif Info.ModuleType == SUP_MODULE_DXE_CORE:
AutoGenC.Append(gDxeCoreEntryPointString.Replace(Dict)) AutoGenC.Append(gDxeCoreEntryPointString.Replace(Dict))
AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict)) AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict))
elif Info.ModuleType == 'SMM_CORE': elif Info.ModuleType == SUP_MODULE_SMM_CORE:
AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict)) AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict))
AutoGenH.Append(gSmmCoreEntryPointPrototype.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)) AutoGenC.Append(gMmCoreStandaloneEntryPointString.Replace(Dict))
AutoGenH.Append(gMmCoreStandaloneEntryPointPrototype.Replace(Dict)) AutoGenH.Append(gMmCoreStandaloneEntryPointPrototype.Replace(Dict))
elif Info.ModuleType == 'PEIM': elif Info.ModuleType == SUP_MODULE_PEIM:
if NumEntryPoints < 2: if NumEntryPoints < 2:
AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(Dict)) AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(Dict))
else: else:
AutoGenC.Append(gPeimEntryPointString[2].Replace(Dict)) AutoGenC.Append(gPeimEntryPointString[2].Replace(Dict))
AutoGenH.Append(gPeimEntryPointPrototype.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: if NumEntryPoints < 2:
AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Replace(Dict)) AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Replace(Dict))
else: else:
AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict)) AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict))
AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict)) AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict))
elif Info.ModuleType == 'DXE_SMM_DRIVER': elif Info.ModuleType == SUP_MODULE_DXE_SMM_DRIVER:
if NumEntryPoints == 0: if NumEntryPoints == 0:
AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict)) AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict))
else: else:
AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict)) AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict))
AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict)) AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict))
elif Info.ModuleType == 'MM_STANDALONE': elif Info.ModuleType == SUP_MODULE_MM_STANDALONE:
if NumEntryPoints < 2: if NumEntryPoints < 2:
AutoGenC.Append(gMmStandaloneEntryPointString[NumEntryPoints].Replace(Dict)) AutoGenC.Append(gMmStandaloneEntryPointString[NumEntryPoints].Replace(Dict))
else: else:
AutoGenC.Append(gMmStandaloneEntryPointString[2].Replace(Dict)) AutoGenC.Append(gMmStandaloneEntryPointString[2].Replace(Dict))
AutoGenH.Append(gMmStandaloneEntryPointPrototype.Replace(Dict)) AutoGenH.Append(gMmStandaloneEntryPointPrototype.Replace(Dict))
elif Info.ModuleType == 'UEFI_APPLICATION': elif Info.ModuleType == SUP_MODULE_UEFI_APPLICATION:
if NumEntryPoints < 2: if NumEntryPoints < 2:
AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(Dict)) AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(Dict))
else: else:
@ -1597,7 +1597,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file # @param AutoGenH The TemplateString object for header file
# #
def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): 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 return
# #
# Unload Image Handlers # Unload Image Handlers
@ -1617,7 +1617,7 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file # @param AutoGenH The TemplateString object for header file
# #
def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH): 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" GuidType = "GUID"
else: else:
GuidType = "EFI_GUID" GuidType = "EFI_GUID"
@ -1641,7 +1641,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file # @param AutoGenH The TemplateString object for header file
# #
def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH): 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" GuidType = "GUID"
else: else:
GuidType = "EFI_GUID" GuidType = "EFI_GUID"
@ -1665,7 +1665,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file # @param AutoGenH The TemplateString object for header file
# #
def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH): 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" GuidType = "GUID"
else: else:
GuidType = "EFI_GUID" 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 # Add extern declarations to AutoGen.h if one or more Token Space GUIDs were found
if TokenSpaceList: if TokenSpaceList:
AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in this module\n\n") 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" GuidType = "GUID"
else: else:
GuidType = "EFI_GUID" GuidType = "EFI_GUID"

View File

@ -24,26 +24,27 @@ from Common.Misc import SaveFileOnChange
from Common.Misc import GuidStructureStringToGuidString from Common.Misc import GuidStructureStringToGuidString
from Common import EdkLogger as EdkLogger from Common import EdkLogger as EdkLogger
from Common.BuildVersion import gBUILD_VERSION from Common.BuildVersion import gBUILD_VERSION
from Common.DataType import *
## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END" ## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END"
gStartClosePattern = re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*", re.S) gStartClosePattern = re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*", re.S)
## Mapping between module type and EFI phase ## Mapping between module type and EFI phase
gType2Phase = { gType2Phase = {
"BASE" : None, SUP_MODULE_BASE : None,
"SEC" : "PEI", SUP_MODULE_SEC : "PEI",
"PEI_CORE" : "PEI", SUP_MODULE_PEI_CORE : "PEI",
"PEIM" : "PEI", SUP_MODULE_PEIM : "PEI",
"DXE_CORE" : "DXE", SUP_MODULE_DXE_CORE : "DXE",
"DXE_DRIVER" : "DXE", SUP_MODULE_DXE_DRIVER : "DXE",
"DXE_SMM_DRIVER" : "DXE", SUP_MODULE_DXE_SMM_DRIVER : "DXE",
"DXE_RUNTIME_DRIVER": "DXE", SUP_MODULE_DXE_RUNTIME_DRIVER: "DXE",
"DXE_SAL_DRIVER" : "DXE", SUP_MODULE_DXE_SAL_DRIVER : "DXE",
"UEFI_DRIVER" : "DXE", SUP_MODULE_UEFI_DRIVER : "DXE",
"UEFI_APPLICATION" : "DXE", SUP_MODULE_UEFI_APPLICATION : "DXE",
"SMM_CORE" : "DXE", SUP_MODULE_SMM_CORE : "DXE",
"MM_STANDALONE" : "MM", SUP_MODULE_MM_STANDALONE : "MM",
"MM_CORE_STANDALONE" : "MM", SUP_MODULE_MM_CORE_STANDALONE : "MM",
} }
## Convert dependency expression string into EFI internal representation ## Convert dependency expression string into EFI internal representation
@ -299,12 +300,12 @@ class DependencyExpression:
NewOperand.append(Token) NewOperand.append(Token)
# don't generate depex if only TRUE operand left # 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 = [] self.PostfixNotation = []
return return
# don't generate depex if all operands are architecture protocols # 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 \ Op == 'AND' and \
self.ArchProtocols == set([GuidStructureStringToGuidString(Guid) for Guid in AllOperand]): self.ArchProtocols == set([GuidStructureStringToGuidString(Guid) for Guid in AllOperand]):
self.PostfixNotation = [] self.PostfixNotation = []

View File

@ -84,7 +84,7 @@ SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY' EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
EDK_COMPONENT_TYPE_SECUARITY_CORE = 'SECUARITY_CORE' 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_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER'
EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM' EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM'
EDK_COMPONENT_TYPE_RELOCATABLE_PEIM = 'RELOCATABLE_PEIM' EDK_COMPONENT_TYPE_RELOCATABLE_PEIM = 'RELOCATABLE_PEIM'

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define checkpoints used by ECC tool # 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 # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 # 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]]: if Item not in LibraryClasses[List[0]]:
LibraryClasses[List[0]].append(Item) 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]) 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 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: for Record in RecordSet:
if Record[1] in LibraryClasses: 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]): 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]) 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: else:

View File

@ -21,6 +21,7 @@ import subprocess
import Common.LongFilePathOs as os import Common.LongFilePathOs as os
from GenFdsGlobalVariable import GenFdsGlobalVariable from GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import CompressSectionClassObject from CommonDataClass.FdfClass import CompressSectionClassObject
from Common.DataType import *
## generate compress section ## generate compress section
# #
@ -82,7 +83,7 @@ class CompressSection (CompressSectionClassObject) :
OutputFile = OutputPath + \ OutputFile = OutputPath + \
os.sep + \ os.sep + \
ModuleName + \ ModuleName + \
'SEC' + \ SUP_MODULE_SEC + \
SecNum + \ SecNum + \
Ffs.SectionSuffix['COMPRESS'] Ffs.SectionSuffix['COMPRESS']
OutputFile = os.path.normpath(OutputFile) OutputFile = os.path.normpath(OutputFile)

View File

@ -1,7 +1,7 @@
## @file ## @file
# process data section generation # 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 # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 CommonDataClass.FdfClass import DataSectionClassObject
from Common.Misc import PeImageClass from Common.Misc import PeImageClass
from Common.LongFilePathSupport import CopyLongFilePath from Common.LongFilePathSupport import CopyLongFilePath
from Common.DataType import *
## generate data section ## generate data section
# #
@ -119,7 +120,7 @@ class DataSection (DataSectionClassObject):
) )
self.SectFileName = TeFile 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) OutputFile = os.path.normpath(OutputFile)
GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile) GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile)
FileList = [OutputFile] FileList = [OutputFile]

View File

@ -25,6 +25,7 @@ from AutoGen.GenDepex import DependencyExpression
from Common import EdkLogger from Common import EdkLogger
from Common.BuildToolError import * from Common.BuildToolError import *
from Common.Misc import PathClass from Common.Misc import PathClass
from Common.DataType import *
## generate data section ## generate data section
# #
@ -94,24 +95,24 @@ class DepexSection (DepexSectionClassObject):
self.ExpressionProcessed = True self.ExpressionProcessed = True
if self.DepexType == 'PEI_DEPEX_EXP': if self.DepexType == 'PEI_DEPEX_EXP':
ModuleType = 'PEIM' ModuleType = SUP_MODULE_PEIM
SecType = 'PEI_DEPEX' SecType = 'PEI_DEPEX'
elif self.DepexType == 'DXE_DEPEX_EXP': elif self.DepexType == 'DXE_DEPEX_EXP':
ModuleType = 'DXE_DRIVER' ModuleType = SUP_MODULE_DXE_DRIVER
SecType = 'DXE_DEPEX' SecType = 'DXE_DEPEX'
elif self.DepexType == 'SMM_DEPEX_EXP': elif self.DepexType == 'SMM_DEPEX_EXP':
ModuleType = 'DXE_SMM_DRIVER' ModuleType = SUP_MODULE_DXE_SMM_DRIVER
SecType = 'SMM_DEPEX' SecType = 'SMM_DEPEX'
else: else:
EdkLogger.error("GenFds", FORMAT_INVALID, EdkLogger.error("GenFds", FORMAT_INVALID,
"Depex type %s is not valid for module %s" % (self.DepexType, ModuleName)) "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) InputFile = os.path.normpath(InputFile)
Depex = DependencyExpression(self.Expression, ModuleType) Depex = DependencyExpression(self.Expression, ModuleType)
Depex.Generate(InputFile) 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) OutputFile = os.path.normpath(OutputFile)
GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile) GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)

View File

@ -27,6 +27,7 @@ from Common.BuildToolError import *
from Common.Misc import PeImageClass from Common.Misc import PeImageClass
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.LongFilePathSupport import CopyLongFilePath from Common.LongFilePathSupport import CopyLongFilePath
from Common.DataType import *
## generate rule section ## generate rule section
# #
@ -66,7 +67,7 @@ class EfiSection (EfiSectionClassObject):
StringData = FfsInf.__ExtendMacro__(self.StringData) StringData = FfsInf.__ExtendMacro__(self.StringData)
ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)') ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
NoStrip = True 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: if FfsInf.KeepReloc is not None:
NoStrip = FfsInf.KeepReloc NoStrip = FfsInf.KeepReloc
elif FfsInf.KeepRelocFromRule is not None: elif FfsInf.KeepRelocFromRule is not None:
@ -122,7 +123,7 @@ class EfiSection (EfiSectionClassObject):
BuildNumTuple = tuple() BuildNumTuple = tuple()
Num = SecNum 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', GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
#Ui=StringData, #Ui=StringData,
Ver=BuildNum, Ver=BuildNum,
@ -133,7 +134,7 @@ class EfiSection (EfiSectionClassObject):
for File in FileList: for File in FileList:
Index = Index + 1 Index = Index + 1
Num = '%s.%d' %(SecNum , Index) 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') f = open(File, 'r')
VerString = f.read() VerString = f.read()
f.close() f.close()
@ -162,7 +163,7 @@ class EfiSection (EfiSectionClassObject):
else: else:
EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss Version Section value" %InfFileName) EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss Version Section value" %InfFileName)
Num = SecNum 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', GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
#Ui=VerString, #Ui=VerString,
Ver=BuildNum, Ver=BuildNum,
@ -183,7 +184,7 @@ class EfiSection (EfiSectionClassObject):
Num = SecNum Num = SecNum
if IsMakefile and StringData == ModuleNameStr: if IsMakefile and StringData == ModuleNameStr:
StringData = "$(MODULE_NAME)" 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', GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=StringData, IsMakefile=IsMakefile) Ui=StringData, IsMakefile=IsMakefile)
OutputFileList.append(OutputFile) OutputFileList.append(OutputFile)
@ -192,7 +193,7 @@ class EfiSection (EfiSectionClassObject):
for File in FileList: for File in FileList:
Index = Index + 1 Index = Index + 1
Num = '%s.%d' %(SecNum , Index) 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') f = open(File, 'r')
UiString = f.read() UiString = f.read()
f.close() f.close()
@ -216,7 +217,7 @@ class EfiSection (EfiSectionClassObject):
Num = SecNum Num = SecNum
if IsMakefile and StringData == ModuleNameStr: if IsMakefile and StringData == ModuleNameStr:
StringData = "$(MODULE_NAME)" 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', GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=StringData, IsMakefile=IsMakefile) Ui=StringData, IsMakefile=IsMakefile)
OutputFileList.append(OutputFile) OutputFileList.append(OutputFile)
@ -237,7 +238,7 @@ class EfiSection (EfiSectionClassObject):
""" Copy Map file to FFS output path """ """ Copy Map file to FFS output path """
Index = Index + 1 Index = Index + 1
Num = '%s.%d' %(SecNum , Index) 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) File = GenFdsGlobalVariable.MacroExtend(File, Dict)
#Get PE Section alignment when align is set to AUTO #Get PE Section alignment when align is set to AUTO

View File

@ -2626,7 +2626,7 @@ class FdfParser:
# #
@staticmethod @staticmethod
def __FileCouldHaveRelocFlag (FileType): 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 return True
else: else:
return False return False
@ -3626,12 +3626,12 @@ class FdfParser:
if not self.__GetNextWord(): if not self.__GetNextWord():
raise Warning("expected Module type", self.FileName, self.CurrentLineNumber) raise Warning("expected Module type", self.FileName, self.CurrentLineNumber)
if self.__Token.upper() not in ("SEC", "PEI_CORE", "PEIM", "DXE_CORE", \ if self.__Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, \
"DXE_DRIVER", "DXE_SAL_DRIVER", \ SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, \
"DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \ SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, \
"UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \ 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", \ "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) raise Warning("Unknown Module type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
return self.__Token return self.__Token
@ -3673,8 +3673,8 @@ class FdfParser:
raise Warning("expected FFS type", self.FileName, self.CurrentLineNumber) raise Warning("expected FFS type", self.FileName, self.CurrentLineNumber)
Type = self.__Token.strip().upper() Type = self.__Token.strip().upper()
if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\ if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,\
"PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALONE"): "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) raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
if not self.__IsToken("="): if not self.__IsToken("="):

View File

@ -16,6 +16,7 @@
# Import Modules # Import Modules
# #
from CommonDataClass.FdfClass import FDClassObject from CommonDataClass.FdfClass import FDClassObject
from Common.DataType import *
## generate FFS ## generate FFS
# #
@ -24,27 +25,27 @@ class Ffs(FDClassObject):
# mapping between MODULE type in FDF (from INF) and file type for GenFfs # mapping between MODULE type in FDF (from INF) and file type for GenFfs
ModuleTypeToFileType = { ModuleTypeToFileType = {
'SEC' : 'EFI_FV_FILETYPE_SECURITY_CORE', SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE',
'PEI_CORE' : 'EFI_FV_FILETYPE_PEI_CORE', SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE',
'PEIM' : 'EFI_FV_FILETYPE_PEIM', SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM',
'DXE_CORE' : 'EFI_FV_FILETYPE_DXE_CORE', SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE',
'DXE_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', SUP_MODULE_DXE_DRIVER : 'EFI_FV_FILETYPE_DRIVER',
'DXE_SAL_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', SUP_MODULE_DXE_SAL_DRIVER : 'EFI_FV_FILETYPE_DRIVER',
'DXE_SMM_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', SUP_MODULE_DXE_SMM_DRIVER : 'EFI_FV_FILETYPE_DRIVER',
'DXE_RUNTIME_DRIVER': 'EFI_FV_FILETYPE_DRIVER', SUP_MODULE_DXE_RUNTIME_DRIVER: 'EFI_FV_FILETYPE_DRIVER',
'UEFI_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', SUP_MODULE_UEFI_DRIVER : 'EFI_FV_FILETYPE_DRIVER',
'UEFI_APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', SUP_MODULE_UEFI_APPLICATION : 'EFI_FV_FILETYPE_APPLICATION',
'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE', SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE',
'MM_STANDALONE' : 'EFI_FV_FILETYPE_MM_STANDALONE', SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE',
'MM_CORE_STANDALONE' : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE' SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'
} }
# mapping between FILE type in FDF and file type for GenFfs # mapping between FILE type in FDF and file type for GenFfs
FdfFvFileTypeToFileType = { FdfFvFileTypeToFileType = {
'SEC' : 'EFI_FV_FILETYPE_SECURITY_CORE', SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE',
'PEI_CORE' : 'EFI_FV_FILETYPE_PEI_CORE', SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE',
'PEIM' : 'EFI_FV_FILETYPE_PEIM', SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM',
'DXE_CORE' : 'EFI_FV_FILETYPE_DXE_CORE', SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE',
'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM', 'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM',
'DRIVER' : 'EFI_FV_FILETYPE_DRIVER', 'DRIVER' : 'EFI_FV_FILETYPE_DRIVER',
'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', 'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION',
@ -52,9 +53,9 @@ class Ffs(FDClassObject):
'RAW' : 'EFI_FV_FILETYPE_RAW', 'RAW' : 'EFI_FV_FILETYPE_RAW',
'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER', 'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER',
'SMM' : 'EFI_FV_FILETYPE_SMM', 'SMM' : 'EFI_FV_FILETYPE_SMM',
'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE', SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE',
'MM_STANDALONE' : 'EFI_FV_FILETYPE_MM_STANDALONE', SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE',
'MM_CORE_STANDALONE' : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE' SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'
} }
# mapping between section type in FDF and file suffix # mapping between section type in FDF and file suffix

View File

@ -88,7 +88,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1], []).append(File) self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1], []).append(File)
# Check if current INF module has DEPEX # 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: and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
ModuleType = self.InfModule.ModuleType ModuleType = self.InfModule.ModuleType
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] 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: 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)) 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) 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) 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: 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 # 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 return EfiFile
# #
@ -488,14 +488,14 @@ class FfsInfStatement(FfsInfStatementClassObject):
# #
# Convert Fv File Type for PI1.1 SMM driver. # 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': if Rule.FvFileType == 'DRIVER':
Rule.FvFileType = 'SMM' Rule.FvFileType = 'SMM'
# #
# Framework SMM Driver has no SMM FV file type # Framework SMM Driver has no SMM FV file 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 Rule.FvFileType == 'SMM' or Rule.FvFileType == 'SMM_CORE': 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) 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 # For the rule only has simpleFile
@ -738,17 +738,17 @@ class FfsInfStatement(FfsInfStatementClassObject):
# #
# Convert Fv Section Type for PI1.1 SMM driver. # 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': if SectionType == 'DXE_DEPEX':
SectionType = 'SMM_DEPEX' SectionType = 'SMM_DEPEX'
# #
# Framework SMM Driver has no SMM_DEPEX section type # 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': if SectionType == 'SMM_DEPEX':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName) EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
NoStrip = True 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: if self.KeepReloc is not None:
NoStrip = self.KeepReloc NoStrip = self.KeepReloc
elif Rule.KeepReloc is not None: elif Rule.KeepReloc is not None:
@ -761,7 +761,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
SecNum = '%d' %Index SecNum = '%d' %Index
GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \ GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \
Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum
Index = Index + 1 Index = Index + 1
OutputFile = os.path.join(self.OutputPath, GenSecOutputFile) OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)
File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch) File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch)
@ -804,7 +804,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
else: else:
SecNum = '%d' %Index SecNum = '%d' %Index
GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \ 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) OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)
GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch) GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch)
@ -902,7 +902,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
# @retval string File name of the generated section file # @retval string File name of the generated section file
# #
def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False): 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: if Rule.KeepReloc is not None:
self.KeepRelocFromRule = Rule.KeepReloc self.KeepRelocFromRule = Rule.KeepReloc
SectFiles = [] SectFiles = []
@ -941,13 +941,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
# #
# Convert Fv Section Type for PI1.1 SMM driver. # 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': if Sect.SectionType == 'DXE_DEPEX':
Sect.SectionType = 'SMM_DEPEX' Sect.SectionType = 'SMM_DEPEX'
# #
# Framework SMM Driver has no SMM_DEPEX section type # 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': if Sect.SectionType == 'SMM_DEPEX':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName) EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
# #

View File

@ -24,6 +24,7 @@ import Common.LongFilePathOs as os
from CommonDataClass.FdfClass import FvImageSectionClassObject from CommonDataClass.FdfClass import FvImageSectionClassObject
from Common import EdkLogger from Common import EdkLogger
from Common.BuildToolError import * from Common.BuildToolError import *
from Common.DataType import *
## generate FV image section ## generate FV image section
# #
@ -74,7 +75,7 @@ class FvImageSection(FvImageSectionClassObject):
if FvAlignmentValue > MaxFvAlignment: if FvAlignmentValue > MaxFvAlignment:
MaxFvAlignment = FvAlignmentValue 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) GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
OutputFileList.append(OutputFile) OutputFileList.append(OutputFile)
@ -138,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject):
# #
# Prepare the parameter of GenSection # 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) GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
OutputFileList.append(OutputFile) OutputFileList.append(OutputFile)

View File

@ -28,6 +28,7 @@ from Common.BuildToolError import *
from FvImageSection import FvImageSection from FvImageSection import FvImageSection
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
from GenFds import FindExtendTool from GenFds import FindExtendTool
from Common.DataType import *
## generate GUIDed section ## generate GUIDed section
# #
@ -121,7 +122,7 @@ class GuidSection(GuidSectionClassObject) :
OutputFile = OutputPath + \ OutputFile = OutputPath + \
os.sep + \ os.sep + \
ModuleName + \ ModuleName + \
'SEC' + \ SUP_MODULE_SEC + \
SecNum + \ SecNum + \
Ffs.SectionSuffix['GUIDED'] Ffs.SectionSuffix['GUIDED']
OutputFile = os.path.normpath(OutputFile) OutputFile = os.path.normpath(OutputFile)
@ -156,7 +157,7 @@ class GuidSection(GuidSectionClassObject) :
TempFile = OutputPath + \ TempFile = OutputPath + \
os.sep + \ os.sep + \
ModuleName + \ ModuleName + \
'SEC' + \ SUP_MODULE_SEC + \
SecNum + \ SecNum + \
'.tmp' '.tmp'
TempFile = os.path.normpath(TempFile) TempFile = os.path.normpath(TempFile)

View File

@ -22,6 +22,7 @@ import Common.LongFilePathOs as os
from GenFdsGlobalVariable import GenFdsGlobalVariable from GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import UiSectionClassObject from CommonDataClass.FdfClass import UiSectionClassObject
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.DataType import SUP_MODULE_SEC
## generate UI section ## generate UI section
# #
@ -57,7 +58,7 @@ class UiSection (UiSectionClassObject):
self.StringData = FfsInf.__ExtendMacro__(self.StringData) self.StringData = FfsInf.__ExtendMacro__(self.StringData)
self.FileName = FfsInf.__ExtendMacro__(self.FileName) 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 : if self.StringData is not None :
NameString = self.StringData NameString = self.StringData

View File

@ -22,6 +22,7 @@ import subprocess
from GenFdsGlobalVariable import GenFdsGlobalVariable from GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import VerSectionClassObject from CommonDataClass.FdfClass import VerSectionClassObject
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.DataType import SUP_MODULE_SEC
## generate version section ## generate version section
# #
@ -59,7 +60,7 @@ class VerSection (VerSectionClassObject):
self.FileName = FfsInf.__ExtendMacro__(self.FileName) self.FileName = FfsInf.__ExtendMacro__(self.FileName)
OutputFile = os.path.join(OutputPath, 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) OutputFile = os.path.normpath(OutputFile)
# Get String Data # Get String Data

View File

@ -68,22 +68,22 @@ class InfBuildData(ModuleBuildClassObject):
# dict used to convert Component type to Module type # dict used to convert Component type to Module type
_MODULE_TYPE_ = { _MODULE_TYPE_ = {
"LIBRARY" : "BASE", "LIBRARY" : SUP_MODULE_BASE,
"SECURITY_CORE" : "SEC", "SECURITY_CORE" : SUP_MODULE_SEC,
"PEI_CORE" : "PEI_CORE", SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE,
"COMBINED_PEIM_DRIVER" : "PEIM", "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM,
"PIC_PEIM" : "PEIM", "PIC_PEIM" : SUP_MODULE_PEIM,
"RELOCATABLE_PEIM" : "PEIM", "RELOCATABLE_PEIM" : SUP_MODULE_PEIM,
"PE32_PEIM" : "PEIM", "PE32_PEIM" : SUP_MODULE_PEIM,
"BS_DRIVER" : "DXE_DRIVER", "BS_DRIVER" : SUP_MODULE_DXE_DRIVER,
"RT_DRIVER" : "DXE_RUNTIME_DRIVER", "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER,
"SAL_RT_DRIVER" : "DXE_SAL_DRIVER", "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER,
"DXE_SMM_DRIVER" : "DXE_SMM_DRIVER", SUP_MODULE_DXE_SMM_DRIVER : SUP_MODULE_DXE_SMM_DRIVER,
# "SMM_DRIVER" : "DXE_SMM_DRIVER", # "SMM_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER,
# "BS_DRIVER" : "DXE_SMM_DRIVER", # "BS_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER,
# "BS_DRIVER" : "UEFI_DRIVER", # "BS_DRIVER" : SUP_MODULE_UEFI_DRIVER,
"APPLICATION" : "UEFI_APPLICATION", "APPLICATION" : SUP_MODULE_UEFI_APPLICATION,
"LOGO" : "BASE", "LOGO" : SUP_MODULE_BASE,
} }
# regular expression for converting XXX_FLAGS in [nmake] section to new type # regular expression for converting XXX_FLAGS in [nmake] section to new type
@ -461,9 +461,9 @@ class InfBuildData(ModuleBuildClassObject):
if self._Header_ is None: if self._Header_ is None:
self._GetHeaderInfo() self._GetHeaderInfo()
if self._ModuleType is None: if self._ModuleType is None:
self._ModuleType = 'BASE' self._ModuleType = SUP_MODULE_BASE
if self._ModuleType not in SUP_MODULE_LIST: if self._ModuleType not in SUP_MODULE_LIST:
self._ModuleType = "USER_DEFINED" self._ModuleType = SUP_MODULE_USER_DEFINED
return self._ModuleType return self._ModuleType
## Retrieve COMPONENT_TYPE ## Retrieve COMPONENT_TYPE
@ -472,7 +472,7 @@ class InfBuildData(ModuleBuildClassObject):
if self._Header_ is None: if self._Header_ is None:
self._GetHeaderInfo() self._GetHeaderInfo()
if self._ComponentType is None: if self._ComponentType is None:
self._ComponentType = 'USER_DEFINED' self._ComponentType = SUP_MODULE_USER_DEFINED
return self._ComponentType return self._ComponentType
## Retrieve "BUILD_TYPE" ## Retrieve "BUILD_TYPE"
@ -481,7 +481,7 @@ class InfBuildData(ModuleBuildClassObject):
if self._Header_ is None: if self._Header_ is None:
self._GetHeaderInfo() self._GetHeaderInfo()
if not self._BuildType: if not self._BuildType:
self._BuildType = "BASE" self._BuildType = SUP_MODULE_BASE
return self._BuildType return self._BuildType
## Retrieve file guid ## Retrieve file guid
@ -899,14 +899,14 @@ class InfBuildData(ModuleBuildClassObject):
# PEIM and DXE drivers must have a valid [Depex] section # PEIM and DXE drivers must have a valid [Depex] section
if len(self.LibraryClass) == 0 and len(RecordList) == 0: 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 \ if self.ModuleType == SUP_MODULE_DXE_DRIVER or self.ModuleType == SUP_MODULE_PEIM or self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER or \
self.ModuleType == 'DXE_SAL_DRIVER' or self.ModuleType == 'DXE_RUNTIME_DRIVER': 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" \ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [Depex] section or no valid expression in [Depex] section for [%s] module" \
% self.ModuleType, File=self.MetaFile) % 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: 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, EdkLogger.error('build', FORMAT_INVALID,
"'%s' module must specify the type of [Depex] section" % self.ModuleType, "'%s' module must specify the type of [Depex] section" % self.ModuleType,
File=self.MetaFile) File=self.MetaFile)

View File

@ -134,7 +134,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildDatabase, Arch, Target, To
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType])) LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
elif LibraryModule.LibraryClass is None \ elif LibraryModule.LibraryClass is None \
or len(LibraryModule.LibraryClass) == 0 \ or len(LibraryModule.LibraryClass) == 0 \
or (ModuleType != 'USER_DEFINED' or (ModuleType != SUP_MODULE_USER_DEFINED
and ModuleType not in LibraryModule.LibraryClass[0].SupModList): and ModuleType not in LibraryModule.LibraryClass[0].SupModList):
# only USER_DEFINED can link against any library instance despite of its SupModList # only USER_DEFINED can link against any library instance despite of its SupModList
return [] return []

View File

@ -48,18 +48,18 @@ import collections
from Common.Expression import * from Common.Expression import *
gComponentType2ModuleType = { gComponentType2ModuleType = {
"LIBRARY" : "BASE", "LIBRARY" : SUP_MODULE_BASE,
"SECURITY_CORE" : "SEC", "SECURITY_CORE" : SUP_MODULE_SEC,
"PEI_CORE" : "PEI_CORE", SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE,
"COMBINED_PEIM_DRIVER" : "PEIM", "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM,
"PIC_PEIM" : "PEIM", "PIC_PEIM" : SUP_MODULE_PEIM,
"RELOCATABLE_PEIM" : "PEIM", "RELOCATABLE_PEIM" : SUP_MODULE_PEIM,
"PE32_PEIM" : "PEIM", "PE32_PEIM" : SUP_MODULE_PEIM,
"BS_DRIVER" : "DXE_DRIVER", "BS_DRIVER" : SUP_MODULE_DXE_DRIVER,
"RT_DRIVER" : "DXE_RUNTIME_DRIVER", "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER,
"SAL_RT_DRIVER" : "DXE_SAL_DRIVER", "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER,
"APPLICATION" : "UEFI_APPLICATION", "APPLICATION" : SUP_MODULE_UEFI_APPLICATION,
"LOGO" : "BASE", "LOGO" : SUP_MODULE_BASE,
} }
## Pattern to extract contents in EDK DXS files ## Pattern to extract contents in EDK DXS files
@ -122,20 +122,20 @@ gPcdTypeMap = {
## The look up table to map module type to driver type ## The look up table to map module type to driver type
gDriverTypeMap = { gDriverTypeMap = {
'SEC' : '0x3 (SECURITY_CORE)', SUP_MODULE_SEC : '0x3 (SECURITY_CORE)',
'PEI_CORE' : '0x4 (PEI_CORE)', SUP_MODULE_PEI_CORE : '0x4 (PEI_CORE)',
'PEIM' : '0x6 (PEIM)', SUP_MODULE_PEIM : '0x6 (PEIM)',
'DXE_CORE' : '0x5 (DXE_CORE)', SUP_MODULE_DXE_CORE : '0x5 (DXE_CORE)',
'DXE_DRIVER' : '0x7 (DRIVER)', SUP_MODULE_DXE_DRIVER : '0x7 (DRIVER)',
'DXE_SAL_DRIVER' : '0x7 (DRIVER)', SUP_MODULE_DXE_SAL_DRIVER : '0x7 (DRIVER)',
'DXE_SMM_DRIVER' : '0x7 (DRIVER)', SUP_MODULE_DXE_SMM_DRIVER : '0x7 (DRIVER)',
'DXE_RUNTIME_DRIVER': '0x7 (DRIVER)', SUP_MODULE_DXE_RUNTIME_DRIVER: '0x7 (DRIVER)',
'UEFI_DRIVER' : '0x7 (DRIVER)', SUP_MODULE_UEFI_DRIVER : '0x7 (DRIVER)',
'UEFI_APPLICATION' : '0x9 (APPLICATION)', SUP_MODULE_UEFI_APPLICATION : '0x9 (APPLICATION)',
'SMM_CORE' : '0xD (SMM_CORE)', SUP_MODULE_SMM_CORE : '0xD (SMM_CORE)',
'SMM_DRIVER' : '0xA (SMM)', # Extension of module type to support PI 1.1 SMM drivers 'SMM_DRIVER' : '0xA (SMM)', # Extension of module type to support PI 1.1 SMM drivers
'MM_STANDALONE' : '0xE (MM_STANDALONE)', SUP_MODULE_MM_STANDALONE : '0xE (MM_STANDALONE)',
'MM_CORE_STANDALONE' : '0xF (MM_CORE_STANDALONE)' SUP_MODULE_MM_CORE_STANDALONE : '0xF (MM_CORE_STANDALONE)'
} }
## The look up table of the supported opcode in the dependency expression binaries ## The look up table of the supported opcode in the dependency expression binaries
@ -424,7 +424,7 @@ class DepexReport(object):
if not ModuleType: if not ModuleType:
ModuleType = gComponentType2ModuleType.get(M.ComponentType, "") 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 return
for Source in M.SourceFileList: 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 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") PiSpec = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000")
if int(PiSpec, 0) >= 0x0001000A: if int(PiSpec, 0) >= 0x0001000A:
ModuleType = "SMM_DRIVER" ModuleType = "SMM_DRIVER"
@ -1382,7 +1382,7 @@ class PredictionReport(object):
# their source code to find PPI/Protocol produce or consume # their source code to find PPI/Protocol produce or consume
# information. # information.
# #
if Module.ModuleType == "BASE": if Module.ModuleType == SUP_MODULE_BASE:
continue continue
# #
# Add module referenced source files # Add module referenced source files

View File

@ -1587,22 +1587,22 @@ class Build():
if not ImageClass.IsValid: if not ImageClass.IsValid:
EdkLogger.error("build", FILE_PARSE_FAILURE, ExtraData=ImageClass.ErrorInfo) EdkLogger.error("build", FILE_PARSE_FAILURE, ExtraData=ImageClass.ErrorInfo)
ImageInfo = PeImageInfo(Module.Name, Module.Guid, Module.Arch, Module.OutputDir, Module.DebugDir, ImageClass) 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 PeiModuleList[Module.MetaFile] = ImageInfo
PeiSize += ImageInfo.Image.Size 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 BtModuleList[Module.MetaFile] = ImageInfo
BtSize += ImageInfo.Image.Size 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 RtModuleList[Module.MetaFile] = ImageInfo
#IPF runtime driver needs to be at 2 page alignment. #IPF runtime driver needs to be at 2 page alignment.
if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0: if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0:
ImageInfo.Image.Size = (ImageInfo.Image.Size / 0x2000 + 1) * 0x2000 ImageInfo.Image.Size = (ImageInfo.Image.Size / 0x2000 + 1) * 0x2000
RtSize += ImageInfo.Image.Size 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 SmmModuleList[Module.MetaFile] = ImageInfo
SmmSize += ImageInfo.Image.Size 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') PiSpecVersion = Module.Module.Specification.get('PI_SPECIFICATION_VERSION', '0x00000000')
# for PI specification < PI1.1, DXE_SMM_DRIVER also runs as BOOT time driver. # for PI specification < PI1.1, DXE_SMM_DRIVER also runs as BOOT time driver.
if int(PiSpecVersion, 16) < 0x0001000A: if int(PiSpecVersion, 16) < 0x0001000A: