summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-09 11:47:35 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-09 11:47:35 +0000
commitb303ea726e1c8ed240dad2bce54821318567eab3 (patch)
tree355db6226949afd1bfcc87d69e09a320ea9b7bb7 /BaseTools/Source/Python
parent4c913fe619bd00861270cb0866feb34bcdc1592e (diff)
downloadedk2-b303ea726e1c8ed240dad2bce54821318567eab3.zip
edk2-b303ea726e1c8ed240dad2bce54821318567eab3.tar.gz
edk2-b303ea726e1c8ed240dad2bce54821318567eab3.tar.bz2
Sync tool code to BuildTools project r1739.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9397 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py404
-rw-r--r--BaseTools/Source/Python/AutoGen/GenC.py118
-rw-r--r--BaseTools/Source/Python/AutoGen/GenDepex.py2
-rw-r--r--BaseTools/Source/Python/AutoGen/StrGather.py106
-rw-r--r--BaseTools/Source/Python/AutoGen/UniClassObject.py10
-rw-r--r--BaseTools/Source/Python/Common/DataType.py4
-rw-r--r--BaseTools/Source/Python/Common/FdfParserLite.py10
-rw-r--r--BaseTools/Source/Python/Common/InfClassObject.py2
-rw-r--r--BaseTools/Source/Python/Common/Misc.py38
-rw-r--r--BaseTools/Source/Python/CommonDataClass/CommonClass.py6
-rw-r--r--BaseTools/Source/Python/CommonDataClass/ModuleClass.py2
-rw-r--r--BaseTools/Source/Python/CommonDataClass/PackageClass.py2
-rw-r--r--BaseTools/Source/Python/GenFds/DepexSection.py32
-rw-r--r--BaseTools/Source/Python/GenFds/Fd.py27
-rw-r--r--BaseTools/Source/Python/GenFds/FdfParser.py123
-rw-r--r--BaseTools/Source/Python/GenFds/Ffs.py4
-rw-r--r--BaseTools/Source/Python/GenFds/FfsInfStatement.py47
-rw-r--r--BaseTools/Source/Python/GenFds/Fv.py83
-rw-r--r--BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py12
-rw-r--r--BaseTools/Source/Python/GenFds/Section.py2
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py5
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceDatabase.py30
-rw-r--r--BaseTools/Source/Python/build/build.py27
23 files changed, 909 insertions, 187 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 647e1d0..9594ef0 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -21,6 +21,7 @@ import copy
import GenC
import GenMake
import GenDepex
+from StringIO import StringIO
from StrGather import *
from BuildEngine import BuildRule
@@ -48,8 +49,8 @@ gBuildRuleFile = 'Conf/build_rule.txt'
gAutoGenCodeFileName = "AutoGen.c"
gAutoGenHeaderFileName = "AutoGen.h"
gAutoGenStringFileName = "%(module_name)sStrDefs.h"
+gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
gAutoGenDepexFileName = "%(module_name)s.depex"
-gAutoGenSmmDepexFileName = "%(module_name)s.smm"
## Base class for AutoGen
#
@@ -137,7 +138,8 @@ class WorkspaceAutoGen(AutoGen):
# @param SkuId SKU id from command line
#
def _Init(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb,
- BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=[], Fvs=[], SkuId=''):
+ BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=[], Fvs=[], SkuId='',
+ ReportFile=None, ReportType=None):
self.MetaFile = ActivePlatform.MetaFile
self.WorkspaceDir = WorkspaceDir
self.Platform = ActivePlatform
@@ -145,6 +147,8 @@ class WorkspaceAutoGen(AutoGen):
self.ToolChain = Toolchain
self.ArchList = ArchList
self.SkuId = SkuId
+ self.ReportFile = ReportFile
+ self.ReportType = ReportType
self.BuildDatabase = MetaFileDb
self.TargetTxt = BuildConfig
@@ -181,6 +185,325 @@ class WorkspaceAutoGen(AutoGen):
Pa.CollectPlatformDynamicPcds()
self.AutoGenObjectList.append(Pa)
+ AllPcds = {}
+ MaxLen = 0
+ for Pcd in Pa._DynaPcdList_ + Pa._NonDynaPcdList_:
+ if Pcd.TokenSpaceGuidCName not in AllPcds:
+ AllPcds[Pcd.TokenSpaceGuidCName] = {}
+ if Pcd.Type not in AllPcds[Pcd.TokenSpaceGuidCName]:
+ AllPcds[Pcd.TokenSpaceGuidCName][Pcd.Type] = []
+ AllPcds[Pcd.TokenSpaceGuidCName][Pcd.Type] += [Pcd]
+ if len(Pcd.TokenCName) > MaxLen:
+ MaxLen = len(Pcd.TokenCName)
+
+ if self.ReportFile <> None:
+ try:
+ if os.path.exists(self.ReportFile):
+ os.remove(self.ReportFile)
+
+ Fd = open(self.ReportFile, "w")
+
+ Fd.write ('===============================================================================\n')
+ Fd.write ('Platform Configuration Database Report\n')
+ Fd.write ('===============================================================================\n')
+ Fd.write (' *P - Platform scoped PCD override in DSC file\n')
+ Fd.write (' *F - Platform scoped PCD override in FDF file\n')
+ Fd.write (' *M - Module scoped PCD override in DSC file\n')
+ Fd.write (' *C - Library has a constructor\n')
+ Fd.write (' *D - Library has a destructor\n')
+ Fd.write (' *CD - Library has both a constructor and a destructor\n')
+ Fd.write ('===============================================================================\n')
+ Fd.write ('\n')
+ Fd.write ('===============================================================================\n')
+ Fd.write ('PLATFORM: %s\n' % (ActivePlatform.MetaFile))
+ Fd.write ('===============================================================================\n')
+ for Key in AllPcds:
+ Fd.write ('%s\n' % (Key))
+ for Type in AllPcds[Key]:
+ TypeName = ''
+ DecType = Type
+ if Type == 'FixedAtBuild':
+ TypeName = 'FIXED'
+ if Type == 'PatchableInModule':
+ TypeName = 'PATCH'
+ if Type == 'FeatureFlag':
+ TypeName = 'FLAG'
+ if Type == 'Dynamic':
+ TypeName = 'DYN'
+ if Type == 'DynamicHii':
+ TypeName = 'DYNHII'
+ DecType = 'Dynamic'
+ if Type == 'DynamicVpd':
+ TypeName = 'DYNVPD'
+ DecType = 'Dynamic'
+ if Type == 'DynamicEx':
+ TypeName = 'DEX'
+ DecType = 'Dynamic'
+ if Type == 'DynamicExHii':
+ TypeName = 'DEXHII'
+ DecType = 'Dynamic'
+ if Type == 'DynamicExVpd':
+ TypeName = 'DEXVPD'
+ DecType = 'Dynamic'
+ for Pcd in AllPcds[Key][Type]:
+
+ DecDefaultValue = None
+ for F in Pa.Platform.Modules.keys():
+ for Package in Pa.Platform.Modules[F].M.Module.Packages:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType) in Package.Pcds:
+ if DecDefaultValue == None:
+ DecDefaultValue = Package.Pcds[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType].DefaultValue
+
+ DscDefaultValue = None
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds:
+ DscDefaultValue = self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)].DefaultValue
+
+ if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
+ if Pcd.DefaultValue.strip()[0:2].upper() == '0X':
+ PcdDefaultValueNumber = int(Pcd.DefaultValue.strip(), 16)
+ else:
+ PcdDefaultValueNumber = int(Pcd.DefaultValue.strip())
+
+ if DecDefaultValue == None:
+ DecMatch = True
+ else:
+ if DecDefaultValue.strip()[0:2].upper() == '0X':
+ DecDefaultValueNumber = int(DecDefaultValue.strip(), 16)
+ else:
+ DecDefaultValueNumber = int(DecDefaultValue.strip())
+ DecMatch = (DecDefaultValueNumber == PcdDefaultValueNumber)
+
+ if DscDefaultValue == None:
+ DscMatch = True
+ else:
+ if DscDefaultValue.strip()[0:2].upper() == '0X':
+ DscDefaultValueNumber = int(DscDefaultValue.strip(), 16)
+ else:
+ DscDefaultValueNumber = int(DscDefaultValue.strip())
+ DscMatch = (DscDefaultValueNumber == PcdDefaultValueNumber)
+ else:
+ if DecDefaultValue == None:
+ DecMatch = True
+ else:
+ DecMatch = (DecDefaultValue == Pcd.DefaultValue)
+
+ if DscDefaultValue == None:
+ DscMatch = True
+ else:
+ DscMatch = (DscDefaultValue == Pcd.DefaultValue)
+
+ if DecMatch:
+ Fd.write (' %-*s: %6s %10s = %-22s\n' % (MaxLen + 2, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', Pcd.DefaultValue))
+ else:
+ if DscMatch:
+ if (Pcd.TokenCName, Key) in PcdSet:
+ Fd.write (' *F %-*s: %6s %10s = %-22s\n' % (MaxLen + 2, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', Pcd.DefaultValue))
+ else:
+ Fd.write (' *P %-*s: %6s %10s = %-22s\n' % (MaxLen + 2, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', Pcd.DefaultValue))
+
+ for F in Pa.Platform.Modules.keys():
+ for ModulePcd in Pa.Platform.Modules[F].M.ModulePcdList + Pa.Platform.Modules[F].M.LibraryPcdList:
+ if ModulePcd.TokenSpaceGuidCName <> Pcd.TokenSpaceGuidCName:
+ continue
+ if ModulePcd.TokenCName <> Pcd.TokenCName:
+ continue
+ if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
+ if ModulePcd.DefaultValue.strip()[0:2].upper() == '0X':
+ ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip(), 16)
+ else:
+ ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip())
+ Match = (ModulePcdDefaultValueNumber == PcdDefaultValueNumber)
+ else:
+ Match = (ModulePcd.DefaultValue == Pcd.DefaultValue)
+ if Match:
+ continue
+ Fd.write (' *M %*s = %s\n' % (MaxLen + 21, str(F).split('\\')[-1], ModulePcd.DefaultValue))
+
+ if not DecMatch and DscMatch and DecDefaultValue <> None:
+ Fd.write (' %*s = %s\n' % (MaxLen + 21, 'DEC DEFAULT', DecDefaultValue))
+
+ Fd.write ('\n')
+
+ Fd.write ('===============================================================================\n')
+ Fd.write ('===============================================================================\n')
+
+ for F in Pa.Platform.Modules.keys():
+ Fd.write ('\n')
+ Fd.write ('===============================================================================\n')
+ Fd.write ('MODULE: %s\n' % (F))
+ Fd.write ('===============================================================================\n')
+
+ Fd.write ('PLATFORM CONFIGURATION DATABASE\n')
+ Fd.write ('-------------------------------------------------------------------------------\n')
+ ModuleFirst = True
+ for Key in AllPcds:
+ First = True
+ for Type in AllPcds[Key]:
+ TypeName = ''
+ DecType = Type
+ if Type == 'FixedAtBuild':
+ TypeName = 'FIXED'
+ if Type == 'PatchableInModule':
+ TypeName = 'PATCH'
+ if Type == 'FeatureFlag':
+ TypeName = 'FLAG'
+ if Type == 'Dynamic':
+ TypeName = 'DYN'
+ if Type == 'DynamicHii':
+ TypeName = 'DYNHII'
+ DecType = 'Dynamic'
+ if Type == 'DynamicVpd':
+ TypeName = 'DYNVPD'
+ DecType = 'Dynamic'
+ if Type == 'DynamicEx':
+ TypeName = 'DEX'
+ DecType = 'Dynamic'
+ if Type == 'DynamicExHii':
+ TypeName = 'DEXHII'
+ DecType = 'Dynamic'
+ if Type == 'DynamicExVpd':
+ TypeName = 'DEXVPD'
+ DecType = 'Dynamic'
+ for Pcd in AllPcds[Key][Type]:
+ for ModulePcd in Pa.Platform.Modules[F].M.ModulePcdList + Pa.Platform.Modules[F].M.LibraryPcdList:
+ if ModulePcd.TokenSpaceGuidCName <> Pcd.TokenSpaceGuidCName:
+ continue
+ if ModulePcd.TokenCName <> Pcd.TokenCName:
+ continue
+ if ModulePcd.Type <> Pcd.Type:
+ continue
+ if First:
+ if ModuleFirst:
+ ModuleFirst = False
+ else:
+ Fd.write ('\n')
+ Fd.write ('%s\n' % (Key))
+ First = False
+
+ InfDefaultValue = ModulePcd.InfDefaultValue
+ if InfDefaultValue == '':
+ InfDefaultValue = None
+
+ DecDefaultValue = None
+ for Package in Pa.Platform.Modules[F].M.Module.Packages:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType) in Package.Pcds:
+ if DecDefaultValue == None:
+ DecDefaultValue = Package.Pcds[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType].DefaultValue
+
+ DscDefaultValue = None
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds:
+ DscDefaultValue = self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)].DefaultValue
+
+ DscModuleOverrideDefaultValue = None
+ if F in self.BuildDatabase.WorkspaceDb.PlatformList[0].Modules:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in self.BuildDatabase.WorkspaceDb.PlatformList[0].Modules[F].Pcds:
+ DscModuleOverrideDefaultValue = self.BuildDatabase.WorkspaceDb.PlatformList[0].Modules[F].Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)].DefaultValue
+
+ if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
+ if ModulePcd.DefaultValue.strip()[0:2].upper() == '0X':
+ ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip(), 16)
+ else:
+ ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip())
+
+ if DecDefaultValue == None:
+ DecMatch = True
+ else:
+ if DecDefaultValue.strip()[0:2].upper() == '0X':
+ DecDefaultValueNumber = int(DecDefaultValue.strip(), 16)
+ else:
+ DecDefaultValueNumber = int(DecDefaultValue.strip())
+ DecMatch = (DecDefaultValueNumber == ModulePcdDefaultValueNumber)
+
+ if InfDefaultValue == None:
+ InfMatch = True
+ else:
+ if InfDefaultValue.strip()[0:2].upper() == '0X':
+ InfDefaultValueNumber = int(InfDefaultValue.strip(), 16)
+ else:
+ InfDefaultValueNumber = int(InfDefaultValue.strip())
+ InfMatch = (InfDefaultValueNumber == ModulePcdDefaultValueNumber)
+
+ if DscDefaultValue == None:
+ DscMatch = True
+ else:
+ if DscDefaultValue.strip()[0:2].upper() == '0X':
+ DscDefaultValueNumber = int(DscDefaultValue.strip(), 16)
+ else:
+ DscDefaultValueNumber = int(DscDefaultValue.strip())
+ DscMatch = (DscDefaultValueNumber == ModulePcdDefaultValueNumber)
+ else:
+ if DecDefaultValue == None:
+ DecMatch = True
+ else:
+ DecMatch = (DecDefaultValue == ModulePcd.DefaultValue)
+
+ if InfDefaultValue == None:
+ InfMatch = True
+ else:
+ InfMatch = (InfDefaultValue == ModulePcd.DefaultValue)
+
+ if DscDefaultValue == None:
+ DscMatch = True
+ else:
+ DscMatch = (DscDefaultValue == ModulePcd.DefaultValue)
+
+ if DecMatch and InfMatch:
+ Fd.write (' %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
+ else:
+ if DscMatch and DscModuleOverrideDefaultValue == None:
+ if (Pcd.TokenCName, Key) in PcdSet:
+ Fd.write (' *F %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
+ else:
+ Fd.write (' *P %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
+ else:
+ Fd.write (' *M %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
+ if DscDefaultValue <> None:
+ Fd.write (' %*s = %s\n' % (MaxLen + 19, 'DSC DEFAULT', DscDefaultValue))
+ if InfDefaultValue <> None:
+ Fd.write (' %*s = %s\n' % (MaxLen + 19, 'INF DEFAULT', InfDefaultValue))
+ if DecDefaultValue <> None and not DecMatch:
+ Fd.write (' %*s = %s\n' % (MaxLen + 19, 'DEC DEFAULT', DecDefaultValue))
+ Fd.write ('-------------------------------------------------------------------------------\n')
+ Fd.write ('LIBRARIES\n')
+ Fd.write ('-------------------------------------------------------------------------------\n')
+ for Lib in Pa.Platform.Modules[F].M.DependentLibraryList:
+ if len(Lib.ConstructorList) > 0:
+ if len(Lib.DestructorList) > 0:
+ Fd.write (' *CD')
+ else:
+ Fd.write (' *C ')
+ else:
+ if len(Lib.DestructorList) > 0:
+ Fd.write (' *D ')
+ else:
+ Fd.write (' ')
+ Fd.write (' %s\n' % (Lib))
+ for Depex in Lib.DepexExpression[Pa.Platform.Modules[F].M.Arch, Pa.Platform.Modules[F].M.ModuleType]:
+ Fd.write (' DEPEX = %s\n' % (Depex))
+ Fd.write ('-------------------------------------------------------------------------------\n')
+
+ Fd.write ('MODULE DEPENDENCY EXPRESSION\n')
+ if len(Pa.Platform.Modules[F].M.Module.DepexExpression[Pa.Platform.Modules[F].M.Arch, Pa.Platform.Modules[F].M.ModuleType]) == 0:
+ Fd.write (' NONE\n')
+ else:
+ for Depex in Pa.Platform.Modules[F].M.Module.DepexExpression[Pa.Platform.Modules[F].M.Arch, Pa.Platform.Modules[F].M.ModuleType]:
+ Fd.write (' %s\n' % (Depex))
+ Fd.write ('-------------------------------------------------------------------------------\n')
+
+ Fd.write ('MODULE + LIBRARY DEPENDENCY EXPRESSION\n')
+ if Pa.Platform.Modules[F].M.ModuleType in Pa.Platform.Modules[F].M.DepexExpressionList:
+ if Pa.Platform.Modules[F].M.DepexExpressionList[Pa.Platform.Modules[F].M.ModuleType] == '':
+ Fd.write (' NONE\n')
+ else:
+ Fd.write (' %s\n' % (Pa.Platform.Modules[F].M.DepexExpressionList[Pa.Platform.Modules[F].M.ModuleType]))
+ else:
+ Fd.write (' NONE\n')
+ Fd.write ('-------------------------------------------------------------------------------\n')
+
+ Fd.close()
+ except:
+ EdkLogger.error(None, FILE_OPEN_FAILURE, ExtraData=self.ReportFile)
+
self._BuildDir = None
self._FvDir = None
self._MakeFileDir = None
@@ -421,6 +744,9 @@ class PlatformAutoGen(AutoGen):
for F in self.Platform.Modules.keys():
M = ModuleAutoGen(self.Workspace, F, self.BuildTarget, self.ToolChain, self.Arch, self.MetaFile)
#GuidValue.update(M.Guids)
+
+ self.Platform.Modules[F].M = M
+
for PcdFromModule in M.ModulePcdList+M.LibraryPcdList:
# make sure that the "VOID*" kind of datum has MaxDatumSize set
if PcdFromModule.DatumType == "VOID*" and PcdFromModule.MaxDatumSize == None:
@@ -1260,6 +1586,7 @@ class ModuleAutoGen(AutoGen):
self._ProtocolList = None
self._PpiList = None
self._DepexList = None
+ self._DepexExpressionList = None
self._BuildOption = None
self._BuildTargets = None
self._IntroBuildTargetList = None
@@ -1433,11 +1760,7 @@ class ModuleAutoGen(AutoGen):
if self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
return self._DepexList
- if self.ModuleType == "DXE_SMM_DRIVER":
- self._DepexList["DXE_DRIVER"] = []
- self._DepexList["SMM_DRIVER"] = []
- else:
- self._DepexList[self.ModuleType] = []
+ self._DepexList[self.ModuleType] = []
for ModuleType in self._DepexList:
DepexList = self._DepexList[ModuleType]
@@ -1463,6 +1786,42 @@ class ModuleAutoGen(AutoGen):
EdkLogger.verbose('')
return self._DepexList
+ ## Merge dependency expression
+ #
+ # @retval list The token list of the dependency expression after parsed
+ #
+ def _GetDepexExpressionTokenList(self):
+ if self._DepexExpressionList == None:
+ self._DepexExpressionList = {}
+ if self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
+ return self._DepexExpressionList
+
+ self._DepexExpressionList[self.ModuleType] = ''
+
+ for ModuleType in self._DepexExpressionList:
+ DepexExpressionList = self._DepexExpressionList[ModuleType]
+ #
+ # Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion
+ #
+ for M in [self.Module] + self.DependentLibraryList:
+ Inherited = False
+ for D in M.DepexExpression[self.Arch, ModuleType]:
+ if DepexExpressionList != '':
+ DepexExpressionList += ' AND '
+ DepexExpressionList += '('
+ DepexExpressionList += D
+ DepexExpressionList = DepexExpressionList.rstrip('END').strip()
+ DepexExpressionList += ')'
+ Inherited = True
+ if Inherited:
+ EdkLogger.verbose("DEPEX[%s] (+%s) = %s" % (self.Name, M.BaseName, DepexExpressionList))
+ if 'BEFORE' in DepexExpressionList or 'AFTER' in DepexExpressionList:
+ break
+ if len(DepexExpressionList) > 0:
+ EdkLogger.verbose('')
+ self._DepexExpressionList[ModuleType] = DepexExpressionList
+ return self._DepexExpressionList
+
## Return the list of specification version required for the module
#
# @retval list The list of specification defined in module file
@@ -1580,12 +1939,12 @@ class ModuleAutoGen(AutoGen):
if Source != File:
CreateDirectory(Source.Dir)
- if FileType in self.BuildRules:
+ if File.IsBinary and File == Source:
+ RuleObject = self.BuildRules[TAB_DEFAULT_BINARY_FILE]
+ elif FileType in self.BuildRules:
RuleObject = self.BuildRules[FileType]
elif Source.Ext in self.BuildRules:
RuleObject = self.BuildRules[Source.Ext]
- elif File.IsBinary and File == Source:
- RuleObject = self.BuildRules[TAB_DEFAULT_BINARY_FILE]
else:
# stop at no more rules
if LastTarget:
@@ -1599,7 +1958,8 @@ class ModuleAutoGen(AutoGen):
# stop at STATIC_LIBRARY for library
if self.IsLibrary and FileType == TAB_STATIC_LIBRARY:
- self._FinalBuildTargetList.add(LastTarget)
+ if LastTarget:
+ self._FinalBuildTargetList.add(LastTarget)
break
Target = RuleObject.Apply(Source)
@@ -1668,12 +2028,17 @@ class ModuleAutoGen(AutoGen):
# @retval list The list of auto-generated file
#
def _GetAutoGenFileList(self):
+ UniStringAutoGenC = True
+ UniStringBinBuffer = None
+ if self.BuildType == 'UEFI_HII':
+ UniStringBinBuffer = StringIO()
+ UniStringAutoGenC = False
if self._AutoGenFileList == None:
self._AutoGenFileList = {}
AutoGenC = TemplateString()
AutoGenH = TemplateString()
StringH = TemplateString()
- GenC.CreateCode(self, AutoGenC, AutoGenH, StringH)
+ GenC.CreateCode(self, AutoGenC, AutoGenH, StringH, UniStringAutoGenC, UniStringBinBuffer)
if str(AutoGenC) != "" and TAB_C_CODE_FILE in self.FileTypes:
AutoFile = PathClass(gAutoGenCodeFileName, self.DebugDir)
self._AutoGenFileList[AutoFile] = str(AutoGenC)
@@ -1686,6 +2051,13 @@ class ModuleAutoGen(AutoGen):
AutoFile = PathClass(gAutoGenStringFileName % {"module_name":self.Name}, self.DebugDir)
self._AutoGenFileList[AutoFile] = str(StringH)
self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
+ if UniStringBinBuffer != None and UniStringBinBuffer.getvalue() != "":
+ AutoFile = PathClass(gAutoGenStringFormFileName % {"module_name":self.Name}, self.OutputDir)
+ self._AutoGenFileList[AutoFile] = UniStringBinBuffer.getvalue()
+ AutoFile.IsBinary = True
+ self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
+ if UniStringBinBuffer != None:
+ UniStringBinBuffer.close()
return self._AutoGenFileList
## Return the list of library modules explicitly or implicityly used by this module
@@ -1838,7 +2210,7 @@ class ModuleAutoGen(AutoGen):
IgoredAutoGenList = []
for File in self.AutoGenFileList:
- if GenC.Generate(File.Path, self.AutoGenFileList[File]):
+ if GenC.Generate(File.Path, self.AutoGenFileList[File], File.IsBinary):
#Ignore R8 AutoGen.c
if self.AutoGenVersion < 0x00010005 and File.Name == 'AutoGen.c':
continue
@@ -1855,10 +2227,7 @@ class ModuleAutoGen(AutoGen):
if len(self.DepexList[ModuleType]) == 0:
continue
Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)
- if ModuleType == 'SMM_DRIVER':
- DpxFile = gAutoGenSmmDepexFileName % {"module_name" : self.Name}
- else:
- DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}
+ DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}
if Dpx.Generate(path.join(self.OutputDir, DpxFile)):
AutoGenList.append(str(DpxFile))
@@ -1947,6 +2316,7 @@ class ModuleAutoGen(AutoGen):
ProtocolList = property(_GetProtocolList)
PpiList = property(_GetPpiList)
DepexList = property(_GetDepexTokenList)
+ DepexExpressionList = property(_GetDepexExpressionTokenList)
BuildOption = property(_GetModuleBuildOption)
BuildCommand = property(_GetBuildCommand)
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index b62a127..0a2bb62 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -383,28 +383,6 @@ ${Function} (
${END}
""")
-## SMM_CORE Entry Point Templates
-gSmmCoreEntryPointString = TemplateString("""
-const UINT32 _gUefiDriverRevision = 0;
-${BEGIN}
-EFI_STATUS
-${Function} (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-EFI_STATUS
-EFIAPI
-ProcessModuleEntryPointList (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- return ${Function} (ImageHandle, SystemTable);
-}
-${END}
-""")
-
gPeimEntryPointString = [
TemplateString("""
GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion};
@@ -461,6 +439,35 @@ ${END}
""")
]
+## SMM_CORE Entry Point Templates
+gSmmCoreEntryPointPrototype = TemplateString("""
+${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+${END}
+""")
+
+gSmmCoreEntryPointString = TemplateString("""
+${BEGIN}
+const UINT32 _gUefiDriverRevision = ${EfiSpecVersion};
+const UINT32 _gDxeRevision = ${PiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return ${Function} (ImageHandle, SystemTable);
+}
+${END}
+""")
+
## DXE SMM Entry Point Templates
gDxeSmmEntryPointPrototype = TemplateString("""
${BEGIN}
@@ -890,8 +897,7 @@ gModuleTypeHeaderFile = {
"DXE_SAL_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
"UEFI_DRIVER" : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
"UEFI_APPLICATION" : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"],
- "SMM_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmDriverEntryPoint.h"],
- "SMM_CORE" : ["PiDxe.h", "Library/DebugLib.h"],
+ "SMM_CORE" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
"USER_DEFINED" : [gBasicHeaderFile]
}
@@ -1504,7 +1510,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
- 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_DRIVER', 'SMM_CORE']:
+ 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']:
ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
@@ -1530,7 +1536,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
elif Info.ModuleType in ['PEI_CORE','PEIM']:
AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
- 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_DRIVER', 'SMM_CORE']:
+ 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']:
AutoGenC.Append(gLibraryString['DXE'].Replace(Dict))
## Create code for library destructor
@@ -1561,7 +1567,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
- 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_DRIVER', 'SMM_CORE']:
+ 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_CORE']:
DestructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
@@ -1587,7 +1593,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
elif Info.ModuleType in ['PEI_CORE','PEIM']:
AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
- 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_DRIVER', 'SMM_CORE']:
+ 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']:
AutoGenC.Append(gLibraryString['DXE'].Replace(Dict))
@@ -1635,26 +1641,25 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict))
elif Info.ModuleType == 'SMM_CORE':
AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict))
+ AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict))
elif Info.ModuleType == 'PEIM':
if NumEntryPoints < 2:
AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(Dict))
else:
AutoGenC.Append(gPeimEntryPointString[2].Replace(Dict))
AutoGenH.Append(gPeimEntryPointPrototype.Replace(Dict))
- elif Info.ModuleType in ['DXE_RUNTIME_DRIVER','DXE_DRIVER','DXE_SMM_DRIVER',
- 'DXE_SAL_DRIVER','UEFI_DRIVER', 'SMM_DRIVER']:
- if Info.ModuleType in ['DXE_SMM_DRIVER', 'SMM_DRIVER']:
- if NumEntryPoints == 0:
- AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict))
- else:
- AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict))
- AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict))
+ elif Info.ModuleType in ['DXE_RUNTIME_DRIVER','DXE_DRIVER','DXE_SAL_DRIVER','UEFI_DRIVER']:
+ if NumEntryPoints < 2:
+ AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Replace(Dict))
else:
- if NumEntryPoints < 2:
- AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Replace(Dict))
- else:
- AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict))
- AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict))
+ AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict))
+ AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict))
+ elif Info.ModuleType == 'DXE_SMM_DRIVER':
+ if NumEntryPoints == 0:
+ AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict))
+ else:
+ AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict))
+ AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict))
elif Info.ModuleType == 'UEFI_APPLICATION':
if NumEntryPoints < 2:
AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(Dict))
@@ -1782,8 +1787,10 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
# @param Info The ModuleAutoGen object
# @param AutoGenC The TemplateString object for C code
# @param AutoGenH The TemplateString object for header file
+# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True
+# @param UniGenBinBuffer Buffer to store uni string package data
#
-def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH):
+def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH, UniGenCFlag, UniGenBinBuffer):
WorkingDir = os.getcwd()
os.chdir(Info.WorkspaceDir)
@@ -1823,13 +1830,15 @@ def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH):
else:
ShellMode = False
- Header, Code = GetStringFiles(Info.UnicodeFileList, SrcList, IncList, ['.uni', '.inf'], Info.Name, CompatibleMode, ShellMode)
- AutoGenC.Append("\n//\n//Unicode String Pack Definition\n//\n")
- AutoGenC.Append(Code)
- AutoGenC.Append("\n")
+ Header, Code = GetStringFiles(Info.UnicodeFileList, SrcList, IncList, ['.uni', '.inf'], Info.Name, CompatibleMode, ShellMode, UniGenCFlag, UniGenBinBuffer)
+ if CompatibleMode or UniGenCFlag:
+ AutoGenC.Append("\n//\n//Unicode String Pack Definition\n//\n")
+ AutoGenC.Append(Code)
+ AutoGenC.Append("\n")
AutoGenH.Append("\n//\n//Unicode String ID\n//\n")
AutoGenH.Append(Header)
- AutoGenH.Append("\n#define STRING_ARRAY_NAME %sStrings\n" % Info.Name)
+ if CompatibleMode or UniGenCFlag:
+ AutoGenH.Append("\n#define STRING_ARRAY_NAME %sStrings\n" % Info.Name)
os.chdir(WorkingDir)
## Create common code
@@ -1890,8 +1899,10 @@ def CreateFooterCode(Info, AutoGenC, AutoGenH):
# @param Info The ModuleAutoGen object
# @param AutoGenC The TemplateString object for C code
# @param AutoGenH The TemplateString object for header file
+# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True
+# @param UniGenBinBuffer Buffer to store uni string package data
#
-def CreateCode(Info, AutoGenC, AutoGenH, StringH):
+def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer):
CreateHeaderCode(Info, AutoGenC, AutoGenH)
if Info.AutoGenVersion >= 0x00010005:
@@ -1908,7 +1919,7 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH):
FileName = "%sStrDefs.h" % Info.Name
StringH.Append(gAutoGenHeaderString.Replace({'FileName':FileName}))
StringH.Append(gAutoGenHPrologueString.Replace({'File':'STRDEFS', 'Guid':Info.Guid.replace('-','_')}))
- CreateUnicodeStringCode(Info, AutoGenC, StringH)
+ CreateUnicodeStringCode(Info, AutoGenC, StringH, UniGenCFlag, UniGenBinBuffer)
StringH.Append("\n#endif\n")
AutoGenH.Append('#include "%s"\n' % FileName)
@@ -1920,12 +1931,13 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH):
## Create the code file
#
-# @param FilePath The path of code file
-# @param Content The content of code file
+# @param FilePath The path of code file
+# @param Content The content of code file
+# @param IsBinaryFile The flag indicating if the file is binary file or not
#
# @retval True If file content is changed or file doesn't exist
# @retval False If the file exists and the content is not changed
#
-def Generate(FilePath, Content):
- return SaveFileOnChange(FilePath, Content, False)
+def Generate(FilePath, Content, IsBinaryFile):
+ return SaveFileOnChange(FilePath, Content, IsBinaryFile)
diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py b/BaseTools/Source/Python/AutoGen/GenDepex.py
index a3d07b8..9ee615c 100644
--- a/BaseTools/Source/Python/AutoGen/GenDepex.py
+++ b/BaseTools/Source/Python/AutoGen/GenDepex.py
@@ -41,7 +41,7 @@ gType2Phase = {
"DXE_SAL_DRIVER" : "DXE",
"UEFI_DRIVER" : "DXE",
"UEFI_APPLICATION" : "DXE",
- "SMM_DRIVER" : "DXE",
+ "SMM_CORE" : "DXE",
}
## Convert dependency expression string into EFI internal representation
diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Source/Python/AutoGen/StrGather.py
index 0f64444..903ac3c 100644
--- a/BaseTools/Source/Python/AutoGen/StrGather.py
+++ b/BaseTools/Source/Python/AutoGen/StrGather.py
@@ -18,6 +18,8 @@ import re
import Common.EdkLogger as EdkLogger
from Common.BuildToolError import *
from UniClassObject import *
+from StringIO import StringIO
+from struct import pack
##
# Static definitions
@@ -60,6 +62,7 @@ OFFSET = 'offset'
STRING = 'string'
TO = 'to'
STRING_TOKEN = re.compile('STRING_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE | re.UNICODE)
+COMPATIBLE_STRING_TOKEN = re.compile('STRING_TOKEN *\(([A-Za-z0-9_]+) *\)', re.MULTILINE | re.UNICODE)
EFI_HII_ARRAY_SIZE_LENGTH = 4
EFI_HII_PACKAGE_HEADER_LENGTH = 4
@@ -151,12 +154,14 @@ def CreateHFileHeader(BaseName):
#
# Create content of .h file
#
-# @param BaseName: The basename of strings
-# @param UniObjectClass: A UniObjectClass instance
+# @param BaseName: The basename of strings
+# @param UniObjectClass A UniObjectClass instance
+# @param IsCompatibleMode Compatible mode
+# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True
#
# @retval Str: A string of .h file content
#
-def CreateHFileContent(BaseName, UniObjectClass):
+def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):
Str = ''
ValueStartPtr = 60
Line = COMMENT_DEFINE_STR + ' ' + LANGUAGE_NAME_STRING_NAME + ' ' * (ValueStartPtr - len(DEFINE_STR + LANGUAGE_NAME_STRING_NAME)) + DecToHexStr(0, 4) + COMMENT_NOT_REFERENCED
@@ -182,21 +187,24 @@ def CreateHFileContent(BaseName, UniObjectClass):
Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
Str = WriteLine(Str, Line)
- Str = WriteLine(Str, '')
- Str = WriteLine(Str, 'extern unsigned char ' + BaseName + 'Strings[];')
+ Str = WriteLine(Str, '')
+ if IsCompatibleMode or UniGenCFlag:
+ Str = WriteLine(Str, 'extern unsigned char ' + BaseName + 'Strings[];')
return Str
## Create a complete .h file
#
# Create a complet .h file with file header and file content
#
-# @param BaseName: The basename of strings
-# @param UniObjectClass: A UniObjectClass instance
+# @param BaseName: The basename of strings
+# @param UniObjectClass A UniObjectClass instance
+# @param IsCompatibleMode Compatible mode
+# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True
#
# @retval Str: A string of complete .h file
#
-def CreateHFile(BaseName, UniObjectClass):
- HFile = WriteLine('', CreateHFileContent(BaseName, UniObjectClass))
+def CreateHFile(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):
+ HFile = WriteLine('', CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag))
return HFile
@@ -213,6 +221,15 @@ def CreateCFileHeader():
return Str
+## Create a buffer to store all items in an array
+#
+# @param BinBuffer Buffer to contain Binary data.
+# @param Array: The array need to be formatted
+#
+def CreateBinBuffer(BinBuffer, Array):
+ for Item in Array:
+ BinBuffer.write(pack("B", int(Item,16)))
+
## Create a formatted string all items in an array
#
# Use ',' to join each item in an array, and break an new line when reaching the width (default is 16)
@@ -260,12 +277,14 @@ def CreateCFileStringValue(Value):
#
# Create content of .c file
#
-# @param BaseName: The basename of strings
-# @param UniObjectClass: A UniObjectClass instance
+# @param BaseName: The basename of strings
+# @param UniObjectClass A UniObjectClass instance
+# @param IsCompatibleMode Compatible mode
+# @param UniBinBuffer UniBinBuffer to contain UniBinary data.
#
# @retval Str: A string of .c file content
#
-def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode):
+def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer=None):
#
# Init array length
#
@@ -280,9 +299,10 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode):
Language = UniObjectClass.LanguageDef[IndexI][0]
LangPrintName = UniObjectClass.LanguageDef[IndexI][1]
+ StringBuffer = StringIO()
StrStringValue = ''
ArrayLength = 0
- NumberOfUseOhterLangDef = 0
+ NumberOfUseOtherLangDef = 0
Index = 0
for IndexJ in range(1, len(UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[IndexI][0]])):
Item = UniObjectClass.FindByToken(IndexJ, Language)
@@ -294,18 +314,19 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode):
UseOtherLangDef = Item.UseOtherLangDef
if UseOtherLangDef != '' and Referenced:
- NumberOfUseOhterLangDef = NumberOfUseOhterLangDef + 1
+ NumberOfUseOtherLangDef = NumberOfUseOtherLangDef + 1
Index = Index + 1
else:
- if NumberOfUseOhterLangDef > 0:
- StrStringValue = WriteLine(StrStringValue, CreateArrayItem([StringSkipType] + DecToHexList(NumberOfUseOhterLangDef, 4)))
- NumberOfUseOhterLangDef = 0
+ if NumberOfUseOtherLangDef > 0:
+ StrStringValue = WriteLine(StrStringValue, CreateArrayItem([StringSkipType] + DecToHexList(NumberOfUseOtherLangDef, 4)))
+ CreateBinBuffer (StringBuffer, ([StringSkipType] + DecToHexList(NumberOfUseOtherLangDef, 4)))
+ NumberOfUseOtherLangDef = 0
ArrayLength = ArrayLength + 3
if Referenced and Item.Token > 0:
Index = Index + 1
StrStringValue = WriteLine(StrStringValue, "// %s: %s:%s" % (DecToHexStr(Index, 4), Name, DecToHexStr(Token, 4)))
StrStringValue = Write(StrStringValue, CreateCFileStringValue(Value))
- Offset = Offset + Length
+ CreateBinBuffer (StringBuffer, [StringBlockType] + Value)
ArrayLength = ArrayLength + Item.Length + 1 # 1 is for the length of string type
#
@@ -340,6 +361,15 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode):
# Add an EFI_HII_SIBT_END at last
#
Str = WriteLine(Str, ' ' + EFI_HII_SIBT_END + ",")
+
+ #
+ # Create binary UNI string
+ #
+ if UniBinBuffer:
+ CreateBinBuffer (UniBinBuffer, List)
+ UniBinBuffer.write (StringBuffer.getvalue())
+ UniBinBuffer.write (pack("B", int(EFI_HII_SIBT_END,16)))
+ StringBuffer.close()
#
# Create line for string variable name
@@ -347,19 +377,18 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode):
#
AllStr = WriteLine('', CHAR_ARRAY_DEFIN + ' ' + BaseName + COMMON_FILE_NAME + '[] = {\n' )
- #
- # Create FRAMEWORK_EFI_HII_PACK_HEADER in compatible mode
- #
if IsCompatibleMode:
+ #
+ # Create FRAMEWORK_EFI_HII_PACK_HEADER in compatible mode
+ #
AllStr = WriteLine(AllStr, '// FRAMEWORK PACKAGE HEADER Length')
AllStr = WriteLine(AllStr, CreateArrayItem(DecToHexList(TotalLength + 2)) + '\n')
AllStr = WriteLine(AllStr, '// FRAMEWORK PACKAGE HEADER Type')
AllStr = WriteLine(AllStr, CreateArrayItem(DecToHexList(2, 4)) + '\n')
-
- #
- # Create whole array length in UEFI mode
- #
- if not IsCompatibleMode:
+ else:
+ #
+ # Create whole array length in UEFI mode
+ #
AllStr = WriteLine(AllStr, '// STRGATHER_OUTPUT_HEADER')
AllStr = WriteLine(AllStr, CreateArrayItem(DecToHexList(TotalLength)) + '\n')
@@ -384,8 +413,9 @@ def CreateCFileEnd():
#
# Create a complete .c file
#
-# @param BaseName: The basename of strings
-# @param UniObjectClass: A UniObjectClass instance
+# @param BaseName: The basename of strings
+# @param UniObjectClass A UniObjectClass instance
+# @param IsCompatibleMode Compatible Mode
#
# @retval CFile: A string of complete .c file
#
@@ -447,10 +477,11 @@ def GetFileList(SourceFileList, IncludeList, SkipList):
#
# @param UniObjectClass: Input UniObjectClass
# @param FileList: Search path list
+# @param IsCompatibleMode Compatible Mode
#
# @retval UniObjectClass: UniObjectClass after searched
#
-def SearchString(UniObjectClass, FileList):
+def SearchString(UniObjectClass, FileList, IsCompatibleMode):
if FileList == []:
return UniObjectClass
@@ -458,7 +489,10 @@ def SearchString(UniObjectClass, FileList):
if os.path.isfile(File):
Lines = open(File, 'r')
for Line in Lines:
- StringTokenList = STRING_TOKEN.findall(Line)
+ if not IsCompatibleMode:
+ StringTokenList = STRING_TOKEN.findall(Line)
+ else:
+ StringTokenList = COMPATIBLE_STRING_TOKEN.findall(Line)
for StrName in StringTokenList:
EdkLogger.debug(EdkLogger.DEBUG_5, "Found string identifier: " + StrName)
UniObjectClass.SetStringReferenced(StrName)
@@ -472,7 +506,7 @@ def SearchString(UniObjectClass, FileList):
# This function is used for UEFI2.1 spec
#
#
-def GetStringFiles(UniFilList, SourceFileList, IncludeList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False):
+def GetStringFiles(UniFilList, SourceFileList, IncludeList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None):
Status = True
ErrorMessage = ''
@@ -489,10 +523,14 @@ def GetStringFiles(UniFilList, SourceFileList, IncludeList, SkipList, BaseName,
FileList = GetFileList(SourceFileList, IncludeList, SkipList)
- Uni = SearchString(Uni, FileList)
+ Uni = SearchString(Uni, FileList, IsCompatibleMode)
- HFile = CreateHFile(BaseName, Uni)
- CFile = CreateCFile(BaseName, Uni, IsCompatibleMode)
+ HFile = CreateHFile(BaseName, Uni, IsCompatibleMode, UniGenCFlag)
+ CFile = None
+ if IsCompatibleMode or UniGenCFlag:
+ CFile = CreateCFile(BaseName, Uni, IsCompatibleMode)
+ if UniGenBinBuffer:
+ CreateCFileContent(BaseName, Uni, IsCompatibleMode, UniGenBinBuffer)
return HFile, CFile
diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py
index 412fa72..dcfa264 100644
--- a/BaseTools/Source/Python/AutoGen/UniClassObject.py
+++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py
@@ -234,6 +234,11 @@ class UniFileClassObject(object):
Value = ''
Name = Item.split()[1]
+ # Check the string name is the upper character
+ if not self.IsCompatibleMode and Name != '':
+ MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE)
+ if MatchString == None or MatchString.end(0) != len(Name):
+ EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid lower case character.' %(Name, self.File))
LanguageList = Item.split(u'#language ')
for IndexI in range(len(LanguageList)):
if IndexI == 0:
@@ -365,6 +370,11 @@ class UniFileClassObject(object):
break
# Value = Value.replace(u'\r\n', u'')
Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
+ # Check the string name is the upper character
+ if not self.IsCompatibleMode and Name != '':
+ MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE)
+ if MatchString == None or MatchString.end(0) != len(Name):
+ EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid lower case character.' %(Name, self.File))
self.AddStringToList(Name, Language, Value)
continue
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 8b6c4e4..c2da992 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -56,12 +56,11 @@ SUP_MODULE_DXE_SMM_DRIVER = 'DXE_SMM_DRIVER'
SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
-SUP_MODULE_SMM_DRIVER = 'SMM_DRIVER'
SUP_MODULE_SMM_CORE = 'SMM_CORE'
SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, \
SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_UEFI_DRIVER, \
- SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, SUP_MODULE_SMM_DRIVER, SUP_MODULE_SMM_CORE]
+ SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, SUP_MODULE_SMM_CORE]
SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(l for l in SUP_MODULE_LIST)
EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
@@ -86,6 +85,7 @@ BINARY_FILE_TYPE_PE32 = 'PE32'
BINARY_FILE_TYPE_PIC = 'PIC'
BINARY_FILE_TYPE_PEI_DEPEX = 'PEI_DEPEX'
BINARY_FILE_TYPE_DXE_DEPEX = 'DXE_DEPEX'
+BINARY_FILE_TYPE_SMM_DEPEX = 'SMM_DEPEX'
BINARY_FILE_TYPE_TE = 'TE'
BINARY_FILE_TYPE_VER = 'VER'
BINARY_FILE_TYPE_UI = 'UI'
diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py
index 5099ed6..b397b16 100644
--- a/BaseTools/Source/Python/Common/FdfParserLite.py
+++ b/BaseTools/Source/Python/Common/FdfParserLite.py
@@ -2408,7 +2408,7 @@ class FdfParser(object):
Obj.SectionList.append(FvImageSectionObj)
- elif self.__IsKeyword("PEI_DEPEX_EXP") or self.__IsKeyword("DXE_DEPEX_EXP"):
+ elif self.__IsKeyword("PEI_DEPEX_EXP") or self.__IsKeyword("DXE_DEPEX_EXP") or self.__IsKeyword("SMM_DEPEX_EXP"):
DepexSectionObj = CommonDataClass.FdfClass.DepexSectionClassObject()
DepexSectionObj.Alignment = AlignValue
DepexSectionObj.DepexType = self.__Token
@@ -2798,7 +2798,7 @@ class FdfParser(object):
"DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \
"UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \
"SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \
- "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_DRIVER", "SMM_CORE"):
+ "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE"):
raise Warning("Unknown Module type At line ", self.FileName, self.CurrentLineNumber)
return self.__Token
@@ -2842,7 +2842,7 @@ class FdfParser(object):
Type = self.__Token.strip().upper()
if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\
- "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM_DXE_COMBO", "SMM", "SMM_CORE"):
+ "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM", "SMM_CORE"):
raise Warning("Unknown FV type At line ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken("="):
@@ -3221,8 +3221,8 @@ class FdfParser(object):
elif SectionType == "RAW":
if FileType not in ("BIN", "SEC_BIN", "RAW", "ASL", "ACPI"):
raise Warning("Incorrect section file type At Line ", self.FileName, self.CurrentLineNumber)
- elif SectionType == "DXE_DEPEX":
- if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX"):
+ elif SectionType == "DXE_DEPEX" or SectionType == "SMM_DEPEX":
+ if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX", "SMM_DEPEX"):
raise Warning("Incorrect section file type At Line ", self.FileName, self.CurrentLineNumber)
elif SectionType == "UI":
if FileType not in ("UI", "SEC_UI"):
diff --git a/BaseTools/Source/Python/Common/InfClassObject.py b/BaseTools/Source/Python/Common/InfClassObject.py
index a772840..27e67f3 100644
--- a/BaseTools/Source/Python/Common/InfClassObject.py
+++ b/BaseTools/Source/Python/Common/InfClassObject.py
@@ -66,8 +66,6 @@ gComponentType2ModuleType = {
"BS_DRIVER" : "DXE_DRIVER",
"RT_DRIVER" : "DXE_RUNTIME_DRIVER",
"SAL_RT_DRIVER" : "DXE_SAL_DRIVER",
-# "BS_DRIVER" : "DXE_SMM_DRIVER",
-# "BS_DRIVER" : "UEFI_DRIVER",
"APPLICATION" : "UEFI_APPLICATION",
"LOGO" : "BASE",
}
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 2c1041c..76dfbb6 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -316,12 +316,14 @@ def DataRestore(File):
# @retval None If path doesn't exist
#
class DirCache:
- _CACHE_ = {}
+ _CACHE_ = set()
+ _UPPER_CACHE_ = {}
def __init__(self, Root):
self._Root = Root
for F in os.listdir(Root):
- self._CACHE_[F.upper()] = F
+ self._CACHE_.add(F)
+ self._UPPER_CACHE_[F.upper()] = F
# =[] operator
def __getitem__(self, Path):
@@ -330,16 +332,18 @@ class DirCache:
return self._Root
if Path and Path[0] == os.path.sep:
Path = Path[1:]
- Path = Path.upper()
if Path in self._CACHE_:
- return os.path.join(self._Root, self._CACHE_[Path])
+ return os.path.join(self._Root, Path)
+ UpperPath = Path.upper()
+ if UpperPath in self._UPPER_CACHE_:
+ return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath])
IndexList = []
LastSepIndex = -1
SepIndex = Path.find(os.path.sep)
while SepIndex > -1:
- Parent = Path[:SepIndex]
- if Parent not in self._CACHE_:
+ Parent = UpperPath[:SepIndex]
+ if Parent not in self._UPPER_CACHE_:
break
LastSepIndex = SepIndex
SepIndex = Path.find(os.path.sep, LastSepIndex + 1)
@@ -351,22 +355,29 @@ class DirCache:
os.chdir(self._Root)
SepIndex = LastSepIndex
while SepIndex > -1:
- ParentKey = Path[:SepIndex]
- if ParentKey not in self._CACHE_:
+ Parent = Path[:SepIndex]
+ ParentKey = UpperPath[:SepIndex]
+ if ParentKey not in self._UPPER_CACHE_:
os.chdir(Cwd)
return None
- ParentDir = self._CACHE_[ParentKey]
+ if Parent in self._CACHE_:
+ ParentDir = Parent
+ else:
+ ParentDir = self._UPPER_CACHE_[ParentKey]
for F in os.listdir(ParentDir):
Dir = os.path.join(ParentDir, F)
- self._CACHE_[Dir.upper()] = Dir
+ self._CACHE_.add(Dir)
+ self._UPPER_CACHE_[Dir.upper()] = Dir
SepIndex = Path.find(os.path.sep, SepIndex + 1)
os.chdir(Cwd)
- if Path not in self._CACHE_:
- return None
- return os.path.join(self._Root, self._CACHE_[Path])
+ if Path in self._CACHE_:
+ return os.path.join(self._Root, Path)
+ elif UpperPath in self._UPPER_CACHE_:
+ return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath])
+ return None
## Get all files of a directory
#
@@ -683,6 +694,7 @@ class TemplateString(object):
## Constructor
def __init__(self, Template=None):
self.String = ''
+ self.IsBinary = False
self._Template = Template
self._TemplateSectionList = self._Parse(Template)
diff --git a/BaseTools/Source/Python/CommonDataClass/CommonClass.py b/BaseTools/Source/Python/CommonDataClass/CommonClass.py
index 763550f..e226f1b 100644
--- a/BaseTools/Source/Python/CommonDataClass/CommonClass.py
+++ b/BaseTools/Source/Python/CommonDataClass/CommonClass.py
@@ -174,7 +174,7 @@ class IncludeStatementClass(object):
# @var GuidTypeList: To store value for GuidTypeList, selection scope is in below list
# DATA_HUB_RECORD | EFI_EVENT | EFI_SYSTEM_CONFIGURATION_TABLE | EFI_VARIABLE | GUID | HII_PACKAGE_LIST | HOB | TOKEN_SPACE_GUID
# @var SupModuleList: To store value for SupModuleList, selection scope is in below list
-# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED
+# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE
#
class GuidProtocolPpiCommonClass(CommonClass):
def __init__(self):
@@ -202,7 +202,7 @@ class GuidProtocolPpiCommonClass(CommonClass):
# @var RecommendedInstance: To store value for RecommendedInstance, selection scope is in below list
# DATA_HUB_RECORD | EFI_EVENT | EFI_SYSTEM_CONFIGURATION_TABLE | EFI_VARIABLE | GUID | HII_PACKAGE_LIST | HOB | TOKEN_SPACE_GUID
# @var SupModuleList: To store value for SupModuleList, selection scope is in below list
-# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED
+# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE
#
class LibraryClassClass(CommonClass, DefineClass):
def __init__(self):
@@ -353,7 +353,7 @@ class PcdErrorClass(object):
# @var SkuInfoList: To store value for SkuInfoList
# It is a set structure as { [SkuIdName] : SkuInfoClass }
# @var SupModuleList: To store value for SupModuleList, selection scope is in below list
-# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED
+# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE
#
class PcdClass(CommonClass):
def __init__(self, CName = '', Token = '', TokenSpaceGuidCName = '', DatumType = '', MaxDatumSize = '', DefaultValue = '', ItemType = '', ValidUsage = None, SkuInfoList = None, SupModuleList = None):
diff --git a/BaseTools/Source/Python/CommonDataClass/ModuleClass.py b/BaseTools/Source/Python/CommonDataClass/ModuleClass.py
index 9d78072..49d052d 100644
--- a/BaseTools/Source/Python/CommonDataClass/ModuleClass.py
+++ b/BaseTools/Source/Python/CommonDataClass/ModuleClass.py
@@ -121,7 +121,7 @@ class ModuleSourceFileClass(CommonClass):
#
# @var BinaryFile: To store value for BinaryFile
# @var FileType: To store value for FileType, selection scope is in below list
-# FW | GUID | PREEFORM | UEFI_APP | UNI_UI | UNI_VER | LIB | PE32 | PIC | PEI_DEPEX | DXE_DEPEX | TE | VER | UI | BIN | FV
+# FW | GUID | PREEFORM | UEFI_APP | UNI_UI | UNI_VER | LIB | PE32 | PIC | PEI_DEPEX | DXE_DEPEX | SMM_DEPEX| TE | VER | UI | BIN | FV
# @var Target: To store value for Target
# @var ToolChainFamily: To store value for ToolChainFamily
#
diff --git a/BaseTools/Source/Python/CommonDataClass/PackageClass.py b/BaseTools/Source/Python/CommonDataClass/PackageClass.py
index c064f25..1382b80 100644
--- a/BaseTools/Source/Python/CommonDataClass/PackageClass.py
+++ b/BaseTools/Source/Python/CommonDataClass/PackageClass.py
@@ -62,7 +62,7 @@ class PackageIndustryStdHeaderClass(CommonClass):
#
# @var IncludeHeader: To store value for IncludeHeader
# @var ModuleType: To store value for ModuleType, it is a set structure as
-# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | TOOL | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED
+# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | TOOL | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE
#
class PackageIncludePkgHeaderClass(object):
def __init__(self):
diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/Python/GenFds/DepexSection.py
index 1c8c82a..a0a1905 100644
--- a/BaseTools/Source/Python/GenFds/DepexSection.py
+++ b/BaseTools/Source/Python/GenFds/DepexSection.py
@@ -80,23 +80,27 @@ class DepexSection (DepexSectionClassObject):
self.Expression = self.Expression.replace(Item, ExpGuidDict[Item])
self.Expression = self.Expression.strip()
- ModuleType = (self.DepexType.startswith('PEI') and ['PEIM'] or ['DXE_DRIVER'])[0]
- if self.DepexType.startswith('SMM'):
- ModuleType = 'SMM_DRIVER'
- InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')
- InputFile = os.path.normpath(InputFile)
+ if self.DepexType == 'PEI_DEPEX_EXP':
+ ModuleType = 'PEIM'
+ SecType = 'PEI_DEPEX'
+ elif self.DepexType == 'DXE_DEPEX_EXP':
+ ModuleType = 'DXE_DRIVER'
+ SecType = 'DXE_DEPEX'
+ elif self.DepexType == 'SMM_DEPEX_EXP':
+ ModuleType = 'DXE_SMM_DRIVER'
+ SecType = 'SMM_DEPEX'
+ else:
+ EdkLogger.error("GenFds", FORMAT_INVALID,
+ "Depex type %s is not valid for module %s" % (self.DepexType, ModuleName))
- Dpx = DependencyExpression(self.Expression, ModuleType)
- Dpx.Generate(InputFile)
+ InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex')
+ InputFile = os.path.normpath(InputFile)
+ Depex = DependencyExpression(self.Expression, ModuleType)
+ Depex.Generate(InputFile)
- OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex')
- if self.DepexType.startswith('SMM'):
- OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.smm')
+ OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')
OutputFile = os.path.normpath(OutputFile)
- SecType = (self.DepexType.startswith('PEI') and ['PEI_DEPEX'] or ['DXE_DEPEX'])[0]
- if self.DepexType.startswith('SMM'):
- SecType = 'SMM_DEPEX'
-
+
GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType))
FileList = [OutputFile]
return FileList, self.Alignment
diff --git a/BaseTools/Source/Python/GenFds/Fd.py b/BaseTools/Source/Python/GenFds/Fd.py
index 370008c..26de500 100644
--- a/BaseTools/Source/Python/GenFds/Fd.py
+++ b/BaseTools/Source/Python/GenFds/Fd.py
@@ -65,6 +65,33 @@ class FD(FDClassObject):
GenFdsGlobalVariable.VerboseLogger('################### Gen VTF ####################')
self.GenVtfFile()
+ TempFdBuffer = StringIO.StringIO('')
+ PreviousRegionStart = -1
+ PreviousRegionSize = 1
+
+ for RegionObj in self.RegionList :
+ if RegionObj.RegionType == 'CAPSULE':
+ continue
+ if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart:
+ pass
+ elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize):
+ pass
+ elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:
+ GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))
+ PadRegion = Region.Region()
+ PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
+ PadRegion.Size = RegionObj.Offset - PadRegion.Offset
+ PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
+ PreviousRegionStart = RegionObj.Offset
+ PreviousRegionSize = RegionObj.Size
+ #
+ # Call each region's AddToBuffer function
+ #
+ if PreviousRegionSize > self.Size:
+ pass
+ GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
+ RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
+
FdBuffer = StringIO.StringIO('')
PreviousRegionStart = -1
PreviousRegionSize = 1
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 07de926..24732a0 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -1877,6 +1877,14 @@ class FdfParser:
self.__GetFvNameGuid(FvObj)
+ FvObj.FvExtEntryTypeValue = []
+ FvObj.FvExtEntryType = []
+ FvObj.FvExtEntryData = []
+ while True:
+ isFvExtEntry = self.__GetFvExtEntryStatement(FvObj)
+ if not isFvExtEntry:
+ break
+
self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())
self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())
@@ -1970,6 +1978,79 @@ class FdfParser:
return
+ def __GetFvExtEntryStatement(self, FvObj):
+
+ if not self.__IsKeyword( "FV_EXT_ENTRY"):
+ return False
+
+ if not self.__IsKeyword ("TYPE"):
+ raise Warning("expected 'TYPE'", self.FileName, self.CurrentLineNumber)
+
+ if not self.__IsToken( "="):
+ raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
+
+ if not self.__GetNextHexNumber() and not self.__GetNextDecimalNumber():
+ raise Warning("expected Hex FV extension entry type value At Line ", self.FileName, self.CurrentLineNumber)
+
+ FvObj.FvExtEntryTypeValue += [self.__Token]
+
+ if not self.__IsToken( "{"):
+ raise Warning("expected '{'", self.FileName, self.CurrentLineNumber)
+
+ if not self.__IsKeyword ("FILE") and not self.__IsKeyword ("DATA"):
+ raise Warning("expected 'FILE' or 'DATA'", self.FileName, self.CurrentLineNumber)
+
+ FvObj.FvExtEntryType += [self.__Token]
+
+ if self.__Token == 'DATA':
+
+ if not self.__IsToken( "="):
+ raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
+
+ if not self.__IsToken( "{"):
+ raise Warning("expected '{'", self.FileName, self.CurrentLineNumber)
+
+ if not self.__GetNextHexNumber():
+ raise Warning("expected Hex byte", self.FileName, self.CurrentLineNumber)
+
+ if len(self.__Token) > 4:
+ raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
+
+ DataString = self.__Token
+ DataString += ","
+
+ while self.__IsToken(","):
+ if not self.__GetNextHexNumber():
+ raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber)
+ if len(self.__Token) > 4:
+ raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
+ DataString += self.__Token
+ DataString += ","
+
+ if not self.__IsToken( "}"):
+ raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)
+
+ if not self.__IsToken( "}"):
+ raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)
+
+ DataString = DataString.rstrip(",")
+ FvObj.FvExtEntryData += [DataString]
+
+ if self.__Token == 'FILE':
+
+ if not self.__IsToken( "="):
+ raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
+
+ if not self.__GetNextToken():
+ raise Warning("expected FV Extension Entry file path At Line ", self.FileName, self.CurrentLineNumber)
+
+ FvObj.FvExtEntryData += [self.__Token]
+
+ if not self.__IsToken( "}"):
+ raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)
+
+ return True
+
## __GetAprioriSection() method
#
# Get token statements
@@ -2683,15 +2764,31 @@ class FdfParser:
# @param Obj for whom token statements are got
#
def __GetCapsuleTokens(self, Obj):
-
- if not self.__IsKeyword("CAPSULE_GUID"):
- raise Warning("expected 'CAPSULE_GUID'", self.FileName, self.CurrentLineNumber)
-
- while self.__CurrentLine().find("=") != -1:
- NameValue = self.__CurrentLine().split("=")
- Obj.TokensDict[NameValue[0].strip()] = NameValue[1].strip()
- self.CurrentLineNumber += 1
- self.CurrentOffsetWithinLine = 0
+ if not self.__GetNextToken():
+ return False
+ while self.__Token in ("CAPSULE_GUID", "CAPSULE_HEADER_SIZE", "CAPSULE_FLAGS"):
+ Name = self.__Token.strip()
+ if not self.__IsToken("="):
+ raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
+ if not self.__GetNextToken():
+ raise Warning("expected value", self.FileName, self.CurrentLineNumber)
+ if Name == 'CAPSULE_FLAGS':
+ if not self.__Token in ("PersistAcrossReset", "PopulateSystemTable", "InitiateReset"):
+ raise Warning("expected PersistAcrossReset, PopulateSystemTable, or InitiateReset", self.FileName, self.CurrentLineNumber)
+ Value = self.__Token.strip()
+ while self.__IsToken(","):
+ Value += ','
+ if not self.__GetNextToken():
+ raise Warning("expected value", self.FileName, self.CurrentLineNumber)
+ if not self.__Token in ("PersistAcrossReset", "PopulateSystemTable", "InitiateReset"):
+ raise Warning("expected PersistAcrossReset, PopulateSystemTable, or InitiateReset", self.FileName, self.CurrentLineNumber)
+ Value += self.__Token.strip()
+ else:
+ Value = self.__Token.strip()
+ Obj.TokensDict[Name] = Value
+ if not self.__GetNextToken():
+ return False
+ self.__UndoToken()
## __GetCapsuleData() method
#
@@ -2815,7 +2912,7 @@ class FdfParser:
"DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \
"UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \
"SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \
- "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_DRIVER", "SMM_CORE"):
+ "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE"):
raise Warning("Unknown Module type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
return self.__Token
@@ -2859,7 +2956,7 @@ class FdfParser:
Type = self.__Token.strip().upper()
if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\
- "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM_DXE_COMBO", "SMM", "SMM_CORE"):
+ "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM", "SMM_CORE"):
raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
if not self.__IsToken("="):
@@ -3238,8 +3335,8 @@ class FdfParser:
elif SectionType == "RAW":
if FileType not in ("BIN", "SEC_BIN", "RAW", "ASL", "ACPI"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
- elif SectionType == "DXE_DEPEX":
- if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX"):
+ elif SectionType == "DXE_DEPEX" or SectionType == "SMM_DEPEX":
+ if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX", "SMM_DEPEX"):
raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)
elif SectionType == "UI":
if FileType not in ("UI", "SEC_UI"):
diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Python/GenFds/Ffs.py
index aaa7917..438bd18 100644
--- a/BaseTools/Source/Python/GenFds/Ffs.py
+++ b/BaseTools/Source/Python/GenFds/Ffs.py
@@ -34,7 +34,6 @@ class Ffs(FDClassObject):
'DXE_RUNTIME_DRIVER': 'EFI_FV_FILETYPE_DRIVER',
'UEFI_DRIVER' : 'EFI_FV_FILETYPE_DRIVER',
'UEFI_APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION',
- 'SMM_DRIVER' : 'EFI_FV_FILETYPE_SMM',
'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE'
}
@@ -50,7 +49,6 @@ class Ffs(FDClassObject):
'FV_IMAGE' : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE',
'RAW' : 'EFI_FV_FILETYPE_RAW',
'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER',
- 'SMM_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_SMM_DXE',
'SMM' : 'EFI_FV_FILETYPE_SMM',
'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE'
}
@@ -70,7 +68,7 @@ class Ffs(FDClassObject):
'COMPRESS' : '.com',
'GUIDED' : '.guided',
'PEI_DEPEX' : '.dpx',
- 'SMM_DEPEX' : '.smm'
+ 'SMM_DEPEX' : '.dpx'
}
## The constructor
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 0dcd96d..ac13e4d 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -47,6 +47,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
self.KeepRelocFromRule = None
self.InDsc = True
self.OptRomDefs = {}
+ self.PiSpecVersion = 0
## __InfParse() method
#
@@ -89,6 +90,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
self.BaseName = Inf.BaseName
self.ModuleGuid = Inf.Guid
self.ModuleType = Inf.ModuleType
+ if Inf.Specification != None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:
+ self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION']
if Inf.AutoGenVersion < 0x00010005:
self.ModuleType = Inf.ComponentType
self.VersionString = Inf.Version
@@ -102,6 +105,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
self.BaseName = Inf.BaseName
self.ModuleGuid = Inf.Guid
self.ModuleType = Inf.ModuleType
+ if Inf.Specification != None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:
+ self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION']
self.VersionString = Inf.Version
self.BinFileList = Inf.Binaries
self.SourceFileList = Inf.Sources
@@ -113,6 +118,9 @@ class FfsInfStatement(FfsInfStatementClassObject):
if len(self.SourceFileList) != 0 and not self.InDsc:
EdkLogger.warn("GenFds", GENFDS_ERROR, "Module %s NOT found in DSC file; Is it really a binary module?" % (self.InfFileName))
+ if self.ModuleType == 'SMM_CORE' and self.PiSpecVersion < 0x0001000A:
+ EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.InfFileName)
+
if Inf._Defs != None and len(Inf._Defs) > 0:
self.OptRomDefs.update(Inf._Defs)
@@ -153,7 +161,18 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
Rule = self.__GetRule__()
GenFdsGlobalVariable.VerboseLogger( "Packing binaries from inf file : %s" %self.InfFileName)
- #FileType = Ffs.Ffs.ModuleTypeToFileType[Rule.ModuleType]
+ #
+ # Convert Fv File Type for PI1.1 SMM driver.
+ #
+ if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:
+ if Rule.FvFileType == 'DRIVER':
+ Rule.FvFileType = 'SMM'
+ #
+ # Framework SMM Driver has no SMM FV file type
+ #
+ if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:
+ if Rule.FvFileType == 'SMM' or Rule.FvFileType == 'SMM_CORE':
+ EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName)
#
# For the rule only has simpleFile
#
@@ -380,7 +399,19 @@ class FfsInfStatement(FfsInfStatementClassObject):
FileList, IsSect = Section.Section.GetFileList(self, '', Rule.FileExtension)
Index = 1
- SectionType = Rule.SectionType
+ SectionType = Rule.SectionType
+ #
+ # Convert Fv Section Type for PI1.1 SMM driver.
+ #
+ if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:
+ if SectionType == 'DXE_DEPEX':
+ SectionType = 'SMM_DEPEX'
+ #
+ # Framework SMM Driver has no SMM_DEPEX section type
+ #
+ if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:
+ if SectionType == 'SMM_DEPEX':
+ EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
NoStrip = True
if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
if self.KeepReloc != None:
@@ -517,6 +548,18 @@ class FfsInfStatement(FfsInfStatementClassObject):
for Sect in Rule.SectionList:
SecIndex = '%d' %Index
SectList = []
+ #
+ # Convert Fv Section Type for PI1.1 SMM driver.
+ #
+ if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:
+ if Sect.SectionType == 'DXE_DEPEX':
+ Sect.SectionType = 'SMM_DEPEX'
+ #
+ # Framework SMM Driver has no SMM_DEPEX section type
+ #
+ if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:
+ if Sect.SectionType == 'SMM_DEPEX':
+ EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
if Rule.KeyStringList != []:
SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self)
else :
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index 23ec582..a9ff26e 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -19,6 +19,7 @@ import os
import shutil
import subprocess
import StringIO
+from struct import *
import Ffs
import AprioriSection
@@ -70,8 +71,8 @@ class FV (FvClassObject):
# If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.
#
if self.CapsuleName != None:
- for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
- FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
+ for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
+ FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
for RegionObj in FdObj.RegionList:
if RegionObj.RegionType == 'FV':
for RegionData in RegionObj.RegionDataList:
@@ -215,19 +216,81 @@ class FV (FvClassObject):
self.FvAlignment.strip() + \
" = TRUE" + \
T_CHAR_LF)
-
- if self.FvNameGuid != None:
- self.FvInfFile.writelines("EFI_FVNAME_GUID" + \
- " = %s" % self.FvNameGuid + \
- T_CHAR_LF)
+
#
- # Add [Files]
+ # Generate FV extension header file
#
+ if self.FvNameGuid == None or self.FvNameGuid == '':
+ if len(self.FvExtEntryType) > 0:
+ GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName))
+
+ if self.FvNameGuid <> None and self.FvNameGuid <> '':
+ TotalSize = 16 + 4
+ Buffer = ''
+ for Index in range (0, len(self.FvExtEntryType)):
+ if self.FvExtEntryType[Index] == 'FILE':
+ # check if the path is absolute or relative
+ if os.path.isabs(self.FvExtEntryData[Index]):
+ FileFullPath = os.path.normpath(self.FvExtEntryData[Index])
+ else:
+ FileFullPath = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.FvExtEntryData[Index]))
+ # check if the file path exists or not
+ if not os.path.isfile(FileFullPath):
+ GenFdsGlobalVariable.ErrorLogger("Error opening FV Extension Header Entry file %s." % (self.FvExtEntryData[Index]))
+ FvExtFile = open (FileFullPath,'rb')
+ FvExtFile.seek(0,2)
+ Size = FvExtFile.tell()
+ if Size >= 0x10000:
+ GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry file %s exceeds 0x10000." % (self.FvExtEntryData[Index]))
+ TotalSize += (Size + 4)
+ FvExtFile.seek(0)
+ Buffer += pack('HH', (Size + 4), int(self.FvExtEntryTypeValue[Index], 16))
+ Buffer += FvExtFile.read()
+ FvExtFile.close()
+ if self.FvExtEntryType[Index] == 'DATA':
+ ByteList = self.FvExtEntryData[Index].split(',')
+ Size = len (ByteList)
+ if Size >= 0x10000:
+ GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry data %s exceeds 0x10000." % (self.FvExtEntryData[Index]))
+ TotalSize += (Size + 4)
+ Buffer += pack('HH', (Size + 4), int(self.FvExtEntryTypeValue[Index], 16))
+ for Index1 in range (0, Size):
+ Buffer += pack('B', int(ByteList[Index1], 16))
+
+ Guid = self.FvNameGuid.split('-')
+ Buffer = pack('LHHBBBBBBBBL',
+ int(Guid[0], 16),
+ int(Guid[1], 16),
+ int(Guid[2], 16),
+ int(Guid[3][-4:-2], 16),
+ int(Guid[3][-2:], 16),
+ int(Guid[4][-12:-10], 16),
+ int(Guid[4][-10:-8], 16),
+ int(Guid[4][-8:-6], 16),
+ int(Guid[4][-6:-4], 16),
+ int(Guid[4][-4:-2], 16),
+ int(Guid[4][-2:], 16),
+ TotalSize
+ ) + Buffer
+
+ #
+ # Generate FV extension header file if the total size is not zero
+ #
+ if TotalSize > 0:
+ FvExtHeaderFileName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName + '.ext')
+ FvExtHeaderFile = open (FvExtHeaderFileName,'wb')
+ FvExtHeaderFile.write(Buffer)
+ FvExtHeaderFile.close()
+ self.FvInfFile.writelines("EFI_FV_EXT_HEADER_FILE_NAME = " + \
+ FvExtHeaderFileName + \
+ T_CHAR_LF)
+
+ #
+ # Add [Files]
+ #
self.FvInfFile.writelines("[files]" + T_CHAR_LF)
if VtfDict != None and self.UiFvName in VtfDict.keys():
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
VtfDict.get(self.UiFvName) + \
T_CHAR_LF)
-
-
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index 77c8821..b54e8c8 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -294,10 +294,7 @@ class GenFdsGlobalVariable:
@staticmethod
def GenerateOptionRom(Output, EfiInput, BinaryInput, Compress=False, ClassCode=None,
Revision=None, DeviceId=None, VendorId=None):
-# if not GenFdsGlobalVariable.NeedsUpdate(Output, Input):
-# return
-# GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
-
+ InputList = []
Cmd = ["EfiRom"]
if len(EfiInput) > 0:
@@ -308,11 +305,18 @@ class GenFdsGlobalVariable:
for EfiFile in EfiInput:
Cmd += [EfiFile]
+ InputList.append (EfiFile)
if len(BinaryInput) > 0:
Cmd += ["-b"]
for BinFile in BinaryInput:
Cmd += [BinFile]
+ InputList.append (BinFile)
+
+ # Check List
+ if not GenFdsGlobalVariable.NeedsUpdate(Output, InputList):
+ return
+ GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))
if ClassCode != None:
Cmd += ["-l", ClassCode]
diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py
index ffca3a1..1905935 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -129,7 +129,7 @@ class Section (SectionClassObject):
if FileType != None:
for File in FfsInf.BinFileList:
if File.Arch == "COMMON" or FfsInf.CurrentArch == File.Arch:
- if File.Type == FileType:
+ if File.Type == FileType or (FfsInf.PiSpecVersion >= 0x0001000A and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX'):
if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
FileList.append(File.Path)
else:
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 40eb826..cf165ff 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -824,7 +824,7 @@ class DscParser(MetaFileParser):
# [PcdsDynamicHii]
#
def _PcdParser(self):
- TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+ TokenList = GetSplitValueList(ReplaceMacro(self._CurrentLine, self._Macros), TAB_VALUE_SPLIT, 1)
self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)
if len(TokenList) == 2:
self._ValueList[2] = TokenList[1]
@@ -1109,7 +1109,8 @@ class DecParser(MetaFileParser):
if not IsValid:
EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine,
File=self.MetaFile, Line=self._LineIndex+1)
- self._ValueList[2] = TokenList[1]
+
+ self._ValueList[2] = ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip()
_SectionParser = {
MODEL_META_DATA_HEADER : MetaFileParser._DefineParser,
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index 348d219..2f2e812 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -1111,7 +1111,7 @@ class InfBuildData(ModuleBuildClassObject):
"BS_DRIVER" : "DXE_DRIVER",
"RT_DRIVER" : "DXE_RUNTIME_DRIVER",
"SAL_RT_DRIVER" : "DXE_SAL_DRIVER",
- "SMM_DRIVER" : "SMM_DRIVER",
+ # "SMM_DRIVER" : "DXE_SMM_DRIVER",
# "BS_DRIVER" : "DXE_SMM_DRIVER",
# "BS_DRIVER" : "UEFI_DRIVER",
"APPLICATION" : "UEFI_APPLICATION",
@@ -1198,6 +1198,7 @@ class InfBuildData(ModuleBuildClassObject):
self._Pcds = None
self._BuildOptions = None
self._Depex = None
+ self._DepexExpression = None
#self._SourceOverridePath = None
## Get architecture
@@ -1317,9 +1318,15 @@ class InfBuildData(ModuleBuildClassObject):
if not self._ModuleType:
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
"MODULE_TYPE is not given", File=self.MetaFile)
+ if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (self._Specification['PI_SPECIFICATION_VERSION'] < 0x0001000A):
+ if self._ModuleType == SUP_MODULE_SMM_CORE:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)
if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \
and 'PCI_CLASS_CODE' in self._Defs:
self._BuildType = 'UEFI_OPTIONROM'
+ elif self._Defs and 'UEFI_HII_RESOURCE_SECTION' in self._Defs \
+ and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
+ self._BuildType = 'UEFI_HII'
else:
self._BuildType = self._ModuleType.upper()
else:
@@ -1824,6 +1831,25 @@ class InfBuildData(ModuleBuildClassObject):
self._Depex[Arch, ModuleType] = Depex[Arch, ModuleType]
return self._Depex
+ ## Retrieve depedency expression
+ def _GetDepexExpression(self):
+ if self._DepexExpression == None:
+ self._DepexExpression = tdict(False, 2)
+ RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]
+ DepexExpression = {}
+ for Record in RecordList:
+ Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)
+ Arch = Record[3]
+ ModuleType = Record[4]
+ TokenList = Record[0].split()
+ if (Arch, ModuleType) not in DepexExpression:
+ DepexExpression[Arch, ModuleType] = ''
+ for Token in TokenList:
+ DepexExpression[Arch, ModuleType] = DepexExpression[Arch, ModuleType] + Token.strip() + ' '
+ for Arch, ModuleType in DepexExpression:
+ self._DepexExpression[Arch, ModuleType] = DepexExpression[Arch, ModuleType]
+ return self._DepexExpression
+
## Retrieve PCD for given type
def _GetPcd(self, Type):
Pcds = {}
@@ -1889,6 +1915,7 @@ class InfBuildData(ModuleBuildClassObject):
Pcd.TokenValue = PcdInPackage.TokenValue
Pcd.DatumType = PcdInPackage.DatumType
Pcd.MaxDatumSize = PcdInPackage.MaxDatumSize
+ Pcd.InfDefaultValue = Pcd.DefaultValue
if Pcd.DefaultValue in [None, '']:
Pcd.DefaultValue = PcdInPackage.DefaultValue
break
@@ -1936,6 +1963,7 @@ class InfBuildData(ModuleBuildClassObject):
Pcds = property(_GetPcds)
BuildOptions = property(_GetBuildOptions)
Depex = property(_GetDepex)
+ DepexExpression = property(_GetDepexExpression)
## Database
#
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 7d14e15..5f470de 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -676,7 +676,8 @@ class Build():
def __init__(self, Target, WorkspaceDir, Platform, Module, Arch, ToolChain,
BuildTarget, FlashDefinition, FdList=[], FvList=[],
MakefileType="nmake", SilentMode=False, ThreadNumber=2,
- SkipAutoGen=False, Reparse=False, SkuId=None):
+ SkipAutoGen=False, Reparse=False, SkuId=None,
+ ReportFile=None, ReportType=None):
self.WorkspaceDir = WorkspaceDir
self.Target = Target
@@ -695,6 +696,11 @@ class Build():
self.Reparse = Reparse
self.SkuId = SkuId
self.SpawnMode = True
+ self.ReportFile = ReportFile
+ if ReportType == None:
+ self.ReportType = ['ALL']
+ else:
+ self.ReportType = ReportType
self.TargetTxt = TargetTxtClassObject()
self.ToolDef = ToolDefClassObject()
@@ -954,7 +960,9 @@ class Build():
self.Fdf,
self.FdList,
self.FvList,
- self.SkuId
+ self.SkuId,
+ self.ReportFile,
+ self.ReportType
)
self.Progress.Stop("done!")
self._Build(self.Target, Wa)
@@ -980,7 +988,9 @@ class Build():
self.Fdf,
self.FdList,
self.FvList,
- self.SkuId
+ self.SkuId,
+ self.ReportFile,
+ self.ReportType
)
Wa.CreateMakeFile(False)
self.Progress.Stop("done!")
@@ -1018,7 +1028,9 @@ class Build():
self.Fdf,
self.FdList,
self.FvList,
- self.SkuId
+ self.SkuId,
+ self.ReportFile,
+ self.ReportType
)
Wa.CreateMakeFile(False)
@@ -1253,6 +1265,10 @@ def MyOptionParser():
Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")
+ Parser.add_option("-y", "--report-file", action="store", dest="ReportFile", help="Put build report in specified file.")
+ Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['ALL','PCD',], dest="ReportType",
+ help="Flags that control the type of build report to generate. Must be one of [ALL, PCD]. To specify more flags, please repeat this option.")
+
(Opt, Args)=Parser.parse_args()
return (Opt, Args)
@@ -1358,7 +1374,8 @@ def Main():
Option.TargetArch, Option.ToolChain, Option.BuildTarget,
Option.FdfFile, Option.RomImage, Option.FvImage,
None, Option.SilentMode, Option.ThreadNumber,
- Option.SkipAutoGen, Option.Reparse, Option.SkuId)
+ Option.SkipAutoGen, Option.Reparse, Option.SkuId,
+ Option.ReportFile, Option.ReportType)
MyBuild.Launch()
#MyBuild.DumpBuildData()
except FatalError, X: