From 8518bf0b92a78938341a2752a0044f04336668cc Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Fri, 22 Dec 2017 20:46:15 +0800 Subject: BaseTools: Support Structure PCD value inherit between the different SKUs https://bugzilla.tianocore.org/show_bug.cgi?id=543 Structure PCD field value can inherit between the different SKUIds. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Feng Bob C Reviewed-by: Liming Gao --- BaseTools/Source/Python/AutoGen/AutoGen.py | 33 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'BaseTools/Source/Python/AutoGen/AutoGen.py') diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 783305c7cc..be6fecd9f3 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -44,7 +44,7 @@ from Common.MultipleWorkspace import MultipleWorkspace as mws import InfSectionParser import datetime import hashlib -from GenVar import Variable,var_info +from GenVar import VariableMgr,var_info ## Regular expression for splitting Dependency Expression string into tokens gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)") @@ -1225,6 +1225,7 @@ class PlatformAutoGen(AutoGen): self.AllPcdList = [] # get the original module/package/platform objects self.BuildDatabase = Workspace.BuildDatabase + self.DscBuildDataObj = Workspace.Platform # flag indicating if the makefile/C-code file has been created or not self.IsMakeFileCreated = False @@ -1354,23 +1355,21 @@ class PlatformAutoGen(AutoGen): LibAuto.ConstPcd[key] = Pcd.DefaultValue def CollectVariables(self, DynamicPcdSet): - VariableInfo = Variable() + VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(),self.DscBuildDataObj._GetSkuIds()) Index = 0 for Pcd in DynamicPcdSet: - if not hasattr(Pcd,"DefaultStoreName"): - Pcd.DefaultStoreName = ['0'] - for StorageName in Pcd.DefaultStoreName: - pcdname = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName)) - for SkuName in Pcd.SkuInfoList: - Sku = Pcd.SkuInfoList[SkuName] - SkuId = Sku.SkuId - if SkuId == None or SkuId == '': - continue - if len(Sku.VariableName) > 0: - VariableGuidStructure = Sku.VariableGuidValue - VariableGuid = GuidStructureStringToGuidString(VariableGuidStructure) - if Pcd.Phase == "DXE": - VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuId, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableAttribute , Pcd.DefaultValue,Sku.HiiDefaultValue,Pcd.DatumType)) + pcdname = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName)) + for SkuName in Pcd.SkuInfoList: + Sku = Pcd.SkuInfoList[SkuName] + SkuId = Sku.SkuId + if SkuId == None or SkuId == '': + continue + if len(Sku.VariableName) > 0: + VariableGuidStructure = Sku.VariableGuidValue + VariableGuid = GuidStructureStringToGuidString(VariableGuidStructure) + if Pcd.Phase == "DXE": + for StorageName in Sku.DefaultStoreDict: + VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuName, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableAttribute , Pcd.DefaultValue,Sku.DefaultStoreDict[StorageName],Pcd.DatumType)) Index += 1 return VariableInfo ## Collect dynamic PCDs @@ -2383,7 +2382,7 @@ class PlatformAutoGen(AutoGen): else: SkuName = 'DEFAULT' ToPcd.SkuInfoList = { - SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName], '', '', '', '', '', ToPcd.DefaultValue) + SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName][0], '', '', '', '', '', ToPcd.DefaultValue) } ## Apply PCD setting defined platform to a module -- cgit v1.2.3