BaseTools: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@@ -241,7 +241,7 @@ class WorkspaceAutoGen(AutoGen):
|
||||
super(WorkspaceAutoGen, self).__init__(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
|
||||
self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
|
||||
self._Init = True
|
||||
|
||||
|
||||
## Initialize WorkspaceAutoGen
|
||||
#
|
||||
# @param WorkspaceDir Root directory of workspace
|
||||
@@ -310,7 +310,7 @@ class WorkspaceAutoGen(AutoGen):
|
||||
ExtraData="Build target [%s] is not supported by the platform. [Valid target: %s]"
|
||||
% (self.BuildTarget, " ".join(self.Platform.BuildTargets)))
|
||||
|
||||
|
||||
|
||||
# parse FDF file to get PCDs in it, if any
|
||||
if not self.FdfFile:
|
||||
self.FdfFile = self.Platform.FlashDefinition
|
||||
@@ -763,7 +763,7 @@ class WorkspaceAutoGen(AutoGen):
|
||||
|
||||
## _CheckDuplicateInFV() method
|
||||
#
|
||||
# Check whether there is duplicate modules/files exist in FV section.
|
||||
# Check whether there is duplicate modules/files exist in FV section.
|
||||
# The check base on the file GUID;
|
||||
#
|
||||
def _CheckDuplicateInFV(self, Fdf):
|
||||
@@ -794,7 +794,7 @@ class WorkspaceAutoGen(AutoGen):
|
||||
Module.Guid.upper()),
|
||||
ExtraData=self.FdfFile)
|
||||
#
|
||||
# Some INF files not have entity in DSC file.
|
||||
# Some INF files not have entity in DSC file.
|
||||
#
|
||||
if not InfFoundFlag:
|
||||
if FfsFile.InfFileName.find('$') == -1:
|
||||
@@ -804,7 +804,7 @@ class WorkspaceAutoGen(AutoGen):
|
||||
|
||||
PathClassObj = PathClass(FfsFile.InfFileName, self.WorkspaceDir)
|
||||
#
|
||||
# Here we just need to get FILE_GUID from INF file, use 'COMMON' as ARCH attribute. and use
|
||||
# Here we just need to get FILE_GUID from INF file, use 'COMMON' as ARCH attribute. and use
|
||||
# BuildObject from one of AutoGenObjectList is enough.
|
||||
#
|
||||
InfObj = self.AutoGenObjectList[0].BuildDatabase.WorkspaceDb.BuildObject[PathClassObj, TAB_ARCH_COMMON, self.BuildTarget, self.ToolChain]
|
||||
@@ -823,7 +823,7 @@ class WorkspaceAutoGen(AutoGen):
|
||||
|
||||
if FfsFile.NameGuid is not None:
|
||||
#
|
||||
# If the NameGuid reference a PCD name.
|
||||
# If the NameGuid reference a PCD name.
|
||||
# The style must match: PCD(xxxx.yyy)
|
||||
#
|
||||
if gPCDAsGuidPattern.match(FfsFile.NameGuid):
|
||||
@@ -900,7 +900,7 @@ class WorkspaceAutoGen(AutoGen):
|
||||
for Pcd in Pa.Platform.Pcds:
|
||||
PcdType = Pa.Platform.Pcds[Pcd].Type
|
||||
|
||||
# If no PCD type, this PCD comes from FDF
|
||||
# If no PCD type, this PCD comes from FDF
|
||||
if not PcdType:
|
||||
continue
|
||||
|
||||
@@ -992,14 +992,14 @@ class WorkspaceAutoGen(AutoGen):
|
||||
## Check the PCDs token value conflict in each DEC file.
|
||||
#
|
||||
# Will cause build break and raise error message while two PCDs conflict.
|
||||
#
|
||||
#
|
||||
# @return None
|
||||
#
|
||||
def _CheckAllPcdsTokenValueConflict(self):
|
||||
for Pa in self.AutoGenObjectList:
|
||||
for Package in Pa.PackageList:
|
||||
PcdList = Package.Pcds.values()
|
||||
PcdList.sort(lambda x, y: cmp(int(x.TokenValue, 0), int(y.TokenValue, 0)))
|
||||
PcdList.sort(lambda x, y: cmp(int(x.TokenValue, 0), int(y.TokenValue, 0)))
|
||||
Count = 0
|
||||
while (Count < len(PcdList) - 1) :
|
||||
Item = PcdList[Count]
|
||||
@@ -1124,20 +1124,20 @@ class PlatformAutoGen(AutoGen):
|
||||
self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch)
|
||||
self._Init = True
|
||||
#
|
||||
# Used to store all PCDs for both PEI and DXE phase, in order to generate
|
||||
# Used to store all PCDs for both PEI and DXE phase, in order to generate
|
||||
# correct PCD database
|
||||
#
|
||||
#
|
||||
_DynaPcdList_ = []
|
||||
_NonDynaPcdList_ = []
|
||||
_PlatformPcds = {}
|
||||
|
||||
|
||||
#
|
||||
# The priority list while override build option
|
||||
# The priority list while override build option
|
||||
#
|
||||
PrioList = {"0x11111" : 16, # TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE (Highest)
|
||||
"0x01111" : 15, # ******_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE
|
||||
"0x10111" : 14, # TARGET_*********_ARCH_COMMANDTYPE_ATTRIBUTE
|
||||
"0x00111" : 13, # ******_*********_ARCH_COMMANDTYPE_ATTRIBUTE
|
||||
"0x00111" : 13, # ******_*********_ARCH_COMMANDTYPE_ATTRIBUTE
|
||||
"0x11011" : 12, # TARGET_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE
|
||||
"0x01011" : 11, # ******_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE
|
||||
"0x10011" : 10, # TARGET_*********_****_COMMANDTYPE_ATTRIBUTE
|
||||
@@ -1289,9 +1289,9 @@ class PlatformAutoGen(AutoGen):
|
||||
#
|
||||
def CollectFixedAtBuildPcds(self):
|
||||
for LibAuto in self.LibraryAutoGenList:
|
||||
FixedAtBuildPcds = {}
|
||||
ShareFixedAtBuildPcdsSameValue = {}
|
||||
for Module in LibAuto._ReferenceModules:
|
||||
FixedAtBuildPcds = {}
|
||||
ShareFixedAtBuildPcdsSameValue = {}
|
||||
for Module in LibAuto._ReferenceModules:
|
||||
for Pcd in Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds:
|
||||
key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
||||
if key not in FixedAtBuildPcds:
|
||||
@@ -1299,7 +1299,7 @@ class PlatformAutoGen(AutoGen):
|
||||
FixedAtBuildPcds[key] = Pcd.DefaultValue
|
||||
else:
|
||||
if FixedAtBuildPcds[key] != Pcd.DefaultValue:
|
||||
ShareFixedAtBuildPcdsSameValue[key] = False
|
||||
ShareFixedAtBuildPcdsSameValue[key] = False
|
||||
for Pcd in LibAuto.FixedAtBuildPcds:
|
||||
key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in self.NonDynamicPcdDict:
|
||||
@@ -1308,7 +1308,7 @@ class PlatformAutoGen(AutoGen):
|
||||
DscPcd = self.NonDynamicPcdDict[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)]
|
||||
if DscPcd.Type != TAB_PCDS_FIXED_AT_BUILD:
|
||||
continue
|
||||
if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtBuildPcdsSameValue[key]:
|
||||
if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtBuildPcdsSameValue[key]:
|
||||
LibAuto.ConstPcd[key] = FixedAtBuildPcds[key]
|
||||
|
||||
def CollectVariables(self, DynamicPcdSet):
|
||||
@@ -1405,7 +1405,7 @@ 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:
|
||||
@@ -1417,27 +1417,27 @@ class PlatformAutoGen(AutoGen):
|
||||
if M.IsBinaryModule == True:
|
||||
PcdFromModule.IsFromBinaryInf = True
|
||||
|
||||
# Check the PCD from DSC or not
|
||||
# Check the PCD from DSC or not
|
||||
PcdFromModule.IsFromDsc = (PcdFromModule.TokenCName, PcdFromModule.TokenSpaceGuidCName) in self.Platform.Pcds
|
||||
|
||||
if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET or PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:
|
||||
if F.Path not in FdfModuleList:
|
||||
# If one of the Source built modules listed in the DSC is not listed
|
||||
# in FDF modules, and the INF lists a PCD can only use the PcdsDynamic
|
||||
# access method (it is only listed in the DEC file that declares the
|
||||
# If one of the Source built modules listed in the DSC is not listed
|
||||
# in FDF modules, and the INF lists a PCD can only use the PcdsDynamic
|
||||
# access method (it is only listed in the DEC file that declares the
|
||||
# PCD as PcdsDynamic), then build tool will report warning message
|
||||
# notify the PI that they are attempting to build a module that must
|
||||
# be included in a flash image in order to be functional. These Dynamic
|
||||
# PCD will not be added into the Database unless it is used by other
|
||||
# notify the PI that they are attempting to build a module that must
|
||||
# be included in a flash image in order to be functional. These Dynamic
|
||||
# PCD will not be added into the Database unless it is used by other
|
||||
# modules that are included in the FDF file.
|
||||
if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET and \
|
||||
PcdFromModule.IsFromBinaryInf == False:
|
||||
# Print warning message to let the developer make a determine.
|
||||
continue
|
||||
# If one of the Source built modules listed in the DSC is not listed in
|
||||
# FDF modules, and the INF lists a PCD can only use the PcdsDynamicEx
|
||||
# access method (it is only listed in the DEC file that declares the
|
||||
# PCD as PcdsDynamicEx), then DO NOT break the build; DO NOT add the
|
||||
# If one of the Source built modules listed in the DSC is not listed in
|
||||
# FDF modules, and the INF lists a PCD can only use the PcdsDynamicEx
|
||||
# access method (it is only listed in the DEC file that declares the
|
||||
# PCD as PcdsDynamicEx), then DO NOT break the build; DO NOT add the
|
||||
# PCD to the Platform's PCD Database.
|
||||
if PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:
|
||||
continue
|
||||
@@ -1465,14 +1465,14 @@ class PlatformAutoGen(AutoGen):
|
||||
PcdFromModule.Pending = False
|
||||
self._NonDynaPcdList_.append (PcdFromModule)
|
||||
DscModuleSet = {os.path.normpath(ModuleInf.Path) for ModuleInf in self.Platform.Modules}
|
||||
# add the PCD from modules that listed in FDF but not in DSC to Database
|
||||
# add the PCD from modules that listed in FDF but not in DSC to Database
|
||||
for InfName in FdfModuleList:
|
||||
if InfName not in DscModuleSet:
|
||||
InfClass = PathClass(InfName)
|
||||
M = self.BuildDatabase[InfClass, self.Arch, self.BuildTarget, self.ToolChain]
|
||||
# If a module INF in FDF but not in current arch's DSC module list, it must be module (either binary or source)
|
||||
# for different Arch. PCDs in source module for different Arch is already added before, so skip the source module here.
|
||||
# For binary module, if in current arch, we need to list the PCDs into database.
|
||||
# If a module INF in FDF but not in current arch's DSC module list, it must be module (either binary or source)
|
||||
# for different Arch. PCDs in source module for different Arch is already added before, so skip the source module here.
|
||||
# For binary module, if in current arch, we need to list the PCDs into database.
|
||||
if not M.IsSupportedArch:
|
||||
continue
|
||||
# Override the module PCD setting by platform setting
|
||||
@@ -1497,20 +1497,20 @@ class PlatformAutoGen(AutoGen):
|
||||
self._NonDynaPcdList_.append(PcdFromModule)
|
||||
if PcdFromModule in self._DynaPcdList_ and PcdFromModule.Phase == 'PEI' and PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:
|
||||
# Overwrite the phase of any the same PCD existing, if Phase is PEI.
|
||||
# It is to solve the case that a dynamic PCD used by a PEM module/PEI
|
||||
# It is to solve the case that a dynamic PCD used by a PEM module/PEI
|
||||
# module & DXE module at a same time.
|
||||
# Overwrite the type of the PCDs in source INF by the type of AsBuild
|
||||
# INF file as DynamicEx.
|
||||
# INF file as DynamicEx.
|
||||
Index = self._DynaPcdList_.index(PcdFromModule)
|
||||
self._DynaPcdList_[Index].Phase = PcdFromModule.Phase
|
||||
self._DynaPcdList_[Index].Type = PcdFromModule.Type
|
||||
for PcdFromModule in self._NonDynaPcdList_:
|
||||
# If a PCD is not listed in the DSC file, but binary INF files used by
|
||||
# this platform all (that use this PCD) list the PCD in a [PatchPcds]
|
||||
# section, AND all source INF files used by this platform the build
|
||||
# that use the PCD list the PCD in either a [Pcds] or [PatchPcds]
|
||||
# If a PCD is not listed in the DSC file, but binary INF files used by
|
||||
# this platform all (that use this PCD) list the PCD in a [PatchPcds]
|
||||
# section, AND all source INF files used by this platform the build
|
||||
# that use the PCD list the PCD in either a [Pcds] or [PatchPcds]
|
||||
# section, then the tools must NOT add the PCD to the Platform's PCD
|
||||
# Database; the build must assign the access method for this PCD as
|
||||
# Database; the build must assign the access method for this PCD as
|
||||
# PcdsPatchableInModule.
|
||||
if PcdFromModule not in self._DynaPcdList_:
|
||||
continue
|
||||
@@ -1533,7 +1533,7 @@ class PlatformAutoGen(AutoGen):
|
||||
self._DynamicPcdList = self._DynaPcdList_
|
||||
#
|
||||
# Sort dynamic PCD list to:
|
||||
# 1) If PCD's datum type is VOID* and value is unicode string which starts with L, the PCD item should
|
||||
# 1) If PCD's datum type is VOID* and value is unicode string which starts with L, the PCD item should
|
||||
# try to be put header of dynamicd List
|
||||
# 2) If PCD is HII type, the PCD item should be put after unicode type PCD
|
||||
#
|
||||
@@ -1554,7 +1554,7 @@ class PlatformAutoGen(AutoGen):
|
||||
if self._PlatformPcds[item].DatumType and self._PlatformPcds[item].DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
|
||||
self._PlatformPcds[item].DatumType = TAB_VOID
|
||||
|
||||
if (self.Workspace.ArchList[-1] == self.Arch):
|
||||
if (self.Workspace.ArchList[-1] == self.Arch):
|
||||
for Pcd in self._DynamicPcdList:
|
||||
# just pick the a value to determine whether is unicode string type
|
||||
Sku = Pcd.SkuInfoList.values()[0]
|
||||
@@ -1637,7 +1637,7 @@ class PlatformAutoGen(AutoGen):
|
||||
#
|
||||
# Fix the PCDs define in VPD PCD section that never referenced by module.
|
||||
# An example is PCD for signature usage.
|
||||
#
|
||||
#
|
||||
for DscPcd in PlatformPcds:
|
||||
DscPcdEntry = self._PlatformPcds[DscPcd]
|
||||
if DscPcdEntry.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
|
||||
@@ -1659,8 +1659,8 @@ class PlatformAutoGen(AutoGen):
|
||||
defaultindex = SkuObjList.index((TAB_DEFAULT, DefaultSku))
|
||||
SkuObjList[0], SkuObjList[defaultindex] = SkuObjList[defaultindex], SkuObjList[0]
|
||||
for (SkuName, Sku) in SkuObjList:
|
||||
Sku.VpdOffset = Sku.VpdOffset.strip()
|
||||
|
||||
Sku.VpdOffset = Sku.VpdOffset.strip()
|
||||
|
||||
# Need to iterate DEC pcd information to get the value & datumtype
|
||||
for eachDec in self.PackageList:
|
||||
for DecPcd in eachDec.Pcds:
|
||||
@@ -1671,8 +1671,8 @@ class PlatformAutoGen(AutoGen):
|
||||
EdkLogger.warn("build", "Unreferenced vpd pcd used!",
|
||||
File=self.MetaFile, \
|
||||
ExtraData = "PCD: %s.%s used in the DSC file %s is unreferenced." \
|
||||
%(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, self.Platform.MetaFile.Path))
|
||||
|
||||
%(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, self.Platform.MetaFile.Path))
|
||||
|
||||
DscPcdEntry.DatumType = DecPcdEntry.DatumType
|
||||
DscPcdEntry.DefaultValue = DecPcdEntry.DefaultValue
|
||||
DscPcdEntry.TokenValue = DecPcdEntry.TokenValue
|
||||
@@ -1680,7 +1680,7 @@ class PlatformAutoGen(AutoGen):
|
||||
# Only fix the value while no value provided in DSC file.
|
||||
if not Sku.DefaultValue:
|
||||
DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]].DefaultValue = DecPcdEntry.DefaultValue
|
||||
|
||||
|
||||
if DscPcdEntry not in self._DynamicPcdList:
|
||||
self._DynamicPcdList.append(DscPcdEntry)
|
||||
Sku.VpdOffset = Sku.VpdOffset.strip()
|
||||
@@ -1711,7 +1711,7 @@ class PlatformAutoGen(AutoGen):
|
||||
VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
|
||||
SkuValueMap[PcdValue].append(Sku)
|
||||
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
|
||||
NeedProcessVpdMapFile = True
|
||||
NeedProcessVpdMapFile = True
|
||||
if DscPcdEntry.DatumType == TAB_VOID and PcdValue.startswith("L"):
|
||||
UnicodePcdArray.add(DscPcdEntry)
|
||||
elif len(Sku.VariableName) > 0:
|
||||
@@ -1723,7 +1723,7 @@ class PlatformAutoGen(AutoGen):
|
||||
VpdSkuMap[DscPcd] = SkuValueMap
|
||||
if (self.Platform.FlashDefinition is None or self.Platform.FlashDefinition == '') and \
|
||||
VpdFile.GetCount() != 0:
|
||||
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
|
||||
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
|
||||
"Fail to get FLASH_DEFINITION definition in DSC file %s which is required when DSC contains VPD PCD." % str(self.Platform.MetaFile))
|
||||
|
||||
if VpdFile.GetCount() != 0:
|
||||
@@ -2071,9 +2071,9 @@ class PlatformAutoGen(AutoGen):
|
||||
self._PcdTokenNumber = OrderedDict()
|
||||
TokenNumber = 1
|
||||
#
|
||||
# Make the Dynamic and DynamicEx PCD use within different TokenNumber area.
|
||||
# Make the Dynamic and DynamicEx PCD use within different TokenNumber area.
|
||||
# Such as:
|
||||
#
|
||||
#
|
||||
# Dynamic PCD:
|
||||
# TokenNumber 0 ~ 10
|
||||
# DynamicEx PCD:
|
||||
@@ -2388,7 +2388,7 @@ class PlatformAutoGen(AutoGen):
|
||||
# @param Options Options to be expanded
|
||||
#
|
||||
# @retval options Options expanded
|
||||
#
|
||||
#
|
||||
def _ExpandBuildOption(self, Options, ModuleStyle=None):
|
||||
BuildOptions = {}
|
||||
FamilyMatch = False
|
||||
@@ -2414,9 +2414,9 @@ class PlatformAutoGen(AutoGen):
|
||||
if OverrideList.get(Key[1]) is not None:
|
||||
OverrideList.pop(Key[1])
|
||||
OverrideList[Key[1]] = Options[Key]
|
||||
|
||||
|
||||
#
|
||||
# Use the highest priority value.
|
||||
# Use the highest priority value.
|
||||
#
|
||||
if (len(OverrideList) >= 2):
|
||||
KeyList = OverrideList.keys()
|
||||
@@ -2427,7 +2427,7 @@ class PlatformAutoGen(AutoGen):
|
||||
NextKey = KeyList[Index1 + Index + 1]
|
||||
#
|
||||
# Compare two Key, if one is included by another, choose the higher priority one
|
||||
#
|
||||
#
|
||||
Target2, ToolChain2, Arch2, CommandType2, Attr2 = NextKey.split("_")
|
||||
if (Target1 == Target2 or Target1 == "*" or Target2 == "*") and\
|
||||
(ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2 == "*") and\
|
||||
@@ -2441,7 +2441,7 @@ class PlatformAutoGen(AutoGen):
|
||||
else:
|
||||
if Options.get((self.BuildRuleFamily, NowKey)) is not None:
|
||||
Options.pop((self.BuildRuleFamily, NowKey))
|
||||
|
||||
|
||||
for Key in Options:
|
||||
if ModuleStyle is not None and len (Key) > 2:
|
||||
# Check Module style is EDK or EDKII.
|
||||
@@ -2639,7 +2639,7 @@ class ModuleAutoGen(AutoGen):
|
||||
% (MetaFile, Arch))
|
||||
return None
|
||||
return obj
|
||||
|
||||
|
||||
## Initialize ModuleAutoGen
|
||||
#
|
||||
# @param Workspace EdkIIWorkspaceBuild object
|
||||
@@ -2737,13 +2737,13 @@ class ModuleAutoGen(AutoGen):
|
||||
|
||||
self.AutoGenDepSet = set()
|
||||
|
||||
|
||||
|
||||
## The Modules referenced to this Library
|
||||
# Only Library has this attribute
|
||||
self._ReferenceModules = []
|
||||
|
||||
self._ReferenceModules = []
|
||||
|
||||
## Store the FixedAtBuild Pcds
|
||||
#
|
||||
#
|
||||
self._FixedAtBuildPcds = []
|
||||
self.ConstPcd = {}
|
||||
|
||||
@@ -2759,8 +2759,8 @@ class ModuleAutoGen(AutoGen):
|
||||
continue
|
||||
if Pcd not in self._FixedAtBuildPcds:
|
||||
self._FixedAtBuildPcds.append(Pcd)
|
||||
|
||||
return self._FixedAtBuildPcds
|
||||
|
||||
return self._FixedAtBuildPcds
|
||||
|
||||
def _GetUniqueBaseName(self):
|
||||
BaseName = self.Name
|
||||
@@ -2959,7 +2959,7 @@ class ModuleAutoGen(AutoGen):
|
||||
continue
|
||||
PackageList.append(Package)
|
||||
return PackageList
|
||||
|
||||
|
||||
## Get the depex string
|
||||
#
|
||||
# @return : a string contain all depex expresion.
|
||||
@@ -2988,7 +2988,7 @@ class ModuleAutoGen(AutoGen):
|
||||
(Arch.upper() == self.Arch.upper() and \
|
||||
ModuleType.upper() in [TAB_ARCH_COMMON, self.ModuleType.upper()]):
|
||||
DepexList.append({(Arch, ModuleType): DepexExpr})
|
||||
|
||||
|
||||
#the type of build module is USER_DEFINED.
|
||||
if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
|
||||
for Depex in DepexList:
|
||||
@@ -2999,7 +2999,7 @@ class ModuleAutoGen(AutoGen):
|
||||
if not DepexStr:
|
||||
return '[Depex.%s]\n' % self.Arch
|
||||
return DepexStr
|
||||
|
||||
|
||||
#the type of build module not is USER_DEFINED.
|
||||
Count = 0
|
||||
for Depex in DepexList:
|
||||
@@ -3019,7 +3019,7 @@ class ModuleAutoGen(AutoGen):
|
||||
if not DepexStr:
|
||||
return '[Depex.%s]\n' % self.Arch
|
||||
return '[Depex.%s]\n# ' % self.Arch + DepexStr
|
||||
|
||||
|
||||
## Merge dependency expression
|
||||
#
|
||||
# @retval list The token list of the dependency expression after parsed
|
||||
@@ -3155,14 +3155,14 @@ class ModuleAutoGen(AutoGen):
|
||||
#
|
||||
self._BuildOptionIncPathList = []
|
||||
return self._BuildOptionIncPathList
|
||||
|
||||
|
||||
BuildOptionIncPathList = []
|
||||
for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'):
|
||||
try:
|
||||
FlagOption = self.BuildOption[Tool]['FLAGS']
|
||||
except KeyError:
|
||||
FlagOption = ''
|
||||
|
||||
|
||||
if self.PlatformInfo.ToolChainFamily != 'RVCT':
|
||||
IncPathList = [NormPath(Path, self.Macros) for Path in BuildOptIncludeRegEx.findall(FlagOption)]
|
||||
else:
|
||||
@@ -3175,7 +3175,7 @@ class ModuleAutoGen(AutoGen):
|
||||
IncPathList.extend(NormPath(PathEntry, self.Macros) for PathEntry in PathList)
|
||||
|
||||
#
|
||||
# EDK II modules must not reference header files outside of the packages they depend on or
|
||||
# EDK II modules must not reference header files outside of the packages they depend on or
|
||||
# within the module's directory tree. Report error if violation.
|
||||
#
|
||||
if self.AutoGenVersion >= 0x00010005:
|
||||
@@ -3187,13 +3187,13 @@ class ModuleAutoGen(AutoGen):
|
||||
ExtraData=ErrMsg,
|
||||
File=str(self.MetaFile))
|
||||
|
||||
|
||||
|
||||
BuildOptionIncPathList += IncPathList
|
||||
|
||||
|
||||
self._BuildOptionIncPathList = BuildOptionIncPathList
|
||||
|
||||
|
||||
return self._BuildOptionIncPathList
|
||||
|
||||
|
||||
## Return a list of files which can be built from source
|
||||
#
|
||||
# What kind of files can be built is determined by build rules in
|
||||
@@ -3247,7 +3247,7 @@ class ModuleAutoGen(AutoGen):
|
||||
Order_Dict[F].sort(key=lambda i: self.BuildRuleOrder.index(i))
|
||||
for Ext in Order_Dict[F][1:]:
|
||||
RemoveList.append(F + Ext)
|
||||
|
||||
|
||||
for item in RemoveList:
|
||||
FileList.remove(item)
|
||||
|
||||
@@ -3690,12 +3690,12 @@ class ModuleAutoGen(AutoGen):
|
||||
for SourceFile in self.Module.Sources:
|
||||
if SourceFile.Type.upper() == ".VFR" :
|
||||
#
|
||||
# search the .map file to find the offset of vfr binary in the PE32+/TE file.
|
||||
# search the .map file to find the offset of vfr binary in the PE32+/TE file.
|
||||
#
|
||||
VfrUniBaseName[SourceFile.BaseName] = (SourceFile.BaseName + "Bin")
|
||||
elif SourceFile.Type.upper() == ".UNI" :
|
||||
#
|
||||
# search the .map file to find the offset of Uni strings binary in the PE32+/TE file.
|
||||
# search the .map file to find the offset of Uni strings binary in the PE32+/TE file.
|
||||
#
|
||||
VfrUniBaseName["UniOffsetName"] = (self.Name + "Strings")
|
||||
|
||||
@@ -3727,7 +3727,7 @@ class ModuleAutoGen(AutoGen):
|
||||
#
|
||||
UniGuid = [0xe0, 0xc5, 0x13, 0x89, 0xf6, 0x33, 0x86, 0x4d, 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66]
|
||||
UniGuid = [chr(ItemGuid) for ItemGuid in UniGuid]
|
||||
fStringIO.write(''.join(UniGuid))
|
||||
fStringIO.write(''.join(UniGuid))
|
||||
UniValue = pack ('Q', int (Item[1], 16))
|
||||
fStringIO.write (UniValue)
|
||||
else:
|
||||
@@ -3738,13 +3738,13 @@ class ModuleAutoGen(AutoGen):
|
||||
#
|
||||
VfrGuid = [0xb4, 0x7c, 0xbc, 0xd0, 0x47, 0x6a, 0x5f, 0x49, 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2]
|
||||
VfrGuid = [chr(ItemGuid) for ItemGuid in VfrGuid]
|
||||
fStringIO.write(''.join(VfrGuid))
|
||||
fStringIO.write(''.join(VfrGuid))
|
||||
VfrValue = pack ('Q', int (Item[1], 16))
|
||||
fStringIO.write (VfrValue)
|
||||
#
|
||||
# write data into file.
|
||||
#
|
||||
try :
|
||||
try :
|
||||
fInputfile.write (fStringIO.getvalue())
|
||||
except:
|
||||
EdkLogger.error("build", FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the "
|
||||
@@ -3764,15 +3764,15 @@ class ModuleAutoGen(AutoGen):
|
||||
|
||||
if self.IsAsBuiltInfCreated:
|
||||
return
|
||||
|
||||
|
||||
# Skip the following code for EDK I inf
|
||||
if self.AutoGenVersion < 0x00010005:
|
||||
return
|
||||
|
||||
|
||||
# Skip the following code for libraries
|
||||
if self.IsLibrary:
|
||||
return
|
||||
|
||||
|
||||
# Skip the following code for modules with no source files
|
||||
if not self.SourceFileList:
|
||||
return
|
||||
@@ -3780,7 +3780,7 @@ class ModuleAutoGen(AutoGen):
|
||||
# Skip the following code for modules without any binary files
|
||||
if self.BinaryFileList:
|
||||
return
|
||||
|
||||
|
||||
### TODO: How to handles mixed source and binary modules
|
||||
|
||||
# Find all DynamicEx and PatchableInModule PCDs used by this module and dependent libraries
|
||||
@@ -4054,7 +4054,7 @@ class ModuleAutoGen(AutoGen):
|
||||
UsageIndex = Index
|
||||
break
|
||||
if UsageIndex != -1:
|
||||
PcdCommentList[UsageIndex] = '## %s %s %s' % (UsageStr, HiiInfo, PcdCommentList[UsageIndex].replace(UsageStr, ''))
|
||||
PcdCommentList[UsageIndex] = '## %s %s %s' % (UsageStr, HiiInfo, PcdCommentList[UsageIndex].replace(UsageStr, ''))
|
||||
else:
|
||||
PcdCommentList.append('## UNDEFINED ' + HiiInfo)
|
||||
PcdComments = '\n '.join(PcdCommentList)
|
||||
@@ -4069,7 +4069,7 @@ class ModuleAutoGen(AutoGen):
|
||||
# Generated LibraryClasses section in comments.
|
||||
for Library in self.LibraryAutoGenList:
|
||||
AsBuiltInfDict['libraryclasses_item'].append(Library.MetaFile.File.replace('\\', '/'))
|
||||
|
||||
|
||||
# Generated UserExtensions TianoCore section.
|
||||
# All tianocore user extensions are copied.
|
||||
UserExtStr = ''
|
||||
@@ -4083,12 +4083,12 @@ class ModuleAutoGen(AutoGen):
|
||||
# Generated depex expression section in comments.
|
||||
DepexExpresion = self._GetDepexExpresionString()
|
||||
AsBuiltInfDict['depexsection_item'] = DepexExpresion if DepexExpresion else ''
|
||||
|
||||
|
||||
AsBuiltInf = TemplateString()
|
||||
AsBuiltInf.Append(gAsBuiltInfHeaderString.Replace(AsBuiltInfDict))
|
||||
|
||||
|
||||
SaveFileOnChange(os.path.join(self.OutputDir, self.Name + '.inf'), str(AsBuiltInf), False)
|
||||
|
||||
|
||||
self.IsAsBuiltInfCreated = True
|
||||
if GlobalData.gBinCacheDest:
|
||||
self.CopyModuleToCache()
|
||||
@@ -4408,7 +4408,7 @@ class ModuleAutoGen(AutoGen):
|
||||
BuildOption = property(_GetModuleBuildOption)
|
||||
BuildOptionIncPathList = property(_GetBuildOptionIncPathList)
|
||||
BuildCommand = property(_GetBuildCommand)
|
||||
|
||||
|
||||
FixedAtBuildPcds = property(_GetFixedAtBuildPcds)
|
||||
UniqueBaseName = property(_GetUniqueBaseName)
|
||||
|
||||
|
@@ -360,7 +360,7 @@ class BuildRule:
|
||||
# Clean up the line and replace path separator with native one
|
||||
Line = self.RuleContent[Index].strip().replace(self._PATH_SEP, os.path.sep)
|
||||
self.RuleContent[Index] = Line
|
||||
|
||||
|
||||
# find the build_rule_version
|
||||
if Line and Line[0] == "#" and Line.find(TAB_BUILD_RULE_VERSION) != -1:
|
||||
if Line.find("=") != -1 and Line.find("=") < (len(Line) - 1) and (Line[(Line.find("=") + 1):]).split():
|
||||
|
@@ -784,7 +784,7 @@ gModuleTypeHeaderFile = {
|
||||
SUP_MODULE_USER_DEFINED : [gBasicHeaderFile]
|
||||
}
|
||||
|
||||
## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName
|
||||
## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName
|
||||
# the TokenName and Guid comparison to avoid define name collisions.
|
||||
#
|
||||
# @param Info The ModuleAutoGen object
|
||||
@@ -804,7 +804,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH):
|
||||
return
|
||||
AutoGenH.Append('\n#define COMPAREGUID(Guid1, Guid2) (BOOLEAN)(*(CONST UINT64*)Guid1 == *(CONST UINT64*)Guid2 && *((CONST UINT64*)Guid1 + 1) == *((CONST UINT64*)Guid2 + 1))\n')
|
||||
# AutoGen for each PCD listed in a [PcdEx] section of a Module/Lib INF file.
|
||||
# Auto generate a macro for each TokenName that takes a Guid pointer as a parameter.
|
||||
# Auto generate a macro for each TokenName that takes a Guid pointer as a parameter.
|
||||
# Use the Guid pointer to see if it matches any of the token space GUIDs.
|
||||
TokenCNameList = set()
|
||||
for TokenCName in ExTokenCNameList:
|
||||
@@ -822,15 +822,15 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH):
|
||||
Index = Index + 1
|
||||
if Index == 1:
|
||||
AutoGenH.Append('\n#define __PCD_%s_ADDR_CMP(GuidPtr) (' % (RealTokenCName))
|
||||
AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))
|
||||
else:
|
||||
AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))
|
||||
if Index == Count:
|
||||
AutoGenH.Append('0 \\\n )\n')
|
||||
TokenCNameList.add(TokenCName)
|
||||
|
||||
|
||||
TokenCNameList = set()
|
||||
for TokenCName in ExTokenCNameList:
|
||||
if TokenCName in TokenCNameList:
|
||||
@@ -848,14 +848,14 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH):
|
||||
if Index == 1:
|
||||
AutoGenH.Append('\n#define __PCD_%s_VAL_CMP(GuidPtr) (' % (RealTokenCName))
|
||||
AutoGenH.Append('\\\n (GuidPtr == NULL) ? 0:')
|
||||
AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))
|
||||
else:
|
||||
AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))
|
||||
if Index == Count:
|
||||
AutoGenH.Append('0 \\\n )\n')
|
||||
# Autogen internal worker macro to compare GUIDs. Guid1 is a pointer to a GUID.
|
||||
# Autogen internal worker macro to compare GUIDs. Guid1 is a pointer to a GUID.
|
||||
# Guid2 is a C name for a GUID. Compare pointers first because optimizing compiler
|
||||
# can do this at build time on CONST GUID pointers and optimize away call to COMPAREGUID().
|
||||
# COMPAREGUID() will only be used if the Guid passed in is local to the module.
|
||||
@@ -890,22 +890,22 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
|
||||
if Pcd.PcdValueFromComm:
|
||||
Pcd.DefaultValue = Pcd.PcdValueFromComm
|
||||
|
||||
|
||||
if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
|
||||
TokenNumber = int(Pcd.TokenValue, 0)
|
||||
# Add TokenSpaceGuidValue value to PcdTokenName to discriminate the DynamicEx PCDs with
|
||||
# Add TokenSpaceGuidValue value to PcdTokenName to discriminate the DynamicEx PCDs with
|
||||
# different Guids but same TokenCName
|
||||
PcdExTokenName = '_PCD_TOKEN_' + Pcd.TokenSpaceGuidCName + '_' + TokenCName
|
||||
AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumber))
|
||||
else:
|
||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber:
|
||||
# If one of the Source built modules listed in the DSC is not listed in FDF modules,
|
||||
# and the INF lists a PCD can only use the PcdsDynamic access method (it is only
|
||||
# listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will
|
||||
# report warning message notify the PI that they are attempting to build a module
|
||||
# that must be included in a flash image in order to be functional. These Dynamic PCD
|
||||
# will not be added into the Database unless it is used by other modules that are
|
||||
# included in the FDF file.
|
||||
# If one of the Source built modules listed in the DSC is not listed in FDF modules,
|
||||
# and the INF lists a PCD can only use the PcdsDynamic access method (it is only
|
||||
# listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will
|
||||
# report warning message notify the PI that they are attempting to build a module
|
||||
# that must be included in a flash image in order to be functional. These Dynamic PCD
|
||||
# will not be added into the Database unless it is used by other modules that are
|
||||
# included in the FDF file.
|
||||
# In this case, just assign an invalid token number to make it pass build.
|
||||
if Pcd.Type in PCD_DYNAMIC_TYPE_SET:
|
||||
TokenNumber = 0
|
||||
@@ -929,7 +929,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_' + TokenCName
|
||||
SetModeStatusName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_S_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_S_' + TokenCName
|
||||
GetModeSizeName = '_PCD_GET_MODE_SIZE' + '_' + TokenCName
|
||||
|
||||
|
||||
if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
|
||||
if Info.IsLibrary:
|
||||
PcdList = Info.LibraryPcdList
|
||||
@@ -1044,7 +1044,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
|
||||
ExtraData="[%s]" % str(Info))
|
||||
if not Value.endswith('U'):
|
||||
Value += 'U'
|
||||
Value += 'U'
|
||||
elif Pcd.DatumType == TAB_UINT8:
|
||||
if ValueNumber < 0:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
@@ -1102,7 +1102,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
PcdValueName = '_PCD_PATCHABLE_VALUE_' + TokenCName
|
||||
else:
|
||||
PcdValueName = '_PCD_VALUE_' + TokenCName
|
||||
|
||||
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
#
|
||||
# For unicode, UINT16 array will be generated, so the alignment of unicode is guaranteed.
|
||||
@@ -1115,7 +1115,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s UINT8 %s%s = %s;\n' % (Const, PcdVariableName, Array, Value))
|
||||
AutoGenH.Append('extern %s UINT8 %s%s;\n' %(Const, PcdVariableName, Array))
|
||||
AutoGenH.Append('#define %s %s%s\n' %(GetModeName, Type, PcdVariableName))
|
||||
|
||||
|
||||
PcdDataSize = Pcd.GetPcdSize()
|
||||
if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD:
|
||||
AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, PcdDataSize))
|
||||
@@ -1132,10 +1132,10 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
AutoGenC.Append('volatile %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName))
|
||||
AutoGenH.Append('extern volatile %s %s %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array))
|
||||
AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, PcdVariableName))
|
||||
|
||||
|
||||
PcdDataSize = Pcd.GetPcdSize()
|
||||
AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, PcdDataSize))
|
||||
|
||||
|
||||
AutoGenH.Append('#define %s %s \n' % (GetModeSizeName, PatchPcdSizeVariableName))
|
||||
AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName)
|
||||
AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED UINTN %s = %s;\n' % (PatchPcdSizeVariableName, PcdDataSize))
|
||||
@@ -1143,7 +1143,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
PcdDataSize = Pcd.GetPcdSize()
|
||||
AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, PcdDataSize))
|
||||
AutoGenH.Append('#define %s %s \n' % (GetModeSizeName, FixPcdSizeTokenName))
|
||||
|
||||
|
||||
AutoGenH.Append('#define %s %s\n' %(PcdValueName, Value))
|
||||
AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName))
|
||||
AutoGenH.Append('extern %s %s %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array))
|
||||
@@ -1190,13 +1190,13 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
TokenNumber = int(Pcd.TokenValue, 0)
|
||||
else:
|
||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber:
|
||||
# If one of the Source built modules listed in the DSC is not listed in FDF modules,
|
||||
# and the INF lists a PCD can only use the PcdsDynamic access method (it is only
|
||||
# listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will
|
||||
# report warning message notify the PI that they are attempting to build a module
|
||||
# that must be included in a flash image in order to be functional. These Dynamic PCD
|
||||
# will not be added into the Database unless it is used by other modules that are
|
||||
# included in the FDF file.
|
||||
# If one of the Source built modules listed in the DSC is not listed in FDF modules,
|
||||
# and the INF lists a PCD can only use the PcdsDynamic access method (it is only
|
||||
# listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will
|
||||
# report warning message notify the PI that they are attempting to build a module
|
||||
# that must be included in a flash image in order to be functional. These Dynamic PCD
|
||||
# will not be added into the Database unless it is used by other modules that are
|
||||
# included in the FDF file.
|
||||
# In this case, just assign an invalid token number to make it pass build.
|
||||
if Pcd.Type in PCD_DYNAMIC_TYPE_SET:
|
||||
TokenNumber = 0
|
||||
@@ -1230,7 +1230,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
if PcdItemType in PCD_DYNAMIC_EX_TYPE_SET:
|
||||
PcdExTokenName = '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + TokenCName
|
||||
AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumber))
|
||||
|
||||
|
||||
if Info.IsLibrary:
|
||||
PcdList = Info.LibraryPcdList
|
||||
else:
|
||||
@@ -1312,7 +1312,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
|
||||
AutoGenH.Append('#define %s %s\n' % (GetModeSizeName, PatchPcdSizeVariableName))
|
||||
AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName)
|
||||
|
||||
|
||||
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:
|
||||
key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
||||
PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_' + TokenCName
|
||||
@@ -1323,7 +1323,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))
|
||||
AutoGenH.Append('#define %s %s_gPcd_FixedAtBuild_%s\n' %(GetModeName, Type, TokenCName))
|
||||
AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)
|
||||
|
||||
|
||||
ConstFixedPcd = False
|
||||
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd or (Info.IsLibrary and not Info._ReferenceModules)):
|
||||
ConstFixedPcd = True
|
||||
@@ -1656,7 +1656,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
|
||||
for Pcd in Info.ModulePcdList:
|
||||
if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenSpaceGuidCName not in TokenSpaceList:
|
||||
TokenSpaceList.append(Pcd.TokenSpaceGuidCName)
|
||||
|
||||
|
||||
SkuMgr = Info.Workspace.Platform.SkuIdMgr
|
||||
AutoGenH.Append("\n// Definition of SkuId Array\n")
|
||||
AutoGenH.Append("extern UINT64 _gPcd_SkuId_Array[];\n")
|
||||
@@ -1666,7 +1666,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
|
||||
if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
|
||||
GuidType = TAB_GUID
|
||||
else:
|
||||
GuidType = "EFI_GUID"
|
||||
GuidType = "EFI_GUID"
|
||||
for Item in TokenSpaceList:
|
||||
AutoGenH.Append('extern %s %s;\n' % (GuidType, Item))
|
||||
|
||||
@@ -2016,7 +2016,7 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
|
||||
if Info.ModuleType in gModuleTypeHeaderFile:
|
||||
AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])
|
||||
#
|
||||
# if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h
|
||||
# if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h
|
||||
# As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section.
|
||||
#
|
||||
if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds:
|
||||
|
@@ -182,10 +182,10 @@ typedef struct {
|
||||
//UINT32 UninitDataBaseSize;// Total size for PCD those default value with 0.
|
||||
//TABLE_OFFSET LocalTokenNumberTableOffset;
|
||||
//TABLE_OFFSET ExMapTableOffset;
|
||||
//TABLE_OFFSET GuidTableOffset;
|
||||
//TABLE_OFFSET GuidTableOffset;
|
||||
//TABLE_OFFSET StringTableOffset;
|
||||
//TABLE_OFFSET SizeTableOffset;
|
||||
//TABLE_OFFSET SkuIdTableOffset;
|
||||
//TABLE_OFFSET SkuIdTableOffset;
|
||||
//TABLE_OFFSET PcdNameTableOffset;
|
||||
//UINT16 LocalTokenCount; // LOCAL_TOKEN_NUMBER for all
|
||||
//UINT16 ExTokenCount; // EX_TOKEN_NUMBER for DynamicEx
|
||||
@@ -237,11 +237,11 @@ ${PHASE}_PCD_DATABASE_INIT g${PHASE}PcdDbInit = {
|
||||
|
||||
## DbItemList
|
||||
#
|
||||
# The class holds the Pcd database items. ItemSize if not zero should match the item datum type in the C structure.
|
||||
# The class holds the Pcd database items. ItemSize if not zero should match the item datum type in the C structure.
|
||||
# When the structure is changed, remember to check the ItemSize and the related PackStr in PackData()
|
||||
# RawDataList is the RawData that may need some kind of calculation or transformation,
|
||||
# RawDataList is the RawData that may need some kind of calculation or transformation,
|
||||
# the DataList corresponds to the data that need to be written to database. If DataList is not present, then RawDataList
|
||||
# will be written to the database.
|
||||
# will be written to the database.
|
||||
#
|
||||
class DbItemList:
|
||||
def __init__(self, ItemSize, DataList=None, RawDataList=None):
|
||||
@@ -309,7 +309,7 @@ class DbItemList:
|
||||
|
||||
## DbExMapTblItemList
|
||||
#
|
||||
# The class holds the ExMap table
|
||||
# The class holds the ExMap table
|
||||
#
|
||||
class DbExMapTblItemList (DbItemList):
|
||||
def __init__(self, ItemSize, DataList=None, RawDataList=None):
|
||||
@@ -319,15 +319,15 @@ class DbExMapTblItemList (DbItemList):
|
||||
Buffer = ''
|
||||
PackStr = "=LHH"
|
||||
for Datas in self.RawDataList:
|
||||
Buffer += pack(PackStr,
|
||||
Buffer += pack(PackStr,
|
||||
GetIntegerValue(Datas[0]),
|
||||
GetIntegerValue(Datas[1]),
|
||||
GetIntegerValue(Datas[2]))
|
||||
GetIntegerValue(Datas[2]))
|
||||
return Buffer
|
||||
|
||||
## DbComItemList
|
||||
#
|
||||
# The DbComItemList is a special kind of DbItemList in case that the size of the List can not be computed by the
|
||||
# The DbComItemList is a special kind of DbItemList in case that the size of the List can not be computed by the
|
||||
# ItemSize multiply the ItemCount.
|
||||
#
|
||||
class DbComItemList (DbItemList):
|
||||
@@ -345,7 +345,7 @@ class DbComItemList (DbItemList):
|
||||
else:
|
||||
assert(Index < len(self.RawDataList))
|
||||
for ItemIndex in xrange(Index):
|
||||
Offset += len(self.RawDataList[ItemIndex]) * self.ItemSize
|
||||
Offset += len(self.RawDataList[ItemIndex]) * self.ItemSize
|
||||
|
||||
return Offset
|
||||
|
||||
@@ -373,12 +373,12 @@ class DbComItemList (DbItemList):
|
||||
Buffer += pack(PackStr, GetIntegerValue(SingleData))
|
||||
else:
|
||||
Buffer += pack(PackStr, GetIntegerValue(Data))
|
||||
|
||||
|
||||
return Buffer
|
||||
|
||||
## DbVariableTableItemList
|
||||
#
|
||||
# The class holds the Variable header value table
|
||||
# The class holds the Variable header value table
|
||||
#
|
||||
class DbVariableTableItemList (DbComItemList):
|
||||
def __init__(self, ItemSize, DataList=None, RawDataList=None):
|
||||
@@ -389,7 +389,7 @@ class DbVariableTableItemList (DbComItemList):
|
||||
Buffer = ''
|
||||
for DataList in self.RawDataList:
|
||||
for Data in DataList:
|
||||
Buffer += pack(PackStr,
|
||||
Buffer += pack(PackStr,
|
||||
GetIntegerValue(Data[0]),
|
||||
GetIntegerValue(Data[1]),
|
||||
GetIntegerValue(Data[2]),
|
||||
@@ -402,7 +402,7 @@ class DbVariableTableItemList (DbComItemList):
|
||||
class DbStringHeadTableItemList(DbItemList):
|
||||
def __init__(self,ItemSize,DataList=None,RawDataList=None):
|
||||
DbItemList.__init__(self, ItemSize, DataList, RawDataList)
|
||||
|
||||
|
||||
def GetInterOffset(self, Index):
|
||||
Offset = 0
|
||||
if self.ItemSize == 0:
|
||||
@@ -435,11 +435,11 @@ class DbStringHeadTableItemList(DbItemList):
|
||||
self.ListSize += len(Datas) * self.ItemSize
|
||||
else:
|
||||
self.ListSize += self.ItemSize
|
||||
return self.ListSize
|
||||
return self.ListSize
|
||||
|
||||
## DbSkuHeadTableItemList
|
||||
#
|
||||
# The class holds the Sku header value table
|
||||
# The class holds the Sku header value table
|
||||
#
|
||||
class DbSkuHeadTableItemList (DbItemList):
|
||||
def __init__(self, ItemSize, DataList=None, RawDataList=None):
|
||||
@@ -449,14 +449,14 @@ class DbSkuHeadTableItemList (DbItemList):
|
||||
PackStr = "=LL"
|
||||
Buffer = ''
|
||||
for Data in self.RawDataList:
|
||||
Buffer += pack(PackStr,
|
||||
Buffer += pack(PackStr,
|
||||
GetIntegerValue(Data[0]),
|
||||
GetIntegerValue(Data[1]))
|
||||
return Buffer
|
||||
|
||||
## DbSizeTableItemList
|
||||
#
|
||||
# The class holds the size table
|
||||
# The class holds the size table
|
||||
#
|
||||
class DbSizeTableItemList (DbItemList):
|
||||
def __init__(self, ItemSize, DataList=None, RawDataList=None):
|
||||
@@ -471,16 +471,16 @@ class DbSizeTableItemList (DbItemList):
|
||||
PackStr = "=H"
|
||||
Buffer = ''
|
||||
for Data in self.RawDataList:
|
||||
Buffer += pack(PackStr,
|
||||
Buffer += pack(PackStr,
|
||||
GetIntegerValue(Data[0]))
|
||||
for subData in Data[1]:
|
||||
Buffer += pack(PackStr,
|
||||
Buffer += pack(PackStr,
|
||||
GetIntegerValue(subData))
|
||||
return Buffer
|
||||
|
||||
## DbStringItemList
|
||||
#
|
||||
# The class holds the string table
|
||||
# The class holds the string table
|
||||
#
|
||||
class DbStringItemList (DbComItemList):
|
||||
def __init__(self, ItemSize, DataList=None, RawDataList=None, LenList=None):
|
||||
@@ -490,7 +490,7 @@ class DbStringItemList (DbComItemList):
|
||||
RawDataList = []
|
||||
if LenList is None:
|
||||
LenList = []
|
||||
|
||||
|
||||
assert(len(RawDataList) == len(LenList))
|
||||
DataList = []
|
||||
# adjust DataList according to the LenList
|
||||
@@ -549,7 +549,7 @@ def GetMatchedIndex(Key1, List1, Key2, List2):
|
||||
return Index
|
||||
else:
|
||||
StartPos = Index + 1
|
||||
|
||||
|
||||
return -1
|
||||
|
||||
|
||||
@@ -557,7 +557,7 @@ def GetMatchedIndex(Key1, List1, Key2, List2):
|
||||
# to List like [0x36, 0x00, 0x34, 0x00, 0x21, 0x00, 0x36, 0x00, 0x34, 0x00, 0x00, 0x00]
|
||||
#
|
||||
# @param StringArray A string array like {0x36, 0x00, 0x34, 0x00, 0x21, 0x00, 0x36, 0x00, 0x34, 0x00, 0x00, 0x00}
|
||||
#
|
||||
#
|
||||
# @retval A list object of integer items
|
||||
#
|
||||
def StringArrayToList(StringArray):
|
||||
@@ -569,7 +569,7 @@ def StringArrayToList(StringArray):
|
||||
## Convert TokenType String like "PCD_DATUM_TYPE_UINT32 | PCD_TYPE_HII" to TokenType value
|
||||
#
|
||||
# @param TokenType A TokenType string like "PCD_DATUM_TYPE_UINT32 | PCD_TYPE_HII"
|
||||
#
|
||||
#
|
||||
# @retval A integer representation of the TokenType
|
||||
#
|
||||
def GetTokenTypeValue(TokenType):
|
||||
@@ -596,7 +596,7 @@ def GetTokenTypeValue(TokenType):
|
||||
## construct the external Pcd database using data from Dict
|
||||
#
|
||||
# @param Dict A dictionary contains Pcd related tables
|
||||
#
|
||||
#
|
||||
# @retval Buffer A byte stream of the Pcd database
|
||||
#
|
||||
def BuildExDataBase(Dict):
|
||||
@@ -625,26 +625,26 @@ def BuildExDataBase(Dict):
|
||||
NumberOfSkuEnabledPcd = GetIntegerValue(Dict['SKU_HEAD_SIZE'])
|
||||
|
||||
Dict['STRING_TABLE_DB_VALUE'] = [StringArrayToList(x) for x in Dict['STRING_TABLE_VALUE']]
|
||||
|
||||
|
||||
StringTableValue = Dict['STRING_TABLE_DB_VALUE']
|
||||
# when calcute the offset, should use StringTableLen instead of StringTableValue, as string maxium len may be different with actual len
|
||||
StringTableLen = Dict['STRING_TABLE_LENGTH']
|
||||
DbStringTableLen = DbStringItemList(0, RawDataList = StringTableValue, LenList = StringTableLen)
|
||||
|
||||
|
||||
|
||||
PcdTokenTable = Dict['PCD_TOKENSPACE']
|
||||
PcdTokenLen = Dict['PCD_TOKENSPACE_LENGTH']
|
||||
PcdTokenTableValue = [StringArrayToList(x) for x in Dict['PCD_TOKENSPACE']]
|
||||
DbPcdTokenTable = DbStringItemList(0, RawDataList = PcdTokenTableValue, LenList = PcdTokenLen)
|
||||
|
||||
|
||||
PcdCNameTable = Dict['PCD_CNAME']
|
||||
PcdCNameLen = Dict['PCD_CNAME_LENGTH']
|
||||
PcdCNameTableValue = [StringArrayToList(x) for x in Dict['PCD_CNAME']]
|
||||
DbPcdCNameTable = DbStringItemList(0, RawDataList = PcdCNameTableValue, LenList = PcdCNameLen)
|
||||
|
||||
|
||||
PcdNameOffsetTable = Dict['PCD_NAME_OFFSET']
|
||||
DbPcdNameOffsetTable = DbItemList(4, RawDataList = PcdNameOffsetTable)
|
||||
|
||||
|
||||
SizeTableValue = zip(Dict['SIZE_TABLE_MAXIMUM_LENGTH'], Dict['SIZE_TABLE_CURRENT_LENGTH'])
|
||||
DbSizeTableValue = DbSizeTableItemList(2, RawDataList = SizeTableValue)
|
||||
InitValueUint16 = Dict['INIT_DB_VALUE_UINT16']
|
||||
@@ -663,7 +663,7 @@ def BuildExDataBase(Dict):
|
||||
DbSkuidValue = DbItemList(8, RawDataList = SkuidValue)
|
||||
|
||||
|
||||
|
||||
|
||||
# Unit Db Items
|
||||
UnInitValueUint64 = Dict['UNINIT_GUID_DECL_UINT64']
|
||||
DbUnInitValueUint64 = DbItemList(8, RawDataList = UnInitValueUint64)
|
||||
@@ -676,12 +676,12 @@ def BuildExDataBase(Dict):
|
||||
UnInitValueBoolean = Dict['UNINIT_GUID_DECL_BOOLEAN']
|
||||
DbUnInitValueBoolean = DbItemList(1, RawDataList = UnInitValueBoolean)
|
||||
PcdTokenNumberMap = Dict['PCD_ORDER_TOKEN_NUMBER_MAP']
|
||||
|
||||
|
||||
DbNameTotle = ["SkuidValue", "InitValueUint64", "VardefValueUint64", "InitValueUint32", "VardefValueUint32", "VpdHeadValue", "ExMapTable",
|
||||
"LocalTokenNumberTable", "GuidTable", "StringHeadValue", "PcdNameOffsetTable", "VariableTable", "StringTableLen", "PcdTokenTable", "PcdCNameTable",
|
||||
"SizeTableValue", "InitValueUint16", "VardefValueUint16", "InitValueUint8", "VardefValueUint8", "InitValueBoolean",
|
||||
"VardefValueBoolean", "UnInitValueUint64", "UnInitValueUint32", "UnInitValueUint16", "UnInitValueUint8", "UnInitValueBoolean"]
|
||||
|
||||
|
||||
DbTotal = [SkuidValue, InitValueUint64, VardefValueUint64, InitValueUint32, VardefValueUint32, VpdHeadValue, ExMapTable,
|
||||
LocalTokenNumberTable, GuidTable, StringHeadValue, PcdNameOffsetTable, VariableTable, StringTableLen, PcdTokenTable, PcdCNameTable,
|
||||
SizeTableValue, InitValueUint16, VardefValueUint16, InitValueUint8, VardefValueUint8, InitValueBoolean,
|
||||
@@ -690,21 +690,21 @@ def BuildExDataBase(Dict):
|
||||
DbLocalTokenNumberTable, DbGuidTable, DbStringHeadValue, DbPcdNameOffsetTable, DbVariableTable, DbStringTableLen, DbPcdTokenTable, DbPcdCNameTable,
|
||||
DbSizeTableValue, DbInitValueUint16, DbVardefValueUint16, DbInitValueUint8, DbVardefValueUint8, DbInitValueBoolean,
|
||||
DbVardefValueBoolean, DbUnInitValueUint64, DbUnInitValueUint32, DbUnInitValueUint16, DbUnInitValueUint8, DbUnInitValueBoolean]
|
||||
|
||||
|
||||
# VardefValueBoolean is the last table in the init table items
|
||||
InitTableNum = DbNameTotle.index("VardefValueBoolean") + 1
|
||||
# The FixedHeader length of the PCD_DATABASE_INIT, from Signature to Pad
|
||||
FixedHeaderLen = 80
|
||||
|
||||
# Get offset of SkuId table in the database
|
||||
# Get offset of SkuId table in the database
|
||||
SkuIdTableOffset = FixedHeaderLen
|
||||
for DbIndex in xrange(len(DbTotal)):
|
||||
if DbTotal[DbIndex] is SkuidValue:
|
||||
break
|
||||
SkuIdTableOffset += DbItemTotal[DbIndex].GetListSize()
|
||||
|
||||
|
||||
# Get offset of SkuValue table in the database
|
||||
|
||||
|
||||
# Get offset of SkuValue table in the database
|
||||
|
||||
# Fix up the LocalTokenNumberTable, SkuHeader table
|
||||
for (LocalTokenNumberTableIndex, (Offset, Table)) in enumerate(LocalTokenNumberTable):
|
||||
@@ -725,11 +725,11 @@ def BuildExDataBase(Dict):
|
||||
TokenTypeValue = GetTokenTypeValue(TokenTypeValue)
|
||||
LocalTokenNumberTable[LocalTokenNumberTableIndex] = DbOffset|int(TokenTypeValue)
|
||||
# if PCD_TYPE_SKU_ENABLED, then we need to fix up the SkuTable
|
||||
|
||||
|
||||
|
||||
|
||||
# resolve variable table offset
|
||||
|
||||
|
||||
|
||||
# resolve variable table offset
|
||||
for VariableEntries in VariableTable:
|
||||
skuindex = 0
|
||||
for VariableEntryPerSku in VariableEntries:
|
||||
@@ -747,7 +747,7 @@ def BuildExDataBase(Dict):
|
||||
else:
|
||||
assert(False)
|
||||
if isinstance(VariableRefTable[0], list):
|
||||
DbOffset += skuindex * 4
|
||||
DbOffset += skuindex * 4
|
||||
skuindex += 1
|
||||
if DbIndex >= InitTableNum:
|
||||
assert(False)
|
||||
@@ -775,17 +775,17 @@ def BuildExDataBase(Dict):
|
||||
|
||||
DbTotalLength += DbItemTotal[DbIndex].GetListSize()
|
||||
if not Dict['PCD_INFO_FLAG']:
|
||||
DbPcdNameOffset = 0
|
||||
DbPcdNameOffset = 0
|
||||
LocalTokenCount = GetIntegerValue(Dict['LOCAL_TOKEN_NUMBER'])
|
||||
ExTokenCount = GetIntegerValue(Dict['EX_TOKEN_NUMBER'])
|
||||
GuidTableCount = GetIntegerValue(Dict['GUID_TABLE_SIZE'])
|
||||
SystemSkuId = GetIntegerValue(Dict['SYSTEM_SKU_ID_VALUE'])
|
||||
Pad = 0xDA
|
||||
|
||||
|
||||
UninitDataBaseSize = 0
|
||||
for Item in (DbUnInitValueUint64, DbUnInitValueUint32, DbUnInitValueUint16, DbUnInitValueUint8, DbUnInitValueBoolean):
|
||||
UninitDataBaseSize += Item.GetListSize()
|
||||
|
||||
|
||||
if (DbTotalLength - UninitDataBaseSize) % 8:
|
||||
DbTotalLength += (8 - (DbTotalLength - UninitDataBaseSize) % 8)
|
||||
# Construct the database buffer
|
||||
@@ -812,7 +812,7 @@ def BuildExDataBase(Dict):
|
||||
|
||||
Buffer += b
|
||||
b = pack('=L', ExMapTableOffset)
|
||||
|
||||
|
||||
Buffer += b
|
||||
b = pack('=L', GuidTableOffset)
|
||||
|
||||
@@ -836,7 +836,7 @@ def BuildExDataBase(Dict):
|
||||
|
||||
Buffer += b
|
||||
b = pack('=H', GuidTableCount)
|
||||
|
||||
|
||||
Buffer += b
|
||||
b = pack('=B', Pad)
|
||||
Buffer += b
|
||||
@@ -845,18 +845,18 @@ def BuildExDataBase(Dict):
|
||||
Buffer += b
|
||||
Buffer += b
|
||||
Buffer += b
|
||||
|
||||
|
||||
Index = 0
|
||||
for Item in DbItemTotal:
|
||||
Index +=1
|
||||
b = Item.PackData()
|
||||
Buffer += b
|
||||
Buffer += b
|
||||
if Index == InitTableNum:
|
||||
if len(Buffer) % 8:
|
||||
for num in range(8 - len(Buffer) % 8):
|
||||
b = pack('=B', Pad)
|
||||
Buffer += b
|
||||
break
|
||||
break
|
||||
return Buffer
|
||||
|
||||
## Create code for PCD database
|
||||
@@ -1010,7 +1010,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
'SYSTEM_SKU_ID' : ' SKU_ID SystemSkuId;',
|
||||
'SYSTEM_SKU_ID_VALUE' : '0U'
|
||||
}
|
||||
|
||||
|
||||
SkuObj = Platform.Platform.SkuIdMgr
|
||||
Dict['SYSTEM_SKU_ID_VALUE'] = 0 if SkuObj.SkuUsageType == SkuObj.SINGLE else Platform.Platform.SkuIds[SkuObj.SystemSkuId][0]
|
||||
|
||||
@@ -1028,7 +1028,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
Dict[Init+'_NUMSKUS_DECL_' + DatumType] = []
|
||||
Dict[Init+'_VALUE_' + DatumType] = []
|
||||
Dict[Init+'_DB_VALUE_'+DatumType] = []
|
||||
|
||||
|
||||
for Type in ['STRING_HEAD', 'VPD_HEAD', 'VARIABLE_HEAD']:
|
||||
Dict[Type + '_CNAME_DECL'] = []
|
||||
Dict[Type + '_GUID_DECL'] = []
|
||||
@@ -1038,7 +1038,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
Dict['STRING_DB_VALUE'] = []
|
||||
Dict['VPD_DB_VALUE'] = []
|
||||
Dict['VARIABLE_DB_VALUE'] = []
|
||||
|
||||
|
||||
Dict['STRING_TABLE_INDEX'] = []
|
||||
Dict['STRING_TABLE_LENGTH'] = []
|
||||
Dict['STRING_TABLE_CNAME'] = []
|
||||
@@ -1061,19 +1061,19 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
|
||||
Dict['LOCAL_TOKEN_NUMBER_DB_VALUE'] = []
|
||||
Dict['VARIABLE_DB_VALUE'] = []
|
||||
|
||||
|
||||
Dict['PCD_TOKENSPACE'] = []
|
||||
Dict['PCD_CNAME'] = []
|
||||
Dict['PCD_CNAME'] = []
|
||||
Dict['PCD_TOKENSPACE_LENGTH'] = []
|
||||
Dict['PCD_CNAME_LENGTH'] = []
|
||||
Dict['PCD_TOKENSPACE_OFFSET'] = []
|
||||
Dict['PCD_CNAME_OFFSET'] = []
|
||||
Dict['PCD_TOKENSPACE_MAP'] = []
|
||||
Dict['PCD_NAME_OFFSET'] = []
|
||||
|
||||
|
||||
Dict['PCD_ORDER_TOKEN_NUMBER_MAP'] = {}
|
||||
PCD_STRING_INDEX_MAP = {}
|
||||
|
||||
|
||||
StringTableIndex = 0
|
||||
StringTableSize = 0
|
||||
NumberOfLocalTokens = 0
|
||||
@@ -1141,8 +1141,8 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
|
||||
if len(Pcd.SkuInfoList) > 1:
|
||||
NumberOfSkuEnabledPcd += 1
|
||||
|
||||
SkuIdIndex = 1
|
||||
|
||||
SkuIdIndex = 1
|
||||
VariableHeadList = []
|
||||
for SkuName in Pcd.SkuInfoList:
|
||||
Sku = Pcd.SkuInfoList[SkuName]
|
||||
@@ -1150,9 +1150,9 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
if SkuId is None or SkuId == '':
|
||||
continue
|
||||
|
||||
|
||||
|
||||
SkuIdIndex += 1
|
||||
|
||||
|
||||
if len(Sku.VariableName) > 0:
|
||||
VariableGuidStructure = Sku.VariableGuidValue
|
||||
VariableGuid = GuidStructureStringToGuidValueName(VariableGuidStructure)
|
||||
@@ -1203,7 +1203,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
for Index in range(Dict['STRING_TABLE_VALUE'].index(VariableNameStructure)):
|
||||
VariableHeadStringIndex += Dict['STRING_TABLE_LENGTH'][Index]
|
||||
VariableHeadList.append(VariableHeadStringIndex)
|
||||
|
||||
|
||||
VariableHeadStringIndex = VariableHeadList[SkuIdIndex - 2]
|
||||
# store VariableGuid to GuidTable and get the VariableHeadGuidIndex
|
||||
|
||||
@@ -1214,11 +1214,11 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
|
||||
if "PCD_TYPE_STRING" in Pcd.TokenTypeList:
|
||||
VariableHeadValueList.append('%dU, offsetof(%s_PCD_DATABASE, Init.%s_%s), %dU, %sU' %
|
||||
(VariableHeadStringIndex, Phase, CName, TokenSpaceGuid,
|
||||
(VariableHeadStringIndex, Phase, CName, TokenSpaceGuid,
|
||||
VariableHeadGuidIndex, Sku.VariableOffset))
|
||||
else:
|
||||
VariableHeadValueList.append('%dU, offsetof(%s_PCD_DATABASE, Init.%s_%s_VariableDefault_%s), %dU, %sU' %
|
||||
(VariableHeadStringIndex, Phase, CName, TokenSpaceGuid, SkuIdIndex,
|
||||
(VariableHeadStringIndex, Phase, CName, TokenSpaceGuid, SkuIdIndex,
|
||||
VariableHeadGuidIndex, Sku.VariableOffset))
|
||||
Dict['VARDEF_CNAME_'+Pcd.DatumType].append(CName)
|
||||
Dict['VARDEF_GUID_'+Pcd.DatumType].append(TokenSpaceGuid)
|
||||
@@ -1231,7 +1231,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
# warning under linux building environment.
|
||||
#
|
||||
Dict['VARDEF_DB_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue)
|
||||
|
||||
|
||||
if Pcd.DatumType == TAB_UINT64:
|
||||
Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue + "ULL")
|
||||
elif Pcd.DatumType in (TAB_UINT32, TAB_UINT16, TAB_UINT8):
|
||||
@@ -1264,13 +1264,13 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
Pcd.InitString = 'INIT'
|
||||
VpdHeadOffsetList.append(str(Sku.VpdOffset) + 'U')
|
||||
VpdDbOffsetList.append(Sku.VpdOffset)
|
||||
# Also add the VOID* string of VPD PCD to SizeTable
|
||||
# Also add the VOID* string of VPD PCD to SizeTable
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
NumberOfSizeItems += 1
|
||||
# For VPD type of PCD, its current size is equal to its MAX size.
|
||||
VoidStarTypeCurrSize = [str(Pcd.MaxDatumSize) + 'U']
|
||||
VoidStarTypeCurrSize = [str(Pcd.MaxDatumSize) + 'U']
|
||||
continue
|
||||
|
||||
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
Pcd.TokenTypeList.append('PCD_TYPE_STRING')
|
||||
Pcd.InitString = 'INIT'
|
||||
@@ -1297,7 +1297,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
DefaultValueBinStructure = StringToArray(Sku.DefaultValue)
|
||||
Size = len(Sku.DefaultValue.split(","))
|
||||
Dict['STRING_TABLE_VALUE'].append(DefaultValueBinStructure)
|
||||
|
||||
|
||||
StringHeadOffsetList.append(str(StringTableSize) + 'U')
|
||||
StringDbOffsetList.append(StringTableSize)
|
||||
if Pcd.MaxDatumSize != '':
|
||||
@@ -1336,10 +1336,10 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
ValueList.append(Sku.DefaultValue + "U")
|
||||
elif Pcd.DatumType == "BOOLEAN":
|
||||
if Sku.DefaultValue in ["1", "0"]:
|
||||
ValueList.append(Sku.DefaultValue + "U")
|
||||
ValueList.append(Sku.DefaultValue + "U")
|
||||
else:
|
||||
ValueList.append(Sku.DefaultValue)
|
||||
|
||||
|
||||
DbValueList.append(Sku.DefaultValue)
|
||||
|
||||
Pcd.TokenTypeList = list(set(Pcd.TokenTypeList))
|
||||
@@ -1348,8 +1348,8 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
Dict['SIZE_TABLE_GUID'].append(TokenSpaceGuid)
|
||||
Dict['SIZE_TABLE_MAXIMUM_LENGTH'].append(str(Pcd.MaxDatumSize) + 'U')
|
||||
Dict['SIZE_TABLE_CURRENT_LENGTH'].append(VoidStarTypeCurrSize)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if 'PCD_TYPE_HII' in Pcd.TokenTypeList:
|
||||
Dict['VARIABLE_HEAD_CNAME_DECL'].append(CName)
|
||||
@@ -1382,7 +1382,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
else:
|
||||
Dict[Pcd.InitString+'_VALUE_'+Pcd.DatumType].append(', '.join(ValueList))
|
||||
Dict[Pcd.InitString+'_DB_VALUE_'+Pcd.DatumType].append(DbValueList)
|
||||
|
||||
|
||||
if Phase == 'PEI':
|
||||
NumberOfLocalTokens = NumberOfPeiLocalTokens
|
||||
if Phase == 'DXE':
|
||||
@@ -1394,7 +1394,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
Dict['TOKEN_TYPE'] = ['' for x in range(NumberOfLocalTokens)]
|
||||
Dict['LOCAL_TOKEN_NUMBER_DB_VALUE'] = ['' for x in range(NumberOfLocalTokens)]
|
||||
Dict['PCD_CNAME'] = ['' for x in range(NumberOfLocalTokens)]
|
||||
Dict['PCD_TOKENSPACE_MAP'] = ['' for x in range(NumberOfLocalTokens)]
|
||||
Dict['PCD_TOKENSPACE_MAP'] = ['' for x in range(NumberOfLocalTokens)]
|
||||
Dict['PCD_CNAME_LENGTH'] = [0 for x in range(NumberOfLocalTokens)]
|
||||
SkuEnablePcdIndex = 0
|
||||
for Pcd in ReorderedDynPcdList:
|
||||
@@ -1419,7 +1419,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
EdkLogger.debug(EdkLogger.DEBUG_1, "PCD = %s.%s" % (CName, TokenSpaceGuidCName))
|
||||
EdkLogger.debug(EdkLogger.DEBUG_1, "phase = %s" % Phase)
|
||||
EdkLogger.debug(EdkLogger.DEBUG_1, "GeneratedTokenNumber = %s" % str(GeneratedTokenNumber))
|
||||
|
||||
|
||||
#
|
||||
# following four Dict items hold the information for LocalTokenNumberTable
|
||||
#
|
||||
@@ -1430,7 +1430,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
Dict['TOKEN_CNAME'][GeneratedTokenNumber] = CName
|
||||
Dict['TOKEN_GUID'][GeneratedTokenNumber] = TokenSpaceGuid
|
||||
Dict['TOKEN_TYPE'][GeneratedTokenNumber] = ' | '.join(Pcd.TokenTypeList)
|
||||
|
||||
|
||||
if Platform.Platform.PcdInfoFlag:
|
||||
TokenSpaceGuidCNameArray = StringToArray('"' + TokenSpaceGuidCName + '"' )
|
||||
if TokenSpaceGuidCNameArray not in Dict['PCD_TOKENSPACE']:
|
||||
@@ -1439,10 +1439,10 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
Dict['PCD_TOKENSPACE_MAP'][GeneratedTokenNumber] = Dict['PCD_TOKENSPACE'].index(TokenSpaceGuidCNameArray)
|
||||
CNameBinArray = StringToArray('"' + CName + '"' )
|
||||
Dict['PCD_CNAME'][GeneratedTokenNumber] = CNameBinArray
|
||||
|
||||
|
||||
Dict['PCD_CNAME_LENGTH'][GeneratedTokenNumber] = len(CNameBinArray.split(","))
|
||||
|
||||
|
||||
|
||||
|
||||
Pcd.TokenTypeList = list(set(Pcd.TokenTypeList))
|
||||
|
||||
# search the Offset and Table, used by LocalTokenNumberTableOffset
|
||||
@@ -1468,7 +1468,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
if Pcd.InitString == 'UNINIT':
|
||||
Table = Dict[Pcd.InitString+'_GUID_DECL_'+Pcd.DatumType]
|
||||
else:
|
||||
Table = Dict[Pcd.InitString+'_DB_VALUE_'+Pcd.DatumType]
|
||||
Table = Dict[Pcd.InitString+'_DB_VALUE_'+Pcd.DatumType]
|
||||
Dict['LOCAL_TOKEN_NUMBER_DB_VALUE'][GeneratedTokenNumber] = (Offset, Table)
|
||||
|
||||
#
|
||||
@@ -1478,10 +1478,10 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
Dict['VARDEF_HEADER'][GeneratedTokenNumber] = '_Variable_Header'
|
||||
else:
|
||||
Dict['VARDEF_HEADER'][GeneratedTokenNumber] = ''
|
||||
|
||||
|
||||
|
||||
|
||||
if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
|
||||
|
||||
|
||||
if Phase == 'DXE':
|
||||
GeneratedTokenNumber += NumberOfPeiLocalTokens
|
||||
#
|
||||
@@ -1493,7 +1493,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
# Therefore, 1 is added to GeneratedTokenNumber to generate a PCD Token Number before being inserted
|
||||
# to the EXMAPPING_TABLE.
|
||||
#
|
||||
|
||||
|
||||
|
||||
Dict['EXMAPPING_TABLE_EXTOKEN'].append(str(Pcd.TokenValue) + 'U')
|
||||
Dict['EXMAPPING_TABLE_LOCAL_TOKEN'].append(str(GeneratedTokenNumber + 1) + 'U')
|
||||
@@ -1504,12 +1504,12 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
TokenSpaceIndex = StringTableSize
|
||||
for i in range(Dict['PCD_TOKENSPACE_MAP'][index]):
|
||||
TokenSpaceIndex += Dict['PCD_TOKENSPACE_LENGTH'][i]
|
||||
Dict['PCD_TOKENSPACE_OFFSET'].append(TokenSpaceIndex)
|
||||
Dict['PCD_TOKENSPACE_OFFSET'].append(TokenSpaceIndex)
|
||||
for index in range(len(Dict['PCD_TOKENSPACE'])):
|
||||
StringTableSize += Dict['PCD_TOKENSPACE_LENGTH'][index]
|
||||
StringTableIndex += 1
|
||||
for index in range(len(Dict['PCD_CNAME'])):
|
||||
Dict['PCD_CNAME_OFFSET'].append(StringTableSize)
|
||||
Dict['PCD_CNAME_OFFSET'].append(StringTableSize)
|
||||
Dict['PCD_NAME_OFFSET'].append(Dict['PCD_TOKENSPACE_OFFSET'][index])
|
||||
Dict['PCD_NAME_OFFSET'].append(StringTableSize)
|
||||
StringTableSize += Dict['PCD_CNAME_LENGTH'][index]
|
||||
@@ -1552,15 +1552,15 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
|
||||
if NumberOfSizeItems != 0:
|
||||
Dict['SIZE_TABLE_SIZE'] = str(NumberOfSizeItems * 2) + 'U'
|
||||
|
||||
if NumberOfSkuEnabledPcd != 0:
|
||||
|
||||
if NumberOfSkuEnabledPcd != 0:
|
||||
Dict['SKU_HEAD_SIZE'] = str(NumberOfSkuEnabledPcd) + 'U'
|
||||
|
||||
|
||||
for AvailableSkuNumber in SkuObj.SkuIdNumberSet:
|
||||
if AvailableSkuNumber not in Dict['SKUID_VALUE']:
|
||||
Dict['SKUID_VALUE'].append(AvailableSkuNumber)
|
||||
Dict['SKUID_VALUE'][0] = len(Dict['SKUID_VALUE']) - 1
|
||||
|
||||
|
||||
AutoGenH.Append(gPcdDatabaseAutoGenH.Replace(Dict))
|
||||
if NumberOfLocalTokens == 0:
|
||||
AutoGenC.Append(gEmptyPcdDatabaseAutoGenC.Replace(Dict))
|
||||
@@ -1573,11 +1573,11 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
SizeCurLenTempList = []
|
||||
SizeMaxLenTempList = []
|
||||
ReOrderFlag = True
|
||||
|
||||
|
||||
if len(Dict['SIZE_TABLE_CNAME']) == 1:
|
||||
if not (Dict['SIZE_TABLE_CNAME'][0] and Dict['SIZE_TABLE_GUID'][0]):
|
||||
ReOrderFlag = False
|
||||
|
||||
|
||||
if ReOrderFlag:
|
||||
for Count in range(len(Dict['TOKEN_CNAME'])):
|
||||
for Count1 in range(len(Dict['SIZE_TABLE_CNAME'])):
|
||||
@@ -1587,15 +1587,15 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||
SizeGuidTempList.append(Dict['SIZE_TABLE_GUID'][Count1])
|
||||
SizeCurLenTempList.append(Dict['SIZE_TABLE_CURRENT_LENGTH'][Count1])
|
||||
SizeMaxLenTempList.append(Dict['SIZE_TABLE_MAXIMUM_LENGTH'][Count1])
|
||||
|
||||
|
||||
for Count in range(len(Dict['SIZE_TABLE_CNAME'])):
|
||||
Dict['SIZE_TABLE_CNAME'][Count] = SizeCNameTempList[Count]
|
||||
Dict['SIZE_TABLE_GUID'][Count] = SizeGuidTempList[Count]
|
||||
Dict['SIZE_TABLE_CURRENT_LENGTH'][Count] = SizeCurLenTempList[Count]
|
||||
Dict['SIZE_TABLE_MAXIMUM_LENGTH'][Count] = SizeMaxLenTempList[Count]
|
||||
|
||||
|
||||
AutoGenC.Append(gPcdDatabaseAutoGenC.Replace(Dict))
|
||||
|
||||
|
||||
|
||||
# print Phase
|
||||
Buffer = BuildExDataBase(Dict)
|
||||
|
@@ -17,14 +17,14 @@
|
||||
import Common.EdkLogger as EdkLogger
|
||||
from Common.BuildToolError import *
|
||||
from Common.DataType import *
|
||||
|
||||
|
||||
|
||||
class InfSectionParser():
|
||||
def __init__(self, FilePath):
|
||||
self._FilePath = FilePath
|
||||
self._FileSectionDataList = []
|
||||
self._ParserInf()
|
||||
|
||||
|
||||
def _ParserInf(self):
|
||||
FileLinesList = []
|
||||
UserExtFind = False
|
||||
@@ -32,12 +32,12 @@ class InfSectionParser():
|
||||
FileLastLine = False
|
||||
SectionLine = ''
|
||||
SectionData = []
|
||||
|
||||
|
||||
try:
|
||||
FileLinesList = open(self._FilePath, "r", 0).readlines()
|
||||
except BaseException:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR, 'File %s is opened failed.' % self._FilePath)
|
||||
|
||||
|
||||
for Index in range(0, len(FileLinesList)):
|
||||
line = str(FileLinesList[Index]).strip()
|
||||
if Index + 1 == len(FileLinesList):
|
||||
@@ -52,7 +52,7 @@ class InfSectionParser():
|
||||
SectionLine = line
|
||||
UserExtFind = True
|
||||
FindEnd = False
|
||||
|
||||
|
||||
if (NextLine != '' and NextLine[0] == TAB_SECTION_START and \
|
||||
NextLine[-1] == TAB_SECTION_END) or FileLastLine:
|
||||
UserExtFind = False
|
||||
@@ -60,7 +60,7 @@ class InfSectionParser():
|
||||
self._FileSectionDataList.append({SectionLine: SectionData[:]})
|
||||
del SectionData[:]
|
||||
SectionLine = ''
|
||||
|
||||
|
||||
# Get user extension TianoCore data
|
||||
#
|
||||
# @return: a list include some dictionary that key is section and value is a list contain all data.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
## @file
|
||||
# This file is used to parse a strings file and create or add to a string database
|
||||
# This file is used to parse a strings file and create or add to a string database
|
||||
# file.
|
||||
#
|
||||
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
@@ -144,7 +144,7 @@ def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):
|
||||
Str = WriteLine(Str, Line)
|
||||
UnusedStr = ''
|
||||
|
||||
#Group the referred/Unused STRING token together.
|
||||
#Group the referred/Unused STRING token together.
|
||||
for Index in range(2, len(UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[0][0]])):
|
||||
StringItem = UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[0][0]][Index]
|
||||
Name = StringItem.StringName
|
||||
@@ -265,16 +265,16 @@ def GetFilteredLanguage(UniLanguageList, LanguageFilterList):
|
||||
PrimaryTag = Language[0:Language.find('-')].lower()
|
||||
else:
|
||||
PrimaryTag = Language
|
||||
|
||||
|
||||
if len(PrimaryTag) == 3:
|
||||
PrimaryTag = LangConvTable.get(PrimaryTag)
|
||||
|
||||
|
||||
for UniLanguage in UniLanguageList:
|
||||
if UniLanguage.find('-') != -1:
|
||||
UniLanguagePrimaryTag = UniLanguage[0:UniLanguage.find('-')].lower()
|
||||
else:
|
||||
UniLanguagePrimaryTag = UniLanguage
|
||||
|
||||
|
||||
if len(UniLanguagePrimaryTag) == 3:
|
||||
UniLanguagePrimaryTag = LangConvTable.get(UniLanguagePrimaryTag)
|
||||
|
||||
@@ -307,7 +307,7 @@ def GetFilteredLanguage(UniLanguageList, LanguageFilterList):
|
||||
# @param UniObjectClass A UniObjectClass instance
|
||||
# @param IsCompatibleMode Compatible mode
|
||||
# @param UniBinBuffer UniBinBuffer to contain UniBinary data.
|
||||
# @param FilterInfo Platform language filter information
|
||||
# @param FilterInfo Platform language filter information
|
||||
#
|
||||
# @retval Str: A string of .c file content
|
||||
#
|
||||
@@ -325,14 +325,14 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer,
|
||||
else:
|
||||
# EDK module is using ISO639-2 format filter, convert to the RFC4646 format
|
||||
LanguageFilterList = [LangConvTable.get(F.lower()) for F in FilterInfo[1]]
|
||||
|
||||
|
||||
UniLanguageList = []
|
||||
for IndexI in range(len(UniObjectClass.LanguageDef)):
|
||||
UniLanguageList += [UniObjectClass.LanguageDef[IndexI][0]]
|
||||
|
||||
UniLanguageListFiltered = GetFilteredLanguage(UniLanguageList, LanguageFilterList)
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Create lines for each language's strings
|
||||
#
|
||||
@@ -340,7 +340,7 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer,
|
||||
Language = UniObjectClass.LanguageDef[IndexI][0]
|
||||
if Language not in UniLanguageListFiltered:
|
||||
continue
|
||||
|
||||
|
||||
StringBuffer = BytesIO()
|
||||
StrStringValue = ''
|
||||
ArrayLength = 0
|
||||
@@ -403,7 +403,7 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer,
|
||||
# Add an EFI_HII_SIBT_END at last
|
||||
#
|
||||
Str = WriteLine(Str, ' ' + EFI_HII_SIBT_END + ",")
|
||||
|
||||
|
||||
#
|
||||
# Create binary UNI string
|
||||
#
|
||||
@@ -458,7 +458,7 @@ def CreateCFileEnd():
|
||||
# @param BaseName: The basename of strings
|
||||
# @param UniObjectClass A UniObjectClass instance
|
||||
# @param IsCompatibleMode Compatible Mode
|
||||
# @param FilterInfo Platform language filter information
|
||||
# @param FilterInfo Platform language filter information
|
||||
#
|
||||
# @retval CFile: A string of complete .c file
|
||||
#
|
||||
@@ -544,7 +544,7 @@ def SearchString(UniObjectClass, FileList, IsCompatibleMode):
|
||||
# This function is used for UEFI2.1 spec
|
||||
#
|
||||
#
|
||||
def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None, FilterInfo = [True, []]):
|
||||
def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None, FilterInfo = [True, []]):
|
||||
if len(UniFilList) > 0:
|
||||
if ShellMode:
|
||||
#
|
||||
|
@@ -284,7 +284,7 @@ class UniFileClassObject(object):
|
||||
if not IsLangInDef:
|
||||
#
|
||||
# The found STRING tokens will be added into new language string list
|
||||
# so that the unique STRING identifier is reserved for all languages in the package list.
|
||||
# so that the unique STRING identifier is reserved for all languages in the package list.
|
||||
#
|
||||
FirstLangName = self.LanguageDef[0][0]
|
||||
if LangName != FirstLangName:
|
||||
@@ -411,10 +411,10 @@ class UniFileClassObject(object):
|
||||
#
|
||||
# Ignore empty line
|
||||
#
|
||||
if len(Line) == 0:
|
||||
continue
|
||||
|
||||
|
||||
if len(Line) == 0:
|
||||
continue
|
||||
|
||||
|
||||
Line = Line.replace(u'/langdef', u'#langdef')
|
||||
Line = Line.replace(u'/string', u'#string')
|
||||
Line = Line.replace(u'/language', u'#language')
|
||||
@@ -429,8 +429,8 @@ class UniFileClassObject(object):
|
||||
Line = Line.replace(u'\\r', CR)
|
||||
Line = Line.replace(u'\\t', u' ')
|
||||
Line = Line.replace(u'\t', u' ')
|
||||
Line = Line.replace(u'\\"', u'"')
|
||||
Line = Line.replace(u"\\'", u"'")
|
||||
Line = Line.replace(u'\\"', u'"')
|
||||
Line = Line.replace(u"\\'", u"'")
|
||||
Line = Line.replace(BACK_SLASH_PLACEHOLDER, u'\\')
|
||||
|
||||
StartPos = Line.find(u'\\x')
|
||||
@@ -570,7 +570,7 @@ class UniFileClassObject(object):
|
||||
else:
|
||||
EdkLogger.error('Unicode File Parser', FORMAT_NOT_SUPPORTED, "The language '%s' for %s is not defined in Unicode file %s." \
|
||||
% (Language, Name, self.File))
|
||||
|
||||
|
||||
if Language not in self.OrderedStringList:
|
||||
self.OrderedStringList[Language] = []
|
||||
self.OrderedStringDict[Language] = {}
|
||||
@@ -592,7 +592,7 @@ class UniFileClassObject(object):
|
||||
for LangName in self.LanguageDef:
|
||||
#
|
||||
# New STRING token will be added into all language string lists.
|
||||
# so that the unique STRING identifier is reserved for all languages in the package list.
|
||||
# so that the unique STRING identifier is reserved for all languages in the package list.
|
||||
#
|
||||
if LangName[0] != Language:
|
||||
if UseOtherLangDef != '':
|
||||
|
@@ -24,7 +24,7 @@ from Common.DataType import *
|
||||
class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
|
||||
def __init__(self):
|
||||
self.var_check_info = []
|
||||
|
||||
|
||||
def push_back(self, var_check_tab):
|
||||
for tab in self.var_check_info:
|
||||
if tab.equal(var_check_tab):
|
||||
@@ -32,9 +32,9 @@ class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
|
||||
break
|
||||
else:
|
||||
self.var_check_info.append(var_check_tab)
|
||||
|
||||
|
||||
def dump(self, dest, Phase):
|
||||
|
||||
|
||||
if not os.path.isabs(dest):
|
||||
return
|
||||
if not os.path.exists(dest):
|
||||
@@ -161,7 +161,7 @@ class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
|
||||
b = pack("=B", var_check_tab.pad)
|
||||
Buffer += b
|
||||
realLength += 1
|
||||
|
||||
|
||||
DbFile = BytesIO()
|
||||
if Phase == 'DXE' and os.path.exists(BinFilePath):
|
||||
BinFile = open(BinFilePath, "rb")
|
||||
@@ -175,7 +175,7 @@ class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
|
||||
Buffer = BinBuffer + Buffer
|
||||
DbFile.write(Buffer)
|
||||
SaveFileOnChange(BinFilePath, DbFile.getvalue(), True)
|
||||
|
||||
|
||||
|
||||
class VAR_CHECK_PCD_VARIABLE_TAB(object):
|
||||
pad = 0xDA
|
||||
@@ -193,26 +193,26 @@ class VAR_CHECK_PCD_VARIABLE_TAB(object):
|
||||
def UpdateSize(self):
|
||||
self.HeaderLength = 32 + len(self.Name.split(","))
|
||||
self.Length = 32 + len(self.Name.split(",")) + self.GetValidTabLen()
|
||||
|
||||
|
||||
def GetValidTabLen(self):
|
||||
validtablen = 0
|
||||
for item in self.validtab:
|
||||
validtablen += item.Length
|
||||
return validtablen
|
||||
|
||||
validtablen += item.Length
|
||||
return validtablen
|
||||
|
||||
def SetAttributes(self, attributes):
|
||||
self.Attributes = attributes
|
||||
|
||||
|
||||
def push_back(self, valid_obj):
|
||||
if valid_obj is not None:
|
||||
self.validtab.append(valid_obj)
|
||||
|
||||
|
||||
def equal(self, varchecktab):
|
||||
if self.Guid == varchecktab.Guid and self.Name == varchecktab.Name:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def merge(self, varchecktab):
|
||||
for validobj in varchecktab.validtab:
|
||||
if validobj in self.validtab:
|
||||
@@ -235,10 +235,10 @@ class VAR_CHECK_PCD_VALID_OBJ(object):
|
||||
except:
|
||||
self.StorageWidth = 0
|
||||
self.ValidData = False
|
||||
|
||||
def __eq__(self, validObj):
|
||||
|
||||
def __eq__(self, validObj):
|
||||
return validObj and self.VarOffset == validObj.VarOffset
|
||||
|
||||
|
||||
class VAR_CHECK_PCD_VALID_LIST(VAR_CHECK_PCD_VALID_OBJ):
|
||||
def __init__(self, VarOffset, validlist, PcdDataType):
|
||||
super(VAR_CHECK_PCD_VALID_LIST, self).__init__(VarOffset, validlist, PcdDataType)
|
||||
@@ -246,7 +246,7 @@ class VAR_CHECK_PCD_VALID_LIST(VAR_CHECK_PCD_VALID_OBJ):
|
||||
valid_num_list = []
|
||||
for item in self.rawdata:
|
||||
valid_num_list.extend(item.split(','))
|
||||
|
||||
|
||||
for valid_num in valid_num_list:
|
||||
valid_num = valid_num.strip()
|
||||
|
||||
@@ -255,10 +255,10 @@ class VAR_CHECK_PCD_VALID_LIST(VAR_CHECK_PCD_VALID_OBJ):
|
||||
else:
|
||||
self.data.add(int(valid_num))
|
||||
|
||||
|
||||
|
||||
self.Length = 5 + len(self.data) * self.StorageWidth
|
||||
|
||||
|
||||
|
||||
|
||||
class VAR_CHECK_PCD_VALID_RANGE(VAR_CHECK_PCD_VALID_OBJ):
|
||||
def __init__(self, VarOffset, validrange, PcdDataType):
|
||||
super(VAR_CHECK_PCD_VALID_RANGE, self).__init__(VarOffset, validrange, PcdDataType)
|
||||
@@ -275,7 +275,7 @@ class VAR_CHECK_PCD_VALID_RANGE(VAR_CHECK_PCD_VALID_OBJ):
|
||||
for obj in rangelist.pop():
|
||||
self.data.add((obj.start, obj.end))
|
||||
self.Length = 5 + len(self.data) * 2 * self.StorageWidth
|
||||
|
||||
|
||||
|
||||
def GetValidationObject(PcdClass, VarOffset):
|
||||
if PcdClass.validateranges:
|
||||
|
Reference in New Issue
Block a user