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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Carsey, Jaben
2018-04-27 00:57:56 +08:00
committed by Yonghong Zhu
parent be409b6756
commit 91fa33eeca
24 changed files with 143 additions and 137 deletions

View File

@ -922,7 +922,7 @@ class WorkspaceAutoGen(AutoGen):
## Return the directory to store FV files ## Return the directory to store FV files
def _GetFvDir(self): def _GetFvDir(self):
if self._FvDir is None: 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 self._FvDir
## Return the directory to store all intermediate and final files built ## Return the directory to store all intermediate and final files built
@ -1325,7 +1325,7 @@ class PlatformAutoGen(AutoGen):
def UpdateNVStoreMaxSize(self,OrgVpdFile): def UpdateNVStoreMaxSize(self,OrgVpdFile):
if self.VariableInfo: 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"] PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if item.TokenCName == "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName == "gEfiMdeModulePkgTokenSpaceGuid"]
if PcdNvStoreDfBuffer: if PcdNvStoreDfBuffer:
@ -1718,7 +1718,7 @@ class PlatformAutoGen(AutoGen):
# Process VPD map file generated by third party BPDG tool # Process VPD map file generated by third party BPDG tool
if NeedProcessVpdMapFile: 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): if os.path.exists(VpdMapFilePath):
VpdFile.Read(VpdMapFilePath) VpdFile.Read(VpdMapFilePath)
@ -1769,7 +1769,7 @@ class PlatformAutoGen(AutoGen):
self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList
def FixVpdOffset(self,VpdFile ): 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): if not os.path.exists(FvPath):
try: try:
os.makedirs(FvPath) 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. # retrieve BPDG tool's path from tool_def.txt according to VPD_TOOL_GUID defined in DSC file.
BPDGToolName = None BPDGToolName = None
for ToolDef in self.ToolDefinition.values(): 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"): 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) 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"] BPDGToolName = ToolDef["PATH"]
@ -3031,7 +3031,7 @@ class ModuleAutoGen(AutoGen):
def _GetFfsOutputDir(self): def _GetFfsOutputDir(self):
if self._FfsOutputDir is None: if self._FfsOutputDir is None:
if GlobalData.gFdfParser is not 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: else:
self._FfsOutputDir = '' self._FfsOutputDir = ''
return self._FfsOutputDir return self._FfsOutputDir

View File

@ -1613,7 +1613,7 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
# #
def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH): def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
GuidType = "GUID" GuidType = TAB_GUID
else: else:
GuidType = "EFI_GUID" GuidType = "EFI_GUID"
@ -1637,7 +1637,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
# #
def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH): def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
GuidType = "GUID" GuidType = TAB_GUID
else: else:
GuidType = "EFI_GUID" GuidType = "EFI_GUID"
@ -1661,7 +1661,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
# #
def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH): def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
GuidType = "GUID" GuidType = TAB_GUID
else: else:
GuidType = "EFI_GUID" GuidType = "EFI_GUID"
@ -1698,7 +1698,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
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 [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
GuidType = "GUID" GuidType = TAB_GUID
else: else:
GuidType = "EFI_GUID" GuidType = "EFI_GUID"
for Item in TokenSpaceList: for Item in TokenSpaceList:

View File

@ -972,7 +972,7 @@ def CreatePcdDatabaseCode (Info, AutoGenC, AutoGenH):
AutoGenC.Append(AdditionalAutoGenC.String) AutoGenC.Append(AdditionalAutoGenC.String)
if Info.IsBinaryModule: 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: else:
DbFileName = os.path.join(Info.OutputDir, Phase + "PcdDataBase.raw") DbFileName = os.path.join(Info.OutputDir, Phase + "PcdDataBase.raw")
DbFile = StringIO() DbFile = StringIO()
@ -1054,7 +1054,7 @@ def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform,Phase):
PcdDriverAutoGenData[(skuname,skuid)] = (AdditionalAutoGenH, AdditionalAutoGenC) PcdDriverAutoGenData[(skuname,skuid)] = (AdditionalAutoGenH, AdditionalAutoGenC)
VarCheckTableData[(skuname,skuid)] = VarCheckTab VarCheckTableData[(skuname,skuid)] = VarCheckTab
if Platform.Platform.VarCheckFlag: if Platform.Platform.VarCheckFlag:
dest = os.path.join(Platform.BuildDir, 'FV') dest = os.path.join(Platform.BuildDir, TAB_FV_DIRECTORY)
VarCheckTable = CreateVarCheckBin(VarCheckTableData) VarCheckTable = CreateVarCheckBin(VarCheckTableData)
VarCheckTable.dump(dest, Phase) VarCheckTable.dump(dest, Phase)
AdditionalAutoGenH, AdditionalAutoGenC = CreateAutoGen(PcdDriverAutoGenData) AdditionalAutoGenH, AdditionalAutoGenC = CreateAutoGen(PcdDriverAutoGenData)

View File

