mirror of https://github.com/acidanthera/audk.git
BaseTools: Check PcdNvStoreDefaultValueBuffer.
Build tool should report warning if a platform defines [DefaultStores] but forgets to defined PcdNvStoreDefaultValueBuffer as PcdsDynamicExVpd in dsc file. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: ZhiqiangX Zhao <zhiqiangx.zhao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
cfed8a37ec
commit
ced8685838
|
@ -1451,7 +1451,10 @@ class PlatformAutoGen(AutoGen):
|
||||||
for skuname in PcdNvStoreDfBuffer.SkuInfoList:
|
for skuname in PcdNvStoreDfBuffer.SkuInfoList:
|
||||||
PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultValue = vardump
|
PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultValue = vardump
|
||||||
PcdNvStoreDfBuffer.MaxDatumSize = str(len(vardump.split(",")))
|
PcdNvStoreDfBuffer.MaxDatumSize = str(len(vardump.split(",")))
|
||||||
|
else:
|
||||||
|
#If the end user define [DefaultStores] and [XXX.Menufacturing] in DSC, but forget to configure PcdNvStoreDefaultValueBuffer to PcdsDynamicVpd
|
||||||
|
if [Pcd for Pcd in self._DynamicPcdList if Pcd.UserDefinedDefaultStoresFlag]:
|
||||||
|
EdkLogger.warn("build", "PcdNvStoreDefaultValueBuffer should be defined as PcdsDynamicExVpd in dsc file since the DefaultStores is enabled for this platform.\n%s" %self.Platform.MetaFile.Path)
|
||||||
PlatformPcds = sorted(self._PlatformPcds.keys())
|
PlatformPcds = sorted(self._PlatformPcds.keys())
|
||||||
#
|
#
|
||||||
# Add VPD type PCD into VpdFile and determine whether the VPD PCD need to be fixed up.
|
# Add VPD type PCD into VpdFile and determine whether the VPD PCD need to be fixed up.
|
||||||
|
@ -2091,6 +2094,8 @@ class PlatformAutoGen(AutoGen):
|
||||||
ToPcd.DatumType = FromPcd.DatumType
|
ToPcd.DatumType = FromPcd.DatumType
|
||||||
if FromPcd.SkuInfoList:
|
if FromPcd.SkuInfoList:
|
||||||
ToPcd.SkuInfoList = FromPcd.SkuInfoList
|
ToPcd.SkuInfoList = FromPcd.SkuInfoList
|
||||||
|
if FromPcd.UserDefinedDefaultStoresFlag:
|
||||||
|
ToPcd.UserDefinedDefaultStoresFlag = FromPcd.UserDefinedDefaultStoresFlag
|
||||||
# Add Flexible PCD format parse
|
# Add Flexible PCD format parse
|
||||||
if ToPcd.DefaultValue:
|
if ToPcd.DefaultValue:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -41,7 +41,7 @@ import collections
|
||||||
# @var Phase: To store value for Phase, default is "DXE"
|
# @var Phase: To store value for Phase, default is "DXE"
|
||||||
#
|
#
|
||||||
class PcdClassObject(object):
|
class PcdClassObject(object):
|
||||||
def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], expressions = [], IsDsc = False):
|
def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], expressions = [], IsDsc = False, UserDefinedDefaultStoresFlag = False):
|
||||||
self.TokenCName = Name
|
self.TokenCName = Name
|
||||||
self.TokenSpaceGuidCName = Guid
|
self.TokenSpaceGuidCName = Guid
|
||||||
self.TokenSpaceGuidValue = GuidValue
|
self.TokenSpaceGuidValue = GuidValue
|
||||||
|
@ -67,6 +67,7 @@ class PcdClassObject(object):
|
||||||
self.PcdValueFromComm = ""
|
self.PcdValueFromComm = ""
|
||||||
self.PcdValueFromFdf = ""
|
self.PcdValueFromFdf = ""
|
||||||
self.DefinitionPosition = ("","")
|
self.DefinitionPosition = ("","")
|
||||||
|
self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GetPcdMaxSizeWorker(PcdString, MaxSize):
|
def GetPcdMaxSizeWorker(PcdString, MaxSize):
|
||||||
|
@ -225,6 +226,7 @@ class StructurePcd(PcdClassObject):
|
||||||
self.PcdValueFromComm = PcdObject.PcdValueFromComm if PcdObject.PcdValueFromComm else self.PcdValueFromComm
|
self.PcdValueFromComm = PcdObject.PcdValueFromComm if PcdObject.PcdValueFromComm else self.PcdValueFromComm
|
||||||
self.PcdValueFromFdf = PcdObject.PcdValueFromFdf if PcdObject.PcdValueFromFdf else self.PcdValueFromFdf
|
self.PcdValueFromFdf = PcdObject.PcdValueFromFdf if PcdObject.PcdValueFromFdf else self.PcdValueFromFdf
|
||||||
self.DefinitionPosition = PcdObject.DefinitionPosition if PcdObject.DefinitionPosition else self.DefinitionPosition
|
self.DefinitionPosition = PcdObject.DefinitionPosition if PcdObject.DefinitionPosition else self.DefinitionPosition
|
||||||
|
self.UserDefinedDefaultStoresFlag = PcdObject.UserDefinedDefaultStoresFlag if PcdObject.UserDefinedDefaultStoresFlag else self.UserDefinedDefaultStoresFlag
|
||||||
if isinstance(PcdObject, StructurePcd):
|
if isinstance(PcdObject, StructurePcd):
|
||||||
self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
|
self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
|
||||||
self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs
|
self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs
|
||||||
|
|
|
@ -2521,6 +2521,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||||
VariableAttrs = {}
|
VariableAttrs = {}
|
||||||
|
|
||||||
Pcds = OrderedDict()
|
Pcds = OrderedDict()
|
||||||
|
UserDefinedDefaultStores = []
|
||||||
#
|
#
|
||||||
# tdict is a special dict kind of type, used for selecting correct
|
# tdict is a special dict kind of type, used for selecting correct
|
||||||
# PCD settings for certain ARCH and SKU
|
# PCD settings for certain ARCH and SKU
|
||||||
|
@ -2538,6 +2539,9 @@ class DscBuildData(PlatformBuildClassObject):
|
||||||
DefaultStore = DefaultStore.upper()
|
DefaultStore = DefaultStore.upper()
|
||||||
if DefaultStore == TAB_COMMON:
|
if DefaultStore == TAB_COMMON:
|
||||||
DefaultStore = TAB_DEFAULT_STORES_DEFAULT
|
DefaultStore = TAB_DEFAULT_STORES_DEFAULT
|
||||||
|
else:
|
||||||
|
#The end user define [DefaultStores] and [SKUID_IDENTIFIER.Menufacturing] in DSC
|
||||||
|
UserDefinedDefaultStores.append((PcdCName, TokenSpaceGuid))
|
||||||
if SkuName not in AvailableSkuIdSet:
|
if SkuName not in AvailableSkuIdSet:
|
||||||
EdkLogger.error('build', PARAMETER_INVALID, 'Sku %s is not defined in [SkuIds] section' % SkuName,
|
EdkLogger.error('build', PARAMETER_INVALID, 'Sku %s is not defined in [SkuIds] section' % SkuName,
|
||||||
File=self.MetaFile, Line=Dummy5)
|
File=self.MetaFile, Line=Dummy5)
|
||||||
|
@ -2600,7 +2604,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||||
pcdObject.SkuInfoList[SkuName] = SkuInfo
|
pcdObject.SkuInfoList[SkuName] = SkuInfo
|
||||||
else:
|
else:
|
||||||
SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], VariableName, VariableGuid, VariableOffset, DefaultValue, VariableAttribute=VarAttribute, DefaultStore={DefaultStore:DefaultValue})
|
SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], VariableName, VariableGuid, VariableOffset, DefaultValue, VariableAttribute=VarAttribute, DefaultStore={DefaultStore:DefaultValue})
|
||||||
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
|
PcdClassObj = PcdClassObject(
|
||||||
PcdCName,
|
PcdCName,
|
||||||
TokenSpaceGuid,
|
TokenSpaceGuid,
|
||||||
self._PCD_TYPE_STRING_[Type],
|
self._PCD_TYPE_STRING_[Type],
|
||||||
|
@ -2615,6 +2619,9 @@ class DscBuildData(PlatformBuildClassObject):
|
||||||
pcdDecObject.validlists,
|
pcdDecObject.validlists,
|
||||||
pcdDecObject.expressions,
|
pcdDecObject.expressions,
|
||||||
IsDsc=True)
|
IsDsc=True)
|
||||||
|
if (PcdCName, TokenSpaceGuid) in UserDefinedDefaultStores:
|
||||||
|
PcdClassObj.UserDefinedDefaultStoresFlag = True
|
||||||
|
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObj
|
||||||
|
|
||||||
if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
|
if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
|
||||||
Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
|
Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
|
||||||
|
|
Loading…
Reference in New Issue