mirror of https://github.com/acidanthera/audk.git
BaseTools: Replace PCD type strings with predefined constant
Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
parent
eece4292ac
commit
be409b6756
|
@ -869,8 +869,8 @@ class WorkspaceAutoGen(AutoGen):
|
|||
def _CheckPcdDefineAndType(self):
|
||||
PcdTypeList = [
|
||||
TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG,
|
||||
TAB_PCDS_DYNAMIC, #"DynamicHii", "DynamicVpd",
|
||||
TAB_PCDS_DYNAMIC_EX, # "DynamicExHii", "DynamicExVpd"
|
||||
TAB_PCDS_DYNAMIC, #TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_VPD,
|
||||
TAB_PCDS_DYNAMIC_EX, # TAB_PCDS_DYNAMIC_EX_HII, TAB_PCDS_DYNAMIC_EX_VPD
|
||||
]
|
||||
|
||||
# This dict store PCDs which are not used by any modules with specified arches
|
||||
|
|
|
@ -28,8 +28,8 @@ from IdfClassObject import *
|
|||
|
||||
## PCD type string
|
||||
gItemTypeStringDatabase = {
|
||||
TAB_PCDS_FEATURE_FLAG : 'FixedAtBuild',
|
||||
TAB_PCDS_FIXED_AT_BUILD : 'FixedAtBuild',
|
||||
TAB_PCDS_FEATURE_FLAG : TAB_PCDS_FIXED_AT_BUILD,
|
||||
TAB_PCDS_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
|
||||
TAB_PCDS_PATCHABLE_IN_MODULE: 'BinaryPatch',
|
||||
TAB_PCDS_DYNAMIC : '',
|
||||
TAB_PCDS_DYNAMIC_DEFAULT : '',
|
||||
|
|
|
@ -1217,7 +1217,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||
Pcd.InitString = 'UNINIT'
|
||||
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
if Pcd.Type not in ["DynamicVpd", "DynamicExVpd"]:
|
||||
if Pcd.Type not in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
|
||||
Pcd.TokenTypeList = ['PCD_TYPE_STRING']
|
||||
else:
|
||||
Pcd.TokenTypeList = []
|
||||
|
|
|
@ -220,6 +220,9 @@ TAB_PCDS_DYNAMIC_HII = 'DynamicHii'
|
|||
PCD_DYNAMIC_TYPE_SET = {TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII}
|
||||
PCD_DYNAMIC_EX_TYPE_SET = {TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII}
|
||||
|
||||
# leave as a list for order
|
||||
PCD_TYPE_LIST = [TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX]
|
||||
|
||||
TAB_PCDS_FIXED_AT_BUILD_NULL = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD
|
||||
TAB_PCDS_FIXED_AT_BUILD_COMMON = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_COMMON
|
||||
TAB_PCDS_FIXED_AT_BUILD_IA32 = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_IA32
|
||||
|
|
|
@ -34,7 +34,7 @@ def SetCommon(Common, XmlCommon):
|
|||
XmlTag = "Usage"
|
||||
Common.Usage = XmlAttribute(XmlCommon, XmlTag).split()
|
||||
|
||||
XmlTag = "FeatureFlag"
|
||||
XmlTag = TAB_PCDS_FEATURE_FLAG
|
||||
Common.FeatureFlag = XmlAttribute(XmlCommon, XmlTag)
|
||||
|
||||
XmlTag = "SupArchList"
|
||||
|
|
|
@ -249,7 +249,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
|||
Pcd = InfPcds[PcdKey]
|
||||
if not hasattr(Pcd, 'Offset'):
|
||||
continue
|
||||
if Pcd.Type != 'PatchableInModule':
|
||||
if Pcd.Type != TAB_PCDS_PATCHABLE_IN_MODULE:
|
||||
continue
|
||||
# Override Patchable PCD value by the value from DSC
|
||||
PatchPcd = None
|
||||
|
|
|
@ -809,7 +809,7 @@ class GenFdsGlobalVariable:
|
|||
for Key in PcdDict:
|
||||
PcdObj = PcdDict[Key]
|
||||
if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
|
||||
if PcdObj.Type != 'FixedAtBuild':
|
||||
if PcdObj.Type != DataType.TAB_PCDS_FIXED_AT_BUILD:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
|
||||
if PcdObj.DatumType != DataType.TAB_VOID:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
|
||||
|
@ -825,7 +825,7 @@ class GenFdsGlobalVariable:
|
|||
for Key in PcdDict:
|
||||
PcdObj = PcdDict[Key]
|
||||
if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
|
||||
if PcdObj.Type != 'FixedAtBuild':
|
||||
if PcdObj.Type != DataType.TAB_PCDS_FIXED_AT_BUILD:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
|
||||
if PcdObj.DatumType != DataType.TAB_VOID:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
|
||||
|
|
|
@ -27,17 +27,17 @@ from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, Pc
|
|||
class DecBuildData(PackageBuildClassObject):
|
||||
# dict used to convert PCD type in database to string used by build tool
|
||||
_PCD_TYPE_STRING_ = {
|
||||
MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild",
|
||||
MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule",
|
||||
MODEL_PCD_FEATURE_FLAG : "FeatureFlag",
|
||||
MODEL_PCD_DYNAMIC : "Dynamic",
|
||||
MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic",
|
||||
MODEL_PCD_DYNAMIC_HII : "DynamicHii",
|
||||
MODEL_PCD_DYNAMIC_VPD : "DynamicVpd",
|
||||
MODEL_PCD_DYNAMIC_EX : "DynamicEx",
|
||||
MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx",
|
||||
MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii",
|
||||
MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd",
|
||||
MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
|
||||
MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
|
||||
MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
|
||||
MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
|
||||
MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
|
||||
MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
|
||||
MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
|
||||
MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
|
||||
MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
|
||||
MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
|
||||
MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
|
||||
}
|
||||
|
||||
# dict used to convert part of [Defines] to members of DecBuildData directly
|
||||
|
|
|
@ -158,17 +158,17 @@ def GetDependencyList(FileStack,SearchPathList):
|
|||
class DscBuildData(PlatformBuildClassObject):
|
||||
# dict used to convert PCD type in database to string used by build tool
|
||||
_PCD_TYPE_STRING_ = {
|
||||
MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild",
|
||||
MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule",
|
||||
MODEL_PCD_FEATURE_FLAG : "FeatureFlag",
|
||||
MODEL_PCD_DYNAMIC : "Dynamic",
|
||||
MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic",
|
||||
MODEL_PCD_DYNAMIC_HII : "DynamicHii",
|
||||
MODEL_PCD_DYNAMIC_VPD : "DynamicVpd",
|
||||
MODEL_PCD_DYNAMIC_EX : "DynamicEx",
|
||||
MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx",
|
||||
MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii",
|
||||
MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd",
|
||||
MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
|
||||
MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
|
||||
MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
|
||||
MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
|
||||
MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
|
||||
MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
|
||||
MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
|
||||
MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
|
||||
MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
|
||||
MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
|
||||
MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
|
||||
}
|
||||
|
||||
# dict used to convert part of [Defines] to members of DscBuildData directly
|
||||
|
|
|
@ -28,17 +28,17 @@ from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClassObjec
|
|||
class InfBuildData(ModuleBuildClassObject):
|
||||
# dict used to convert PCD type in database to string used by build tool
|
||||
_PCD_TYPE_STRING_ = {
|
||||
MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild",
|
||||
MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule",
|
||||
MODEL_PCD_FEATURE_FLAG : "FeatureFlag",
|
||||
MODEL_PCD_DYNAMIC : "Dynamic",
|
||||
MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic",
|
||||
MODEL_PCD_DYNAMIC_HII : "DynamicHii",
|
||||
MODEL_PCD_DYNAMIC_VPD : "DynamicVpd",
|
||||
MODEL_PCD_DYNAMIC_EX : "DynamicEx",
|
||||
MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx",
|
||||
MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii",
|
||||
MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd",
|
||||
MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
|
||||
MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
|
||||
MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
|
||||
MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
|
||||
MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
|
||||
MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
|
||||
MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
|
||||
MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
|
||||
MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
|
||||
MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
|
||||
MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
|
||||
}
|
||||
|
||||
# dict used to convert part of [Defines] to members of InfBuildData directly
|
||||
|
@ -1026,13 +1026,13 @@ class InfBuildData(ModuleBuildClassObject):
|
|||
# if platform doesn't give its type, use 'lowest' one in the
|
||||
# following order, if any
|
||||
#
|
||||
# "FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"
|
||||
# TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX
|
||||
#
|
||||
_GuidDict.update(Package.Guids)
|
||||
PcdType = self._PCD_TYPE_STRING_[Type]
|
||||
if Type == MODEL_PCD_DYNAMIC:
|
||||
Pcd.Pending = True
|
||||
for T in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
|
||||
for T in PCD_TYPE_LIST:
|
||||
if (PcdRealName, TokenSpaceGuid) in GlobalData.MixedPcd:
|
||||
for item in GlobalData.MixedPcd[(PcdRealName, TokenSpaceGuid)]:
|
||||
if str(item[0]).endswith(T) and (item[0], item[1], T) in Package.Pcds:
|
||||
|
|
|
@ -94,15 +94,15 @@ gSubSectionSep = "-" * gLineMaxLength
|
|||
|
||||
## The look up table to map PCD type to pair of report display type and DEC type
|
||||
gPcdTypeMap = {
|
||||
'FixedAtBuild' : ('FIXED', 'FixedAtBuild'),
|
||||
'PatchableInModule': ('PATCH', 'PatchableInModule'),
|
||||
'FeatureFlag' : ('FLAG', 'FeatureFlag'),
|
||||
'Dynamic' : ('DYN', 'Dynamic'),
|
||||
'DynamicHii' : ('DYNHII', 'Dynamic'),
|
||||
'DynamicVpd' : ('DYNVPD', 'Dynamic'),
|
||||
'DynamicEx' : ('DEX', 'DynamicEx'),
|
||||
'DynamicExHii' : ('DEXHII', 'DynamicEx'),
|
||||
'DynamicExVpd' : ('DEXVPD', 'DynamicEx'),
|
||||
TAB_PCDS_FIXED_AT_BUILD : ('FIXED', TAB_PCDS_FIXED_AT_BUILD),
|
||||
TAB_PCDS_PATCHABLE_IN_MODULE: ('PATCH', TAB_PCDS_PATCHABLE_IN_MODULE),
|
||||
TAB_PCDS_FEATURE_FLAG : ('FLAG', TAB_PCDS_FEATURE_FLAG),
|
||||
TAB_PCDS_DYNAMIC : ('DYN', TAB_PCDS_DYNAMIC),
|
||||
TAB_PCDS_DYNAMIC_HII : ('DYNHII', TAB_PCDS_DYNAMIC),
|
||||
TAB_PCDS_DYNAMIC_VPD : ('DYNVPD', TAB_PCDS_DYNAMIC),
|
||||
TAB_PCDS_DYNAMIC_EX : ('DEX', TAB_PCDS_DYNAMIC_EX),
|
||||
TAB_PCDS_DYNAMIC_EX_HII : ('DEXHII', TAB_PCDS_DYNAMIC_EX),
|
||||
TAB_PCDS_DYNAMIC_EX_VPD : ('DEXVPD', TAB_PCDS_DYNAMIC_EX),
|
||||
}
|
||||
|
||||
## The look up table to map module type to driver type
|
||||
|
@ -784,7 +784,7 @@ class PcdReport(object):
|
|||
Pcd = Pa.Platform.Pcds[item]
|
||||
if not Pcd.Type:
|
||||
# check the Pcd in FDF file, whether it is used in module first
|
||||
for T in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
|
||||
for T in PCD_TYPE_LIST:
|
||||
PcdList = self.AllPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(T, [])
|
||||
if Pcd in PcdList:
|
||||
Pcd.Type = T
|
||||
|
@ -792,7 +792,7 @@ class PcdReport(object):
|
|||
if not Pcd.Type:
|
||||
PcdTypeFlag = False
|
||||
for package in Pa.PackageList:
|
||||
for T in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
|
||||
for T in PCD_TYPE_LIST:
|
||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, T) in package.Pcds:
|
||||
Pcd.Type = T
|
||||
PcdTypeFlag = True
|
||||
|
@ -804,10 +804,10 @@ class PcdReport(object):
|
|||
if not Pcd.DatumType:
|
||||
PcdType = Pcd.Type
|
||||
# Try to remove Hii and Vpd suffix
|
||||
if PcdType.startswith("DynamicEx"):
|
||||
PcdType = "DynamicEx"
|
||||
elif PcdType.startswith("Dynamic"):
|
||||
PcdType = "Dynamic"
|
||||
if PcdType.startswith(TAB_PCDS_DYNAMIC_EX):
|
||||
PcdType = TAB_PCDS_DYNAMIC_EX
|
||||
elif PcdType.startswith(TAB_PCDS_DYNAMIC):
|
||||
PcdType = TAB_PCDS_DYNAMIC
|
||||
for package in Pa.PackageList:
|
||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType) in package.Pcds:
|
||||
Pcd.DatumType = package.Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType)].DatumType
|
||||
|
|
Loading…
Reference in New Issue