@ -40,6 +40,7 @@ TAB_UINT16 = 'UINT16'
TAB_UINT32 = 'UINT32' TAB_UINT32 = 'UINT32'
TAB_UINT64 = 'UINT64' TAB_UINT64 = 'UINT64'
TAB_VOID = 'VOID*' TAB_VOID = 'VOID*'
TAB_GUID = 'GUID'
TAB_PCD_CLEAN_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64} 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'} 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_EDK_SOURCE = '$(EDK_SOURCE)'
TAB_EFI_SOURCE = '$(EFI_SOURCE)' TAB_EFI_SOURCE = '$(EFI_SOURCE)'
TAB_WORKSPACE = '$(WORKSPACE)' TAB_WORKSPACE = '$(WORKSPACE)'
TAB_FV_DIRECTORY = 'FV'
TAB_ARCH_NULL = '' TAB_ARCH_NULL = ''
TAB_ARCH_COMMON = 'COMMON' TAB_ARCH_COMMON = 'COMMON'

View File

@ -951,7 +951,7 @@ class ValueExpressionEx(ValueExpression):
Size = 0 Size = 0
ValueStr = '' ValueStr = ''
TokenSpaceGuidName = '' TokenSpaceGuidName = ''
if Item.startswith('GUID') and Item.endswith(')'): if Item.startswith(TAB_GUID) and Item.endswith(')'):
try: try:
TokenSpaceGuidName = re.search('GUID\((\w+)\)', Item).group(1) TokenSpaceGuidName = re.search('GUID\((\w+)\)', Item).group(1)
except: except:

View File

@ -1219,7 +1219,7 @@ class tdict:
def IsFieldValueAnArray (Value): def IsFieldValueAnArray (Value):
Value = Value.strip() Value = Value.strip()
if Value.startswith('GUID') and Value.endswith(')'): if Value.startswith(TAB_GUID) and Value.endswith(')'):
return True return True
if Value.startswith('L"') and Value.endswith('"') and len(list(Value[2:-1])) > 1: if Value.startswith('L"') and Value.endswith('"') and len(list(Value[2:-1])) > 1:
return True return True
@ -1316,7 +1316,7 @@ def ParseFieldValue (Value):
if Size > 8: if Size > 8:
raise BadExpression('Value (%s) Size larger than %d' % (Value, Size)) raise BadExpression('Value (%s) Size larger than %d' % (Value, Size))
return Value, 8 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() Value = Value.split('(', 1)[1][:-1].strip()
if Value[0] == '{' and Value[-1] == '}': if Value[0] == '{' and Value[-1] == '}':
TmpValue = GuidStructureStringToGuidString(Value) TmpValue = GuidStructureStringToGuidString(Value)

View File

@ -82,7 +82,7 @@ class DataSection (DataSectionClassObject):
CopyLongFilePath(MapFile, CopyMapFile) CopyLongFilePath(MapFile, CopyMapFile)
#Get PE Section alignment when align is set to AUTO #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) ImageObj = PeImageClass (Filename)
if ImageObj.SectionAlignment < 0x400: if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment) self.Alignment = str (ImageObj.SectionAlignment)
@ -92,7 +92,7 @@ class DataSection (DataSectionClassObject):
self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M' self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'
NoStrip = True 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: if self.KeepReloc is not None:
NoStrip = self.KeepReloc NoStrip = self.KeepReloc
@ -110,7 +110,7 @@ class DataSection (DataSectionClassObject):
) )
self.SectFileName = StrippedFile self.SectFileName = StrippedFile
if self.SecType == 'TE': if self.SecType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw') TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage( GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile, TeFile,

View File

@ -96,13 +96,13 @@ class DepexSection (DepexSectionClassObject):
if self.DepexType == 'PEI_DEPEX_EXP': if self.DepexType == 'PEI_DEPEX_EXP':
ModuleType = SUP_MODULE_PEIM ModuleType = SUP_MODULE_PEIM
SecType = 'PEI_DEPEX' SecType = BINARY_FILE_TYPE_PEI_DEPEX
elif self.DepexType == 'DXE_DEPEX_EXP': elif self.DepexType == 'DXE_DEPEX_EXP':
ModuleType = SUP_MODULE_DXE_DRIVER ModuleType = SUP_MODULE_DXE_DRIVER
SecType = 'DXE_DEPEX' SecType = BINARY_FILE_TYPE_DXE_DEPEX
elif self.DepexType == 'SMM_DEPEX_EXP': elif self.DepexType == 'SMM_DEPEX_EXP':
ModuleType = SUP_MODULE_DXE_SMM_DRIVER ModuleType = SUP_MODULE_DXE_SMM_DRIVER
SecType = 'SMM_DEPEX' SecType = BINARY_FILE_TYPE_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))

View File

