Sync BaseTool trunk (version r2610) into EDKII BaseTools.
Signed-off-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14856 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Generate AutoGen.h, AutoGen.c and *.depex files
|
||||
#
|
||||
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -34,9 +34,12 @@ import Common.GlobalData as GlobalData
|
||||
from GenFds.FdfParser import *
|
||||
from CommonDataClass.CommonClass import SkuInfoClass
|
||||
from Workspace.BuildClassObject import *
|
||||
from GenPatchPcdTable.GenPatchPcdTable import parsePcdInfoFromMapFile
|
||||
import Common.VpdInfoFile as VpdInfoFile
|
||||
from GenPcdDb import CreatePcdDatabaseCode
|
||||
from Workspace.MetaFileCommentParser import UsageList
|
||||
|
||||
## Regular expression for splitting Dependency Expression stirng into tokens
|
||||
## Regular expression for splitting Dependency Expression string into tokens
|
||||
gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)")
|
||||
|
||||
## Mapping Makefile type
|
||||
@@ -59,13 +62,7 @@ gAutoGenDepexFileName = "%(module_name)s.depex"
|
||||
#
|
||||
# Template string to generic AsBuilt INF
|
||||
#
|
||||
gAsBuiltInfHeaderString = TemplateString("""## @file
|
||||
# ${module_name}
|
||||
#
|
||||
# DO NOT EDIT
|
||||
# FILE auto-generated Binary INF
|
||||
#
|
||||
##
|
||||
gAsBuiltInfHeaderString = TemplateString("""${header_comments}
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010016
|
||||
@@ -73,6 +70,7 @@ gAsBuiltInfHeaderString = TemplateString("""## @file
|
||||
FILE_GUID = ${module_guid}
|
||||
MODULE_TYPE = ${module_module_type}
|
||||
VERSION_STRING = ${module_version_string}${BEGIN}
|
||||
PCD_IS_DRIVER = ${pcd_is_driver_string}${END}${BEGIN}
|
||||
UEFI_SPECIFICATION_VERSION = ${module_uefi_specification_version}${END}${BEGIN}
|
||||
PI_SPECIFICATION_VERSION = ${module_pi_specification_version}${END}
|
||||
|
||||
@@ -82,8 +80,21 @@ gAsBuiltInfHeaderString = TemplateString("""## @file
|
||||
[Binaries.${module_arch}]${BEGIN}
|
||||
${binary_item}${END}
|
||||
|
||||
[PcdEx]${BEGIN}
|
||||
${pcd_item}${END}
|
||||
[PatchPcd.${module_arch}]${BEGIN}
|
||||
${patchablepcd_item}
|
||||
${END}
|
||||
[Protocols.${module_arch}]${BEGIN}
|
||||
${protocol_item}
|
||||
${END}
|
||||
[Ppis.${module_arch}]${BEGIN}
|
||||
${ppi_item}
|
||||
${END}
|
||||
[Guids.${module_arch}]${BEGIN}
|
||||
${guid_item}
|
||||
${END}
|
||||
[PcdEx.${module_arch}]${BEGIN}
|
||||
${pcd_item}
|
||||
${END}
|
||||
|
||||
## @AsBuilt${BEGIN}
|
||||
## ${flags_item}${END}
|
||||
@@ -228,15 +239,6 @@ class WorkspaceAutoGen(AutoGen):
|
||||
ExtraData="Build target [%s] is not supported by the platform. [Valid target: %s]"
|
||||
% (self.BuildTarget, " ".join(self.Platform.BuildTargets)))
|
||||
|
||||
# Validate SKU ID
|
||||
if not self.SkuId:
|
||||
self.SkuId = 'DEFAULT'
|
||||
|
||||
if self.SkuId not in self.Platform.SkuIds:
|
||||
EdkLogger.error("build", PARAMETER_INVALID,
|
||||
ExtraData="SKU-ID [%s] is not supported by the platform. [Valid SKU-ID: %s]"
|
||||
% (self.SkuId, " ".join(self.Platform.SkuIds.keys())))
|
||||
|
||||
# parse FDF file to get PCDs in it, if any
|
||||
if not self.FdfFile:
|
||||
self.FdfFile = self.Platform.FlashDefinition
|
||||
@@ -867,7 +869,7 @@ class PlatformAutoGen(AutoGen):
|
||||
|
||||
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:
|
||||
if PcdFromModule.DatumType == "VOID*" and PcdFromModule.MaxDatumSize in [None, '']:
|
||||
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, F))
|
||||
|
||||
if PcdFromModule.Type in GenC.gDynamicPcd or PcdFromModule.Type in GenC.gDynamicExPcd:
|
||||
@@ -938,31 +940,19 @@ class PlatformAutoGen(AutoGen):
|
||||
# Add VPD type PCD into VpdFile and determine whether the VPD PCD need to be fixed up.
|
||||
#
|
||||
for PcdKey in PlatformPcds:
|
||||
Pcd = self.Platform.Pcds[PcdKey]
|
||||
if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
|
||||
Pcd = VpdPcdDict[PcdKey]
|
||||
Sku = Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]]
|
||||
Sku.VpdOffset = Sku.VpdOffset.strip()
|
||||
#
|
||||
# Fix the optional data of VPD PCD.
|
||||
#
|
||||
if (Pcd.DatumType.strip() != "VOID*"):
|
||||
if Sku.DefaultValue == '':
|
||||
Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]].DefaultValue = Pcd.MaxDatumSize
|
||||
Pcd.MaxDatumSize = None
|
||||
else:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR, "PCD setting error",
|
||||
File=self.MetaFile,
|
||||
ExtraData="\n\tPCD: %s.%s format incorrect in DSC: %s\n\t\t\n"
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, self.Platform.MetaFile.Path))
|
||||
|
||||
VpdFile.Add(Pcd, Sku.VpdOffset)
|
||||
# if the offset of a VPD is *, then it need to be fixed up by third party tool.
|
||||
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
|
||||
NeedProcessVpdMapFile = True
|
||||
if self.Platform.VpdToolGuid == None or self.Platform.VpdToolGuid == '':
|
||||
EdkLogger.error("Build", FILE_NOT_FOUND, \
|
||||
"Fail to find third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.")
|
||||
Pcd = self.Platform.Pcds[PcdKey]
|
||||
if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD] and \
|
||||
PcdKey in VpdPcdDict:
|
||||
Pcd = VpdPcdDict[PcdKey]
|
||||
for (SkuName,Sku) in Pcd.SkuInfoList.items():
|
||||
Sku.VpdOffset = Sku.VpdOffset.strip()
|
||||
VpdFile.Add(Pcd, Sku.VpdOffset)
|
||||
# if the offset of a VPD is *, then it need to be fixed up by third party tool.
|
||||
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
|
||||
NeedProcessVpdMapFile = True
|
||||
if self.Platform.VpdToolGuid == None or self.Platform.VpdToolGuid == '':
|
||||
EdkLogger.error("Build", FILE_NOT_FOUND, \
|
||||
"Fail to find third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.")
|
||||
|
||||
|
||||
#
|
||||
@@ -983,32 +973,46 @@ class PlatformAutoGen(AutoGen):
|
||||
# Not found, it should be signature
|
||||
if not FoundFlag :
|
||||
# just pick the a value to determine whether is unicode string type
|
||||
Sku = DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]]
|
||||
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:
|
||||
DecPcdEntry = eachDec.Pcds[DecPcd]
|
||||
if (DecPcdEntry.TokenSpaceGuidCName == DscPcdEntry.TokenSpaceGuidCName) and \
|
||||
(DecPcdEntry.TokenCName == DscPcdEntry.TokenCName):
|
||||
# Print warning message to let the developer make a determine.
|
||||
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.DatumType = DecPcdEntry.DatumType
|
||||
DscPcdEntry.DefaultValue = DecPcdEntry.DefaultValue
|
||||
# Only fix the value while no value provided in DSC file.
|
||||
if (Sku.DefaultValue == "" or Sku.DefaultValue==None):
|
||||
DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]].DefaultValue = DecPcdEntry.DefaultValue
|
||||
|
||||
for (SkuName,Sku) in DscPcdEntry.SkuInfoList.items():
|
||||
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:
|
||||
DecPcdEntry = eachDec.Pcds[DecPcd]
|
||||
if (DecPcdEntry.TokenSpaceGuidCName == DscPcdEntry.TokenSpaceGuidCName) and \
|
||||
(DecPcdEntry.TokenCName == DscPcdEntry.TokenCName):
|
||||
# Print warning message to let the developer make a determine.
|
||||
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.DatumType = DecPcdEntry.DatumType
|
||||
DscPcdEntry.DefaultValue = DecPcdEntry.DefaultValue
|
||||
DscPcdEntry.TokenValue = DecPcdEntry.TokenValue
|
||||
DscPcdEntry.TokenSpaceGuidValue = eachDec.Guids[DecPcdEntry.TokenSpaceGuidCName]
|
||||
# Only fix the value while no value provided in DSC file.
|
||||
if (Sku.DefaultValue == "" or Sku.DefaultValue==None):
|
||||
DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]].DefaultValue = DecPcdEntry.DefaultValue
|
||||
|
||||
if DscPcdEntry not in self._DynamicPcdList:
|
||||
self._DynamicPcdList.append(DscPcdEntry)
|
||||
# Sku = DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]]
|
||||
Sku.VpdOffset = Sku.VpdOffset.strip()
|
||||
PcdValue = Sku.DefaultValue
|
||||
VpdFile.Add(DscPcdEntry, Sku.VpdOffset)
|
||||
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
|
||||
NeedProcessVpdMapFile = True
|
||||
if DscPcdEntry.DatumType == 'VOID*' and PcdValue.startswith("L"):
|
||||
UnicodePcdArray.append(DscPcdEntry)
|
||||
elif len(Sku.VariableName) > 0:
|
||||
HiiPcdArray.append(DscPcdEntry)
|
||||
else:
|
||||
OtherPcdArray.append(DscPcdEntry)
|
||||
|
||||
# if the offset of a VPD is *, then it need to be fixed up by third party tool.
|
||||
|
||||
VpdFile.Add(DscPcdEntry, Sku.VpdOffset)
|
||||
# if the offset of a VPD is *, then it need to be fixed up by third party tool.
|
||||
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
|
||||
NeedProcessVpdMapFile = True
|
||||
|
||||
|
||||
if (self.Platform.FlashDefinition == None or self.Platform.FlashDefinition == '') and \
|
||||
@@ -1055,9 +1059,11 @@ class PlatformAutoGen(AutoGen):
|
||||
# Fixup "*" offset
|
||||
for Pcd in self._DynamicPcdList:
|
||||
# just pick the a value to determine whether is unicode string type
|
||||
Sku = Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]]
|
||||
if Sku.VpdOffset == "*":
|
||||
Sku.VpdOffset = VpdFile.GetOffset(Pcd)[0].strip()
|
||||
i = 0
|
||||
for (SkuName,Sku) in Pcd.SkuInfoList.items():
|
||||
if Sku.VpdOffset == "*":
|
||||
Sku.VpdOffset = VpdFile.GetOffset(Pcd)[i].strip()
|
||||
i += 1
|
||||
else:
|
||||
EdkLogger.error("build", FILE_READ_FAILURE, "Can not find VPD map file %s to fix up VPD offset." % VpdMapFilePath)
|
||||
|
||||
@@ -1605,13 +1611,13 @@ class PlatformAutoGen(AutoGen):
|
||||
% (ToPcd.TokenSpaceGuidCName, ToPcd.TokenCName))
|
||||
Value = ToPcd.DefaultValue
|
||||
if Value in [None, '']:
|
||||
ToPcd.MaxDatumSize = 1
|
||||
ToPcd.MaxDatumSize = '1'
|
||||
elif Value[0] == 'L':
|
||||
ToPcd.MaxDatumSize = str(len(Value) * 2)
|
||||
ToPcd.MaxDatumSize = str((len(Value) - 2) * 2)
|
||||
elif Value[0] == '{':
|
||||
ToPcd.MaxDatumSize = str(len(Value.split(',')))
|
||||
else:
|
||||
ToPcd.MaxDatumSize = str(len(Value))
|
||||
ToPcd.MaxDatumSize = str(len(Value) - 1)
|
||||
|
||||
# apply default SKU for dynamic PCDS if specified one is not available
|
||||
if (ToPcd.Type in PCD_DYNAMIC_TYPE_LIST or ToPcd.Type in PCD_DYNAMIC_EX_TYPE_LIST) \
|
||||
@@ -2004,9 +2010,14 @@ class ModuleAutoGen(AutoGen):
|
||||
self._DerivedPackageList = None
|
||||
self._ModulePcdList = None
|
||||
self._LibraryPcdList = None
|
||||
self._PcdComments = sdict()
|
||||
self._GuidList = None
|
||||
self._GuidsUsedByPcd = None
|
||||
self._GuidComments = sdict()
|
||||
self._ProtocolList = None
|
||||
self._ProtocolComments = sdict()
|
||||
self._PpiList = None
|
||||
self._PpiComments = sdict()
|
||||
self._DepexList = None
|
||||
self._DepexExpressionList = None
|
||||
self._BuildOption = None
|
||||
@@ -2107,6 +2118,10 @@ class ModuleAutoGen(AutoGen):
|
||||
self._LibraryFlag = False
|
||||
return self._LibraryFlag
|
||||
|
||||
## Check if the module is binary module or not
|
||||
def _IsBinaryModule(self):
|
||||
return self.Module.IsBinaryModule
|
||||
|
||||
## Return the directory to store intermediate files of the module
|
||||
def _GetBuildDir(self):
|
||||
if self._BuildDir == None:
|
||||
@@ -2563,6 +2578,12 @@ class ModuleAutoGen(AutoGen):
|
||||
self._DependentLibraryList = self.PlatformInfo.ApplyLibraryInstance(self.Module)
|
||||
return self._DependentLibraryList
|
||||
|
||||
@staticmethod
|
||||
def UpdateComments(Recver, Src):
|
||||
for Key in Src:
|
||||
if Key not in Recver:
|
||||
Recver[Key] = []
|
||||
Recver[Key].extend(Src[Key])
|
||||
## Get the list of PCDs from current module
|
||||
#
|
||||
# @retval list The list of PCD
|
||||
@@ -2571,6 +2592,7 @@ class ModuleAutoGen(AutoGen):
|
||||
if self._ModulePcdList == None:
|
||||
# apply PCD settings from platform
|
||||
self._ModulePcdList = self.PlatformInfo.ApplyPcdSetting(self.Module, self.Module.Pcds)
|
||||
self.UpdateComments(self._PcdComments, self.Module.PcdComments)
|
||||
return self._ModulePcdList
|
||||
|
||||
## Get the list of PCDs from dependent libraries
|
||||
@@ -2583,6 +2605,7 @@ class ModuleAutoGen(AutoGen):
|
||||
if not self.IsLibrary:
|
||||
# get PCDs from dependent libraries
|
||||
for Library in self.DependentLibraryList:
|
||||
self.UpdateComments(self._PcdComments, Library.PcdComments)
|
||||
for Key in Library.Pcds:
|
||||
# skip duplicated PCDs
|
||||
if Key in self.Module.Pcds or Key in Pcds:
|
||||
@@ -2603,8 +2626,17 @@ class ModuleAutoGen(AutoGen):
|
||||
self._GuidList = self.Module.Guids
|
||||
for Library in self.DependentLibraryList:
|
||||
self._GuidList.update(Library.Guids)
|
||||
self.UpdateComments(self._GuidComments, Library.GuidComments)
|
||||
self.UpdateComments(self._GuidComments, self.Module.GuidComments)
|
||||
return self._GuidList
|
||||
|
||||
def GetGuidsUsedByPcd(self):
|
||||
if self._GuidsUsedByPcd == None:
|
||||
self._GuidsUsedByPcd = sdict()
|
||||
self._GuidsUsedByPcd.update(self.Module.GetGuidsUsedByPcd())
|
||||
for Library in self.DependentLibraryList:
|
||||
self._GuidsUsedByPcd.update(Library.GetGuidsUsedByPcd())
|
||||
return self._GuidsUsedByPcd
|
||||
## Get the protocol value mapping
|
||||
#
|
||||
# @retval dict The mapping between protocol cname and its value
|
||||
@@ -2614,6 +2646,8 @@ class ModuleAutoGen(AutoGen):
|
||||
self._ProtocolList = self.Module.Protocols
|
||||
for Library in self.DependentLibraryList:
|
||||
self._ProtocolList.update(Library.Protocols)
|
||||
self.UpdateComments(self._ProtocolComments, Library.ProtocolComments)
|
||||
self.UpdateComments(self._ProtocolComments, self.Module.ProtocolComments)
|
||||
return self._ProtocolList
|
||||
|
||||
## Get the PPI value mapping
|
||||
@@ -2625,6 +2659,8 @@ class ModuleAutoGen(AutoGen):
|
||||
self._PpiList = self.Module.Ppis
|
||||
for Library in self.DependentLibraryList:
|
||||
self._PpiList.update(Library.Ppis)
|
||||
self.UpdateComments(self._PpiComments, Library.PpiComments)
|
||||
self.UpdateComments(self._PpiComments, self.Module.PpiComments)
|
||||
return self._PpiList
|
||||
|
||||
## Get the list of include search path
|
||||
@@ -2681,38 +2717,74 @@ class ModuleAutoGen(AutoGen):
|
||||
|
||||
### TODO: How to handles mixed source and binary modules
|
||||
|
||||
# Find all DynamicEx PCDs used by this module and dependent libraries
|
||||
# Find all DynamicEx and PatchableInModule PCDs used by this module and dependent libraries
|
||||
# Also find all packages that the DynamicEx PCDs depend on
|
||||
Pcds = []
|
||||
PatchablePcds = {}
|
||||
Packages = []
|
||||
PcdCheckList = []
|
||||
PcdTokenSpaceList = []
|
||||
for Pcd in self.ModulePcdList + self.LibraryPcdList:
|
||||
if Pcd.Type in GenC.gDynamicExPcd:
|
||||
if Pcd not in Pcds:
|
||||
Pcds += [Pcd]
|
||||
for Package in self.DerivedPackageList:
|
||||
if Package not in Packages:
|
||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'DynamicEx') in Package.Pcds:
|
||||
Packages += [Package]
|
||||
elif (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'Dynamic') in Package.Pcds:
|
||||
Packages += [Package]
|
||||
if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
|
||||
PatchablePcds[Pcd.TokenCName] = Pcd
|
||||
PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'PatchableInModule'))
|
||||
elif Pcd.Type in GenC.gDynamicExPcd:
|
||||
if Pcd not in Pcds:
|
||||
Pcds += [Pcd]
|
||||
PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'DynamicEx'))
|
||||
PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'Dynamic'))
|
||||
PcdTokenSpaceList.append(Pcd.TokenSpaceGuidCName)
|
||||
GuidList = sdict()
|
||||
GuidList.update(self.GuidList)
|
||||
for TokenSpace in self.GetGuidsUsedByPcd():
|
||||
# If token space is not referred by patch PCD or Ex PCD, remove the GUID from GUID list
|
||||
# The GUIDs in GUIDs section should really be the GUIDs in source INF or referred by Ex an patch PCDs
|
||||
if TokenSpace not in PcdTokenSpaceList and TokenSpace in GuidList:
|
||||
GuidList.pop(TokenSpace)
|
||||
CheckList = (GuidList, self.PpiList, self.ProtocolList, PcdCheckList)
|
||||
for Package in self.DerivedPackageList:
|
||||
if Package in Packages:
|
||||
continue
|
||||
BeChecked = (Package.Guids, Package.Ppis, Package.Protocols, Package.Pcds)
|
||||
Found = False
|
||||
for Index in range(len(BeChecked)):
|
||||
for Item in CheckList[Index]:
|
||||
if Item in BeChecked[Index]:
|
||||
Packages += [Package]
|
||||
Found = True
|
||||
break
|
||||
if Found: break
|
||||
|
||||
ModuleType = self.ModuleType
|
||||
if ModuleType == 'UEFI_DRIVER' and self.DepexGenerated:
|
||||
ModuleType = 'DXE_DRIVER'
|
||||
ModuleType = 'DXE_DRIVER'
|
||||
|
||||
DriverType = ''
|
||||
if self.PcdIsDriver != '':
|
||||
DriverType = self.PcdIsDriver
|
||||
|
||||
AsBuiltInfDict = {
|
||||
'module_name' : self.Name,
|
||||
'module_guid' : self.Guid,
|
||||
'module_module_type' : ModuleType,
|
||||
'module_version_string' : self.Version,
|
||||
'pcd_is_driver_string' : [],
|
||||
'module_uefi_specification_version' : [],
|
||||
'module_pi_specification_version' : [],
|
||||
'module_arch' : self.Arch,
|
||||
'package_item' : ['%s' % (Package.MetaFile.File.replace('\\','/')) for Package in Packages],
|
||||
'binary_item' : [],
|
||||
'patchablepcd_item' : [],
|
||||
'pcd_item' : [],
|
||||
'flags_item' : []
|
||||
'protocol_item' : [],
|
||||
'ppi_item' : [],
|
||||
'guid_item' : [],
|
||||
'flags_item' : [],
|
||||
'libraryclasses_item' : []
|
||||
}
|
||||
AsBuiltInfDict['module_inf_version'] = '0x%08x' % self.AutoGenVersion
|
||||
if DriverType:
|
||||
AsBuiltInfDict['pcd_is_driver_string'] += [DriverType]
|
||||
|
||||
if 'UEFI_SPECIFICATION_VERSION' in self.Specification:
|
||||
AsBuiltInfDict['module_uefi_specification_version'] += [self.Specification['UEFI_SPECIFICATION_VERSION']]
|
||||
@@ -2744,9 +2816,125 @@ class ModuleAutoGen(AutoGen):
|
||||
if self.ModuleType in ['DXE_SMM_DRIVER']:
|
||||
AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + '.depex']
|
||||
|
||||
for Root, Dirs, Files in os.walk(OutputDir):
|
||||
for File in Files:
|
||||
if File.lower().endswith('.pdb'):
|
||||
AsBuiltInfDict['binary_item'] += ['DISPOSABLE|' + File]
|
||||
HeaderComments = self.Module.HeaderComments
|
||||
StartPos = 0
|
||||
for Index in range(len(HeaderComments)):
|
||||
if HeaderComments[Index].find('@BinaryHeader') != -1:
|
||||
HeaderComments[Index] = HeaderComments[Index].replace('@BinaryHeader', '@file')
|
||||
StartPos = Index
|
||||
break
|
||||
AsBuiltInfDict['header_comments'] = '\n'.join(HeaderComments[StartPos:]).replace(':#', '://')
|
||||
GenList = [
|
||||
(self.ProtocolList, self._ProtocolComments, 'protocol_item'),
|
||||
(self.PpiList, self._PpiComments, 'ppi_item'),
|
||||
(GuidList, self._GuidComments, 'guid_item')
|
||||
]
|
||||
for Item in GenList:
|
||||
for CName in Item[0]:
|
||||
Comments = ''
|
||||
if CName in Item[1]:
|
||||
Comments = '\n '.join(Item[1][CName])
|
||||
Entry = CName
|
||||
if Comments:
|
||||
Entry = Comments + '\n ' + CName
|
||||
AsBuiltInfDict[Item[2]].append(Entry)
|
||||
PatchList = parsePcdInfoFromMapFile(
|
||||
os.path.join(self.OutputDir, self.Name + '.map'),
|
||||
os.path.join(self.OutputDir, self.Name + '.efi')
|
||||
)
|
||||
if PatchList:
|
||||
for PatchPcd in PatchList:
|
||||
if PatchPcd[0] not in PatchablePcds:
|
||||
continue
|
||||
Pcd = PatchablePcds[PatchPcd[0]]
|
||||
PcdValue = ''
|
||||
if Pcd.DatumType != 'VOID*':
|
||||
HexFormat = '0x%02x'
|
||||
if Pcd.DatumType == 'UINT16':
|
||||
HexFormat = '0x%04x'
|
||||
elif Pcd.DatumType == 'UINT32':
|
||||
HexFormat = '0x%08x'
|
||||
elif Pcd.DatumType == 'UINT64':
|
||||
HexFormat = '0x%016x'
|
||||
PcdValue = HexFormat % int(Pcd.DefaultValue, 0)
|
||||
else:
|
||||
if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '':
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"Unknown [MaxDatumSize] of PCD [%s.%s]" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
|
||||
)
|
||||
ArraySize = int(Pcd.MaxDatumSize, 0)
|
||||
PcdValue = Pcd.DefaultValue
|
||||
if PcdValue[0] != '{':
|
||||
Unicode = False
|
||||
if PcdValue[0] == 'L':
|
||||
Unicode = True
|
||||
PcdValue = PcdValue.lstrip('L')
|
||||
PcdValue = eval(PcdValue)
|
||||
NewValue = '{'
|
||||
for Index in range(0, len(PcdValue)):
|
||||
if Unicode:
|
||||
CharVal = ord(PcdValue[Index])
|
||||
NewValue = NewValue + '0x%02x' % (CharVal & 0x00FF) + ', ' \
|
||||
+ '0x%02x' % (CharVal >> 8) + ', '
|
||||
else:
|
||||
NewValue = NewValue + '0x%02x' % (ord(PcdValue[Index]) % 0x100) + ', '
|
||||
Padding = '0x00, '
|
||||
if Unicode:
|
||||
Padding = Padding * 2
|
||||
ArraySize = ArraySize / 2
|
||||
if ArraySize < (len(PcdValue) + 1):
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
|
||||
)
|
||||
if ArraySize > len(PcdValue) + 1:
|
||||
NewValue = NewValue + Padding * (ArraySize - len(PcdValue) - 1)
|
||||
PcdValue = NewValue + Padding.strip().rstrip(',') + '}'
|
||||
elif len(PcdValue.split(',')) <= ArraySize:
|
||||
PcdValue = PcdValue.rstrip('}') + ', 0x00' * (ArraySize - len(PcdValue.split(',')))
|
||||
PcdValue += '}'
|
||||
else:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
|
||||
)
|
||||
PcdItem = '%s.%s|%s|0x%X' % \
|
||||
(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, PcdValue, PatchPcd[1])
|
||||
PcdComments = ''
|
||||
if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in self._PcdComments:
|
||||
PcdComments = '\n '.join(self._PcdComments[Pcd.TokenSpaceGuidCName, Pcd.TokenCName])
|
||||
if PcdComments:
|
||||
PcdItem = PcdComments + '\n ' + PcdItem
|
||||
AsBuiltInfDict['patchablepcd_item'].append(PcdItem)
|
||||
for Pcd in Pcds:
|
||||
AsBuiltInfDict['pcd_item'] += [Pcd.TokenSpaceGuidCName + '.' + Pcd.TokenCName]
|
||||
|
||||
PcdComments = ''
|
||||
PcdCommentList = []
|
||||
HiiInfo = ''
|
||||
if Pcd.Type == TAB_PCDS_DYNAMIC_EX_HII:
|
||||
for SkuName in Pcd.SkuInfoList:
|
||||
SkuInfo = Pcd.SkuInfoList[SkuName]
|
||||
HiiInfo = '## %s|%s|%s' % (SkuInfo.VariableName, SkuInfo.VariableGuid, SkuInfo.VariableOffset)
|
||||
break
|
||||
if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in self._PcdComments:
|
||||
PcdCommentList = self._PcdComments[Pcd.TokenSpaceGuidCName, Pcd.TokenCName][:]
|
||||
if HiiInfo:
|
||||
UsageIndex = -1
|
||||
for Index, Comment in enumerate(PcdCommentList):
|
||||
for Usage in UsageList:
|
||||
if Comment.find(Usage) != -1:
|
||||
UsageIndex = Index
|
||||
break
|
||||
if UsageIndex != -1:
|
||||
PcdCommentList[UsageIndex] = PcdCommentList[UsageIndex] + ' ' + HiiInfo
|
||||
else:
|
||||
PcdCommentList.append('## ' + HiiInfo)
|
||||
PcdComments = '\n '.join(PcdCommentList)
|
||||
PcdEntry = Pcd.TokenSpaceGuidCName + '.' + Pcd.TokenCName
|
||||
if PcdComments:
|
||||
PcdEntry = PcdComments + '\n ' + PcdEntry
|
||||
AsBuiltInfDict['pcd_item'] += [PcdEntry]
|
||||
for Item in self.BuildOption:
|
||||
if 'FLAGS' in self.BuildOption[Item]:
|
||||
AsBuiltInfDict['flags_item'] += ['%s:%s_%s_%s_%s_FLAGS = %s' % (self.ToolChainFamily, self.BuildTarget, self.ToolChain, self.Arch, Item, self.BuildOption[Item]['FLAGS'].strip())]
|
||||
@@ -2793,6 +2981,11 @@ class ModuleAutoGen(AutoGen):
|
||||
if self.IsCodeFileCreated:
|
||||
return
|
||||
|
||||
# Need to generate PcdDatabase even PcdDriver is binarymodule
|
||||
if self.IsBinaryModule and self.PcdIsDriver != '':
|
||||
CreatePcdDatabaseCode(self, TemplateString(), TemplateString())
|
||||
return
|
||||
|
||||
if not self.IsLibrary and CreateLibraryCodeFile:
|
||||
for LibraryAutoGen in self.LibraryAutoGenList:
|
||||
LibraryAutoGen.CreateCodeFile()
|
||||
@@ -2875,7 +3068,7 @@ class ModuleAutoGen(AutoGen):
|
||||
Specification = property(_GetSpecification)
|
||||
|
||||
IsLibrary = property(_IsLibrary)
|
||||
|
||||
IsBinaryModule = property(_IsBinaryModule)
|
||||
BuildDir = property(_GetBuildDir)
|
||||
OutputDir = property(_GetOutputDir)
|
||||
DebugDir = property(_GetDebugDir)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Routines for generating AutoGen.h and AutoGen.c
|
||||
#
|
||||
# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -22,6 +22,7 @@ from Common.DataType import *
|
||||
from Common.Misc import *
|
||||
from Common.String import StringToArray
|
||||
from StrGather import *
|
||||
from GenPcdDb import CreatePcdDatabaseCode
|
||||
|
||||
## PCD type string
|
||||
gItemTypeStringDatabase = {
|
||||
@@ -49,252 +50,6 @@ gDatumSizeStringDatabase = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64
|
||||
gDatumSizeStringDatabaseH = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'BOOL','VOID*':'PTR'}
|
||||
gDatumSizeStringDatabaseLib = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'Bool','VOID*':'Ptr'}
|
||||
|
||||
## Mapping between PCD driver type and EFI phase
|
||||
gPcdPhaseMap = {
|
||||
"PEI_PCD_DRIVER" : "PEI",
|
||||
"DXE_PCD_DRIVER" : "DXE"
|
||||
}
|
||||
|
||||
gPcdDatabaseCommonAutoGenH = """
|
||||
//
|
||||
// The following definition will be generated by build tool
|
||||
//
|
||||
|
||||
//
|
||||
// Common definitions
|
||||
//
|
||||
typedef UINT8 SKU_ID;
|
||||
|
||||
#define PCD_TYPE_SHIFT 28
|
||||
|
||||
#define PCD_TYPE_DATA (0x0U << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_HII (0x8U << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_VPD (0x4U << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_SKU_ENABLED (0x2U << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_STRING (0x1U << PCD_TYPE_SHIFT)
|
||||
|
||||
#define PCD_TYPE_ALL_SET (PCD_TYPE_DATA | PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_SKU_ENABLED | PCD_TYPE_STRING)
|
||||
|
||||
#define PCD_DATUM_TYPE_SHIFT 24
|
||||
|
||||
#define PCD_DATUM_TYPE_POINTER (0x0U << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT8 (0x1U << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT16 (0x2U << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT32 (0x4U << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT64 (0x8U << PCD_DATUM_TYPE_SHIFT)
|
||||
|
||||
#define PCD_DATUM_TYPE_ALL_SET (PCD_DATUM_TYPE_POINTER | \\
|
||||
PCD_DATUM_TYPE_UINT8 | \\
|
||||
PCD_DATUM_TYPE_UINT16 | \\
|
||||
PCD_DATUM_TYPE_UINT32 | \\
|
||||
PCD_DATUM_TYPE_UINT64)
|
||||
|
||||
#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET | PCD_DATUM_TYPE_ALL_SET))
|
||||
|
||||
typedef struct {
|
||||
UINT32 ExTokenNumber;
|
||||
UINT16 LocalTokenNumber; // PCD Number of this particular platform build
|
||||
UINT16 ExGuidIndex; // Index of GuidTable
|
||||
} DYNAMICEX_MAPPING;
|
||||
|
||||
typedef struct {
|
||||
UINT32 SkuDataStartOffset; //We have to use offsetof MACRO as we don't know padding done by compiler
|
||||
UINT32 SkuIdTableOffset; //Offset from the PCD_DB
|
||||
} SKU_HEAD;
|
||||
|
||||
typedef struct {
|
||||
UINT32 StringIndex; // Offset in String Table in units of UINT32.
|
||||
UINT32 DefaultValueOffset; // Offset of the Default Value
|
||||
UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.
|
||||
UINT16 Offset; // Offset in Variable
|
||||
} VARIABLE_HEAD;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Offset;
|
||||
} VPD_HEAD;
|
||||
|
||||
typedef UINT32 STRING_HEAD;
|
||||
|
||||
typedef UINT16 SIZE_INFO;
|
||||
|
||||
#define offsetof(s,m) (UINT32) (UINTN) &(((s *)0)->m)
|
||||
|
||||
"""
|
||||
|
||||
gPcdDatabaseEpilogueAutoGenH = """
|
||||
typedef struct {
|
||||
PEI_PCD_DATABASE PeiDb;
|
||||
DXE_PCD_DATABASE DxeDb;
|
||||
} PCD_DATABASE;
|
||||
|
||||
#define PCD_TOTAL_TOKEN_NUMBER (PEI_LOCAL_TOKEN_NUMBER + DXE_LOCAL_TOKEN_NUMBER)
|
||||
|
||||
"""
|
||||
|
||||
gPcdDatabaseAutoGenH = TemplateString("""
|
||||
#define ${PHASE}_GUID_TABLE_SIZE ${GUID_TABLE_SIZE}
|
||||
#define ${PHASE}_STRING_TABLE_SIZE ${STRING_TABLE_SIZE}
|
||||
#define ${PHASE}_SKUID_TABLE_SIZE ${SKUID_TABLE_SIZE}
|
||||
#define ${PHASE}_LOCAL_TOKEN_NUMBER_TABLE_SIZE ${LOCAL_TOKEN_NUMBER_TABLE_SIZE}
|
||||
#define ${PHASE}_LOCAL_TOKEN_NUMBER ${LOCAL_TOKEN_NUMBER}
|
||||
#define ${PHASE}_EXMAPPING_TABLE_SIZE ${EXMAPPING_TABLE_SIZE}
|
||||
#define ${PHASE}_EX_TOKEN_NUMBER ${EX_TOKEN_NUMBER}
|
||||
#define ${PHASE}_SIZE_TABLE_SIZE ${SIZE_TABLE_SIZE}
|
||||
#define ${PHASE}_GUID_TABLE_EMPTY ${GUID_TABLE_EMPTY}
|
||||
#define ${PHASE}_STRING_TABLE_EMPTY ${STRING_TABLE_EMPTY}
|
||||
#define ${PHASE}_SKUID_TABLE_EMPTY ${SKUID_TABLE_EMPTY}
|
||||
#define ${PHASE}_DATABASE_EMPTY ${DATABASE_EMPTY}
|
||||
#define ${PHASE}_EXMAP_TABLE_EMPTY ${EXMAP_TABLE_EMPTY}
|
||||
|
||||
typedef struct {
|
||||
${BEGIN} UINT64 ${INIT_CNAME_DECL_UINT64}_${INIT_GUID_DECL_UINT64}[${INIT_NUMSKUS_DECL_UINT64}];
|
||||
${END}
|
||||
${BEGIN} UINT64 ${VARDEF_CNAME_UINT64}_${VARDEF_GUID_UINT64}_VariableDefault_${VARDEF_SKUID_UINT64};
|
||||
${END}
|
||||
${BEGIN} UINT32 ${INIT_CNAME_DECL_UINT32}_${INIT_GUID_DECL_UINT32}[${INIT_NUMSKUS_DECL_UINT32}];
|
||||
${END}
|
||||
${BEGIN} UINT32 ${VARDEF_CNAME_UINT32}_${VARDEF_GUID_UINT32}_VariableDefault_${VARDEF_SKUID_UINT32};
|
||||
${END}
|
||||
${BEGIN} VPD_HEAD ${VPD_HEAD_CNAME_DECL}_${VPD_HEAD_GUID_DECL}[${VPD_HEAD_NUMSKUS_DECL}];
|
||||
${END}
|
||||
DYNAMICEX_MAPPING ExMapTable[${PHASE}_EXMAPPING_TABLE_SIZE];
|
||||
UINT32 LocalTokenNumberTable[${PHASE}_LOCAL_TOKEN_NUMBER_TABLE_SIZE];
|
||||
GUID GuidTable[${PHASE}_GUID_TABLE_SIZE];
|
||||
${BEGIN} STRING_HEAD ${STRING_HEAD_CNAME_DECL}_${STRING_HEAD_GUID_DECL}[${STRING_HEAD_NUMSKUS_DECL}];
|
||||
${END}
|
||||
${BEGIN} VARIABLE_HEAD ${VARIABLE_HEAD_CNAME_DECL}_${VARIABLE_HEAD_GUID_DECL}_Variable_Header[${VARIABLE_HEAD_NUMSKUS_DECL}];
|
||||
${END}
|
||||
${BEGIN} UINT8 StringTable${STRING_TABLE_INDEX}[${STRING_TABLE_LENGTH}]; /* ${STRING_TABLE_CNAME}_${STRING_TABLE_GUID} */
|
||||
${END}
|
||||
SIZE_INFO SizeTable[${PHASE}_SIZE_TABLE_SIZE];
|
||||
${BEGIN} UINT16 ${INIT_CNAME_DECL_UINT16}_${INIT_GUID_DECL_UINT16}[${INIT_NUMSKUS_DECL_UINT16}];
|
||||
${END}
|
||||
${BEGIN} UINT16 ${VARDEF_CNAME_UINT16}_${VARDEF_GUID_UINT16}_VariableDefault_${VARDEF_SKUID_UINT16};
|
||||
${END}
|
||||
${BEGIN} UINT8 ${INIT_CNAME_DECL_UINT8}_${INIT_GUID_DECL_UINT8}[${INIT_NUMSKUS_DECL_UINT8}];
|
||||
${END}
|
||||
${BEGIN} UINT8 ${VARDEF_CNAME_UINT8}_${VARDEF_GUID_UINT8}_VariableDefault_${VARDEF_SKUID_UINT8};
|
||||
${END}
|
||||
${BEGIN} BOOLEAN ${INIT_CNAME_DECL_BOOLEAN}_${INIT_GUID_DECL_BOOLEAN}[${INIT_NUMSKUS_DECL_BOOLEAN}];
|
||||
${END}
|
||||
${BEGIN} BOOLEAN ${VARDEF_CNAME_BOOLEAN}_${VARDEF_GUID_BOOLEAN}_VariableDefault_${VARDEF_SKUID_BOOLEAN};
|
||||
${END}
|
||||
UINT8 SkuIdTable[${PHASE}_SKUID_TABLE_SIZE];
|
||||
${SYSTEM_SKU_ID}
|
||||
} ${PHASE}_PCD_DATABASE_INIT;
|
||||
|
||||
typedef struct {
|
||||
${PCD_DATABASE_UNINIT_EMPTY}
|
||||
${BEGIN} UINT64 ${UNINIT_CNAME_DECL_UINT64}_${UNINIT_GUID_DECL_UINT64}[${UNINIT_NUMSKUS_DECL_UINT64}];
|
||||
${END}
|
||||
${BEGIN} UINT32 ${UNINIT_CNAME_DECL_UINT32}_${UNINIT_GUID_DECL_UINT32}[${UNINIT_NUMSKUS_DECL_UINT32}];
|
||||
${END}
|
||||
${BEGIN} UINT16 ${UNINIT_CNAME_DECL_UINT16}_${UNINIT_GUID_DECL_UINT16}[${UNINIT_NUMSKUS_DECL_UINT16}];
|
||||
${END}
|
||||
${BEGIN} UINT8 ${UNINIT_CNAME_DECL_UINT8}_${UNINIT_GUID_DECL_UINT8}[${UNINIT_NUMSKUS_DECL_UINT8}];
|
||||
${END}
|
||||
${BEGIN} BOOLEAN ${UNINIT_CNAME_DECL_BOOLEAN}_${UNINIT_GUID_DECL_BOOLEAN}[${UNINIT_NUMSKUS_DECL_BOOLEAN}];
|
||||
${END}
|
||||
} ${PHASE}_PCD_DATABASE_UNINIT;
|
||||
|
||||
#define PCD_${PHASE}_SERVICE_DRIVER_VERSION 2
|
||||
|
||||
typedef struct {
|
||||
${PHASE}_PCD_DATABASE_INIT Init;
|
||||
${PHASE}_PCD_DATABASE_UNINIT Uninit;
|
||||
} ${PHASE}_PCD_DATABASE;
|
||||
|
||||
#define ${PHASE}_NEX_TOKEN_NUMBER (${PHASE}_LOCAL_TOKEN_NUMBER - ${PHASE}_EX_TOKEN_NUMBER)
|
||||
""")
|
||||
|
||||
gEmptyPcdDatabaseAutoGenC = TemplateString("""
|
||||
${PHASE}_PCD_DATABASE_INIT g${PHASE}PcdDbInit = {
|
||||
/* ExMapTable */
|
||||
{
|
||||
{0, 0, 0}
|
||||
},
|
||||
/* LocalTokenNumberTable */
|
||||
{
|
||||
0
|
||||
},
|
||||
/* GuidTable */
|
||||
{
|
||||
{0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}
|
||||
},
|
||||
/* StringTable */
|
||||
{ 0 },
|
||||
/* SizeTable */
|
||||
{
|
||||
0, 0
|
||||
},
|
||||
/* SkuIdTable */
|
||||
{ 0 },
|
||||
${SYSTEM_SKU_ID_VALUE}
|
||||
};
|
||||
""")
|
||||
|
||||
gPcdDatabaseAutoGenC = TemplateString("""
|
||||
${PHASE}_PCD_DATABASE_INIT g${PHASE}PcdDbInit = {
|
||||
${BEGIN} { ${INIT_VALUE_UINT64} }, /* ${INIT_CNAME_DECL_UINT64}_${INIT_GUID_DECL_UINT64}[${INIT_NUMSKUS_DECL_UINT64}] */
|
||||
${END}
|
||||
${BEGIN} ${VARDEF_VALUE_UINT64}, /* ${VARDEF_CNAME_UINT64}_${VARDEF_GUID_UINT64}_VariableDefault_${VARDEF_SKUID_UINT64} */
|
||||
${END}
|
||||
${BEGIN} { ${INIT_VALUE_UINT32} }, /* ${INIT_CNAME_DECL_UINT32}_${INIT_GUID_DECL_UINT32}[${INIT_NUMSKUS_DECL_UINT32}] */
|
||||
${END}
|
||||
${BEGIN} ${VARDEF_VALUE_UINT32}, /* ${VARDEF_CNAME_UINT32}_${VARDEF_GUID_UINT32}_VariableDefault_${VARDEF_SKUID_UINT32} */
|
||||
${END}
|
||||
/* VPD */
|
||||
${BEGIN} { ${VPD_HEAD_VALUE} }, /* ${VPD_HEAD_CNAME_DECL}_${VPD_HEAD_GUID_DECL}[${VPD_HEAD_NUMSKUS_DECL}] */
|
||||
${END}
|
||||
/* ExMapTable */
|
||||
{
|
||||
${BEGIN} { ${EXMAPPING_TABLE_EXTOKEN}, ${EXMAPPING_TABLE_LOCAL_TOKEN}, ${EXMAPPING_TABLE_GUID_INDEX} },
|
||||
${END}
|
||||
},
|
||||
/* LocalTokenNumberTable */
|
||||
{
|
||||
${BEGIN} offsetof(${PHASE}_PCD_DATABASE, ${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}${VARDEF_HEADER}) | ${TOKEN_TYPE},
|
||||
${END}
|
||||
},
|
||||
/* GuidTable */
|
||||
{
|
||||
${BEGIN} ${GUID_STRUCTURE},
|
||||
${END}
|
||||
},
|
||||
${BEGIN} { ${STRING_HEAD_VALUE} }, /* ${STRING_HEAD_CNAME_DECL}_${STRING_HEAD_GUID_DECL}[${STRING_HEAD_NUMSKUS_DECL}] */
|
||||
${END}
|
||||
${BEGIN} /* ${VARIABLE_HEAD_CNAME_DECL}_${VARIABLE_HEAD_GUID_DECL}_Variable_Header[${VARIABLE_HEAD_NUMSKUS_DECL}] */
|
||||
{
|
||||
${VARIABLE_HEAD_VALUE}
|
||||
},
|
||||
${END}
|
||||
/* StringTable */
|
||||
${BEGIN} ${STRING_TABLE_VALUE}, /* ${STRING_TABLE_CNAME}_${STRING_TABLE_GUID} */
|
||||
${END}
|
||||
/* SizeTable */
|
||||
{
|
||||
${BEGIN} ${SIZE_TABLE_MAXIMUM_LENGTH}, ${SIZE_TABLE_CURRENT_LENGTH}, /* ${SIZE_TABLE_CNAME}_${SIZE_TABLE_GUID} */
|
||||
${END}
|
||||
},
|
||||
${BEGIN} { ${INIT_VALUE_UINT16} }, /* ${INIT_CNAME_DECL_UINT16}_${INIT_GUID_DECL_UINT16}[${INIT_NUMSKUS_DECL_UINT16}] */
|
||||
${END}
|
||||
${BEGIN} ${VARDEF_VALUE_UINT16}, /* ${VARDEF_CNAME_UINT16}_${VARDEF_GUID_UINT16}_VariableDefault_${VARDEF_SKUID_UINT16} */
|
||||
${END}
|
||||
${BEGIN} { ${INIT_VALUE_UINT8} }, /* ${INIT_CNAME_DECL_UINT8}_${INIT_GUID_DECL_UINT8}[${INIT_NUMSKUS_DECL_UINT8}] */
|
||||
${END}
|
||||
${BEGIN} ${VARDEF_VALUE_UINT8}, /* ${VARDEF_CNAME_UINT8}_${VARDEF_GUID_UINT8}_VariableDefault_${VARDEF_SKUID_UINT8} */
|
||||
${END}
|
||||
${BEGIN} { ${INIT_VALUE_BOOLEAN} }, /* ${INIT_CNAME_DECL_BOOLEAN}_${INIT_GUID_DECL_BOOLEAN}[${INIT_NUMSKUS_DECL_BOOLEAN}] */
|
||||
${END}
|
||||
${BEGIN} ${VARDEF_VALUE_BOOLEAN}, /* ${VARDEF_CNAME_BOOLEAN}_${VARDEF_GUID_BOOLEAN}_VariableDefault_${VARDEF_SKUID_BOOLEAN} */
|
||||
${END}
|
||||
/* SkuIdTable */
|
||||
{ ${BEGIN}${SKUID_VALUE}, ${END} },
|
||||
${SYSTEM_SKU_ID_VALUE}
|
||||
};
|
||||
""")
|
||||
|
||||
|
||||
## AutoGen File Header Templates
|
||||
gAutoGenHeaderString = TemplateString("""\
|
||||
/**
|
||||
@@ -907,6 +662,76 @@ gModuleTypeHeaderFile = {
|
||||
"USER_DEFINED" : [gBasicHeaderFile]
|
||||
}
|
||||
|
||||
## 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
|
||||
# @param AutoGenH The TemplateString object for header file
|
||||
#
|
||||
#
|
||||
def DynExPcdTokenNumberMapping(Info, AutoGenH):
|
||||
ExTokenCNameList = []
|
||||
PcdExList = []
|
||||
if Info.IsLibrary:
|
||||
PcdList = Info.LibraryPcdList
|
||||
else:
|
||||
PcdList = Info.ModulePcdList
|
||||
for Pcd in PcdList:
|
||||
if Pcd.Type in gDynamicExPcd:
|
||||
ExTokenCNameList.append(Pcd.TokenCName)
|
||||
PcdExList.append(Pcd)
|
||||
if len(ExTokenCNameList) == 0:
|
||||
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.
|
||||
# Use the Guid pointer to see if it matches any of the token space GUIDs.
|
||||
TokenCNameList = []
|
||||
for TokenCName in ExTokenCNameList:
|
||||
if TokenCName in TokenCNameList:
|
||||
continue
|
||||
Index = 0
|
||||
Count = ExTokenCNameList.count(TokenCName)
|
||||
for Pcd in PcdExList:
|
||||
if Pcd.TokenCName == TokenCName:
|
||||
Index = Index + 1
|
||||
if Index == 1:
|
||||
AutoGenH.Append('\n#define __PCD_%s_ADDR_CMP(GuidPtr) (' % (Pcd.TokenCName))
|
||||
AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
||||
else:
|
||||
AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
||||
if Index == Count:
|
||||
AutoGenH.Append('0 \\\n )\n')
|
||||
TokenCNameList.append(TokenCName)
|
||||
|
||||
TokenCNameList = []
|
||||
for TokenCName in ExTokenCNameList:
|
||||
if TokenCName in TokenCNameList:
|
||||
continue
|
||||
Index = 0
|
||||
Count = ExTokenCNameList.count(TokenCName)
|
||||
for Pcd in PcdExList:
|
||||
if Pcd.Type in gDynamicExPcd and Pcd.TokenCName == TokenCName:
|
||||
Index = Index + 1
|
||||
if Index == 1:
|
||||
AutoGenH.Append('\n#define __PCD_%s_VAL_CMP(GuidPtr) (' % (Pcd.TokenCName))
|
||||
AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
||||
else:
|
||||
AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
||||
if Index == Count:
|
||||
AutoGenH.Append('0 \\\n )\n')
|
||||
# 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.
|
||||
AutoGenH.Append('#define _PCD_TOKEN_EX_%s(GuidPtr) __PCD_%s_ADDR_CMP(GuidPtr) ? __PCD_%s_ADDR_CMP(GuidPtr) : __PCD_%s_VAL_CMP(GuidPtr) \n'
|
||||
% (Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName))
|
||||
TokenCNameList.append(TokenCName)
|
||||
|
||||
## Create code for module PCDs
|
||||
#
|
||||
# @param Info The ModuleAutoGen object
|
||||
@@ -923,13 +748,29 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
PcdTokenName = '_PCD_TOKEN_' + Pcd.TokenCName
|
||||
if Pcd.Type in gDynamicExPcd:
|
||||
TokenNumber = int(Pcd.TokenValue, 0)
|
||||
# Add TokenSpaceGuidValue value to PcdTokenName to discriminate the DynamicEx PCDs with
|
||||
# different Guids but same TokenCName
|
||||
PcdExTokenName = '_PCD_TOKEN_' + Pcd.TokenSpaceGuidCName + '_' + Pcd.TokenCName
|
||||
AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumber))
|
||||
else:
|
||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
|
||||
ExtraData="[%s]" % str(Info))
|
||||
TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName]
|
||||
AutoGenH.Append('\n#define %s %dU\n' % (PcdTokenName, TokenNumber))
|
||||
# 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_LIST:
|
||||
TokenNumber = 0
|
||||
else:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
|
||||
ExtraData="[%s]" % str(Info))
|
||||
else:
|
||||
TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName]
|
||||
AutoGenH.Append('\n#define %s %dU\n' % (PcdTokenName, TokenNumber))
|
||||
|
||||
EdkLogger.debug(EdkLogger.DEBUG_3, "Creating code for " + Pcd.TokenCName + "." + Pcd.TokenSpaceGuidCName)
|
||||
if Pcd.Type not in gItemTypeStringDatabase:
|
||||
@@ -946,12 +787,33 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
GetModeName = '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + Pcd.TokenCName
|
||||
SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + Pcd.TokenCName
|
||||
|
||||
PcdExCNameList = []
|
||||
if Pcd.Type in gDynamicExPcd:
|
||||
AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
if Info.IsLibrary:
|
||||
PcdList = Info.LibraryPcdList
|
||||
else:
|
||||
AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
PcdList = Info.ModulePcdList
|
||||
for PcdModule in PcdList:
|
||||
if PcdModule.Type in gDynamicExPcd:
|
||||
PcdExCNameList.append(PcdModule.TokenCName)
|
||||
# Be compatible with the current code which using PcdToken and PcdGet/Set for DynamicEx Pcd.
|
||||
# If only PcdToken and PcdGet/Set used in all Pcds with different CName, it should succeed to build.
|
||||
# If PcdToken and PcdGet/Set used in the Pcds with different Guids but same CName, it should failed to build.
|
||||
if PcdExCNameList.count(Pcd.TokenCName) > 1:
|
||||
AutoGenH.Append('// Disabled the macros, as PcdToken and PcdGet/Set are not allowed in the case that more than one DynamicEx Pcds are different Guids but same CName.\n')
|
||||
AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTokenName))
|
||||
AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
AutoGenH.Append('// #define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExTokenName))
|
||||
AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
elif Pcd.Type in gDynamicPcd:
|
||||
AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName, DatumSizeLib, PcdTokenName))
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
@@ -1117,16 +979,30 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
PcdTokenNumber = Info.PlatformInfo.PcdTokenNumber
|
||||
TokenSpaceGuidCName = Pcd.TokenSpaceGuidCName
|
||||
TokenCName = Pcd.TokenCName
|
||||
TokenSpaceGuidValue = Pcd.TokenSpaceGuidValue #Info.GuidList[TokenSpaceGuidCName]
|
||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
|
||||
ExtraData="[%s]" % str(Info))
|
||||
TokenNumber = PcdTokenNumber[TokenCName, TokenSpaceGuidCName]
|
||||
|
||||
# If PCD is DynamicEx, then use TokenNumber declared in DEC file
|
||||
PcdTokenName = '_PCD_TOKEN_' + TokenCName
|
||||
#
|
||||
# Write PCDs
|
||||
#
|
||||
if Pcd.Type in gDynamicExPcd:
|
||||
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.
|
||||
# In this case, just assign an invalid token number to make it pass build.
|
||||
if Pcd.Type in PCD_DYNAMIC_TYPE_LIST:
|
||||
TokenNumber = 0
|
||||
else:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
|
||||
ExtraData="[%s]" % str(Info))
|
||||
else:
|
||||
TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName]
|
||||
|
||||
if Pcd.Type not in gItemTypeStringDatabase:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
@@ -1148,23 +1024,40 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
Type = '(VOID *)'
|
||||
Array = '[]'
|
||||
|
||||
AutoGenH.Append('#define _PCD_TOKEN_%s %dU\n' % (TokenCName, TokenNumber))
|
||||
|
||||
PcdItemType = Pcd.Type
|
||||
#if PcdItemType in gDynamicPcd:
|
||||
# PcdItemType = TAB_PCDS_FIXED_AT_BUILD
|
||||
# if (TokenCName, TokenSpaceGuidCName) in Info.PlatformInfo.Platform.Pcds:
|
||||
# PcdItemType = Info.PlatformInfo.Platform.Pcds[TokenCName, TokenSpaceGuidCName].Type
|
||||
PcdExCNameList = []
|
||||
if PcdItemType in gDynamicExPcd:
|
||||
PcdTokenName = '_PCD_TOKEN_' + TokenCName
|
||||
AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, TokenSpaceGuidCName, PcdTokenName))
|
||||
if DatumType == 'VOID*':
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName,DatumSizeLib, TokenSpaceGuidCName, PcdTokenName))
|
||||
PcdExTokenName = '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + Pcd.TokenCName
|
||||
AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumber))
|
||||
|
||||
if Info.IsLibrary:
|
||||
PcdList = Info.LibraryPcdList
|
||||
else:
|
||||
AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, TokenSpaceGuidCName, PcdTokenName))
|
||||
PcdList = Info.ModulePcdList
|
||||
for PcdModule in PcdList:
|
||||
if PcdModule.Type in gDynamicExPcd:
|
||||
PcdExCNameList.append(PcdModule.TokenCName)
|
||||
# Be compatible with the current code which using PcdGet/Set for DynamicEx Pcd.
|
||||
# If only PcdGet/Set used in all Pcds with different CName, it should succeed to build.
|
||||
# If PcdGet/Set used in the Pcds with different Guids but same CName, it should failed to build.
|
||||
if PcdExCNameList.count(Pcd.TokenCName) > 1:
|
||||
AutoGenH.Append('// Disabled the macros, as PcdToken and PcdGet/Set are not allowed in the case that more than one DynamicEx Pcds are different Guids but same CName.\n')
|
||||
AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTokenName))
|
||||
AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
AutoGenH.Append('// #define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExTokenName))
|
||||
AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
AutoGenH.Append('#define _PCD_TOKEN_%s %dU\n' % (TokenCName, TokenNumber))
|
||||
if PcdItemType in gDynamicPcd:
|
||||
PcdTokenName = '_PCD_TOKEN_' + TokenCName
|
||||
AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName, DatumSizeLib, PcdTokenName))
|
||||
if DatumType == 'VOID*':
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdTokenName))
|
||||
@@ -1172,468 +1065,15 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
AutoGenH.Append('#define %s(Value) LibPcdSet%s(%s, (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName))
|
||||
if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE:
|
||||
PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName
|
||||
AutoGenH.Append('extern %s _gPcd_BinaryPatch_%s%s;\n' %(DatumType, TokenCName, Array) )
|
||||
AutoGenH.Append('extern volatile %s _gPcd_BinaryPatch_%s%s;\n' %(DatumType, TokenCName, Array) )
|
||||
AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeName, Type, TokenCName))
|
||||
AutoGenH.Append('#define %s(Value) (%s = (Value))\n' % (SetModeName, PcdVariableName))
|
||||
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:
|
||||
AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))
|
||||
#AutoGenH.Append('#define _PCD_VALUE_%s _gPcd_FixedAtBuild_%s\n' %(TokenCName, TokenCName))
|
||||
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)
|
||||
|
||||
## Create code for PCD database in DXE or PEI phase
|
||||
#
|
||||
# @param Platform The platform object
|
||||
# @retval tuple Two TemplateString objects for C code and header file,
|
||||
# respectively
|
||||
#
|
||||
def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
|
||||
AutoGenC = TemplateString()
|
||||
AutoGenH = TemplateString()
|
||||
|
||||
Dict = {
|
||||
'PHASE' : Phase,
|
||||
'GUID_TABLE_SIZE' : '1U',
|
||||
'STRING_TABLE_SIZE' : '1U',
|
||||
'SKUID_TABLE_SIZE' : '1U',
|
||||
'LOCAL_TOKEN_NUMBER_TABLE_SIZE' : '1U',
|
||||
'LOCAL_TOKEN_NUMBER' : '0U',
|
||||
'EXMAPPING_TABLE_SIZE' : '1U',
|
||||
'EX_TOKEN_NUMBER' : '0U',
|
||||
'SIZE_TABLE_SIZE' : '2U',
|
||||
'GUID_TABLE_EMPTY' : 'TRUE',
|
||||
'STRING_TABLE_EMPTY' : 'TRUE',
|
||||
'SKUID_TABLE_EMPTY' : 'TRUE',
|
||||
'DATABASE_EMPTY' : 'TRUE',
|
||||
'EXMAP_TABLE_EMPTY' : 'TRUE',
|
||||
'PCD_DATABASE_UNINIT_EMPTY' : ' UINT8 dummy; /* PCD_DATABASE_UNINIT is emptry */',
|
||||
'SYSTEM_SKU_ID' : ' SKU_ID SystemSkuId;',
|
||||
'SYSTEM_SKU_ID_VALUE' : '0U'
|
||||
}
|
||||
|
||||
for DatumType in ['UINT64','UINT32','UINT16','UINT8','BOOLEAN', "VOID*"]:
|
||||
Dict['VARDEF_CNAME_' + DatumType] = []
|
||||
Dict['VARDEF_GUID_' + DatumType] = []
|
||||
Dict['VARDEF_SKUID_' + DatumType] = []
|
||||
Dict['VARDEF_VALUE_' + DatumType] = []
|
||||
for Init in ['INIT','UNINIT']:
|
||||
Dict[Init+'_CNAME_DECL_' + DatumType] = []
|
||||
Dict[Init+'_GUID_DECL_' + DatumType] = []
|
||||
Dict[Init+'_NUMSKUS_DECL_' + DatumType] = []
|
||||
Dict[Init+'_VALUE_' + DatumType] = []
|
||||
|
||||
for Type in ['STRING_HEAD','VPD_HEAD','VARIABLE_HEAD']:
|
||||
Dict[Type + '_CNAME_DECL'] = []
|
||||
Dict[Type + '_GUID_DECL'] = []
|
||||
Dict[Type + '_NUMSKUS_DECL'] = []
|
||||
Dict[Type + '_VALUE'] = []
|
||||
|
||||
Dict['STRING_TABLE_INDEX'] = []
|
||||
Dict['STRING_TABLE_LENGTH'] = []
|
||||
Dict['STRING_TABLE_CNAME'] = []
|
||||
Dict['STRING_TABLE_GUID'] = []
|
||||
Dict['STRING_TABLE_VALUE'] = []
|
||||
|
||||
Dict['SIZE_TABLE_CNAME'] = []
|
||||
Dict['SIZE_TABLE_GUID'] = []
|
||||
Dict['SIZE_TABLE_CURRENT_LENGTH'] = []
|
||||
Dict['SIZE_TABLE_MAXIMUM_LENGTH'] = []
|
||||
|
||||
Dict['EXMAPPING_TABLE_EXTOKEN'] = []
|
||||
Dict['EXMAPPING_TABLE_LOCAL_TOKEN'] = []
|
||||
Dict['EXMAPPING_TABLE_GUID_INDEX'] = []
|
||||
|
||||
Dict['GUID_STRUCTURE'] = []
|
||||
|
||||
Dict['SKUID_VALUE'] = []
|
||||
Dict['VARDEF_HEADER'] = []
|
||||
if Phase == 'DXE':
|
||||
Dict['SYSTEM_SKU_ID'] = ''
|
||||
Dict['SYSTEM_SKU_ID_VALUE'] = ''
|
||||
|
||||
StringTableIndex = 0
|
||||
StringTableSize = 0
|
||||
NumberOfLocalTokens = 0
|
||||
NumberOfPeiLocalTokens = 0
|
||||
NumberOfDxeLocalTokens = 0
|
||||
NumberOfExTokens = 0
|
||||
NumberOfSizeItems = 0
|
||||
GuidList = []
|
||||
|
||||
for Pcd in Platform.DynamicPcdList:
|
||||
CName = Pcd.TokenCName
|
||||
TokenSpaceGuidCName = Pcd.TokenSpaceGuidCName
|
||||
|
||||
EdkLogger.debug(EdkLogger.DEBUG_3, "PCD: %s %s (%s : %s)" % (CName, TokenSpaceGuidCName, Pcd.Phase, Phase))
|
||||
if Pcd.DatumType not in gDatumSizeStringDatabase:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"Unknown datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
|
||||
ExtraData="[%s]" % str(Platform))
|
||||
|
||||
if Pcd.Phase == 'PEI':
|
||||
NumberOfPeiLocalTokens += 1
|
||||
if Pcd.Phase == 'DXE':
|
||||
NumberOfDxeLocalTokens += 1
|
||||
if Pcd.Phase != Phase:
|
||||
continue
|
||||
|
||||
#
|
||||
# TODO: need GetGuidValue() definition
|
||||
#
|
||||
TokenSpaceGuidStructure = Pcd.TokenSpaceGuidValue
|
||||
TokenSpaceGuid = GuidStructureStringToGuidValueName(TokenSpaceGuidStructure)
|
||||
if Pcd.Type in gDynamicExPcd:
|
||||
if TokenSpaceGuid not in GuidList:
|
||||
GuidList += [TokenSpaceGuid]
|
||||
Dict['GUID_STRUCTURE'].append(TokenSpaceGuidStructure)
|
||||
NumberOfExTokens += 1
|
||||
|
||||
ValueList = []
|
||||
StringHeadOffsetList = []
|
||||
VpdHeadOffsetList = []
|
||||
VariableHeadValueList = []
|
||||
Pcd.InitString = 'UNINIT'
|
||||
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
if Pcd.Type not in ["DynamicVpd", "DynamicExVpd"]:
|
||||
Pcd.TokenTypeList = ['PCD_TYPE_STRING']
|
||||
else:
|
||||
Pcd.TokenTypeList = []
|
||||
elif Pcd.DatumType == 'BOOLEAN':
|
||||
Pcd.TokenTypeList = ['PCD_DATUM_TYPE_UINT8']
|
||||
else:
|
||||
Pcd.TokenTypeList = ['PCD_DATUM_TYPE_' + Pcd.DatumType]
|
||||
|
||||
if len(Pcd.SkuInfoList) > 1:
|
||||
Pcd.TokenTypeList += ['PCD_TYPE_SKU_ENABLED']
|
||||
|
||||
for SkuName in Pcd.SkuInfoList:
|
||||
Sku = Pcd.SkuInfoList[SkuName]
|
||||
SkuId = Sku.SkuId
|
||||
if SkuId == None or SkuId == '':
|
||||
continue
|
||||
|
||||
if (SkuId + 'U') not in Dict['SKUID_VALUE']:
|
||||
Dict['SKUID_VALUE'].append(SkuId + 'U')
|
||||
|
||||
SkuIdIndex = Dict['SKUID_VALUE'].index(SkuId + 'U')
|
||||
if len(Sku.VariableName) > 0:
|
||||
Pcd.TokenTypeList += ['PCD_TYPE_HII']
|
||||
Pcd.InitString = 'INIT'
|
||||
VariableNameStructure = StringToArray(Sku.VariableName)
|
||||
if VariableNameStructure not in Dict['STRING_TABLE_VALUE']:
|
||||
Dict['STRING_TABLE_CNAME'].append(CName)
|
||||
Dict['STRING_TABLE_GUID'].append(TokenSpaceGuid)
|
||||
if StringTableIndex == 0:
|
||||
Dict['STRING_TABLE_INDEX'].append('')
|
||||
else:
|
||||
Dict['STRING_TABLE_INDEX'].append('_%d' % StringTableIndex)
|
||||
|
||||
Dict['STRING_TABLE_LENGTH'].append((len(Sku.VariableName) - 3 + 1) * 2)
|
||||
Dict['STRING_TABLE_VALUE'].append(VariableNameStructure)
|
||||
StringTableIndex += 1
|
||||
StringTableSize += (len(Sku.VariableName) - 3 + 1) * 2
|
||||
|
||||
VariableHeadStringIndex = 0
|
||||
for Index in range(Dict['STRING_TABLE_VALUE'].index(VariableNameStructure)):
|
||||
VariableHeadStringIndex += Dict['STRING_TABLE_LENGTH'][Index]
|
||||
|
||||
VariableGuidStructure = Sku.VariableGuidValue
|
||||
VariableGuid = GuidStructureStringToGuidValueName(VariableGuidStructure)
|
||||
if VariableGuid not in GuidList:
|
||||
GuidList += [VariableGuid]
|
||||
Dict['GUID_STRUCTURE'].append(VariableGuidStructure)
|
||||
VariableHeadGuidIndex = GuidList.index(VariableGuid)
|
||||
|
||||
if "PCD_TYPE_STRING" in Pcd.TokenTypeList:
|
||||
VariableHeadValueList.append('%dU, offsetof(%s_PCD_DATABASE, Init.%s_%s), %dU, %sU' %
|
||||
(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,
|
||||
VariableHeadGuidIndex, Sku.VariableOffset))
|
||||
Dict['VARDEF_CNAME_'+Pcd.DatumType].append(CName)
|
||||
Dict['VARDEF_GUID_'+Pcd.DatumType].append(TokenSpaceGuid)
|
||||
Dict['VARDEF_SKUID_'+Pcd.DatumType].append(SkuIdIndex)
|
||||
if "PCD_TYPE_STRING" in Pcd.TokenTypeList:
|
||||
Dict['VARDEF_VALUE_' + Pcd.DatumType].append("%s_%s[%d]" % (Pcd.TokenCName, TokenSpaceGuid, SkuIdIndex))
|
||||
else:
|
||||
#
|
||||
# ULL (for UINT64) or U(other integer type) should be append to avoid
|
||||
# warning under linux building environment.
|
||||
#
|
||||
if Pcd.DatumType == "UINT64":
|
||||
Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue + "ULL")
|
||||
elif Pcd.DatumType in ("UINT32", "UINT16", "UINT8"):
|
||||
Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue + "U")
|
||||
elif Pcd.DatumType == "BOOLEAN":
|
||||
if Sku.HiiDefaultValue in ["1", "0"]:
|
||||
Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue + "U")
|
||||
else:
|
||||
Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue)
|
||||
|
||||
elif Sku.VpdOffset != '':
|
||||
Pcd.TokenTypeList += ['PCD_TYPE_VPD']
|
||||
Pcd.InitString = 'INIT'
|
||||
VpdHeadOffsetList.append(str(Sku.VpdOffset) + 'U')
|
||||
continue
|
||||
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
Pcd.TokenTypeList += ['PCD_TYPE_STRING']
|
||||
Pcd.InitString = 'INIT'
|
||||
if Sku.HiiDefaultValue != '' and Sku.DefaultValue == '':
|
||||
Sku.DefaultValue = Sku.HiiDefaultValue
|
||||
if Sku.DefaultValue != '':
|
||||
NumberOfSizeItems += 1
|
||||
Dict['STRING_TABLE_CNAME'].append(CName)
|
||||
Dict['STRING_TABLE_GUID'].append(TokenSpaceGuid)
|
||||
|
||||
if StringTableIndex == 0:
|
||||
Dict['STRING_TABLE_INDEX'].append('')
|
||||
else:
|
||||
Dict['STRING_TABLE_INDEX'].append('_%d' % StringTableIndex)
|
||||
if Sku.DefaultValue[0] == 'L':
|
||||
Size = (len(Sku.DefaultValue) - 3 + 1) * 2
|
||||
Dict['STRING_TABLE_VALUE'].append(StringToArray(Sku.DefaultValue))
|
||||
elif Sku.DefaultValue[0] == '"':
|
||||
Size = len(Sku.DefaultValue) - 2 + 1
|
||||
Dict['STRING_TABLE_VALUE'].append(StringToArray(Sku.DefaultValue))
|
||||
elif Sku.DefaultValue[0] == '{':
|
||||
Size = len(Sku.DefaultValue.replace(',',' ').split())
|
||||
Dict['STRING_TABLE_VALUE'].append(Sku.DefaultValue)
|
||||
|
||||
StringHeadOffsetList.append(str(StringTableSize) + 'U')
|
||||
Dict['SIZE_TABLE_CNAME'].append(CName)
|
||||
Dict['SIZE_TABLE_GUID'].append(TokenSpaceGuid)
|
||||
Dict['SIZE_TABLE_CURRENT_LENGTH'].append(str(Size) + 'U')
|
||||
Dict['SIZE_TABLE_MAXIMUM_LENGTH'].append(str(Pcd.MaxDatumSize) + 'U')
|
||||
if Pcd.MaxDatumSize != '':
|
||||
MaxDatumSize = int(Pcd.MaxDatumSize, 0)
|
||||
if MaxDatumSize < Size:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
|
||||
ExtraData="[%s]" % str(Platform))
|
||||
Size = MaxDatumSize
|
||||
Dict['STRING_TABLE_LENGTH'].append(Size)
|
||||
StringTableIndex += 1
|
||||
StringTableSize += (Size)
|
||||
else:
|
||||
if "PCD_TYPE_HII" not in Pcd.TokenTypeList:
|
||||
Pcd.TokenTypeList += ['PCD_TYPE_DATA']
|
||||
if Sku.DefaultValue == 'TRUE':
|
||||
Pcd.InitString = 'INIT'
|
||||
else:
|
||||
try:
|
||||
if int(Sku.DefaultValue, 0) != 0:
|
||||
Pcd.InitString = 'INIT'
|
||||
except:
|
||||
pass
|
||||
|
||||
#
|
||||
# For UNIT64 type PCD's value, ULL should be append to avoid
|
||||
# warning under linux building environment.
|
||||
#
|
||||
if Pcd.DatumType == "UINT64":
|
||||
ValueList.append(Sku.DefaultValue + "ULL")
|
||||
elif Pcd.DatumType in ("UINT32", "UINT16", "UINT8"):
|
||||
ValueList.append(Sku.DefaultValue + "U")
|
||||
elif Pcd.DatumType == "BOOLEAN":
|
||||
if Sku.DefaultValue in ["1", "0"]:
|
||||
ValueList.append(Sku.DefaultValue + "U")
|
||||
else:
|
||||
ValueList.append(Sku.DefaultValue)
|
||||
|
||||
Pcd.TokenTypeList = list(set(Pcd.TokenTypeList))
|
||||
|
||||
|
||||
if 'PCD_TYPE_HII' in Pcd.TokenTypeList:
|
||||
Dict['VARIABLE_HEAD_CNAME_DECL'].append(CName)
|
||||
Dict['VARIABLE_HEAD_GUID_DECL'].append(TokenSpaceGuid)
|
||||
Dict['VARIABLE_HEAD_NUMSKUS_DECL'].append(len(Pcd.SkuInfoList))
|
||||
Dict['VARIABLE_HEAD_VALUE'].append('{ %s }\n' % ' },\n { '.join(VariableHeadValueList))
|
||||
Dict['VARDEF_HEADER'].append('_Variable_Header')
|
||||
else:
|
||||
Dict['VARDEF_HEADER'].append('')
|
||||
if 'PCD_TYPE_VPD' in Pcd.TokenTypeList:
|
||||
Dict['VPD_HEAD_CNAME_DECL'].append(CName)
|
||||
Dict['VPD_HEAD_GUID_DECL'].append(TokenSpaceGuid)
|
||||
Dict['VPD_HEAD_NUMSKUS_DECL'].append(len(Pcd.SkuInfoList))
|
||||
Dict['VPD_HEAD_VALUE'].append('{ %s }' % ' }, { '.join(VpdHeadOffsetList))
|
||||
if 'PCD_TYPE_STRING' in Pcd.TokenTypeList:
|
||||
Dict['STRING_HEAD_CNAME_DECL'].append(CName)
|
||||
Dict['STRING_HEAD_GUID_DECL'].append(TokenSpaceGuid)
|
||||
Dict['STRING_HEAD_NUMSKUS_DECL'].append(len(Pcd.SkuInfoList))
|
||||
Dict['STRING_HEAD_VALUE'].append(', '.join(StringHeadOffsetList))
|
||||
if 'PCD_TYPE_DATA' in Pcd.TokenTypeList:
|
||||
Dict[Pcd.InitString+'_CNAME_DECL_'+Pcd.DatumType].append(CName)
|
||||
Dict[Pcd.InitString+'_GUID_DECL_'+Pcd.DatumType].append(TokenSpaceGuid)
|
||||
Dict[Pcd.InitString+'_NUMSKUS_DECL_'+Pcd.DatumType].append(len(Pcd.SkuInfoList))
|
||||
if Pcd.InitString == 'UNINIT':
|
||||
Dict['PCD_DATABASE_UNINIT_EMPTY'] = ''
|
||||
else:
|
||||
Dict[Pcd.InitString+'_VALUE_'+Pcd.DatumType].append(', '.join(ValueList))
|
||||
|
||||
if Phase == 'PEI':
|
||||
NumberOfLocalTokens = NumberOfPeiLocalTokens
|
||||
if Phase == 'DXE':
|
||||
NumberOfLocalTokens = NumberOfDxeLocalTokens
|
||||
|
||||
Dict['TOKEN_INIT'] = ['' for x in range(NumberOfLocalTokens)]
|
||||
Dict['TOKEN_CNAME'] = ['' for x in range(NumberOfLocalTokens)]
|
||||
Dict['TOKEN_GUID'] = ['' for x in range(NumberOfLocalTokens)]
|
||||
Dict['TOKEN_TYPE'] = ['' for x in range(NumberOfLocalTokens)]
|
||||
|
||||
for Pcd in Platform.DynamicPcdList:
|
||||
CName = Pcd.TokenCName
|
||||
TokenSpaceGuidCName = Pcd.TokenSpaceGuidCName
|
||||
if Pcd.Phase != Phase:
|
||||
continue
|
||||
|
||||
TokenSpaceGuid = GuidStructureStringToGuidValueName(Pcd.TokenSpaceGuidValue) #(Platform.PackageList, TokenSpaceGuidCName))
|
||||
GeneratedTokenNumber = Platform.PcdTokenNumber[CName, TokenSpaceGuidCName] - 1
|
||||
if Phase == 'DXE':
|
||||
GeneratedTokenNumber -= NumberOfPeiLocalTokens
|
||||
|
||||
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))
|
||||
|
||||
Dict['TOKEN_INIT'][GeneratedTokenNumber] = 'Init'
|
||||
if Pcd.InitString == 'UNINIT':
|
||||
Dict['TOKEN_INIT'][GeneratedTokenNumber] = 'Uninit'
|
||||
Dict['TOKEN_CNAME'][GeneratedTokenNumber] = CName
|
||||
Dict['TOKEN_GUID'][GeneratedTokenNumber] = TokenSpaceGuid
|
||||
Dict['TOKEN_TYPE'][GeneratedTokenNumber] = ' | '.join(Pcd.TokenTypeList)
|
||||
|
||||
Pcd.TokenTypeList = list(set(Pcd.TokenTypeList))
|
||||
#
|
||||
# Update VARDEF_HEADER
|
||||
#
|
||||
if 'PCD_TYPE_HII' in Pcd.TokenTypeList:
|
||||
Dict['VARDEF_HEADER'][GeneratedTokenNumber] = '_Variable_Header'
|
||||
else:
|
||||
Dict['VARDEF_HEADER'][GeneratedTokenNumber] = ''
|
||||
|
||||
|
||||
if Pcd.Type in gDynamicExPcd:
|
||||
Dict['EXMAPPING_TABLE_EXTOKEN'].append(str(Pcd.TokenValue) + 'U')
|
||||
if Phase == 'DXE':
|
||||
GeneratedTokenNumber += NumberOfPeiLocalTokens
|
||||
#
|
||||
# Per, PCD architecture specification, PCD Token Number is 1 based and 0 is defined as invalid token number.
|
||||
# For each EX type PCD, a PCD Token Number is assigned. When the
|
||||
# PCD Driver/PEIM map EX_GUID and EX_TOKEN_NUMBER to the PCD Token Number,
|
||||
# the non-EX Protocol/PPI interface can be called to get/set the value. This assumption is made by
|
||||
# Pcd Driver/PEIM in MdeModulePkg.
|
||||
# Therefore, 1 is added to GeneratedTokenNumber to generate a PCD Token Number before being inserted
|
||||
# to the EXMAPPING_TABLE.
|
||||
#
|
||||
Dict['EXMAPPING_TABLE_LOCAL_TOKEN'].append(str(GeneratedTokenNumber + 1) + 'U')
|
||||
Dict['EXMAPPING_TABLE_GUID_INDEX'].append(str(GuidList.index(TokenSpaceGuid)) + 'U')
|
||||
|
||||
if GuidList != []:
|
||||
Dict['GUID_TABLE_EMPTY'] = 'FALSE'
|
||||
Dict['GUID_TABLE_SIZE'] = str(len(GuidList)) + 'U'
|
||||
else:
|
||||
Dict['GUID_STRUCTURE'] = [GuidStringToGuidStructureString('00000000-0000-0000-0000-000000000000')]
|
||||
|
||||
if StringTableIndex == 0:
|
||||
Dict['STRING_TABLE_INDEX'].append('')
|
||||
Dict['STRING_TABLE_LENGTH'].append(1)
|
||||
Dict['STRING_TABLE_CNAME'].append('')
|
||||
Dict['STRING_TABLE_GUID'].append('')
|
||||
Dict['STRING_TABLE_VALUE'].append('{ 0 }')
|
||||
else:
|
||||
Dict['STRING_TABLE_EMPTY'] = 'FALSE'
|
||||
Dict['STRING_TABLE_SIZE'] = str(StringTableSize) + 'U'
|
||||
|
||||
if Dict['SIZE_TABLE_CNAME'] == []:
|
||||
Dict['SIZE_TABLE_CNAME'].append('')
|
||||
Dict['SIZE_TABLE_GUID'].append('')
|
||||
Dict['SIZE_TABLE_CURRENT_LENGTH'].append('0U')
|
||||
Dict['SIZE_TABLE_MAXIMUM_LENGTH'].append('0U')
|
||||
|
||||
if NumberOfLocalTokens != 0:
|
||||
Dict['DATABASE_EMPTY'] = 'FALSE'
|
||||
Dict['LOCAL_TOKEN_NUMBER_TABLE_SIZE'] = NumberOfLocalTokens
|
||||
Dict['LOCAL_TOKEN_NUMBER'] = NumberOfLocalTokens
|
||||
|
||||
if NumberOfExTokens != 0:
|
||||
Dict['EXMAP_TABLE_EMPTY'] = 'FALSE'
|
||||
Dict['EXMAPPING_TABLE_SIZE'] = str(NumberOfExTokens) + 'U'
|
||||
Dict['EX_TOKEN_NUMBER'] = str(NumberOfExTokens) + 'U'
|
||||
else:
|
||||
Dict['EXMAPPING_TABLE_EXTOKEN'].append('0U')
|
||||
Dict['EXMAPPING_TABLE_LOCAL_TOKEN'].append('0U')
|
||||
Dict['EXMAPPING_TABLE_GUID_INDEX'].append('0U')
|
||||
|
||||
if NumberOfSizeItems != 0:
|
||||
Dict['SIZE_TABLE_SIZE'] = str(NumberOfSizeItems * 2) + 'U'
|
||||
|
||||
AutoGenH.Append(gPcdDatabaseAutoGenH.Replace(Dict))
|
||||
if NumberOfLocalTokens == 0:
|
||||
AutoGenC.Append(gEmptyPcdDatabaseAutoGenC.Replace(Dict))
|
||||
else:
|
||||
#
|
||||
# Update Size Table to the right order, it should be same with LocalTokenNumberTable
|
||||
#
|
||||
SizeCNameTempList = []
|
||||
SizeGuidTempList = []
|
||||
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'])):
|
||||
if Dict['TOKEN_CNAME'][Count] == Dict['SIZE_TABLE_CNAME'][Count1] and \
|
||||
Dict['TOKEN_GUID'][Count] == Dict['SIZE_TABLE_GUID'][Count1]:
|
||||
SizeCNameTempList.append(Dict['SIZE_TABLE_CNAME'][Count1])
|
||||
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))
|
||||
|
||||
return AutoGenH, AutoGenC
|
||||
|
||||
## Create code for PCD database
|
||||
#
|
||||
# @param Info The ModuleAutoGen object
|
||||
# @param AutoGenC The TemplateString object for C code
|
||||
# @param AutoGenH The TemplateString object for header file
|
||||
#
|
||||
def CreatePcdDatabaseCode (Info, AutoGenC, AutoGenH):
|
||||
if Info.PcdIsDriver == "":
|
||||
return
|
||||
if Info.PcdIsDriver not in gPcdPhaseMap:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR, "Not supported PcdIsDriver type:%s" % Info.PcdIsDriver,
|
||||
ExtraData="[%s]" % str(Info))
|
||||
|
||||
AutoGenH.Append(gPcdDatabaseCommonAutoGenH)
|
||||
AdditionalAutoGenH, AdditionalAutoGenC = CreatePcdDatabasePhaseSpecificAutoGen (Info.PlatformInfo, 'PEI')
|
||||
AutoGenH.Append(AdditionalAutoGenH.String)
|
||||
|
||||
Phase = gPcdPhaseMap[Info.PcdIsDriver]
|
||||
if Phase == 'PEI':
|
||||
AutoGenC.Append(AdditionalAutoGenC.String)
|
||||
|
||||
if Phase == 'DXE':
|
||||
AdditionalAutoGenH, AdditionalAutoGenC = CreatePcdDatabasePhaseSpecificAutoGen (Info.PlatformInfo, Phase)
|
||||
AutoGenH.Append(AdditionalAutoGenH.String)
|
||||
AutoGenC.Append(AdditionalAutoGenC.String)
|
||||
AutoGenH.Append(gPcdDatabaseEpilogueAutoGenH)
|
||||
|
||||
## Create code for library constructor
|
||||
#
|
||||
@@ -1920,7 +1360,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
|
||||
# Collect Token Space GUIDs used by DynamicEc PCDs
|
||||
TokenSpaceList = []
|
||||
for Pcd in Info.ModulePcdList:
|
||||
if Pcd.Type in gDynamicExPcd and Pcd.TokenSpaceGuidCName not in TokenSpaceList:
|
||||
if Pcd.Type in gDynamicExPcd and Pcd.TokenSpaceGuidCName not in TokenSpaceList:
|
||||
TokenSpaceList += [Pcd.TokenSpaceGuidCName]
|
||||
|
||||
# Add extern declarations to AutoGen.h if one or more Token Space GUIDs were found
|
||||
@@ -1938,13 +1378,14 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
|
||||
AutoGenH.Append("\n// PCD definitions\n")
|
||||
for Pcd in Info.ModulePcdList:
|
||||
CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd)
|
||||
DynExPcdTokenNumberMapping (Info, AutoGenH)
|
||||
else:
|
||||
if Info.ModulePcdList:
|
||||
AutoGenH.Append("\n// Definition of PCDs used in this module\n")
|
||||
AutoGenC.Append("\n// Definition of PCDs used in this module\n")
|
||||
for Pcd in Info.ModulePcdList:
|
||||
CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd)
|
||||
|
||||
DynExPcdTokenNumberMapping (Info, AutoGenH)
|
||||
if Info.LibraryPcdList:
|
||||
AutoGenH.Append("\n// Definition of PCDs used in libraries is in AutoGen.c\n")
|
||||
AutoGenC.Append("\n// Definition of PCDs used in libraries\n")
|
||||
|
1566
BaseTools/Source/Python/AutoGen/GenPcdDb.py
Normal file
1566
BaseTools/Source/Python/AutoGen/GenPcdDb.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -34,9 +34,10 @@ _FORMAT_CHAR = {1: 'B',
|
||||
# This class contain method to format and pack pcd's value.
|
||||
#
|
||||
class PcdEntry:
|
||||
def __init__(self, PcdCName, PcdOffset, PcdSize, PcdValue, Lineno=None, FileName=None, PcdUnpackValue=None,
|
||||
def __init__(self, PcdCName, SkuId,PcdOffset, PcdSize, PcdValue, Lineno=None, FileName=None, PcdUnpackValue=None,
|
||||
PcdBinOffset=None, PcdBinSize=None):
|
||||
self.PcdCName = PcdCName.strip()
|
||||
self.SkuId = SkuId.strip()
|
||||
self.PcdOffset = PcdOffset.strip()
|
||||
self.PcdSize = PcdSize.strip()
|
||||
self.PcdValue = PcdValue.strip()
|
||||
@@ -284,7 +285,7 @@ class PcdEntry:
|
||||
"Invalid unicode character %s in unicode string %s(File: %s Line: %s)" % \
|
||||
(Value, UnicodeString, self.FileName, self.Lineno))
|
||||
|
||||
for Index in range(len(UnicodeString) * 2, Size):
|
||||
for Index in xrange(len(UnicodeString) * 2, Size):
|
||||
ReturnArray.append(0)
|
||||
|
||||
self.PcdValue = ReturnArray.tolist()
|
||||
@@ -343,7 +344,7 @@ class GenVPD :
|
||||
#
|
||||
# Enhanced for support "|" character in the string.
|
||||
#
|
||||
ValueList = ['', '', '', '']
|
||||
ValueList = ['', '', '', '','']
|
||||
|
||||
ValueRe = re.compile(r'\s*L?\".*\|.*\"\s*$')
|
||||
PtrValue = ValueRe.findall(line)
|
||||
@@ -358,7 +359,7 @@ class GenVPD :
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
|
||||
if ValueUpdateFlag:
|
||||
ValueList[3] = PtrValue[0]
|
||||
ValueList[4] = PtrValue[0]
|
||||
self.FileLinesList[count] = ValueList
|
||||
# Store the line number
|
||||
self.FileLinesList[count].append(str(count+1))
|
||||
@@ -393,9 +394,10 @@ class GenVPD :
|
||||
count = 0
|
||||
for line in self.FileLinesList:
|
||||
if line != None :
|
||||
PCD = PcdEntry(line[0], line[1], line[2], line[3], line[4], self.InputFileName)
|
||||
PCD = PcdEntry(line[0], line[1], line[2], line[3], line[4],line[5], self.InputFileName)
|
||||
# Strip the space char
|
||||
PCD.PcdCName = PCD.PcdCName.strip(' ')
|
||||
PCD.SkuId = PCD.SkuId.strip(' ')
|
||||
PCD.PcdOffset = PCD.PcdOffset.strip(' ')
|
||||
PCD.PcdSize = PCD.PcdSize.strip(' ')
|
||||
PCD.PcdValue = PCD.PcdValue.strip(' ')
|
||||
@@ -639,7 +641,7 @@ class GenVPD :
|
||||
for eachPcd in self.PcdFixedOffsetSizeList :
|
||||
# write map file
|
||||
try :
|
||||
fMapFile.write("%s | %s | %s | %s \n" % (eachPcd.PcdCName, eachPcd.PcdOffset, eachPcd.PcdSize,eachPcd.PcdUnpackValue))
|
||||
fMapFile.write("%s | %s | %s | %s | %s \n" % (eachPcd.PcdCName, eachPcd.SkuId,eachPcd.PcdOffset, eachPcd.PcdSize,eachPcd.PcdUnpackValue))
|
||||
except:
|
||||
EdkLogger.error("BPDG", BuildToolError.FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." %self.MapFileName,None)
|
||||
|
||||
|
@@ -13,4 +13,4 @@
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
|
||||
gBUILD_VERSION = "Build 2601"
|
||||
gBUILD_VERSION = "Build 2610"
|
||||
|
@@ -397,6 +397,7 @@ TAB_DSC_DEFINES_OUTPUT_DIRECTORY = 'OUTPUT_DIRECTORY'
|
||||
TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES = 'SUPPORTED_ARCHITECTURES'
|
||||
TAB_DSC_DEFINES_BUILD_TARGETS = 'BUILD_TARGETS'
|
||||
TAB_DSC_DEFINES_SKUID_IDENTIFIER = 'SKUID_IDENTIFIER'
|
||||
TAB_DSC_DEFINES_PCD_INFO_GENERATION = 'PCD_INFO_GENERATION'
|
||||
TAB_DSC_DEFINES_FLASH_DEFINITION = 'FLASH_DEFINITION'
|
||||
TAB_DSC_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
|
||||
TAB_DSC_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
|
||||
|
@@ -50,3 +50,22 @@ gWideStringPattern = re.compile('(\W|\A)L"')
|
||||
#
|
||||
gAutoGenPhase = False
|
||||
|
||||
#
|
||||
# The Conf dir outside the workspace dir
|
||||
#
|
||||
gConfDirectory = ''
|
||||
|
||||
#
|
||||
# The relative default database file path
|
||||
#
|
||||
gDatabasePath = ".cache/build.db"
|
||||
|
||||
#
|
||||
# Build flag for binary build
|
||||
#
|
||||
gIgnoreSource = False
|
||||
|
||||
#
|
||||
# FDF parser
|
||||
#
|
||||
gFdfParser = None
|
||||
|
@@ -31,6 +31,7 @@ from Common import GlobalData as GlobalData
|
||||
from DataType import *
|
||||
from BuildToolError import *
|
||||
from CommonDataClass.DataClass import *
|
||||
from Parsing import GetSplitValueList
|
||||
|
||||
## Regular expression used to find out place holders in string template
|
||||
gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE|re.UNICODE)
|
||||
@@ -1248,8 +1249,13 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''):
|
||||
Size = Type = ''
|
||||
if len(FieldList) > 1:
|
||||
Type = FieldList[1]
|
||||
else:
|
||||
Type = DataType
|
||||
if len(FieldList) > 2:
|
||||
Size = FieldList[2]
|
||||
else:
|
||||
if Type == 'VOID*':
|
||||
Size = str(len(Value))
|
||||
if DataType == 'VOID*':
|
||||
IsValid = (len(FieldList) <= 3)
|
||||
else:
|
||||
@@ -1322,25 +1328,13 @@ def AnalyzePcdData(Setting):
|
||||
#
|
||||
# @retval ValueList: A List contaian VariableName, VariableGuid, VariableOffset, DefaultValue.
|
||||
#
|
||||
def AnalyzeHiiPcdData(Setting):
|
||||
ValueList = ['', '', '', '']
|
||||
|
||||
ValueRe = re.compile(r'^\s*L?\".*\|.*\"')
|
||||
PtrValue = ValueRe.findall(Setting)
|
||||
|
||||
ValueUpdateFlag = False
|
||||
|
||||
if len(PtrValue) >= 1:
|
||||
Setting = re.sub(ValueRe, '', Setting)
|
||||
ValueUpdateFlag = True
|
||||
def AnalyzeHiiPcdData(Setting):
|
||||
ValueList = ['', '', '', '']
|
||||
|
||||
TokenList = Setting.split(TAB_VALUE_SPLIT)
|
||||
TokenList = GetSplitValueList(Setting)
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
|
||||
if ValueUpdateFlag:
|
||||
ValueList[0] = PtrValue[0]
|
||||
|
||||
return ValueList
|
||||
|
||||
return ValueList
|
||||
|
||||
## AnalyzeVpdPcdData
|
||||
#
|
||||
@@ -1679,7 +1673,60 @@ class PeImageClass():
|
||||
for index in range(len(ByteList) - 1, -1, -1):
|
||||
Value = (Value << 8) | int(ByteList[index])
|
||||
return Value
|
||||
|
||||
|
||||
class SkuClass():
|
||||
|
||||
DEFAULT = 0
|
||||
SINGLE = 1
|
||||
MULTIPLE =2
|
||||
|
||||
def __init__(self,SkuIdentifier='', SkuIds={}):
|
||||
|
||||
self.AvailableSkuIds = sdict()
|
||||
self.SkuIdSet = []
|
||||
|
||||
if SkuIdentifier == '' or SkuIdentifier is None:
|
||||
self.SkuIdSet = ['DEFAULT']
|
||||
elif SkuIdentifier == 'ALL':
|
||||
self.SkuIdSet = SkuIds.keys()
|
||||
else:
|
||||
r = SkuIdentifier.split('|')
|
||||
self.SkuIdSet=[r[k].strip() for k in range(len(r))]
|
||||
if len(self.SkuIdSet) == 2 and 'DEFAULT' in self.SkuIdSet and SkuIdentifier != 'ALL':
|
||||
self.SkuIdSet.remove('DEFAULT')
|
||||
|
||||
for each in self.SkuIdSet:
|
||||
if each in SkuIds:
|
||||
self.AvailableSkuIds[each] = SkuIds[each]
|
||||
else:
|
||||
EdkLogger.error("build", PARAMETER_INVALID,
|
||||
ExtraData="SKU-ID [%s] is not supported by the platform. [Valid SKU-ID: %s]"
|
||||
% (each, " ".join(SkuIds.keys())))
|
||||
|
||||
def __SkuUsageType(self):
|
||||
|
||||
if len(self.SkuIdSet) == 1:
|
||||
if self.SkuIdSet[0] == 'DEFAULT':
|
||||
return SkuClass.DEFAULT
|
||||
else:
|
||||
return SkuClass.SINGLE
|
||||
else:
|
||||
return SkuClass.MULTIPLE
|
||||
|
||||
def __GetAvailableSkuIds(self):
|
||||
return self.AvailableSkuIds
|
||||
|
||||
def __GetSystemSkuID(self):
|
||||
if self.__SkuUsageType() == SkuClass.SINGLE:
|
||||
return self.SkuIdSet[0]
|
||||
else:
|
||||
return 'DEFAULT'
|
||||
|
||||
SystemSkuId = property(__GetSystemSkuID)
|
||||
AvailableSkuIdSet = property(__GetAvailableSkuIds)
|
||||
SkuUsageType = property(__SkuUsageType)
|
||||
|
||||
##
|
||||
#
|
||||
# This acts like the main() function for the script, unless it is 'import'ed into another
|
||||
|
@@ -138,12 +138,14 @@ class VpdInfoFile:
|
||||
Pcds = self._VpdArray.keys()
|
||||
Pcds.sort()
|
||||
for Pcd in Pcds:
|
||||
i = 0
|
||||
for Offset in self._VpdArray[Pcd]:
|
||||
PcdValue = str(Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]].DefaultValue).strip()
|
||||
PcdValue = str(Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[i]].DefaultValue).strip()
|
||||
if PcdValue == "" :
|
||||
PcdValue = Pcd.DefaultValue
|
||||
|
||||
fd.write("%s.%s|%s|%s|%s \n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, str(Offset).strip(), str(Pcd.MaxDatumSize).strip(),PcdValue))
|
||||
fd.write("%s.%s|%s|%s|%s|%s \n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, str(Pcd.SkuInfoList.keys()[i]),str(Offset).strip(), str(Pcd.MaxDatumSize).strip(),PcdValue))
|
||||
i += 1
|
||||
except:
|
||||
EdkLogger.error("VpdInfoFile",
|
||||
BuildToolError.FILE_WRITE_FAILURE,
|
||||
@@ -174,21 +176,22 @@ class VpdInfoFile:
|
||||
# the line must follow output format defined in BPDG spec.
|
||||
#
|
||||
try:
|
||||
PcdName, Offset, Size, Value = Line.split("#")[0].split("|")
|
||||
PcdName, SkuId,Offset, Size, Value = Line.split("#")[0].split("|")
|
||||
PcdName, SkuId,Offset, Size, Value = PcdName.strip(), SkuId.strip(),Offset.strip(), Size.strip(), Value.strip()
|
||||
TokenSpaceName, PcdTokenName = PcdName.split(".")
|
||||
except:
|
||||
EdkLogger.error("BPDG", BuildToolError.PARSER_ERROR, "Fail to parse VPD information file %s" % FilePath)
|
||||
|
||||
Found = False
|
||||
|
||||
for VpdObject in self._VpdArray.keys():
|
||||
if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObject.TokenCName == PcdTokenName.strip():
|
||||
if self._VpdArray[VpdObject][0] == "*":
|
||||
if Offset == "*":
|
||||
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName)
|
||||
|
||||
self._VpdArray[VpdObject][0] = Offset
|
||||
Found = True
|
||||
break
|
||||
for sku in VpdObject.SkuInfoList.keys():
|
||||
if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObject.TokenCName == PcdTokenName.strip() and sku == SkuId:
|
||||
if self._VpdArray[VpdObject][VpdObject.SkuInfoList.keys().index(sku)] == "*":
|
||||
if Offset == "*":
|
||||
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName)
|
||||
self._VpdArray[VpdObject][VpdObject.SkuInfoList.keys().index(sku)] = Offset
|
||||
Found = True
|
||||
if not Found:
|
||||
EdkLogger.error("BPDG", BuildToolError.PARSER_ERROR, "Can not find PCD defined in VPD guid file.")
|
||||
|
||||
|
@@ -77,6 +77,7 @@ MODEL_PCD_DYNAMIC_DEFAULT = 4009
|
||||
MODEL_PCD_DYNAMIC_VPD = 4010
|
||||
MODEL_PCD_DYNAMIC_HII = 4011
|
||||
|
||||
MODEL_META_DATA_HEADER_COMMENT = 5000
|
||||
MODEL_META_DATA_HEADER = 5001
|
||||
MODEL_META_DATA_INCLUDE = 5002
|
||||
MODEL_META_DATA_DEFINE = 5003
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# classes represent data in FDF
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -27,7 +27,7 @@ class FDClassObject:
|
||||
self.BaseAddressPcd = None
|
||||
self.Size = None
|
||||
self.SizePcd = None
|
||||
self.ErasePolarity = '1'
|
||||
self.ErasePolarity = None
|
||||
# 3-tuple list (blockSize, numBlocks, pcd)
|
||||
self.BlockSizeList = []
|
||||
# DefineVarDict[var] = value
|
||||
|
@@ -719,6 +719,7 @@ class DscParser(MetaFileParser):
|
||||
"PLATFORM_GUID",
|
||||
"PLATFORM_VERSION",
|
||||
"SKUID_IDENTIFIER",
|
||||
"PCD_INFO_GENERATION",
|
||||
"SUPPORTED_ARCHITECTURES",
|
||||
"BUILD_TARGETS",
|
||||
"OUTPUT_DIRECTORY",
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# parse FDF file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -1423,7 +1423,15 @@ class FdfParser:
|
||||
if not Status:
|
||||
raise Warning("FD name error", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
self.__GetTokenStatements(FdObj)
|
||||
while self.__GetTokenStatements(FdObj):
|
||||
pass
|
||||
for Attr in ("BaseAddress", "Size", "ErasePolarity"):
|
||||
if getattr(FdObj, Attr) == None:
|
||||
self.__GetNextToken()
|
||||
raise Warning("Keyword %s missing" % Attr, self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not FdObj.BlockSizeList:
|
||||
FdObj.BlockSizeList.append((1, FdObj.Size, None))
|
||||
|
||||
self.__GetDefineStatements(FdObj)
|
||||
|
||||
@@ -1480,58 +1488,54 @@ class FdfParser:
|
||||
# @param Obj for whom token statement is got
|
||||
#
|
||||
def __GetTokenStatements(self, Obj):
|
||||
if not self.__IsKeyword( "BaseAddress"):
|
||||
raise Warning("BaseAddress missing", self.FileName, self.CurrentLineNumber)
|
||||
if self.__IsKeyword( "BaseAddress"):
|
||||
if not self.__IsToken( "="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextHexNumber():
|
||||
raise Warning("expected Hex base address", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
Obj.BaseAddress = self.__Token
|
||||
|
||||
if self.__IsToken( "|"):
|
||||
pcdPair = self.__GetNextPcdName()
|
||||
Obj.BaseAddressPcd = pcdPair
|
||||
self.Profile.PcdDict[pcdPair] = Obj.BaseAddress
|
||||
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
||||
self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple
|
||||
return True
|
||||
|
||||
if not self.__IsToken( "="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
if self.__IsKeyword( "Size"):
|
||||
if not self.__IsToken( "="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextHexNumber():
|
||||
raise Warning("expected Hex size", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextHexNumber():
|
||||
raise Warning("expected Hex base address", self.FileName, self.CurrentLineNumber)
|
||||
Size = self.__Token
|
||||
if self.__IsToken( "|"):
|
||||
pcdPair = self.__GetNextPcdName()
|
||||
Obj.SizePcd = pcdPair
|
||||
self.Profile.PcdDict[pcdPair] = Size
|
||||
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
||||
self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple
|
||||
Obj.Size = long(Size, 0)
|
||||
return True
|
||||
|
||||
Obj.BaseAddress = self.__Token
|
||||
if self.__IsKeyword( "ErasePolarity"):
|
||||
if not self.__IsToken( "="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected Erase Polarity", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if self.__Token != "1" and self.__Token != "0":
|
||||
raise Warning("expected 1 or 0 Erase Polarity", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
Obj.ErasePolarity = self.__Token
|
||||
return True
|
||||
|
||||
if self.__IsToken( "|"):
|
||||
pcdPair = self.__GetNextPcdName()
|
||||
Obj.BaseAddressPcd = pcdPair
|
||||
self.Profile.PcdDict[pcdPair] = Obj.BaseAddress
|
||||
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
||||
self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple
|
||||
|
||||
if not self.__IsKeyword( "Size"):
|
||||
raise Warning("Size missing", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__IsToken( "="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextHexNumber():
|
||||
raise Warning("expected Hex size", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
|
||||
Size = self.__Token
|
||||
if self.__IsToken( "|"):
|
||||
pcdPair = self.__GetNextPcdName()
|
||||
Obj.SizePcd = pcdPair
|
||||
self.Profile.PcdDict[pcdPair] = Size
|
||||
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
||||
self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple
|
||||
Obj.Size = long(Size, 0)
|
||||
|
||||
if not self.__IsKeyword( "ErasePolarity"):
|
||||
raise Warning("ErasePolarity missing", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__IsToken( "="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected Erase Polarity", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if self.__Token != "1" and self.__Token != "0":
|
||||
raise Warning("expected 1 or 0 Erase Polarity", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
Obj.ErasePolarity = self.__Token
|
||||
|
||||
self.__GetBlockStatements(Obj)
|
||||
return self.__GetBlockStatements(Obj)
|
||||
|
||||
## __GetAddressStatements() method
|
||||
#
|
||||
@@ -1572,18 +1576,14 @@ class FdfParser:
|
||||
# @param Obj for whom block statement is got
|
||||
#
|
||||
def __GetBlockStatements(self, Obj):
|
||||
|
||||
if not self.__GetBlockStatement(Obj):
|
||||
#set default block size is 1
|
||||
Obj.BlockSizeList.append((1, Obj.Size, None))
|
||||
return
|
||||
|
||||
IsBlock = False
|
||||
while self.__GetBlockStatement(Obj):
|
||||
pass
|
||||
IsBlock = True
|
||||
|
||||
for Item in Obj.BlockSizeList:
|
||||
Item = Obj.BlockSizeList[-1]
|
||||
if Item[0] == None or Item[1] == None:
|
||||
raise Warning("expected block statement", self.FileName, self.CurrentLineNumber)
|
||||
return IsBlock
|
||||
|
||||
## __GetBlockStatement() method
|
||||
#
|
||||
@@ -2038,27 +2038,16 @@ class FdfParser:
|
||||
|
||||
self.__GetAddressStatements(FvObj)
|
||||
|
||||
while self.__GetBlockStatement(FvObj):
|
||||
pass
|
||||
|
||||
self.__GetSetStatements(FvObj)
|
||||
|
||||
self.__GetFvBaseAddress(FvObj)
|
||||
|
||||
self.__GetFvForceRebase(FvObj)
|
||||
|
||||
self.__GetFvAlignment(FvObj)
|
||||
|
||||
self.__GetFvAttributes(FvObj)
|
||||
|
||||
self.__GetFvNameGuid(FvObj)
|
||||
|
||||
FvObj.FvExtEntryTypeValue = []
|
||||
FvObj.FvExtEntryType = []
|
||||
FvObj.FvExtEntryData = []
|
||||
while True:
|
||||
isFvExtEntry = self.__GetFvExtEntryStatement(FvObj)
|
||||
if not isFvExtEntry:
|
||||
self.__GetSetStatements(FvObj)
|
||||
|
||||
if not (self.__GetBlockStatement(FvObj) or self.__GetFvBaseAddress(FvObj) or
|
||||
self.__GetFvForceRebase(FvObj) or self.__GetFvAlignment(FvObj) or
|
||||
self.__GetFvAttributes(FvObj) or self.__GetFvNameGuid(FvObj) or
|
||||
self.__GetFvExtEntryStatement(FvObj)):
|
||||
break
|
||||
|
||||
self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())
|
||||
@@ -2177,9 +2166,9 @@ class FdfParser:
|
||||
"WRITE_DISABLED_CAP", "WRITE_STATUS", "READ_ENABLED_CAP", \
|
||||
"READ_DISABLED_CAP", "READ_STATUS", "READ_LOCK_CAP", \
|
||||
"READ_LOCK_STATUS", "WRITE_LOCK_CAP", "WRITE_LOCK_STATUS", \
|
||||
"WRITE_POLICY_RELIABLE"):
|
||||
"WRITE_POLICY_RELIABLE", "WEAK_ALIGNMENT"):
|
||||
self.__UndoToken()
|
||||
return
|
||||
return False
|
||||
|
||||
if not self.__IsToken( "="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
@@ -2189,7 +2178,7 @@ class FdfParser:
|
||||
|
||||
FvObj.FvAttributeDict[name] = self.__Token
|
||||
|
||||
return
|
||||
return True
|
||||
|
||||
## __GetFvNameGuid() method
|
||||
#
|
||||
@@ -2202,7 +2191,7 @@ class FdfParser:
|
||||
def __GetFvNameGuid(self, FvObj):
|
||||
|
||||
if not self.__IsKeyword( "FvNameGuid"):
|
||||
return
|
||||
return False
|
||||
|
||||
if not self.__IsToken( "="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
@@ -2212,7 +2201,7 @@ class FdfParser:
|
||||
|
||||
FvObj.FvNameGuid = self.__Token
|
||||
|
||||
return
|
||||
return True
|
||||
|
||||
def __GetFvExtEntryStatement(self, FvObj):
|
||||
|
||||
@@ -3058,7 +3047,7 @@ class FdfParser:
|
||||
def __GetCapsuleTokens(self, Obj):
|
||||
if not self.__GetNextToken():
|
||||
return False
|
||||
while self.__Token in ("CAPSULE_GUID", "CAPSULE_HEADER_SIZE", "CAPSULE_FLAGS"):
|
||||
while self.__Token in ("CAPSULE_GUID", "CAPSULE_HEADER_SIZE", "CAPSULE_FLAGS", "OEM_CAPSULE_FLAGS"):
|
||||
Name = self.__Token.strip()
|
||||
if not self.__IsToken("="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
@@ -3075,6 +3064,15 @@ class FdfParser:
|
||||
if not self.__Token in ("PersistAcrossReset", "PopulateSystemTable", "InitiateReset"):
|
||||
raise Warning("expected PersistAcrossReset, PopulateSystemTable, or InitiateReset", self.FileName, self.CurrentLineNumber)
|
||||
Value += self.__Token.strip()
|
||||
elif Name == 'OEM_CAPSULE_FLAGS':
|
||||
Value = self.__Token.strip()
|
||||
try:
|
||||
Value = int(Value, 0)
|
||||
except ValueError:
|
||||
raise Warning("expected integer value between 0x0000 and 0xFFFF", self.FileName, self.CurrentLineNumber)
|
||||
if not 0x0000 <= Value <= 0xFFFF:
|
||||
raise Warning("expected integer value between 0x0000 and 0xFFFF", self.FileName, self.CurrentLineNumber)
|
||||
Value = self.__Token.strip()
|
||||
else:
|
||||
Value = self.__Token.strip()
|
||||
Obj.TokensDict[Name] = Value
|
||||
|
@@ -37,6 +37,7 @@ from GuidSection import GuidSection
|
||||
from FvImageSection import FvImageSection
|
||||
from Common.Misc import PeImageClass
|
||||
from AutoGen.GenDepex import DependencyExpression
|
||||
from PatchPcdValue.PatchPcdValue import PatchBinaryFile
|
||||
|
||||
## generate FFS from INF
|
||||
#
|
||||
@@ -203,14 +204,80 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
|
||||
if Inf._Defs != None and len(Inf._Defs) > 0:
|
||||
self.OptRomDefs.update(Inf._Defs)
|
||||
|
||||
self.PatchPcds = []
|
||||
InfPcds = Inf.Pcds
|
||||
Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||
FdfPcdDict = GenFdsGlobalVariable.FdfParser.Profile.PcdDict
|
||||
DscModules = {}
|
||||
for DscModule in Platform.Modules:
|
||||
DscModules[str(DscModule).lower()] = Platform.Modules[DscModule]
|
||||
for PcdKey in InfPcds:
|
||||
Pcd = InfPcds[PcdKey]
|
||||
if not hasattr(Pcd, 'Offset'):
|
||||
continue
|
||||
if Pcd.Type != 'PatchableInModule':
|
||||
continue
|
||||
PatchPcd = None
|
||||
InfLowerPath = str(PathClassObj).lower()
|
||||
if InfLowerPath in DscModules and PcdKey in DscModules[InfLowerPath].Pcds:
|
||||
PatchPcd = DscModules[InfLowerPath].Pcds[PcdKey]
|
||||
elif PcdKey in Platform.Pcds:
|
||||
PatchPcd = Platform.Pcds[PcdKey]
|
||||
DscOverride = False
|
||||
if PatchPcd and Pcd.Type == PatchPcd.Type:
|
||||
DefaultValue = PatchPcd.DefaultValue
|
||||
DscOverride = True
|
||||
FdfOverride = False
|
||||
if PcdKey in FdfPcdDict:
|
||||
DefaultValue = FdfPcdDict[PcdKey]
|
||||
FdfOverride = True
|
||||
if not DscOverride and not FdfOverride:
|
||||
continue
|
||||
if Pcd.DatumType == "VOID*":
|
||||
if Pcd.DefaultValue == DefaultValue or DefaultValue in [None, '']:
|
||||
continue
|
||||
if DefaultValue[0] == 'L':
|
||||
MaxDatumSize = str((len(DefaultValue) - 2) * 2)
|
||||
elif DefaultValue[0] == '{':
|
||||
MaxDatumSize = str(len(DefaultValue.split(',')))
|
||||
else:
|
||||
MaxDatumSize = str(len(DefaultValue) - 1)
|
||||
if DscOverride:
|
||||
Pcd.MaxDatumSize = PatchPcd.MaxDatumSize
|
||||
if Pcd.MaxDatumSize in ['', None]:
|
||||
Pcd.MaxDatumSize = str(len(Pcd.DefaultValue.split(',')))
|
||||
else:
|
||||
Base1 = Base2 = 10
|
||||
if Pcd.DefaultValue.upper().startswith('0X'):
|
||||
Base1 = 16
|
||||
if DefaultValue.upper().startswith('0X'):
|
||||
Base2 = 16
|
||||
try:
|
||||
PcdValueInImg = int(Pcd.DefaultValue, Base1)
|
||||
PcdValueInDscOrFdf = int(DefaultValue, Base2)
|
||||
if PcdValueInImg == PcdValueInDscOrFdf:
|
||||
continue
|
||||
except:
|
||||
continue
|
||||
if Pcd.DatumType == "VOID*":
|
||||
if int(MaxDatumSize) > int(Pcd.MaxDatumSize):
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "The size of VOID* type PCD '%s.%s' exceeds its maximum size %d bytes." \
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, int(MaxDatumSize) - int(Pcd.MaxDatumSize)))
|
||||
else:
|
||||
if PcdValueInDscOrFdf > FfsInfStatement._MAX_SIZE_TYPE[Pcd.DatumType] \
|
||||
or PcdValueInImg > FfsInfStatement._MAX_SIZE_TYPE[Pcd.DatumType]:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "The size of %s type PCD '%s.%s' doesn't match its data type." \
|
||||
% (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
||||
Pcd.DefaultValue = DefaultValue
|
||||
self.PatchPcds.append(Pcd)
|
||||
self.InfModule = Inf
|
||||
|
||||
GenFdsGlobalVariable.VerboseLogger( "BaseName : %s" %self.BaseName)
|
||||
GenFdsGlobalVariable.VerboseLogger("ModuleGuid : %s" %self.ModuleGuid)
|
||||
GenFdsGlobalVariable.VerboseLogger("ModuleType : %s" %self.ModuleType)
|
||||
GenFdsGlobalVariable.VerboseLogger("VersionString : %s" %self.VersionString)
|
||||
GenFdsGlobalVariable.VerboseLogger("InfFileName :%s" %self.InfFileName)
|
||||
self.PcdIsDriver = Inf.PcdIsDriver
|
||||
self.IsBinaryModule = Inf.IsBinaryModule
|
||||
GenFdsGlobalVariable.VerboseLogger("BaseName : %s" % self.BaseName)
|
||||
GenFdsGlobalVariable.VerboseLogger("ModuleGuid : %s" % self.ModuleGuid)
|
||||
GenFdsGlobalVariable.VerboseLogger("ModuleType : %s" % self.ModuleType)
|
||||
GenFdsGlobalVariable.VerboseLogger("VersionString : %s" % self.VersionString)
|
||||
GenFdsGlobalVariable.VerboseLogger("InfFileName :%s" % self.InfFileName)
|
||||
|
||||
#
|
||||
# Set OutputPath = ${WorkSpace}\Build\Fv\Ffs\${ModuleGuid}+ ${MdouleName}\
|
||||
@@ -224,6 +291,27 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
self.EfiOutputPath = self.__GetEFIOutPutPath__()
|
||||
GenFdsGlobalVariable.VerboseLogger( "ModuelEFIPath: " + self.EfiOutputPath)
|
||||
|
||||
## PatchEfiFile
|
||||
#
|
||||
# Patch EFI file with patch PCD
|
||||
#
|
||||
# @param EfiFile: EFI file needs to be patched.
|
||||
# @retval: Full path of patched EFI file: self.OutputPath + EfiFile base name
|
||||
# If passed in file does not end with efi, return as is
|
||||
#
|
||||
def PatchEfiFile(self, EfiFile):
|
||||
if os.path.splitext(EfiFile)[1].lower() != '.efi':
|
||||
return EfiFile
|
||||
if not self.PatchPcds:
|
||||
return EfiFile
|
||||
Basename = os.path.basename(EfiFile)
|
||||
Output = os.path.join(self.OutputPath, Basename)
|
||||
CopyLongFilePath(EfiFile, Output)
|
||||
for Pcd in self.PatchPcds:
|
||||
RetVal, RetStr = PatchBinaryFile(Output, int(Pcd.Offset, 0), Pcd.DatumType, Pcd.DefaultValue, Pcd.MaxDatumSize)
|
||||
if RetVal:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, RetStr, File=self.InfFileName)
|
||||
return Output
|
||||
## GenFfs() method
|
||||
#
|
||||
# Generate FFS
|
||||
@@ -668,6 +756,30 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
SectAlignments = []
|
||||
Index = 1
|
||||
HasGneratedFlag = False
|
||||
if self.PcdIsDriver == 'PEI_PCD_DRIVER':
|
||||
if self.IsBinaryModule:
|
||||
PcdExDbFileName = os.path.join(GenFdsGlobalVariable.FvDir, "PEIPcdDataBase.raw")
|
||||
else:
|
||||
PcdExDbFileName = os.path.join(self.EfiOutputPath, "PEIPcdDataBase.raw")
|
||||
PcdExDbSecName = os.path.join(self.OutputPath, "PEIPcdDataBaseSec.raw")
|
||||
GenFdsGlobalVariable.GenerateSection(PcdExDbSecName,
|
||||
[PcdExDbFileName],
|
||||
"EFI_SECTION_RAW",
|
||||
)
|
||||
SectFiles.append(PcdExDbSecName)
|
||||
SectAlignments.append(None)
|
||||
elif self.PcdIsDriver == 'DXE_PCD_DRIVER':
|
||||
if self.IsBinaryModule:
|
||||
PcdExDbFileName = os.path.join(GenFdsGlobalVariable.FvDir, "DXEPcdDataBase.raw")
|
||||
else:
|
||||
PcdExDbFileName = os.path.join(self.EfiOutputPath, "DXEPcdDataBase.raw")
|
||||
PcdExDbSecName = os.path.join(self.OutputPath, "DXEPcdDataBaseSec.raw")
|
||||
GenFdsGlobalVariable.GenerateSection(PcdExDbSecName,
|
||||
[PcdExDbFileName],
|
||||
"EFI_SECTION_RAW",
|
||||
)
|
||||
SectFiles.append(PcdExDbSecName)
|
||||
SectAlignments.append(None)
|
||||
for Sect in Rule.SectionList:
|
||||
SecIndex = '%d' %Index
|
||||
SectList = []
|
||||
|
@@ -131,7 +131,7 @@ class Section (SectionClassObject):
|
||||
if File.Arch == "COMMON" or FfsInf.CurrentArch == File.Arch:
|
||||
if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX'):
|
||||
if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
|
||||
FileList.append(File.Path)
|
||||
FileList.append(FfsInf.PatchEfiFile(File.Path))
|
||||
else:
|
||||
GenFdsGlobalVariable.InfLogger ("\nBuild Target \'%s\' of File %s is not in the Scope of %s specified by INF %s in FDF" %(File.Target, File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName))
|
||||
else:
|
||||
|
@@ -5,7 +5,7 @@
|
||||
# PCD Name Offset in binary
|
||||
# ======== ================
|
||||
#
|
||||
# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -54,39 +54,54 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
|
||||
|
||||
if len(lines) == 0: return None
|
||||
if lines[0].strip().find("Archive member included because of file (symbol)") != -1:
|
||||
return _parseForGCC(lines)
|
||||
return _parseForGCC(lines, efifilepath)
|
||||
return _parseGeneral(lines, efifilepath)
|
||||
|
||||
def _parseForGCC(lines):
|
||||
|
||||
def _parseForGCC(lines, efifilepath):
|
||||
""" Parse map file generated by GCC linker """
|
||||
status = 0
|
||||
imageBase = -1
|
||||
lastSectionName = None
|
||||
pcds = []
|
||||
status = 0
|
||||
imageBase = -1
|
||||
sections = []
|
||||
bpcds = []
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
# status machine transection
|
||||
if status == 0 and line == "Linker script and memory map":
|
||||
if status == 0 and line == "Memory Configuration":
|
||||
status = 1
|
||||
continue
|
||||
elif status == 1 and line == 'START GROUP':
|
||||
elif status == 1 and line == 'Linker script and memory map':
|
||||
status = 2
|
||||
continue
|
||||
|
||||
# status handler:
|
||||
if status == 1:
|
||||
m = re.match('^[\da-fA-FxhH]+ +__image_base__ += +([\da-fA-FhxH]+)', line)
|
||||
if m != None:
|
||||
imageBase = int(m.groups(0)[0], 16)
|
||||
elif status ==2 and line == 'START GROUP':
|
||||
status = 3
|
||||
continue
|
||||
|
||||
# status handler
|
||||
if status == 2:
|
||||
m = re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)', line)
|
||||
m = re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$', line)
|
||||
if m != None:
|
||||
lastSectionName = m.groups(0)[0]
|
||||
sections.append(m.groups(0))
|
||||
if status == 2:
|
||||
m = re.match("^([\da-fA-Fx]+) +[_]+gPcd_BinaryPatch_([\w_\d]+)", line)
|
||||
m = re.match("^([\da-fA-Fx]+) +[_]+gPcd_BinaryPatch_([\w_\d]+)$", line)
|
||||
if m != None:
|
||||
assert imageBase != -1, "Fail to get Binary PCD offsest for unknown image base address"
|
||||
pcds.append((m.groups(0)[1], int(m.groups(0)[0], 16) - imageBase, lastSectionName))
|
||||
bpcds.append((m.groups(0)[1], int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0]))
|
||||
|
||||
# get section information from efi file
|
||||
efisecs = PeImageClass(efifilepath).SectionHeaderList
|
||||
if efisecs == None or len(efisecs) == 0:
|
||||
return None
|
||||
#redirection
|
||||
redirection = 0
|
||||
for efisec in efisecs:
|
||||
for section in sections:
|
||||
if section[0].strip() == efisec[0].strip() and section[0].strip() == '.text':
|
||||
redirection = int(section[1], 16) - efisec[1]
|
||||
pcds = []
|
||||
for pcd in bpcds:
|
||||
for efisec in efisecs:
|
||||
if pcd[1] >= efisec[1] and pcd[1] < efisec[1]+efisec[3]:
|
||||
#assert efisec[0].strip() == pcd[3].strip() and efisec[1] + redirection == pcd[2], "There are some differences between map file and efi file"
|
||||
pcds.append([pcd[0], efisec[2] + pcd[1] - efisec[1] - redirection, efisec[0]])
|
||||
return pcds
|
||||
|
||||
def _parseGeneral(lines, efifilepath):
|
||||
|
@@ -72,7 +72,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
elif TypeName == 'VOID*':
|
||||
if MaxSize == 0:
|
||||
return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD."
|
||||
ValueLength = MaxSize
|
||||
ValueLength = int(MaxSize)
|
||||
else:
|
||||
return PARAMETER_INVALID, "PCD type %s is not valid." %(CommandOptions.PcdTypeName)
|
||||
#
|
||||
@@ -97,6 +97,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
#
|
||||
# Patch value into offset
|
||||
#
|
||||
SavedStr = ValueString
|
||||
ValueString = ValueString.upper()
|
||||
ValueNumber = 0
|
||||
if TypeName == 'BOOLEAN':
|
||||
@@ -109,9 +110,9 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
elif ValueString == 'FALSE':
|
||||
ValueNumber = 0
|
||||
elif ValueString.startswith('0X'):
|
||||
ValueNumber = int (Value, 16)
|
||||
ValueNumber = int (ValueString, 16)
|
||||
else:
|
||||
ValueNumber = int (Value)
|
||||
ValueNumber = int (ValueString)
|
||||
if ValueNumber != 0:
|
||||
ValueNumber = 1
|
||||
except:
|
||||
@@ -138,12 +139,13 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
ByteList[ValueOffset + Index] = ValueNumber % 0x100
|
||||
ValueNumber = ValueNumber / 0x100
|
||||
elif TypeName == 'VOID*':
|
||||
if ValueString.startswith("L "):
|
||||
ValueString = SavedStr
|
||||
if ValueString.startswith('L"'):
|
||||
#
|
||||
# Patch Unicode String
|
||||
#
|
||||
Index = 0
|
||||
for ByteString in ValueString[2:]:
|
||||
for ByteString in ValueString[2:-1]:
|
||||
#
|
||||
# Reserve zero as unicode tail
|
||||
#
|
||||
@@ -177,7 +179,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
# Patch ascii string
|
||||
#
|
||||
Index = 0
|
||||
for ByteString in ValueString:
|
||||
for ByteString in ValueString[1:-1]:
|
||||
#
|
||||
# Reserve zero as string tail
|
||||
#
|
||||
|
@@ -17,4 +17,4 @@
|
||||
Build version information
|
||||
'''
|
||||
|
||||
gBUILD_VERSION = "Build 2601"
|
||||
gBUILD_VERSION = "Build 2610"
|
||||
|
28
BaseTools/Source/Python/Workspace/MetaFileCommentParser.py
Normal file
28
BaseTools/Source/Python/Workspace/MetaFileCommentParser.py
Normal file
@@ -0,0 +1,28 @@
|
||||
## @file
|
||||
# This file is used to check format of comments
|
||||
#
|
||||
# Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
|
||||
from CommonDataClass.DataClass import (
|
||||
MODEL_PCD_PATCHABLE_IN_MODULE,
|
||||
MODEL_PCD_DYNAMIC_EX,
|
||||
MODEL_PCD_DYNAMIC,
|
||||
MODEL_EFI_GUID,
|
||||
MODEL_EFI_PPI,
|
||||
MODEL_EFI_PROTOCOL
|
||||
)
|
||||
from Common.BuildToolError import FORMAT_INVALID
|
||||
import Common.EdkLogger as EdkLogger
|
||||
|
||||
UsageList = ("PRODUCES", "PRODUCED", "ALWAYS_PRODUCES", "ALWAYS_PRODUCED", "SOMETIMES_PRODUCES",
|
||||
"SOMETIMES_PRODUCED", "CONSUMES", "CONSUMED", "ALWAYS_CONSUMES", "ALWAYS_CONSUMED",
|
||||
"SOMETIMES_CONSUMES", "SOMETIMES_CONSUMED", "SOMETIME_CONSUMES")
|
||||
|
@@ -287,7 +287,7 @@ class MetaFileParser(object):
|
||||
if self._SectionName in self.DataType:
|
||||
self._SectionType = self.DataType[self._SectionName]
|
||||
# Check if the section name is valid
|
||||
if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH and len(ItemList) > 2:
|
||||
if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH and len(ItemList) > 3:
|
||||
EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item,
|
||||
self.MetaFile, self._LineIndex + 1, self._CurrentLine)
|
||||
elif self._Version >= 0x00010005:
|
||||
@@ -495,14 +495,18 @@ class InfParser(MetaFileParser):
|
||||
|
||||
# parse the file line by line
|
||||
IsFindBlockComment = False
|
||||
GetHeaderComment = False
|
||||
Comments = []
|
||||
|
||||
for Index in range(0, len(Content)):
|
||||
# skip empty, commented, block commented lines
|
||||
Line = CleanString(Content[Index], AllowCppStyleComment=True)
|
||||
Line, Comment = CleanString2(Content[Index], AllowCppStyleComment=True)
|
||||
NextLine = ''
|
||||
if Index + 1 < len(Content):
|
||||
NextLine = CleanString(Content[Index + 1])
|
||||
NextLine, NextComment = CleanString2(Content[Index + 1])
|
||||
if Line == '':
|
||||
if Comment:
|
||||
Comments.append((Comment, Index + 1))
|
||||
continue
|
||||
if Line.find(DataType.TAB_COMMENT_EDK_START) > -1:
|
||||
IsFindBlockComment = True
|
||||
@@ -518,6 +522,12 @@ class InfParser(MetaFileParser):
|
||||
|
||||
# section header
|
||||
if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
|
||||
if not GetHeaderComment:
|
||||
for Cmt, LNo in Comments:
|
||||
self._Store(MODEL_META_DATA_HEADER_COMMENT, Cmt, '', '', 'COMMON',
|
||||
'COMMON', self._Owner[-1], LNo, -1, LNo, -1, 0)
|
||||
GetHeaderComment = True
|
||||
Comments = []
|
||||
self._SectionHeaderParser()
|
||||
# Check invalid sections
|
||||
if self._Version < 0x00010005:
|
||||
@@ -566,13 +576,16 @@ class InfParser(MetaFileParser):
|
||||
self._SectionParser[self._SectionType](self)
|
||||
if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE:
|
||||
self._ItemType = -1
|
||||
Comments = []
|
||||
continue
|
||||
if Comment:
|
||||
Comments.append((Comment, Index + 1))
|
||||
#
|
||||
# Model, Value1, Value2, Value3, Arch, Platform, BelongsToItem=-1,
|
||||
# LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
|
||||
#
|
||||
for Arch, Platform in self._Scope:
|
||||
self._Store(self._SectionType,
|
||||
LastItem = self._Store(self._SectionType,
|
||||
self._ValueList[0],
|
||||
self._ValueList[1],
|
||||
self._ValueList[2],
|
||||
@@ -585,6 +598,10 @@ class InfParser(MetaFileParser):
|
||||
- 1,
|
||||
0
|
||||
)
|
||||
for Comment, LineNo in Comments:
|
||||
self._Store(MODEL_META_DATA_COMMENT, Comment, '', '', Arch, Platform,
|
||||
LastItem, LineNo, -1, LineNo, -1, 0)
|
||||
Comments = []
|
||||
if IsFindBlockComment:
|
||||
EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */",
|
||||
File=self.MetaFile)
|
||||
@@ -770,6 +787,7 @@ class DscParser(MetaFileParser):
|
||||
"PLATFORM_GUID",
|
||||
"PLATFORM_VERSION",
|
||||
"SKUID_IDENTIFIER",
|
||||
"PCD_INFO_GENERATION",
|
||||
"SUPPORTED_ARCHITECTURES",
|
||||
"BUILD_TARGETS",
|
||||
"OUTPUT_DIRECTORY",
|
||||
|
@@ -134,7 +134,7 @@ class ModuleTable(MetaFileTable):
|
||||
#
|
||||
# @retval: A recordSet of all found records
|
||||
#
|
||||
def Query(self, Model, Arch=None, Platform=None):
|
||||
def Query(self, Model, Arch=None, Platform=None, BelongsToItem=None):
|
||||
ConditionString = "Model=%s AND Enabled>=0" % Model
|
||||
ValueString = "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine"
|
||||
|
||||
@@ -142,6 +142,8 @@ class ModuleTable(MetaFileTable):
|
||||
ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Arch
|
||||
if Platform != None and Platform != 'COMMON':
|
||||
ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Platform
|
||||
if BelongsToItem != None:
|
||||
ConditionString += " AND BelongsToItem=%s" % BelongsToItem
|
||||
|
||||
SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)
|
||||
return self.Exec(SqlCommand)
|
||||
|
@@ -70,7 +70,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
#TAB_DSC_DEFINES_OUTPUT_DIRECTORY : "_OutputDirectory",
|
||||
#TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES : "_SupArchList",
|
||||
#TAB_DSC_DEFINES_BUILD_TARGETS : "_BuildTargets",
|
||||
#TAB_DSC_DEFINES_SKUID_IDENTIFIER : "_SkuName",
|
||||
TAB_DSC_DEFINES_SKUID_IDENTIFIER : "_SkuName",
|
||||
#TAB_DSC_DEFINES_FLASH_DEFINITION : "_FlashDefinition",
|
||||
TAB_DSC_DEFINES_BUILD_NUMBER : "_BuildNumber",
|
||||
TAB_DSC_DEFINES_MAKEFILE_NAME : "_MakefileName",
|
||||
@@ -126,6 +126,8 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
self._SupArchList = None
|
||||
self._BuildTargets = None
|
||||
self._SkuName = None
|
||||
self._SkuIdentifier = None
|
||||
self._PcdInfoFlag = None
|
||||
self._FlashDefinition = None
|
||||
self._BuildNumber = None
|
||||
self._MakefileName = None
|
||||
@@ -181,10 +183,9 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
for Record in RecordList:
|
||||
Name = Record[1]
|
||||
# items defined _PROPERTY_ don't need additional processing
|
||||
if Name in self:
|
||||
self[Name] = Record[2]
|
||||
|
||||
# some special items in [Defines] section need special treatment
|
||||
elif Name == TAB_DSC_DEFINES_OUTPUT_DIRECTORY:
|
||||
if Name == TAB_DSC_DEFINES_OUTPUT_DIRECTORY:
|
||||
self._OutputDirectory = NormPath(Record[2], self._Macros)
|
||||
if ' ' in self._OutputDirectory:
|
||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in OUTPUT_DIRECTORY",
|
||||
@@ -203,6 +204,9 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
elif Name == TAB_DSC_DEFINES_SKUID_IDENTIFIER:
|
||||
if self._SkuName == None:
|
||||
self._SkuName = Record[2]
|
||||
self._SkuIdentifier = Record[2]
|
||||
elif Name == TAB_DSC_DEFINES_PCD_INFO_GENERATION:
|
||||
self._PcdInfoFlag = Record[2]
|
||||
elif Name == TAB_FIX_LOAD_TOP_MEMORY_ADDRESS:
|
||||
try:
|
||||
self._LoadFixAddress = int (Record[2], 0)
|
||||
@@ -247,6 +251,8 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
except:
|
||||
EdkLogger.error("build", FORMAT_INVALID, "Invalid GUID format for VPD_TOOL_GUID", File=self.MetaFile)
|
||||
self._VpdToolGuid = Record[2]
|
||||
elif Name in self:
|
||||
self[Name] = Record[2]
|
||||
# set _Header to non-None in order to avoid database re-querying
|
||||
self._Header = 'DUMMY'
|
||||
|
||||
@@ -312,7 +318,20 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
if self._BuildTargets == None:
|
||||
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No BUILD_TARGETS", File=self.MetaFile)
|
||||
return self._BuildTargets
|
||||
|
||||
|
||||
def _GetPcdInfoFlag(self):
|
||||
if self._PcdInfoFlag == None or self._PcdInfoFlag.upper() == 'FALSE':
|
||||
return False
|
||||
elif self._PcdInfoFlag.upper() == 'TRUE':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def _GetSkuIdentifier(self):
|
||||
if self._SkuIdentifier == None:
|
||||
if self._Header == None:
|
||||
self._GetHeaderInfo()
|
||||
return self._SkuIdentifier
|
||||
## Retrieve SKUID_IDENTIFIER
|
||||
def _GetSkuName(self):
|
||||
if self._SkuName == None:
|
||||
@@ -441,9 +460,11 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
if Record[1] in [None, '']:
|
||||
EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID name',
|
||||
File=self.MetaFile, Line=Record[-1])
|
||||
self._SkuIds[Record[1]] = Record[0]
|
||||
self._SkuIds[Record[1].upper()] = Record[0]
|
||||
if 'DEFAULT' not in self._SkuIds:
|
||||
self._SkuIds['DEFAULT'] = '0'
|
||||
if 'COMMON' not in self._SkuIds:
|
||||
self._SkuIds['COMMON'] = '0'
|
||||
return self._SkuIds
|
||||
|
||||
## Retrieve [Components] section information
|
||||
@@ -701,19 +722,45 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
# tdict is a special dict kind of type, used for selecting correct
|
||||
# PCD settings for certain ARCH
|
||||
#
|
||||
|
||||
SkuObj = SkuClass(self.SkuIdentifier,self.SkuIds)
|
||||
|
||||
PcdDict = tdict(True, 3)
|
||||
PcdSet = set()
|
||||
# Find out all possible PCD candidates for self._Arch
|
||||
RecordList = self._RawData[Type, self._Arch]
|
||||
PcdValueDict = sdict()
|
||||
for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4 in RecordList:
|
||||
PcdSet.add((PcdCName, TokenSpaceGuid, Dummy4))
|
||||
PcdDict[Arch, PcdCName, TokenSpaceGuid] = Setting
|
||||
# Remove redundant PCD candidates
|
||||
for PcdCName, TokenSpaceGuid, Dummy4 in PcdSet:
|
||||
Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid]
|
||||
SkuName = SkuName.upper()
|
||||
if SkuName in (SkuObj.SystemSkuId,'DEFAULT','COMMON'):
|
||||
PcdSet.add((PcdCName, TokenSpaceGuid, SkuName,Dummy4))
|
||||
PcdDict[Arch, PcdCName, TokenSpaceGuid,SkuName] = Setting
|
||||
|
||||
#handle pcd value override
|
||||
for PcdCName, TokenSpaceGuid, SkuName,Dummy4 in PcdSet:
|
||||
Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid,SkuName]
|
||||
if Setting == None:
|
||||
continue
|
||||
PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
|
||||
if (PcdCName, TokenSpaceGuid) in PcdValueDict:
|
||||
PcdValueDict[PcdCName, TokenSpaceGuid][SkuName] = (PcdValue,DatumType,MaxDatumSize)
|
||||
else:
|
||||
PcdValueDict[PcdCName, TokenSpaceGuid] = {SkuName:(PcdValue,DatumType,MaxDatumSize)}
|
||||
|
||||
PcdsKeys = PcdValueDict.keys()
|
||||
for PcdCName,TokenSpaceGuid in PcdsKeys:
|
||||
|
||||
PcdSetting = PcdValueDict[PcdCName, TokenSpaceGuid]
|
||||
PcdValue = None
|
||||
DatumType = None
|
||||
MaxDatumSize = None
|
||||
if 'COMMON' in PcdSetting:
|
||||
PcdValue,DatumType,MaxDatumSize = PcdSetting['COMMON']
|
||||
if 'DEFAULT' in PcdSetting:
|
||||
PcdValue,DatumType,MaxDatumSize = PcdSetting['DEFAULT']
|
||||
if SkuObj.SystemSkuId in PcdSetting:
|
||||
PcdValue,DatumType,MaxDatumSize = PcdSetting[SkuObj.SystemSkuId]
|
||||
|
||||
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
|
||||
PcdCName,
|
||||
TokenSpaceGuid,
|
||||
@@ -735,6 +782,9 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
# @retval a dict object contains settings of given PCD type
|
||||
#
|
||||
def _GetDynamicPcd(self, Type):
|
||||
|
||||
SkuObj = SkuClass(self.SkuIdentifier,self.SkuIds)
|
||||
|
||||
Pcds = sdict()
|
||||
#
|
||||
# tdict is a special dict kind of type, used for selecting correct
|
||||
@@ -744,30 +794,68 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
PcdList = []
|
||||
# Find out all possible PCD candidates for self._Arch
|
||||
RecordList = self._RawData[Type, self._Arch]
|
||||
AvailableSkuIdSet = SkuObj.AvailableSkuIdSet.copy()
|
||||
|
||||
AvailableSkuIdSet.update({'DEFAULT':0,'COMMON':0})
|
||||
for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4 in RecordList:
|
||||
PcdList.append((PcdCName, TokenSpaceGuid, Dummy4))
|
||||
SkuName = SkuName.upper()
|
||||
if SkuName not in AvailableSkuIdSet:
|
||||
continue
|
||||
|
||||
PcdList.append((PcdCName, TokenSpaceGuid, SkuName,Dummy4))
|
||||
PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid] = Setting
|
||||
# Remove redundant PCD candidates, per the ARCH and SKU
|
||||
for PcdCName, TokenSpaceGuid, Dummy4 in PcdList:
|
||||
Setting = PcdDict[self._Arch, self.SkuName, PcdCName, TokenSpaceGuid]
|
||||
for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList:
|
||||
|
||||
Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid]
|
||||
if Setting == None:
|
||||
continue
|
||||
|
||||
PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
|
||||
SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName], '', '', '', '', '', PcdValue)
|
||||
if (PcdCName,TokenSpaceGuid) in Pcds.keys():
|
||||
pcdObject = Pcds[PcdCName,TokenSpaceGuid]
|
||||
pcdObject.SkuInfoList[SkuName] = SkuInfo
|
||||
else:
|
||||
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
|
||||
PcdCName,
|
||||
TokenSpaceGuid,
|
||||
self._PCD_TYPE_STRING_[Type],
|
||||
DatumType,
|
||||
PcdValue,
|
||||
'',
|
||||
MaxDatumSize,
|
||||
{SkuName : SkuInfo},
|
||||
False,
|
||||
None
|
||||
)
|
||||
|
||||
for pcd in Pcds.values():
|
||||
if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():
|
||||
pcdDecObject = self._DecPcds[pcd.TokenCName,pcd.TokenSpaceGuidCName]
|
||||
valuefromDec = pcdDecObject.DefaultValue
|
||||
SkuInfo = SkuInfoClass('DEFAULT', '0', '', '', '', '', '', valuefromDec)
|
||||
pcd.SkuInfoList['DEFAULT'] = SkuInfo
|
||||
elif 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' in pcd.SkuInfoList.keys():
|
||||
pcd.SkuInfoList['DEFAULT'] = pcd.SkuInfoList['COMMON']
|
||||
del(pcd.SkuInfoList['COMMON'])
|
||||
elif 'DEFAULT' in pcd.SkuInfoList.keys() and 'COMMON' in pcd.SkuInfoList.keys():
|
||||
del(pcd.SkuInfoList['COMMON'])
|
||||
if SkuObj.SkuUsageType == SkuObj.SINGLE:
|
||||
if 'DEFAULT' in pcd.SkuInfoList.keys() and SkuObj.SystemSkuId not in pcd.SkuInfoList.keys():
|
||||
pcd.SkuInfoList[SkuObj.SystemSkuId] = pcd.SkuInfoList['DEFAULT']
|
||||
del(pcd.SkuInfoList['DEFAULT'])
|
||||
|
||||
if SkuObj.SkuUsageType == SkuObj.MULTIPLE:
|
||||
if pcd.DatumType == "VOID*":
|
||||
MaxSize = int(pcd.MaxDatumSize,0)
|
||||
for (skuname,skuobj) in pcd.SkuInfoList.items():
|
||||
datalen = len(skuobj.DefaultValue)
|
||||
if datalen>MaxSize:
|
||||
MaxSize = datalen
|
||||
pcd.MaxDatumSize = str(MaxSize)
|
||||
|
||||
|
||||
SkuInfo = SkuInfoClass(self.SkuName, self.SkuIds[self.SkuName], '', '', '', '', '', PcdValue)
|
||||
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
|
||||
PcdCName,
|
||||
TokenSpaceGuid,
|
||||
self._PCD_TYPE_STRING_[Type],
|
||||
DatumType,
|
||||
PcdValue,
|
||||
'',
|
||||
MaxDatumSize,
|
||||
{self.SkuName : SkuInfo},
|
||||
False,
|
||||
None
|
||||
)
|
||||
return Pcds
|
||||
|
||||
## Retrieve dynamic HII PCD settings
|
||||
@@ -777,6 +865,9 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
# @retval a dict object contains settings of given PCD type
|
||||
#
|
||||
def _GetDynamicHiiPcd(self, Type):
|
||||
|
||||
SkuObj = SkuClass(self.SkuIdentifier,self.SkuIds)
|
||||
|
||||
Pcds = sdict()
|
||||
#
|
||||
# tdict is a special dict kind of type, used for selecting correct
|
||||
@@ -786,17 +877,28 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
PcdSet = set()
|
||||
RecordList = self._RawData[Type, self._Arch]
|
||||
# Find out all possible PCD candidates for self._Arch
|
||||
AvailableSkuIdSet = SkuObj.AvailableSkuIdSet.copy()
|
||||
|
||||
AvailableSkuIdSet.update({'DEFAULT':0,'COMMON':0})
|
||||
for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4 in RecordList:
|
||||
PcdSet.add((PcdCName, TokenSpaceGuid, Dummy4))
|
||||
SkuName = SkuName.upper()
|
||||
if SkuName not in AvailableSkuIdSet:
|
||||
continue
|
||||
PcdSet.add((PcdCName, TokenSpaceGuid, SkuName,Dummy4))
|
||||
PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid] = Setting
|
||||
# Remove redundant PCD candidates, per the ARCH and SKU
|
||||
for PcdCName, TokenSpaceGuid, Dummy4 in PcdSet:
|
||||
Setting = PcdDict[self._Arch, self.SkuName, PcdCName, TokenSpaceGuid]
|
||||
for PcdCName, TokenSpaceGuid,SkuName, Dummy4 in PcdSet:
|
||||
|
||||
Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid]
|
||||
if Setting == None:
|
||||
continue
|
||||
VariableName, VariableGuid, VariableOffset, DefaultValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
|
||||
SkuInfo = SkuInfoClass(self.SkuName, self.SkuIds[self.SkuName], VariableName, VariableGuid, VariableOffset, DefaultValue)
|
||||
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
|
||||
SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName], VariableName, VariableGuid, VariableOffset, DefaultValue)
|
||||
if (PcdCName,TokenSpaceGuid) in Pcds.keys():
|
||||
pcdObject = Pcds[PcdCName,TokenSpaceGuid]
|
||||
pcdObject.SkuInfoList[SkuName] = SkuInfo
|
||||
else:
|
||||
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
|
||||
PcdCName,
|
||||
TokenSpaceGuid,
|
||||
self._PCD_TYPE_STRING_[Type],
|
||||
@@ -804,10 +906,29 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
DefaultValue,
|
||||
'',
|
||||
'',
|
||||
{self.SkuName : SkuInfo},
|
||||
{SkuName : SkuInfo},
|
||||
False,
|
||||
None
|
||||
)
|
||||
|
||||
|
||||
for pcd in Pcds.values():
|
||||
SkuInfoObj = pcd.SkuInfoList.values()[0]
|
||||
if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():
|
||||
pcdDecObject = self._DecPcds[pcd.TokenCName,pcd.TokenSpaceGuidCName]
|
||||
valuefromDec = pcdDecObject.DefaultValue
|
||||
SkuInfo = SkuInfoClass('DEFAULT', '0', SkuInfoObj.VariableName, SkuInfoObj.VariableGuid, SkuInfoObj.VariableOffset, valuefromDec)
|
||||
pcd.SkuInfoList['DEFAULT'] = SkuInfo
|
||||
elif 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' in pcd.SkuInfoList.keys():
|
||||
pcd.SkuInfoList['DEFAULT'] = pcd.SkuInfoList['COMMON']
|
||||
del(pcd.SkuInfoList['COMMON'])
|
||||
elif 'DEFAULT' in pcd.SkuInfoList.keys() and 'COMMON' in pcd.SkuInfoList.keys():
|
||||
del(pcd.SkuInfoList['COMMON'])
|
||||
|
||||
if SkuObj.SkuUsageType == SkuObj.SINGLE:
|
||||
if 'DEFAULT' in pcd.SkuInfoList.keys() and SkuObj.SystemSkuId not in pcd.SkuInfoList.keys():
|
||||
pcd.SkuInfoList[SkuObj.SystemSkuId] = pcd.SkuInfoList['DEFAULT']
|
||||
del(pcd.SkuInfoList['DEFAULT'])
|
||||
return Pcds
|
||||
|
||||
## Retrieve dynamic VPD PCD settings
|
||||
@@ -817,6 +938,9 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
# @retval a dict object contains settings of given PCD type
|
||||
#
|
||||
def _GetDynamicVpdPcd(self, Type):
|
||||
|
||||
SkuObj = SkuClass(self.SkuIdentifier,self.SkuIds)
|
||||
|
||||
Pcds = sdict()
|
||||
#
|
||||
# tdict is a special dict kind of type, used for selecting correct
|
||||
@@ -826,12 +950,19 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
PcdList = []
|
||||
# Find out all possible PCD candidates for self._Arch
|
||||
RecordList = self._RawData[Type, self._Arch]
|
||||
AvailableSkuIdSet = SkuObj.AvailableSkuIdSet.copy()
|
||||
|
||||
AvailableSkuIdSet.update({'DEFAULT':0,'COMMON':0})
|
||||
for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4 in RecordList:
|
||||
PcdList.append((PcdCName, TokenSpaceGuid, Dummy4))
|
||||
SkuName = SkuName.upper()
|
||||
if SkuName not in AvailableSkuIdSet:
|
||||
continue
|
||||
|
||||
PcdList.append((PcdCName, TokenSpaceGuid,SkuName, Dummy4))
|
||||
PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid] = Setting
|
||||
# Remove redundant PCD candidates, per the ARCH and SKU
|
||||
for PcdCName, TokenSpaceGuid, Dummy4 in PcdList:
|
||||
Setting = PcdDict[self._Arch, self.SkuName, PcdCName, TokenSpaceGuid]
|
||||
for PcdCName, TokenSpaceGuid, SkuName,Dummy4 in PcdList:
|
||||
Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid]
|
||||
if Setting == None:
|
||||
continue
|
||||
#
|
||||
@@ -841,9 +972,12 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
# until the DEC parser has been called.
|
||||
#
|
||||
VpdOffset, MaxDatumSize, InitialValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
|
||||
|
||||
SkuInfo = SkuInfoClass(self.SkuName, self.SkuIds[self.SkuName], '', '', '', '', VpdOffset, InitialValue)
|
||||
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
|
||||
SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName], '', '', '', '', VpdOffset, InitialValue)
|
||||
if (PcdCName,TokenSpaceGuid) in Pcds.keys():
|
||||
pcdObject = Pcds[PcdCName,TokenSpaceGuid]
|
||||
pcdObject.SkuInfoList[SkuName] = SkuInfo
|
||||
else:
|
||||
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
|
||||
PcdCName,
|
||||
TokenSpaceGuid,
|
||||
self._PCD_TYPE_STRING_[Type],
|
||||
@@ -851,10 +985,35 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
'',
|
||||
'',
|
||||
MaxDatumSize,
|
||||
{self.SkuName : SkuInfo},
|
||||
{SkuName : SkuInfo},
|
||||
False,
|
||||
None
|
||||
)
|
||||
for pcd in Pcds.values():
|
||||
SkuInfoObj = pcd.SkuInfoList.values()[0]
|
||||
if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():
|
||||
pcdDecObject = self._DecPcds[pcd.TokenCName,pcd.TokenSpaceGuidCName]
|
||||
valuefromDec = pcdDecObject.DefaultValue
|
||||
SkuInfo = SkuInfoClass('DEFAULT', '0', '', '', '','',SkuInfoObj.VpdOffset, valuefromDec)
|
||||
pcd.SkuInfoList['DEFAULT'] = SkuInfo
|
||||
elif 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' in pcd.SkuInfoList.keys():
|
||||
pcd.SkuInfoList['DEFAULT'] = pcd.SkuInfoList['COMMON']
|
||||
del(pcd.SkuInfoList['COMMON'])
|
||||
elif 'DEFAULT' in pcd.SkuInfoList.keys() and 'COMMON' in pcd.SkuInfoList.keys():
|
||||
del(pcd.SkuInfoList['COMMON'])
|
||||
if SkuObj.SkuUsageType == SkuObj.SINGLE:
|
||||
if 'DEFAULT' in pcd.SkuInfoList.keys() and SkuObj.SystemSkuId not in pcd.SkuInfoList.keys():
|
||||
pcd.SkuInfoList[SkuObj.SystemSkuId] = pcd.SkuInfoList['DEFAULT']
|
||||
del(pcd.SkuInfoList['DEFAULT'])
|
||||
|
||||
if SkuObj.SkuUsageType == SkuObj.MULTIPLE:
|
||||
if pcd.MaxDatumSize.strip():
|
||||
MaxSize = int(pcd.MaxDatumSize,0)
|
||||
for (skuname,skuobj) in pcd.SkuInfoList.items():
|
||||
datalen = len(skuobj.DefaultValue)
|
||||
if datalen>MaxSize:
|
||||
MaxSize = datalen
|
||||
pcd.MaxDatumSize = str(MaxSize)
|
||||
return Pcds
|
||||
|
||||
## Add external modules
|
||||
@@ -896,6 +1055,8 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
SupArchList = property(_GetSupArch)
|
||||
BuildTargets = property(_GetBuildTarget)
|
||||
SkuName = property(_GetSkuName, _SetSkuName)
|
||||
SkuIdentifier = property(_GetSkuIdentifier)
|
||||
PcdInfoFlag = property(_GetPcdInfoFlag)
|
||||
FlashDefinition = property(_GetFdfFile)
|
||||
BuildNumber = property(_GetBuildNumber)
|
||||
MakefileName = property(_GetMakefileName)
|
||||
@@ -1358,6 +1519,7 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
|
||||
## Set all internal used members of InfBuildData to None
|
||||
def _Clear(self):
|
||||
self._HeaderComments = None
|
||||
self._Header_ = None
|
||||
self._AutoGenVersion = None
|
||||
self._BaseName = None
|
||||
@@ -1384,11 +1546,16 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
self._LibraryClasses = None
|
||||
self._Libraries = None
|
||||
self._Protocols = None
|
||||
self._ProtocolComments = None
|
||||
self._Ppis = None
|
||||
self._PpiComments = None
|
||||
self._Guids = None
|
||||
self._GuidsUsedByPcd = sdict()
|
||||
self._GuidComments = None
|
||||
self._Includes = None
|
||||
self._Packages = None
|
||||
self._Pcds = None
|
||||
self._PcdComments = None
|
||||
self._BuildOptions = None
|
||||
self._Depex = None
|
||||
self._DepexExpression = None
|
||||
@@ -1438,6 +1605,13 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
return
|
||||
self._Platform = Value
|
||||
self._Clear()
|
||||
def _GetHeaderComments(self):
|
||||
if not self._HeaderComments:
|
||||
self._HeaderComments = []
|
||||
RecordList = self._RawData[MODEL_META_DATA_HEADER_COMMENT]
|
||||
for Record in RecordList:
|
||||
self._HeaderComments.append(Record[0])
|
||||
return self._HeaderComments
|
||||
|
||||
## Retrieve all information in [Defines] section
|
||||
#
|
||||
@@ -1873,10 +2047,14 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
self._Libraries.append(LibraryName)
|
||||
return self._Libraries
|
||||
|
||||
def _GetProtocolComments(self):
|
||||
self._GetProtocols()
|
||||
return self._ProtocolComments
|
||||
## Retrieve protocols consumed/produced by this module
|
||||
def _GetProtocols(self):
|
||||
if self._Protocols == None:
|
||||
self._Protocols = sdict()
|
||||
self._ProtocolComments = sdict()
|
||||
RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch, self._Platform]
|
||||
for Record in RecordList:
|
||||
CName = Record[0]
|
||||
@@ -1887,12 +2065,21 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
"Value of Protocol [%s] is not found under [Protocols] section in" % CName,
|
||||
ExtraData=PackageList, File=self.MetaFile, Line=Record[-1])
|
||||
self._Protocols[CName] = Value
|
||||
CommentRecords = self._RawData[MODEL_META_DATA_COMMENT, self._Arch, self._Platform, Record[5]]
|
||||
Comments = []
|
||||
for CmtRec in CommentRecords:
|
||||
Comments.append(CmtRec[0])
|
||||
self._ProtocolComments[CName] = Comments
|
||||
return self._Protocols
|
||||
|
||||
def _GetPpiComments(self):
|
||||
self._GetPpis()
|
||||
return self._PpiComments
|
||||
## Retrieve PPIs consumed/produced by this module
|
||||
def _GetPpis(self):
|
||||
if self._Ppis == None:
|
||||
self._Ppis = sdict()
|
||||
self._PpiComments = sdict()
|
||||
RecordList = self._RawData[MODEL_EFI_PPI, self._Arch, self._Platform]
|
||||
for Record in RecordList:
|
||||
CName = Record[0]
|
||||
@@ -1903,12 +2090,21 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
"Value of PPI [%s] is not found under [Ppis] section in " % CName,
|
||||
ExtraData=PackageList, File=self.MetaFile, Line=Record[-1])
|
||||
self._Ppis[CName] = Value
|
||||
CommentRecords = self._RawData[MODEL_META_DATA_COMMENT, self._Arch, self._Platform, Record[5]]
|
||||
Comments = []
|
||||
for CmtRec in CommentRecords:
|
||||
Comments.append(CmtRec[0])
|
||||
self._PpiComments[CName] = Comments
|
||||
return self._Ppis
|
||||
|
||||
def _GetGuidComments(self):
|
||||
self._GetGuids()
|
||||
return self._GuidComments
|
||||
## Retrieve GUIDs consumed/produced by this module
|
||||
def _GetGuids(self):
|
||||
if self._Guids == None:
|
||||
self._Guids = sdict()
|
||||
self._GuidComments = sdict()
|
||||
RecordList = self._RawData[MODEL_EFI_GUID, self._Arch, self._Platform]
|
||||
for Record in RecordList:
|
||||
CName = Record[0]
|
||||
@@ -1919,6 +2115,11 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
"Value of Guid [%s] is not found under [Guids] section in" % CName,
|
||||
ExtraData=PackageList, File=self.MetaFile, Line=Record[-1])
|
||||
self._Guids[CName] = Value
|
||||
CommentRecords = self._RawData[MODEL_META_DATA_COMMENT, self._Arch, self._Platform, Record[5]]
|
||||
Comments = []
|
||||
for CmtRec in CommentRecords:
|
||||
Comments.append(CmtRec[0])
|
||||
self._GuidComments[CName] = Comments
|
||||
return self._Guids
|
||||
|
||||
## Retrieve include paths necessary for this module (for Edk.x style of modules)
|
||||
@@ -1986,10 +2187,15 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
self._Packages.append(Package)
|
||||
return self._Packages
|
||||
|
||||
## Retrieve PCD comments
|
||||
def _GetPcdComments(self):
|
||||
self._GetPcds()
|
||||
return self._PcdComments
|
||||
## Retrieve PCDs used in this module
|
||||
def _GetPcds(self):
|
||||
if self._Pcds == None:
|
||||
self._Pcds = sdict()
|
||||
self._PcdComments = sdict()
|
||||
self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))
|
||||
self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))
|
||||
self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG))
|
||||
@@ -2087,13 +2293,15 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
self._DepexExpression[Arch, ModuleType] = DepexExpression[Arch, ModuleType]
|
||||
return self._DepexExpression
|
||||
|
||||
def GetGuidsUsedByPcd(self):
|
||||
return self._GuidsUsedByPcd
|
||||
## Retrieve PCD for given type
|
||||
def _GetPcd(self, Type):
|
||||
Pcds = sdict()
|
||||
PcdDict = tdict(True, 4)
|
||||
PcdList = []
|
||||
RecordList = self._RawData[Type, self._Arch, self._Platform]
|
||||
for TokenSpaceGuid, PcdCName, Setting, Arch, Platform, Dummy1, LineNo in RecordList:
|
||||
for TokenSpaceGuid, PcdCName, Setting, Arch, Platform, Id, LineNo in RecordList:
|
||||
PcdDict[Arch, Platform, PcdCName, TokenSpaceGuid] = (Setting, LineNo)
|
||||
PcdList.append((PcdCName, TokenSpaceGuid))
|
||||
# get the guid value
|
||||
@@ -2105,6 +2313,12 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
"Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid,
|
||||
ExtraData=PackageList, File=self.MetaFile, Line=LineNo)
|
||||
self.Guids[TokenSpaceGuid] = Value
|
||||
self._GuidsUsedByPcd[TokenSpaceGuid] = Value
|
||||
CommentRecords = self._RawData[MODEL_META_DATA_COMMENT, self._Arch, self._Platform, Id]
|
||||
Comments = []
|
||||
for CmtRec in CommentRecords:
|
||||
Comments.append(CmtRec[0])
|
||||
self._PcdComments[TokenSpaceGuid, PcdCName] = Comments
|
||||
|
||||
# resolve PCD type, value, datum info, etc. by getting its definition from package
|
||||
for PcdCName, TokenSpaceGuid in PcdList:
|
||||
@@ -2125,6 +2339,9 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
False,
|
||||
self.Guids[TokenSpaceGuid]
|
||||
)
|
||||
if Type == MODEL_PCD_PATCHABLE_IN_MODULE and ValueList[1]:
|
||||
# Patch PCD: TokenSpace.PcdCName|Value|Offset
|
||||
Pcd.Offset = ValueList[1]
|
||||
|
||||
# get necessary info from package declaring this PCD
|
||||
for Package in self.Packages:
|
||||
@@ -2216,10 +2433,20 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
|
||||
return Pcds
|
||||
|
||||
_Macros = property(_GetMacros)
|
||||
Arch = property(_GetArch, _SetArch)
|
||||
Platform = property(_GetPlatform, _SetPlatform)
|
||||
## check whether current module is binary module
|
||||
def _IsBinaryModule(self):
|
||||
if self.Binaries and not self.Sources:
|
||||
return True
|
||||
elif GlobalData.gIgnoreSource:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
_Macros = property(_GetMacros)
|
||||
Arch = property(_GetArch, _SetArch)
|
||||
Platform = property(_GetPlatform, _SetPlatform)
|
||||
|
||||
HeaderComments = property(_GetHeaderComments)
|
||||
AutoGenVersion = property(_GetInfVersion)
|
||||
BaseName = property(_GetBaseName)
|
||||
ModuleType = property(_GetModuleType)
|
||||
@@ -2244,14 +2471,19 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
LibraryClasses = property(_GetLibraryClassUses)
|
||||
Libraries = property(_GetLibraryNames)
|
||||
Protocols = property(_GetProtocols)
|
||||
ProtocolComments = property(_GetProtocolComments)
|
||||
Ppis = property(_GetPpis)
|
||||
PpiComments = property(_GetPpiComments)
|
||||
Guids = property(_GetGuids)
|
||||
GuidComments = property(_GetGuidComments)
|
||||
Includes = property(_GetIncludes)
|
||||
Packages = property(_GetPackages)
|
||||
Pcds = property(_GetPcds)
|
||||
PcdComments = property(_GetPcdComments)
|
||||
BuildOptions = property(_GetBuildOptions)
|
||||
Depex = property(_GetDepex)
|
||||
DepexExpression = property(_GetDepexExpression)
|
||||
IsBinaryModule = property(_IsBinaryModule)
|
||||
|
||||
## Database
|
||||
#
|
||||
|
@@ -1433,8 +1433,8 @@ class Build():
|
||||
Ma.CreateAsBuiltInf()
|
||||
if self.Target == "genmake":
|
||||
continue
|
||||
self.Progress.Stop("done!")
|
||||
pModules.append(Ma)
|
||||
self.Progress.Stop("done!")
|
||||
|
||||
for Ma in pModules:
|
||||
# Generate build task for the module
|
||||
|
Reference in New Issue
Block a user