diff options
author | Liming Gao <liming.gao@intel.com> | 2017-11-24 14:46:58 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2017-12-25 11:05:46 +0800 |
commit | 34952f493c24c02f5eba6ae86ed758d3311cddb1 (patch) | |
tree | a382c9d5cea9ce166bc4566aab73622b5092ed7b /BaseTools/Source/Python/AutoGen/AutoGen.py | |
parent | ae7b6df816e913394a7f11264f24953658ff34ba (diff) | |
download | edk2-34952f493c24c02f5eba6ae86ed758d3311cddb1.tar.gz edk2-34952f493c24c02f5eba6ae86ed758d3311cddb1.tar.bz2 edk2-34952f493c24c02f5eba6ae86ed758d3311cddb1.zip |
BaseTools: Collect DynamicHii PCD values and assign it to VPD PCD Value
https://bugzilla.tianocore.org/show_bug.cgi?id=661
Collect all DynamicHii and DynamicExHii PCD value into PCD
PcdNvStoreDefaultValueBuffer, then firmware can access this PCD value
to get the variable default setting.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/AutoGen.py')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/AutoGen.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 12861399ac..783305c7cc 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -44,6 +44,7 @@ from Common.MultipleWorkspace import MultipleWorkspace as mws import InfSectionParser
import datetime
import hashlib
+from GenVar import Variable,var_info
## Regular expression for splitting Dependency Expression string into tokens
gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)")
@@ -1352,6 +1353,26 @@ class PlatformAutoGen(AutoGen): if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtBuildPcdsSameValue[key]:
LibAuto.ConstPcd[key] = Pcd.DefaultValue
+ def CollectVariables(self, DynamicPcdSet):
+ VariableInfo = Variable()
+ 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))
+ Index += 1
+ return VariableInfo
## Collect dynamic PCDs
#
# Gather dynamic PCDs list from each module and their settings from platform
@@ -1582,6 +1603,17 @@ class PlatformAutoGen(AutoGen): if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
VpdPcdDict[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)] = Pcd
+ #Collect DynamicHii PCD values and assign it to DynamicExVpd PCD gEfiMdeModulePkgTokenSpaceGuid.PcdNvStoreDefaultValueBuffer
+ PcdNvStoreDfBuffer = VpdPcdDict.get(("PcdNvStoreDefaultValueBuffer","gEfiMdeModulePkgTokenSpaceGuid"))
+ if PcdNvStoreDfBuffer:
+ var_info = self.CollectVariables(self._DynamicPcdList)
+ default_skuobj = PcdNvStoreDfBuffer.SkuInfoList.get("DEFAULT")
+ default_skuobj.DefaultValue = var_info.dump()
+ if default_skuobj:
+ PcdNvStoreDfBuffer.SkuInfoList.clear()
+ PcdNvStoreDfBuffer.SkuInfoList['DEFAULT'] = default_skuobj
+ PcdNvStoreDfBuffer.MaxDatumSize = len(default_skuobj.DefaultValue.split(","))
+
PlatformPcds = self._PlatformPcds.keys()
PlatformPcds.sort()
#
|