@ -67,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 (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: if FfsInf.KeepReloc is not None:
NoStrip = FfsInf.KeepReloc NoStrip = FfsInf.KeepReloc
elif FfsInf.KeepRelocFromRule is not None: elif FfsInf.KeepRelocFromRule is not None:
@ -171,9 +171,9 @@ class EfiSection (EfiSectionClassObject):
OutputFileList.append(OutputFile) 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 InfOverrideUiString = False
if FfsInf.Ui is not None: if FfsInf.Ui is not None:
@ -242,7 +242,7 @@ class EfiSection (EfiSectionClassObject):
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
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) ImageObj = PeImageClass (File)
if ImageObj.SectionAlignment < 0x400: if ImageObj.SectionAlignment < 0x400:
Align = str (ImageObj.SectionAlignment) Align = str (ImageObj.SectionAlignment)
@ -287,7 +287,7 @@ class EfiSection (EfiSectionClassObject):
"""For TE Section call GenFw to generate TE image""" """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') TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage( GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile, TeFile,

View File

@ -27,6 +27,7 @@ from Common import EdkLogger
from Common.BuildToolError import * from Common.BuildToolError import *
from Common.Misc import SaveFileOnChange from Common.Misc import SaveFileOnChange
from GenFds import GenFds from GenFds import GenFds
from Common.DataType import BINARY_FILE_TYPE_FV
## generate FD ## generate FD
# #
@ -158,7 +159,7 @@ class FD(FDClassObject):
FvAddDict ={} FvAddDict ={}
FvList = [] FvList = []
for RegionObj in self.RegionList: for RegionObj in self.RegionList:
if RegionObj.RegionType == 'FV': if RegionObj.RegionType == BINARY_FILE_TYPE_FV:
if len(RegionObj.RegionDataList) == 1: if len(RegionObj.RegionDataList) == 1:
RegionData = RegionObj.RegionDataList[0] RegionData = RegionObj.RegionDataList[0]
FvList.append(RegionData.upper()) FvList.append(RegionData.upper())

View File

@ -1843,7 +1843,7 @@ class FdfParser:
if not self.__GetNextWord(): if not self.__GetNextWord():
return True 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]] # 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. # 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(): if not self.__GetNextWord():
return True return True
elif self.__Token == "FV": elif self.__Token == BINARY_FILE_TYPE_FV:
self.__UndoToken() self.__UndoToken()
self.__GetRegionFvType( RegionObj) self.__GetRegionFvType( RegionObj)
@ -1918,8 +1918,8 @@ class FdfParser:
# #
def __GetRegionFvType(self, RegionObj): def __GetRegionFvType(self, RegionObj):
if not self.__IsKeyword( "FV"): if not self.__IsKeyword( BINARY_FILE_TYPE_FV):
raise Warning("expected Keyword 'FV'", self.FileName, self.CurrentLineNumber) raise Warning("expected Keyword BINARY_FILE_TYPE_FV", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="): if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber) raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
@ -1927,10 +1927,10 @@ class FdfParser:
if not self.__GetNextToken(): if not self.__GetNextToken():
raise Warning("expected FV name", self.FileName, self.CurrentLineNumber) raise Warning("expected FV name", self.FileName, self.CurrentLineNumber)
RegionObj.RegionType = "FV" RegionObj.RegionType = BINARY_FILE_TYPE_FV
RegionObj.RegionDataList.append((self.__Token).upper()) RegionObj.RegionDataList.append((self.__Token).upper())
while self.__IsKeyword( "FV"): while self.__IsKeyword( BINARY_FILE_TYPE_FV):
if not self.__IsToken( "="): if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber) raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
@ -2528,7 +2528,7 @@ class FdfParser:
if self.__GetStringData(): if self.__GetStringData():
FfsInfObj.Version = self.__Token FfsInfObj.Version = self.__Token
if self.__IsKeyword( "UI"): if self.__IsKeyword( BINARY_FILE_TYPE_UI):
if not self.__IsToken( "="): if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber) raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken(): if not self.__GetNextToken():
@ -2641,7 +2641,7 @@ class FdfParser:
# #
@staticmethod @staticmethod
def __SectionCouldHaveRelocFlag (SectionType): def __SectionCouldHaveRelocFlag (SectionType):
if SectionType in ('TE', 'PE32'): if SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
return True return True
else: else:
return False return False
@ -2674,7 +2674,7 @@ class FdfParser:
if not self.__GetNextToken(): if not self.__GetNextToken():
raise Warning("expected File name or section data", self.FileName, self.CurrentLineNumber) 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( "="): if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber) raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken(): if not self.__GetNextToken():
@ -2881,7 +2881,7 @@ class FdfParser:
VerSectionObj.FileName = self.__Token VerSectionObj.FileName = self.__Token
Obj.SectionList.append(VerSectionObj) Obj.SectionList.append(VerSectionObj)
elif self.__IsKeyword( "UI"): elif self.__IsKeyword( BINARY_FILE_TYPE_UI):
if AlignValue == 'Auto': if AlignValue == 'Auto':
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber) raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="): if not self.__IsToken( "="):
@ -2965,10 +2965,10 @@ class FdfParser:
self.SetFileBufferPos(OldPos) self.SetFileBufferPos(OldPos)
return False return False
if self.__Token not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_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,\
"UI", "VERSION", "PEI_DEPEX", "SUBTYPE_GUID", "SMM_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) 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) raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
# DataSection # DataSection
@ -3386,7 +3386,7 @@ class FdfParser:
# #
def __GetFvStatement(self, CapsuleObj, FMPCapsule = False): def __GetFvStatement(self, CapsuleObj, FMPCapsule = False):
if not self.__IsKeyword("FV"): if not self.__IsKeyword(BINARY_FILE_TYPE_FV):
return False return False
if not self.__IsToken("="): if not self.__IsToken("="):
@ -3534,7 +3534,7 @@ class FdfParser:
AfileBaseName = os.path.basename(AfileName) AfileBaseName = os.path.basename(AfileName)
if os.path.splitext(AfileBaseName)[1] not in [".bin",".BIN",".Bin",".dat",".DAT",".Dat",".data",".DATA",".Data"]: 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) self.FileName, self.CurrentLineNumber)
if not os.path.isabs(AfileName): if not os.path.isabs(AfileName):
@ -3767,8 +3767,8 @@ class FdfParser:
SectionName = self.__Token SectionName = self.__Token
if SectionName not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_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,\
"UI", "PEI_DEPEX", "VERSION", "SUBTYPE_GUID", "SMM_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) 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", if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
"256K", "512K", "1M", "2M", "4M", "8M", "16M"): "256K", "512K", "1M", "2M", "4M", "8M", "16M"):
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) 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) raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
SectAlignment = self.__Token SectAlignment = self.__Token
@ -3824,8 +3824,8 @@ class FdfParser:
return False return False
SectionName = self.__Token SectionName = self.__Token
if SectionName not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_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,\
"UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_DEPEX"): BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX):
self.__UndoToken() self.__UndoToken()
return False return False
@ -3855,8 +3855,8 @@ class FdfParser:
FvImageSectionObj.FvName = None FvImageSectionObj.FvName = None
else: else:
if not self.__IsKeyword("FV"): if not self.__IsKeyword(BINARY_FILE_TYPE_FV):
raise Warning("expected 'FV'", self.FileName, self.CurrentLineNumber) raise Warning("expected BINARY_FILE_TYPE_FV", self.FileName, self.CurrentLineNumber)
FvImageSectionObj.FvFileType = self.__Token FvImageSectionObj.FvFileType = self.__Token
if self.__GetAlignment(): if self.__GetAlignment():
@ -3868,8 +3868,8 @@ class FdfParser:
if self.__IsToken('|'): if self.__IsToken('|'):
FvImageSectionObj.FvFileExtension = self.__GetFileExtension() FvImageSectionObj.FvFileExtension = self.__GetFileExtension()
elif self.__GetNextToken(): elif self.__GetNextToken():
if self.__Token not in ("}", "COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_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,\
"UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_DEPEX"): BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX):
FvImageSectionObj.FvFileName = self.__Token FvImageSectionObj.FvFileName = self.__Token
else: else:
self.__UndoToken() 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", if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
"256K", "512K", "1M", "2M", "4M", "8M", "16M"): "256K", "512K", "1M", "2M", "4M", "8M", "16M"):
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) 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) raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
EfiSectionObj.Alignment = self.__Token EfiSectionObj.Alignment = self.__Token
@ -3950,8 +3950,8 @@ class FdfParser:
if self.__IsToken('|'): if self.__IsToken('|'):
EfiSectionObj.FileExtension = self.__GetFileExtension() EfiSectionObj.FileExtension = self.__GetFileExtension()
elif self.__GetNextToken(): elif self.__GetNextToken():
if self.__Token not in ("}", "COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_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,\
"UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_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'): if self.__Token.startswith('PCD'):
self.__UndoToken() self.__UndoToken()
@ -3985,7 +3985,7 @@ class FdfParser:
# #
@staticmethod @staticmethod
def __RuleSectionCouldBeOptional(SectionType): 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 return True
else: else:
return False return False
@ -4015,7 +4015,7 @@ class FdfParser:
# #
@staticmethod @staticmethod
def __RuleSectionCouldHaveString(SectionType): def __RuleSectionCouldHaveString(SectionType):
if SectionType in ("UI", "VERSION"): if SectionType in (BINARY_FILE_TYPE_UI, "VERSION"):
return True return True
else: else:
return False return False
@ -4032,32 +4032,32 @@ class FdfParser:
if SectionType == "COMPAT16": if SectionType == "COMPAT16":
if FileType not in ("COMPAT16", "SEC_COMPAT16"): if FileType not in ("COMPAT16", "SEC_COMPAT16"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber) raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "PE32": elif SectionType == BINARY_FILE_TYPE_PE32:
if FileType not in ("PE32", "SEC_PE32"): if FileType not in (BINARY_FILE_TYPE_PE32, "SEC_PE32"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber) raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "PIC": elif SectionType == BINARY_FILE_TYPE_PIC:
if FileType not in ("PIC", "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) raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "TE": elif SectionType == BINARY_FILE_TYPE_TE:
if FileType not in ("TE", "SEC_TE"): if FileType not in (BINARY_FILE_TYPE_TE, "SEC_TE"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber) raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "RAW": 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) raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "DXE_DEPEX" or SectionType == "SMM_DEPEX": elif SectionType == BINARY_FILE_TYPE_DXE_DEPEX or SectionType == BINARY_FILE_TYPE_SMM_DEPEX:
if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX", "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) raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "UI": elif SectionType == BINARY_FILE_TYPE_UI:
if FileType not in ("UI", "SEC_UI"): if FileType not in (BINARY_FILE_TYPE_UI, "SEC_UI"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber) raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "VERSION": elif SectionType == "VERSION":
if FileType not in ("VERSION", "SEC_VERSION"): if FileType not in ("VERSION", "SEC_VERSION"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber) raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "PEI_DEPEX": elif SectionType == BINARY_FILE_TYPE_PEI_DEPEX:
if FileType not in ("PEI_DEPEX", "SEC_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) raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "GUID": elif SectionType == BINARY_FILE_TYPE_GUID:
if FileType not in ("PE32", "SEC_GUID"): if FileType not in (BINARY_FILE_TYPE_PE32, "SEC_GUID"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber) raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
## __GetRuleEncapsulationSection() method ## __GetRuleEncapsulationSection() method
@ -4494,7 +4494,7 @@ class FdfParser:
FfsFileObj = OptRomFileStatement.OptRomFileStatement() 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) raise Warning("expected Binary type (EFI/BIN)", self.FileName, self.CurrentLineNumber)
FfsFileObj.FileType = self.__Token FfsFileObj.FileType = self.__Token
@ -4575,7 +4575,7 @@ class FdfParser:
if FdName.upper() in self.Profile.FdDict: if FdName.upper() in self.Profile.FdDict:
FdObj = self.Profile.FdDict[FdName.upper()] FdObj = self.Profile.FdDict[FdName.upper()]
for elementRegion in FdObj.RegionList: for elementRegion in FdObj.RegionList:
if elementRegion.RegionType == 'FV': if elementRegion.RegionType == BINARY_FILE_TYPE_FV:
for elementRegionData in elementRegion.RegionDataList: for elementRegionData in elementRegion.RegionDataList:
if elementRegionData.endswith(".fv"): if elementRegionData.endswith(".fv"):
continue continue

View File

@ -42,12 +42,12 @@ class Ffs(FDClassObject):
# mapping between section type in FDF and file suffix # mapping between section type in FDF and file suffix
SectionSuffix = { SectionSuffix = {
'PE32' : '.pe32', BINARY_FILE_TYPE_PE32 : '.pe32',
'PIC' : '.pic', BINARY_FILE_TYPE_PIC : '.pic',
'TE' : '.te', BINARY_FILE_TYPE_TE : '.te',
'DXE_DEPEX' : '.dpx', BINARY_FILE_TYPE_DXE_DEPEX : '.dpx',
'VERSION' : '.ver', 'VERSION' : '.ver',
'UI' : '.ui', BINARY_FILE_TYPE_UI : '.ui',
'COMPAT16' : '.com16', 'COMPAT16' : '.com16',
'RAW' : '.raw', 'RAW' : '.raw',
'FREEFORM_SUBTYPE_GUID': '.guid', 'FREEFORM_SUBTYPE_GUID': '.guid',
@ -55,8 +55,8 @@ class Ffs(FDClassObject):
'FV_IMAGE' : 'fv.sec', 'FV_IMAGE' : 'fv.sec',
'COMPRESS' : '.com', 'COMPRESS' : '.com',
'GUIDED' : '.guided', 'GUIDED' : '.guided',
'PEI_DEPEX' : '.dpx', BINARY_FILE_TYPE_PEI_DEPEX : '.dpx',
'SMM_DEPEX' : '.dpx' BINARY_FILE_TYPE_SMM_DEPEX : '.dpx'
} }
## The constructor ## The constructor

View File

@ -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 != SUP_MODULE_USER_DEFINED: if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType != SUP_MODULE_USER_DEFINED:
return EfiFile return EfiFile
# #
@ -739,13 +739,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 == SUP_MODULE_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 == BINARY_FILE_TYPE_DXE_DEPEX:
SectionType = 'SMM_DEPEX' SectionType = BINARY_FILE_TYPE_SMM_DEPEX
# #
# Framework SMM Driver has no SMM_DEPEX section type # Framework SMM Driver has no SMM_DEPEX section type
# #
if self.ModuleType == SUP_MODULE_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 == BINARY_FILE_TYPE_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 (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM): 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) File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch)
#Get PE Section alignment when align is set to AUTO #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) ImageObj = PeImageClass (File)
if ImageObj.SectionAlignment < 0x400: if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment) self.Alignment = str (ImageObj.SectionAlignment)
@ -790,7 +790,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
) )
File = StrippedFile File = StrippedFile
if SectionType == 'TE': if SectionType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw') TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage( GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile, TeFile,
@ -809,7 +809,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch) GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch)
#Get PE Section alignment when align is set to AUTO #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) ImageObj = PeImageClass (GenSecInputFile)
if ImageObj.SectionAlignment < 0x400: if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment) self.Alignment = str (ImageObj.SectionAlignment)
@ -833,7 +833,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
) )
GenSecInputFile = StrippedFile GenSecInputFile = StrippedFile
if SectionType == 'TE': if SectionType == BINARY_FILE_TYPE_TE:
TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw') TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage( GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile, TeFile,
@ -942,13 +942,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 == SUP_MODULE_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 == BINARY_FILE_TYPE_DXE_DEPEX:
Sect.SectionType = 'SMM_DEPEX' Sect.SectionType = BINARY_FILE_TYPE_SMM_DEPEX
# #
# Framework SMM Driver has no SMM_DEPEX section type # Framework SMM Driver has no SMM_DEPEX section type
# #
if self.ModuleType == SUP_MODULE_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 == BINARY_FILE_TYPE_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)
# #
# process the inside FvImage from FvSection or GuidSection # process the inside FvImage from FvSection or GuidSection

View File

@ -29,6 +29,7 @@ from CommonDataClass.FdfClass import FvClassObject
from Common.Misc import SaveFileOnChange from Common.Misc import SaveFileOnChange
from Common.LongFilePathSupport import CopyLongFilePath from Common.LongFilePathSupport import CopyLongFilePath
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.DataType import *
T_CHAR_LF = '\n' T_CHAR_LF = '\n'
FV_UI_EXT_ENTY_GUID = 'A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C' FV_UI_EXT_ENTY_GUID = 'A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C'
@ -80,7 +81,7 @@ class FV (FvClassObject):
if self.CapsuleName is not None: if self.CapsuleName is not None:
for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values(): for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
for RegionObj in FdObj.RegionList: for RegionObj in FdObj.RegionList:
if RegionObj.RegionType == 'FV': if RegionObj.RegionType == BINARY_FILE_TYPE_FV:
for RegionData in RegionObj.RegionDataList: for RegionData in RegionObj.RegionDataList:
if RegionData.endswith(".fv"): if RegionData.endswith(".fv"):
continue continue
@ -236,7 +237,7 @@ class FV (FvClassObject):
for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values(): for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
for RegionObj in FdObj.RegionList: for RegionObj in FdObj.RegionList:
if RegionObj.RegionType != 'FV': if RegionObj.RegionType != BINARY_FILE_TYPE_FV:
continue continue
for RegionData in RegionObj.RegionDataList: for RegionData in RegionObj.RegionDataList:
# #

View File

@ -315,7 +315,7 @@ def main():
for Fd in FdfParserObj.Profile.FdDict: for Fd in FdfParserObj.Profile.FdDict:
FdObj = FdfParserObj.Profile.FdDict[Fd] FdObj = FdfParserObj.Profile.FdDict[Fd]
for RegionObj in FdObj.RegionList: for RegionObj in FdObj.RegionList:
if RegionObj.RegionType != 'FV': if RegionObj.RegionType != BINARY_FILE_TYPE_FV:
continue continue
for RegionData in RegionObj.RegionDataList: for RegionData in RegionObj.RegionDataList:
if FvObj.UiFvName.upper() == RegionData.upper(): if FvObj.UiFvName.upper() == RegionData.upper():
@ -405,7 +405,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
KeyList[1] + \ KeyList[1] + \
'_' + \ '_' + \
KeyList[2] KeyList[2]
if Key in KeyStringList and KeyList[4] == 'GUID': if Key in KeyStringList and KeyList[4] == TAB_GUID:
ToolPathKey = Key + '_' + KeyList[3] + '_PATH' ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS' ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
ToolPath = ToolDefinition.get(ToolPathKey) ToolPath = ToolDefinition.get(ToolPathKey)
@ -447,7 +447,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
if NameGuid == BuildOption[Op]: if NameGuid == BuildOption[Op]:
KeyList = Op.split('_') KeyList = Op.split('_')
Key = KeyList[0] + '_' + KeyList[1] +'_' + KeyList[2] 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' ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS' ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
if ToolPathKey in BuildOption: if ToolPathKey in BuildOption:
@ -589,7 +589,7 @@ class GenFds :
if FdObj is None: if FdObj is None:
for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values(): for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
for ElementRegion in ElementFd.RegionList: for ElementRegion in ElementFd.RegionList:
if ElementRegion.RegionType == 'FV': if ElementRegion.RegionType == BINARY_FILE_TYPE_FV:
for ElementRegionData in ElementRegion.RegionDataList: for ElementRegionData in ElementRegion.RegionDataList:
if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName: if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:
if FvObj.BlockSizeList != []: if FvObj.BlockSizeList != []:
@ -601,7 +601,7 @@ class GenFds :
return DefaultBlockSize return DefaultBlockSize
else: else:
for ElementRegion in FdObj.RegionList: for ElementRegion in FdObj.RegionList:
if ElementRegion.RegionType == 'FV': if ElementRegion.RegionType == BINARY_FILE_TYPE_FV:
for ElementRegionData in ElementRegion.RegionDataList: for ElementRegionData in ElementRegion.RegionDataList:
if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName: if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:
if FvObj.BlockSizeList != []: if FvObj.BlockSizeList != []:

View File

@ -288,7 +288,7 @@ class GenFdsGlobalVariable:
# GenFdsGlobalVariable.OutputDirDict = OutputDir # GenFdsGlobalVariable.OutputDirDict = OutputDir
GenFdsGlobalVariable.FdfParser = FdfParser GenFdsGlobalVariable.FdfParser = FdfParser
GenFdsGlobalVariable.WorkSpace = WorkSpace 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) : if not os.path.exists(GenFdsGlobalVariable.FvDir) :
os.makedirs(GenFdsGlobalVariable.FvDir) os.makedirs(GenFdsGlobalVariable.FvDir)
GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs') GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
@ -349,7 +349,7 @@ class GenFdsGlobalVariable:
GenFdsGlobalVariable.PlatformName = WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.PlatformName = WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
GlobalData.gGlobalDefines['TARGET'], GlobalData.gGlobalDefines['TARGET'],
GlobalData.gGlobalDefines['TOOLCHAIN']].PlatformName 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): if not os.path.exists(GenFdsGlobalVariable.FvDir):
os.makedirs(GenFdsGlobalVariable.FvDir) os.makedirs(GenFdsGlobalVariable.FvDir)
GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs') GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')

View File

@ -141,7 +141,7 @@ class OptRomInfStatement (FfsInfStatement):
OutputFileList = [] OutputFileList = []
for Sect in Rule.SectionList: for Sect in Rule.SectionList:
if Sect.SectionType == 'PE32': if Sect.SectionType == BINARY_FILE_TYPE_PE32:
if Sect.FileName is not None: if Sect.FileName is not None:
GenSecInputFile = self.__ExtendMacro__(Sect.FileName) GenSecInputFile = self.__ExtendMacro__(Sect.FileName)
OutputFileList.append(GenSecInputFile) OutputFileList.append(GenSecInputFile)

View File

@ -26,6 +26,7 @@ from Common import EdkLogger
from Common.BuildToolError import * from Common.BuildToolError import *
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.MultipleWorkspace import MultipleWorkspace as mws from Common.MultipleWorkspace import MultipleWorkspace as mws
from Common.DataType import BINARY_FILE_TYPE_FV
## generate Region ## generate Region
# #
@ -80,10 +81,10 @@ class Region(RegionClassObject):
GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset) GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" % Size) GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" % Size)
GenFdsGlobalVariable.SharpCounter = 0 GenFdsGlobalVariable.SharpCounter = 0
if Flag and (self.RegionType != 'FV'): if Flag and (self.RegionType != BINARY_FILE_TYPE_FV):
return return
if self.RegionType == 'FV': if self.RegionType == BINARY_FILE_TYPE_FV:
# #
# Get Fv from FvDict # Get Fv from FvDict
# #

View File

@ -20,7 +20,7 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable
import Common.LongFilePathOs as os, glob import Common.LongFilePathOs as os, glob
from Common import EdkLogger from Common import EdkLogger
from Common.BuildToolError import * from Common.BuildToolError import *
from Common.DataType import TAB_ARCH_COMMON from Common.DataType import *
## section base class ## section base class
# #
@ -29,37 +29,37 @@ class Section (SectionClassObject):
SectionType = { SectionType = {
'RAW' : 'EFI_SECTION_RAW', 'RAW' : 'EFI_SECTION_RAW',
'FREEFORM' : 'EFI_SECTION_FREEFORM_SUBTYPE_GUID', 'FREEFORM' : 'EFI_SECTION_FREEFORM_SUBTYPE_GUID',
'PE32' : 'EFI_SECTION_PE32', BINARY_FILE_TYPE_PE32 : 'EFI_SECTION_PE32',
'PIC' : 'EFI_SECTION_PIC', BINARY_FILE_TYPE_PIC : 'EFI_SECTION_PIC',
'TE' : 'EFI_SECTION_TE', BINARY_FILE_TYPE_TE : 'EFI_SECTION_TE',
'FV_IMAGE' : 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', 'FV_IMAGE' : 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE',
'DXE_DEPEX' : 'EFI_SECTION_DXE_DEPEX', BINARY_FILE_TYPE_DXE_DEPEX : 'EFI_SECTION_DXE_DEPEX',
'PEI_DEPEX' : 'EFI_SECTION_PEI_DEPEX', BINARY_FILE_TYPE_PEI_DEPEX : 'EFI_SECTION_PEI_DEPEX',
'GUIDED' : 'EFI_SECTION_GUID_DEFINED', 'GUIDED' : 'EFI_SECTION_GUID_DEFINED',
'COMPRESS' : 'EFI_SECTION_COMPRESSION', 'COMPRESS' : 'EFI_SECTION_COMPRESSION',
'UI' : 'EFI_SECTION_USER_INTERFACE', BINARY_FILE_TYPE_UI : 'EFI_SECTION_USER_INTERFACE',
'SMM_DEPEX' : 'EFI_SECTION_SMM_DEPEX' BINARY_FILE_TYPE_SMM_DEPEX : 'EFI_SECTION_SMM_DEPEX'
} }
BinFileType = { BinFileType = {
'GUID' : '.guid', BINARY_FILE_TYPE_GUID : '.guid',
'ACPI' : '.acpi', 'ACPI' : '.acpi',
'ASL' : '.asl' , 'ASL' : '.asl' ,
'UEFI_APP' : '.app', BINARY_FILE_TYPE_UEFI_APP : '.app',
'LIB' : '.lib', BINARY_FILE_TYPE_LIB : '.lib',
'PE32' : '.pe32', BINARY_FILE_TYPE_PE32 : '.pe32',
'PIC' : '.pic', BINARY_FILE_TYPE_PIC : '.pic',
'PEI_DEPEX' : '.depex', BINARY_FILE_TYPE_PEI_DEPEX : '.depex',
'SEC_PEI_DEPEX' : '.depex', 'SEC_PEI_DEPEX' : '.depex',
'TE' : '.te', BINARY_FILE_TYPE_TE : '.te',
'UNI_VER' : '.ver', BINARY_FILE_TYPE_UNI_VER : '.ver',
'VER' : '.ver', BINARY_FILE_TYPE_VER : '.ver',
'UNI_UI' : '.ui', BINARY_FILE_TYPE_UNI_UI : '.ui',
'UI' : '.ui', BINARY_FILE_TYPE_UI : '.ui',
'BIN' : '.bin', BINARY_FILE_TYPE_BIN : '.bin',
'RAW' : '.raw', 'RAW' : '.raw',
'COMPAT16' : '.comp16', 'COMPAT16' : '.comp16',
'FV' : '.fv' BINARY_FILE_TYPE_FV : '.fv'
} }
SectFileType = { SectFileType = {
@ -128,8 +128,8 @@ class Section (SectionClassObject):
for File in FfsInf.BinFileList: for File in FfsInf.BinFileList:
if File.Arch == TAB_ARCH_COMMON or FfsInf.CurrentArch == File.Arch: if File.Arch == TAB_ARCH_COMMON or FfsInf.CurrentArch == File.Arch:
if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \ if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX') \ and FileType == 'DXE_DPEX' and File.Type == BINARY_FILE_TYPE_SMM_DEPEX) \
or (FileType == 'TE'and File.Type == 'PE32'): 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 == []: if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type)) FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
else: else:

View File

@ -22,7 +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 from Common.DataType import *
## generate UI section ## generate UI section
# #
@ -58,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 + 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 : if self.StringData is not None :
NameString = self.StringData NameString = self.StringData

View File

@ -23,6 +23,7 @@ from optparse import OptionParser
from optparse import make_option from optparse import make_option
from Common.BuildToolError import * from Common.BuildToolError import *
from Common.Misc import * from Common.Misc import *
from Common.DataType import *
from Common.BuildVersion import gBUILD_VERSION from Common.BuildVersion import gBUILD_VERSION
import Common.EdkLogger as EdkLogger import Common.EdkLogger as EdkLogger
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
@ -303,7 +304,7 @@ def TrimPreprocessedVfr(Source, Target):
FoundTypedef = False FoundTypedef = False
TypedefEnd = Index TypedefEnd = Index
# keep all "typedef struct" except to GUID, EFI_PLABEL and PAL_CALL_RETURN # 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): for i in range(TypedefStart, TypedefEnd+1):
Lines[i] = "\n" Lines[i] = "\n"

View File

@ -1500,7 +1500,7 @@ class DscBuildData(PlatformBuildClassObject):
def get_length(value): def get_length(value):
Value = value.strip() Value = value.strip()
if len(value) > 1: if len(value) > 1:
if Value.startswith('GUID') and Value.endswith(')'): if Value.startswith(TAB_GUID) and Value.endswith(')'):
return 16 return 16
if Value.startswith('L"') and Value.endswith('"'): if Value.startswith('L"') and Value.endswith('"'):
return len(Value[2:-1]) return len(Value[2:-1])

View File

@ -71,7 +71,7 @@ class InfBuildData(ModuleBuildClassObject):
# dict used to convert old tool name used in [nmake] section to new ones # dict used to convert old tool name used in [nmake] section to new ones
_TOOL_CODE_ = { _TOOL_CODE_ = {
"C" : "CC", "C" : "CC",
"LIB" : "SLINK", BINARY_FILE_TYPE_LIB : "SLINK",
"LINK" : "DLINK", "LINK" : "DLINK",
} }

View File

@ -208,7 +208,7 @@ def FindIncludeFiles(Source, IncludePathList, IncludeFiles):
FileName = "Protocol/%(Key)s/%(Key)s.h" % {"Key" : Key} FileName = "Protocol/%(Key)s/%(Key)s.h" % {"Key" : Key}
elif "PPI" in Type: elif "PPI" in Type:
FileName = "Ppi/%(Key)s/%(Key)s.h" % {"Key" : Key} 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} FileName = "Guid/%(Key)s/%(Key)s.h" % {"Key" : Key}
else: else:
continue continue
@ -1410,7 +1410,7 @@ class PredictionReport(object):
if Wa.FdfProfile: if Wa.FdfProfile:
for Fd in Wa.FdfProfile.FdDict: for Fd in Wa.FdfProfile.FdDict:
for FdRegion in Wa.FdfProfile.FdDict[Fd].RegionList: for FdRegion in Wa.FdfProfile.FdDict[Fd].RegionList:
if FdRegion.RegionType != "FV": if FdRegion.RegionType != BINARY_FILE_TYPE_FV:
continue continue
for FvName in FdRegion.RegionDataList: for FvName in FdRegion.RegionDataList:
if FvName in self._FvList: if FvName in self._FvList:
@ -1686,7 +1686,7 @@ class FdRegionReport(object):
# If the input FdRegion is not a firmware volume, # If the input FdRegion is not a firmware volume,
# we are done. # we are done.
# #
if self.Type != "FV": if self.Type != BINARY_FILE_TYPE_FV:
return return
# #
@ -1780,7 +1780,7 @@ class FdRegionReport(object):
FileWrite(File, "Type: %s" % Type) FileWrite(File, "Type: %s" % Type)
FileWrite(File, "Base Address: 0x%X" % BaseAddress) FileWrite(File, "Base Address: 0x%X" % BaseAddress)
if self.Type == "FV": if self.Type == BINARY_FILE_TYPE_FV:
FvTotalSize = 0 FvTotalSize = 0
FvTakenSize = 0 FvTakenSize = 0
FvFreeSize = 0 FvFreeSize = 0
@ -1843,7 +1843,7 @@ class FdRegionReport(object):
if (len(self.FvList) > 0): if (len(self.FvList) > 0):
for FvItem in self.FvList: for FvItem in self.FvList:
Info = self.FvInfo[FvItem] 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: else:
self._GenerateReport(File, "FD Region", self.Type, self.BaseAddress, self.Size) self._GenerateReport(File, "FD Region", self.Type, self.BaseAddress, self.Size)
@ -1869,7 +1869,7 @@ class FdReport(object):
self.BaseAddress = Fd.BaseAddress self.BaseAddress = Fd.BaseAddress
self.Size = Fd.Size self.Size = Fd.Size
self.FdRegionList = [FdRegionReport(FdRegion, Wa) for FdRegion in Fd.RegionList] 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.VpdFilePath = os.path.join(self.FvPath, "%s.map" % Wa.Platform.VpdToolGuid)
self.VPDBaseAddress = 0 self.VPDBaseAddress = 0
self.VPDSize = 0 self.VPDSize = 0