From: BobCF <bob.c.feng@intel.com>
To: edk2-devel@lists.01.org
Cc: Bob Feng <bob.c.feng@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [Patch 4/4] BaseTools: Improve build performance
Date: Wed, 28 Feb 2018 13:59:21 +0800 [thread overview]
Message-ID: <20180228055921.35432-4-bob.c.feng@intel.com> (raw)
In-Reply-To: <20180228055921.35432-1-bob.c.feng@intel.com>
Optimized the PcdValueInit.c size.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
.../Source/Python/Workspace/BuildClassObject.py | 4 +
BaseTools/Source/Python/Workspace/DscBuildData.py | 211 +++++++++++----------
2 files changed, 112 insertions(+), 103 deletions(-)
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 05a83e84ac..edf2bdf4b9 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -63,10 +63,11 @@ class PcdClassObject(object):
self.IsFromDsc = False
self.validateranges = validateranges
self.validlists = validlists
self.expressions = expressions
self.DscDefaultValue = None
+ self.DscRawValue = None
if IsDsc:
self.DscDefaultValue = Value
## Convert the class to a string
#
@@ -125,10 +126,11 @@ class StructurePcd(PcdClassObject):
self.FlexibleFieldName = None
self.StructName = None
self.PcdDefineLineNo = 0
self.PkgPath = ""
self.DefaultValueFromDec = ""
+ self.ValueChain = dict()
def __repr__(self):
return self.TypeName
def AddDefaultValue (self, FieldName, Value, FileName="", LineNo=0):
if FieldName in self.DefaultValues:
@@ -170,10 +172,11 @@ class StructurePcd(PcdClassObject):
self.IsFromBinaryInf = PcdObject.IsFromBinaryInf if PcdObject.IsFromBinaryInf else self.IsFromBinaryInf
self.IsFromDsc = PcdObject.IsFromDsc if PcdObject.IsFromDsc else self.IsFromDsc
self.validateranges = PcdObject.validateranges if PcdObject.validateranges else self.validateranges
self.validlists = PcdObject.validlists if PcdObject.validlists else self.validlists
self.expressions = PcdObject.expressions if PcdObject.expressions else self.expressions
+ self.DscRawValue = PcdObject.DscRawValue if PcdObject.DscRawValue else self.DscRawValue
if type(PcdObject) is StructurePcd:
self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs
self.DefaultValues = PcdObject.DefaultValues if PcdObject.DefaultValues else self.DefaultValues
self.PcdMode = PcdObject.PcdMode if PcdObject.PcdMode else self.PcdMode
@@ -182,10 +185,11 @@ class StructurePcd(PcdClassObject):
self.SkuOverrideValues = PcdObject.SkuOverrideValues if PcdObject.SkuOverrideValues else self.SkuOverrideValues
self.FlexibleFieldName = PcdObject.FlexibleFieldName if PcdObject.FlexibleFieldName else self.FlexibleFieldName
self.StructName = PcdObject.DatumType if PcdObject.DatumType else self.StructName
self.PcdDefineLineNo = PcdObject.PcdDefineLineNo if PcdObject.PcdDefineLineNo else self.PcdDefineLineNo
self.PkgPath = PcdObject.PkgPath if PcdObject.PkgPath else self.PkgPath
+ self.ValueChain = PcdObject.ValueChain if PcdObject.ValueChain else self.ValueChain
## LibraryClassObject
#
# This Class defines LibraryClassObject used in BuildDatabase
#
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 29c43e751f..580fcdefc2 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1329,16 +1329,19 @@ class DscBuildData(PlatformBuildClassObject):
for skuid in SkuIds:
if skuid in stru_pcd.SkuOverrideValues:
continue
nextskuid = self.SkuIdMgr.GetNextSkuId(skuid)
NoDefault = False
- while nextskuid not in stru_pcd.SkuOverrideValues:
- if nextskuid == "DEFAULT":
- NoDefault = True
- break
- nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
- stru_pcd.SkuOverrideValues[skuid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in DefaultStores} if DefaultStores else {'STANDARD':stru_pcd.DefaultValues})
+ if skuid not in stru_pcd.SkuOverrideValues:
+ while nextskuid not in stru_pcd.SkuOverrideValues:
+ if nextskuid == "DEFAULT":
+ NoDefault = True
+ break
+ nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
+ stru_pcd.SkuOverrideValues[skuid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in DefaultStores} if DefaultStores else {'STANDARD':stru_pcd.DefaultValues})
+ if not NoDefault:
+ stru_pcd.ValueChain[(skuid,'')]= (nextskuid,'')
if stru_pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
for skuid in SkuIds:
nextskuid = skuid
NoDefault = False
if skuid not in stru_pcd.SkuOverrideValues:
@@ -1353,10 +1356,11 @@ class DscBuildData(PlatformBuildClassObject):
mindefaultstorename = DefaultStoreMgr.GetMin(PcdDefaultStoreSet)
for defaultstoreid in DefaultStores:
if defaultstoreid not in stru_pcd.SkuOverrideValues[skuid]:
stru_pcd.SkuOverrideValues[skuid][defaultstoreid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstorename])
+ stru_pcd.ValueChain[(skuid,defaultstoreid)]= (nextskuid,mindefaultstorename)
S_pcd_set = self.OverrideByFdfComm(S_pcd_set)
Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)
if Str_Pcd_Values:
for (skuname,StoreName,PcdGuid,PcdName,PcdValue) in Str_Pcd_Values:
str_pcd_obj = S_pcd_set.get((PcdName, PcdGuid))
@@ -1676,14 +1680,28 @@ class DscBuildData(PlatformBuildClassObject):
else:
if ValueSize > 4:
CApp = CApp + ' Pcd->%s = %dULL; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
else:
CApp = CApp + ' Pcd->%s = %d; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + "}\n"
+ return CApp
+ def GenerateDefaultValueAssignStatement(self,Pcd):
+ CApp = ' Assign_%s_%s_Default_Value(Pcd);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ return CApp
+ def GenerateInitValueFunction(self,Pcd,SkuName,DefaultStoreName):
+ CApp = "// Value in Dsc for Sku: %s, DefaultStore %s\n" % (SkuName,DefaultStoreName)
+ CApp = CApp + "void Assign_%s_%s_%s_%s_Value(%s *Pcd){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName,DefaultStoreName,Pcd.DatumType)
+ CApp = CApp + ' UINT32 FieldSize;\n'
+ CApp = CApp + ' CHAR8 *Value;\n'
+
CApp = CApp + "// SkuName: %s, DefaultStoreName: %s \n" % ('DEFAULT', 'STANDARD')
- inherit_OverrideValues = Pcd.SkuOverrideValues['DEFAULT']
- pcddefaultvalue = Pcd.DefaultFromDSC.get('DEFAULT',{}).get('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue
- for FieldList in [pcddefaultvalue,inherit_OverrideValues.get('STANDARD')]:
+ inherit_OverrideValues = Pcd.SkuOverrideValues[SkuName]
+ if (SkuName,DefaultStoreName) == ('DEFAULT','STANDARD'):
+ pcddefaultvalue = Pcd.DefaultFromDSC.get('DEFAULT',{}).get('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue
+ else:
+ pcddefaultvalue = Pcd.DscRawValue.get(SkuName,{}).get(DefaultStoreName)
+ for FieldList in [pcddefaultvalue,inherit_OverrideValues.get(DefaultStoreName)]:
if not FieldList:
continue
if pcddefaultvalue and FieldList == pcddefaultvalue:
IsArray = self.IsFieldValueAnArray(FieldList)
if IsArray:
@@ -1691,52 +1709,64 @@ class DscBuildData(PlatformBuildClassObject):
FieldList = ValueExpressionEx(FieldList, "VOID*")(True)
except BadExpression:
EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from DSC: %s" %
(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldList))
Value, ValueSize = ParseFieldValue (FieldList)
- if isinstance(Value, str):
- CApp = CApp + ' Pcd = %s; // From DSC Default Value %s\n' % (Value, Pcd.DefaultFromDSC.get('DEFAULT',{}).get('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
- elif IsArray:
- #
- # Use memcpy() to copy value into field
- #
- CApp = CApp + ' Value = %s; // From DSC Default Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC.get('DEFAULT',{}).get('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
- CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize)
+
+ if (SkuName,DefaultStoreName) == ('DEFAULT','STANDARD'):
+ if isinstance(Value, str):
+ CApp = CApp + ' Pcd = %s; // From DSC Default Value %s\n' % (Value, Pcd.DefaultFromDSC.get('DEFAULT',{}).get('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
+ elif IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ CApp = CApp + ' Value = %s; // From DSC Default Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC.get('DEFAULT',{}).get('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
+ CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize)
+ else:
+ if isinstance(Value, str):
+ CApp = CApp + ' Pcd = %s; // From DSC Default Value %s\n' % (Value, Pcd.DscRawValue.get(SkuName,{}).get(DefaultStoreName))
+ elif IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ CApp = CApp + ' Value = %s; // From DSC Default Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DscRawValue.get(SkuName,{}).get(DefaultStoreName))
+ CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize)
continue
- for FieldName in FieldList:
- IsArray = self.IsFieldValueAnArray(FieldList[FieldName][0])
- if IsArray:
+ if (SkuName,DefaultStoreName) == ('DEFAULT','STANDARD') or (( (SkuName,'') not in Pcd.ValueChain) and ( (SkuName,DefaultStoreName) not in Pcd.ValueChain )):
+ for FieldName in FieldList:
+ IsArray = self.IsFieldValueAnArray(FieldList[FieldName][0])
+ if IsArray:
+ try:
+ FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], "VOID*", self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
try:
- FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], "VOID*", self._GuidDict)(True)
- except BadExpression:
- EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
- (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
- try:
- Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
- except Exception:
- EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName,FieldName)),FieldList[FieldName][1], FieldList[FieldName][2]))
- if isinstance(Value, str):
- CApp = CApp + ' Pcd->%s = %s; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
- elif IsArray:
- #
- # Use memcpy() to copy value into field
- #
- CApp = CApp + ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd.DatumType, FieldName)
- CApp = CApp + ' Value = %s; // From %s Line %d Value %s\n' % (self.IntToCString(Value, ValueSize), FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
- CApp = CApp + ' memcpy (&Pcd->%s, Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize)
- else:
- if ValueSize > 4:
- CApp = CApp + ' Pcd->%s = %dULL; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
+ except Exception:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName,FieldName)),FieldList[FieldName][1], FieldList[FieldName][2]))
+ if isinstance(Value, str):
+ CApp = CApp + ' Pcd->%s = %s; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ elif IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ CApp = CApp + ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd.DatumType, FieldName)
+ CApp = CApp + ' Value = %s; // From %s Line %d Value %s\n' % (self.IntToCString(Value, ValueSize), FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + ' memcpy (&Pcd->%s, Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize)
else:
- CApp = CApp + ' Pcd->%s = %d; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ if ValueSize > 4:
+ CApp = CApp + ' Pcd->%s = %dULL; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ else:
+ CApp = CApp + ' Pcd->%s = %d; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
CApp = CApp + "}\n"
return CApp
- def GenerateDefaultValueAssignStatement(self,Pcd):
- CApp = ' Assign_%s_%s_Default_Value(Pcd);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ def GenerateInitValueStatement(self,Pcd,SkuName,DefaultStoreName):
+ CApp = ' Assign_%s_%s_%s_%s_Value(Pcd);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName,DefaultStoreName)
return CApp
- def GenerateInitializeFunc(self, SkuName, DefaultStoreName, Pcd, InitByteValue, CApp):
- OverrideValues = {DefaultStoreName:""}
+ def GenerateInitializeFunc(self, SkuName, DefaultStore, Pcd, InitByteValue, CApp):
+ OverrideValues = {DefaultStore:""}
if Pcd.SkuOverrideValues:
OverrideValues = Pcd.SkuOverrideValues[SkuName]
for DefaultStoreName in OverrideValues.keys():
CApp = CApp + 'void\n'
CApp = CApp + 'Initialize_%s_%s_%s_%s(\n' % (SkuName, DefaultStoreName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
@@ -1750,11 +1780,11 @@ class DscBuildData(PlatformBuildClassObject):
CApp = CApp + ' VOID *OriginalPcd;\n'
CApp = CApp + ' %s *Pcd; // From %s Line %d \n' % (Pcd.DatumType, Pcd.PkgPath, Pcd.PcdDefineLineNo)
CApp = CApp + '\n'
if SkuName in Pcd.SkuInfoList:
- DefaultValue = Pcd.SkuInfoList[SkuName].DefaultStoreDict.get(DefaultStoreName,Pcd.SkuInfoList[SkuName].HiiDefaultValue) if Pcd.SkuInfoList[SkuName].HiiDefaultValue else Pcd.SkuInfoList[SkuName].DefaultValue
+ DefaultValue = Pcd.SkuInfoList[SkuName].DefaultStoreDict.get(DefaultStoreName,Pcd.SkuInfoList[SkuName].HiiDefaultValue if Pcd.SkuInfoList[SkuName].HiiDefaultValue else Pcd.SkuInfoList[SkuName].DefaultValue)
else:
DefaultValue = Pcd.DefaultValue
PcdDefaultValue = StringToArray(DefaultValue.strip())
InitByteValue += '%s.%s.%s.%s|%s|%s\n' % (SkuName, DefaultStoreName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DatumType, PcdDefaultValue)
@@ -1790,67 +1820,22 @@ class DscBuildData(PlatformBuildClassObject):
#
# Assign field values in PCD
#
CApp = CApp + self.GenerateDefaultValueAssignStatement(Pcd)
- for skuname in self.SkuIdMgr.GetSkuChain(SkuName):
- if skuname == "DEFAULT":
- continue
- inherit_OverrideValues = Pcd.SkuOverrideValues[skuname]
- storeset = [DefaultStoreName] if DefaultStoreName == 'STANDARD' else ['STANDARD', DefaultStoreName]
- for defaultstorenameitem in storeset:
- CApp = CApp + "// SkuName: %s, DefaultStoreName: %s \n" % (skuname, defaultstorenameitem)
- pcddefaultvalue = Pcd.DefaultFromDSC.get(skuname,{}).get(defaultstorenameitem, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue
- for FieldList in [pcddefaultvalue,inherit_OverrideValues.get(defaultstorenameitem)]:
- if not FieldList:
- continue
- if pcddefaultvalue and FieldList == pcddefaultvalue:
- IsArray = self.IsFieldValueAnArray(FieldList)
- if IsArray:
- try:
- FieldList = ValueExpressionEx(FieldList, "VOID*")(True)
- except BadExpression:
- EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from DSC: %s" %
- (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldList))
- Value, ValueSize = ParseFieldValue (FieldList)
- if isinstance(Value, str):
- CApp = CApp + ' Pcd = %s; // From DSC Default Value %s\n' % (Value, Pcd.DefaultFromDSC.get(skuname,{}).get(defaultstorenameitem, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
- elif IsArray:
- #
- # Use memcpy() to copy value into field
- #
- CApp = CApp + ' Value = %s; // From DSC Default Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC.get(skuname,{}).get(defaultstorenameitem, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
- CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize)
- continue
- for FieldName in FieldList:
- IsArray = self.IsFieldValueAnArray(FieldList[FieldName][0])
- if IsArray:
- try:
- FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], "VOID*", self._GuidDict)(True)
- except BadExpression:
- EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
- (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
- try:
- Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
- except Exception:
- EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName,FieldName)),FieldList[FieldName][1], FieldList[FieldName][2]))
- if isinstance(Value, str):
- CApp = CApp + ' Pcd->%s = %s; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
- elif IsArray:
- #
- # Use memcpy() to copy value into field
- #
- CApp = CApp + ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd.DatumType, FieldName)
- CApp = CApp + ' Value = %s; // From %s Line %d Value %s\n' % (self.IntToCString(Value, ValueSize), FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
- CApp = CApp + ' memcpy (&Pcd->%s, Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize)
- else:
- if ValueSize > 4:
- CApp = CApp + ' Pcd->%s = %dULL; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
- else:
- CApp = CApp + ' Pcd->%s = %d; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
- if skuname == SkuName:
- break
+ if Pcd.Type not in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
+ for skuname in self.SkuIdMgr.GetSkuChain(SkuName):
+ storeset = [DefaultStoreName] if DefaultStoreName == 'STANDARD' else ['STANDARD', DefaultStoreName]
+ for defaultstorenameitem in storeset:
+ CApp = CApp + "// SkuName: %s, DefaultStoreName: %s \n" % (skuname, defaultstorenameitem)
+ CApp = CApp + self.GenerateInitValueStatement(Pcd,skuname,defaultstorenameitem)
+ if skuname == SkuName:
+ break
+ else:
+ CApp = CApp + "// SkuName: DEFAULT, DefaultStoreName: STANDARD \n"
+ CApp = CApp + self.GenerateInitValueStatement(Pcd,"DEFAULT","STANDARD")
#
# Set new PCD value and size
#
CApp = CApp + ' PcdSetPtr (%s, %s, %s, %s, Size, (UINT8 *)Pcd);\n' % (SkuName, DefaultStoreName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
@@ -1882,10 +1867,19 @@ class DscBuildData(PlatformBuildClassObject):
CApp = CApp + '\n'
for PcdName in StructuredPcds:
Pcd = StructuredPcds[PcdName]
CApp = CApp + self.GenerateSizeFunction(Pcd)
CApp = CApp + self.GenerateDefaultValueAssignFunction(Pcd)
+ if not Pcd.SkuOverrideValues or Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
+ CApp = CApp + self.GenerateInitValueFunction(Pcd,self.SkuIdMgr.SystemSkuId, 'STANDARD')
+ else:
+ for SkuName in self.SkuIdMgr.SkuOverrideOrder():
+ if SkuName not in Pcd.SkuOverrideValues:
+ continue
+ for DefaultStoreName in Pcd.SkuOverrideValues[SkuName]:
+ CApp = CApp + self.GenerateInitValueFunction(Pcd,SkuName,DefaultStoreName)
if not Pcd.SkuOverrideValues or Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
InitByteValue, CApp = self.GenerateInitializeFunc(self.SkuIdMgr.SystemSkuId, 'STANDARD', Pcd, InitByteValue, CApp)
else:
for SkuName in self.SkuIdMgr.SkuOverrideOrder():
@@ -2198,10 +2192,20 @@ class DscBuildData(PlatformBuildClassObject):
Attr2Set = set(Attr2s)
if Attr2Set == Attr1Set:
return True
else:
return False
+ def CopyDscRawValue(self,Pcd):
+ if Pcd.DscRawValue is None:
+ Pcd.DscRawValue = dict()
+ for skuname in Pcd.SkuInfoList:
+ Pcd.DscRawValue[skuname] = {}
+ if Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
+ for defaultstore in Pcd.SkuInfoList[skuname].DefaultStoreDict:
+ Pcd.DscRawValue[skuname][defaultstore] = Pcd.SkuInfoList[skuname].DefaultStoreDict[defaultstore]
+ else:
+ Pcd.DscRawValue[skuname]['STANDARD'] = Pcd.SkuInfoList[skuname].DefaultValue
def CompletePcdValues(self,PcdSet):
Pcds = {}
DefaultStoreObj = DefaultStore(self._GetDefaultStores())
SkuIds = {skuname:skuid for skuname,skuid in self.SkuIdMgr.AvailableSkuIdSet.items() if skuname !='COMMON'}
DefaultStores = set([storename for pcdobj in PcdSet.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict.keys()])
@@ -2213,10 +2217,11 @@ class DscBuildData(PlatformBuildClassObject):
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_DEFAULT],
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII],
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_VPD]]:
Pcds[PcdCName, TokenSpaceGuid]= PcdObj
continue
+ self.CopyDscRawValue(PcdObj)
PcdType = PcdObj.Type
if PcdType in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
for skuid in PcdObj.SkuInfoList:
skuobj = PcdObj.SkuInfoList[skuid]
mindefaultstorename = DefaultStoreObj.GetMin(set([defaultstorename for defaultstorename in skuobj.DefaultStoreDict]))
--
2.14.3.windows.1
next prev parent reply other threads:[~2018-02-28 5:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 5:59 [Patch 1/4] BaseTools: Fixed the pcd value override issue BobCF
2018-02-28 5:59 ` [Patch 2/4] BaseTools: Improve build performance BobCF
2018-02-28 5:59 ` [Patch 3/4] BaseTool: GUID assignment fail BobCF
2018-02-28 5:59 ` BobCF [this message]
2018-02-28 6:46 ` [Patch 1/4] BaseTools: Fixed the pcd value override issue Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180228055921.35432-4-bob.c.feng@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox