* [Patch V3] BaseTools: Fix PcdNvStoreDefaultValueBuffer Value.
@ 2018-12-11 9:04 BobCF
2018-12-11 13:42 ` Gao, Liming
0 siblings, 1 reply; 2+ messages in thread
From: BobCF @ 2018-12-11 9:04 UTC (permalink / raw)
To: edk2-devel; +Cc: Feng, Bob C, Liming Gao, Leif Lindholm
From: "Feng, Bob C" <bob.c.feng@intel.com>
https://bugzilla.tianocore.org/show_bug.cgi?id=1385
This patch is going to fix the regression issue that is
introduced by commit e6eae3b4c7b9b756263ecec79694de5f1e85b73a
and commit 0b6c5954e1d9a17e01eee7d5ef840a5b4790e2e8.
PcdNvStoreDefaultValueBuffer value is update to Vpd Info File,
but it is not update into a internal cache. This patch will
fix this incorrect value in that internal cache.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
---
BaseTools/Source/Python/AutoGen/AutoGen.py | 16 ++++++++++++----
BaseTools/Source/Python/Common/VpdInfoFile.py | 6 +++---
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 12e53010a5..d646cd50ce 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1568,10 +1568,16 @@ class PlatformAutoGen(AutoGen):
if VpdFile.GetCount() != 0:
self.FixVpdOffset(VpdFile)
self.FixVpdOffset(self.UpdateNVStoreMaxSize(VpdFile))
+ PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if item.TokenCName == "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName == "gEfiMdeModulePkgTokenSpaceGuid"]
+ if PcdNvStoreDfBuffer:
+ PcdName,PcdGuid = PcdNvStoreDfBuffer[0].TokenCName, PcdNvStoreDfBuffer[0].TokenSpaceGuidCName
+ if (PcdName,PcdGuid) in VpdSkuMap:
+ DefaultSku = PcdNvStoreDfBuffer[0].SkuInfoList.get(TAB_DEFAULT)
+ VpdSkuMap[(PcdName,PcdGuid)] = {DefaultSku.DefaultValue:[DefaultSku]}
# Process VPD map file generated by third party BPDG tool
if NeedProcessVpdMapFile:
VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)
if os.path.exists(VpdMapFilePath):
@@ -1885,19 +1891,21 @@ class PlatformAutoGen(AutoGen):
@cached_property
def NonDynamicPcdDict(self):
return {(Pcd.TokenCName, Pcd.TokenSpaceGuidCName):Pcd for Pcd in self.NonDynamicPcdList}
## Get list of non-dynamic PCDs
- @cached_property
+ @property
def NonDynamicPcdList(self):
- self.CollectPlatformDynamicPcds()
+ if not self._NonDynamicPcdList:
+ self.CollectPlatformDynamicPcds()
return self._NonDynamicPcdList
## Get list of dynamic PCDs
- @cached_property
+ @property
def DynamicPcdList(self):
- self.CollectPlatformDynamicPcds()
+ if not self._DynamicPcdList:
+ self.CollectPlatformDynamicPcds()
return self._DynamicPcdList
## Generate Token Number for all PCD
@cached_property
def PcdTokenNumber(self):
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
index 3be0670e36..cebc1f7187 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -175,12 +175,12 @@ class VpdInfoFile:
EdkLogger.error("BPDG", BuildToolError.PARSER_ERROR, "Fail to parse VPD information file %s" % FilePath)
Found = False
if (TokenSpaceName, PcdTokenName) not in self._VpdInfo:
- self._VpdInfo[(TokenSpaceName, PcdTokenName)] = []
- self._VpdInfo[(TokenSpaceName, PcdTokenName)].append((SkuId, Offset, Value))
+ self._VpdInfo[(TokenSpaceName, PcdTokenName)] = {}
+ self._VpdInfo[(TokenSpaceName, PcdTokenName)][(SkuId, Offset)] = Value
for VpdObject in self._VpdArray:
VpdObjectTokenCName = VpdObject.TokenCName
for PcdItem in GlobalData.MixedPcd:
if (VpdObject.TokenCName, VpdObject.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
VpdObjectTokenCName = PcdItem[0]
@@ -217,11 +217,11 @@ class VpdInfoFile:
return None
return self._VpdArray[vpd]
def GetVpdInfo(self, arg):
(PcdTokenName, TokenSpaceName) = arg
- return self._VpdInfo.get((TokenSpaceName, PcdTokenName))
+ return [(sku,offset,value) for (sku,offset),value in self._VpdInfo.get((TokenSpaceName, PcdTokenName)).items()]
## Call external BPDG tool to process VPD file
#
# @param ToolPath The string path name for BPDG tool
# @param VpdFileName The string path name for VPD information guid.txt
--
2.19.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch V3] BaseTools: Fix PcdNvStoreDefaultValueBuffer Value.
2018-12-11 9:04 [Patch V3] BaseTools: Fix PcdNvStoreDefaultValueBuffer Value BobCF
@ 2018-12-11 13:42 ` Gao, Liming
0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2018-12-11 13:42 UTC (permalink / raw)
To: Feng, Bob C, edk2-devel@lists.01.org
Reviewed-by: Liming Gao <liming.gao@intel.com>
> -----Original Message-----
> From: Feng, Bob C
> Sent: Tuesday, December 11, 2018 5:04 PM
> To: edk2-devel@lists.01.org
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; Leif Lindholm <leif.lindholm@linaro.org>
> Subject: [Patch V3] BaseTools: Fix PcdNvStoreDefaultValueBuffer Value.
>
> From: "Feng, Bob C" <bob.c.feng@intel.com>
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=1385
> This patch is going to fix the regression issue that is
> introduced by commit e6eae3b4c7b9b756263ecec79694de5f1e85b73a
> and commit 0b6c5954e1d9a17e01eee7d5ef840a5b4790e2e8.
>
> PcdNvStoreDefaultValueBuffer value is update to Vpd Info File,
> but it is not update into a internal cache. This patch will
> fix this incorrect value in that internal cache.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> BaseTools/Source/Python/AutoGen/AutoGen.py | 16 ++++++++++++----
> BaseTools/Source/Python/Common/VpdInfoFile.py | 6 +++---
> 2 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index 12e53010a5..d646cd50ce 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -1568,10 +1568,16 @@ class PlatformAutoGen(AutoGen):
> if VpdFile.GetCount() != 0:
>
> self.FixVpdOffset(VpdFile)
>
> self.FixVpdOffset(self.UpdateNVStoreMaxSize(VpdFile))
> + PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if item.TokenCName ==
> "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName == "gEfiMdeModulePkgTokenSpaceGuid"]
> + if PcdNvStoreDfBuffer:
> + PcdName,PcdGuid = PcdNvStoreDfBuffer[0].TokenCName, PcdNvStoreDfBuffer[0].TokenSpaceGuidCName
> + if (PcdName,PcdGuid) in VpdSkuMap:
> + DefaultSku = PcdNvStoreDfBuffer[0].SkuInfoList.get(TAB_DEFAULT)
> + VpdSkuMap[(PcdName,PcdGuid)] = {DefaultSku.DefaultValue:[DefaultSku]}
>
> # Process VPD map file generated by third party BPDG tool
> if NeedProcessVpdMapFile:
> VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)
> if os.path.exists(VpdMapFilePath):
> @@ -1885,19 +1891,21 @@ class PlatformAutoGen(AutoGen):
> @cached_property
> def NonDynamicPcdDict(self):
> return {(Pcd.TokenCName, Pcd.TokenSpaceGuidCName):Pcd for Pcd in self.NonDynamicPcdList}
>
> ## Get list of non-dynamic PCDs
> - @cached_property
> + @property
> def NonDynamicPcdList(self):
> - self.CollectPlatformDynamicPcds()
> + if not self._NonDynamicPcdList:
> + self.CollectPlatformDynamicPcds()
> return self._NonDynamicPcdList
>
> ## Get list of dynamic PCDs
> - @cached_property
> + @property
> def DynamicPcdList(self):
> - self.CollectPlatformDynamicPcds()
> + if not self._DynamicPcdList:
> + self.CollectPlatformDynamicPcds()
> return self._DynamicPcdList
>
> ## Generate Token Number for all PCD
> @cached_property
> def PcdTokenNumber(self):
> diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
> index 3be0670e36..cebc1f7187 100644
> --- a/BaseTools/Source/Python/Common/VpdInfoFile.py
> +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
> @@ -175,12 +175,12 @@ class VpdInfoFile:
> EdkLogger.error("BPDG", BuildToolError.PARSER_ERROR, "Fail to parse VPD information file %s" % FilePath)
>
> Found = False
>
> if (TokenSpaceName, PcdTokenName) not in self._VpdInfo:
> - self._VpdInfo[(TokenSpaceName, PcdTokenName)] = []
> - self._VpdInfo[(TokenSpaceName, PcdTokenName)].append((SkuId, Offset, Value))
> + self._VpdInfo[(TokenSpaceName, PcdTokenName)] = {}
> + self._VpdInfo[(TokenSpaceName, PcdTokenName)][(SkuId, Offset)] = Value
> for VpdObject in self._VpdArray:
> VpdObjectTokenCName = VpdObject.TokenCName
> for PcdItem in GlobalData.MixedPcd:
> if (VpdObject.TokenCName, VpdObject.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
> VpdObjectTokenCName = PcdItem[0]
> @@ -217,11 +217,11 @@ class VpdInfoFile:
> return None
>
> return self._VpdArray[vpd]
> def GetVpdInfo(self, arg):
> (PcdTokenName, TokenSpaceName) = arg
> - return self._VpdInfo.get((TokenSpaceName, PcdTokenName))
> + return [(sku,offset,value) for (sku,offset),value in self._VpdInfo.get((TokenSpaceName, PcdTokenName)).items()]
>
> ## Call external BPDG tool to process VPD file
> #
> # @param ToolPath The string path name for BPDG tool
> # @param VpdFileName The string path name for VPD information guid.txt
> --
> 2.19.1.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-11 13:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-11 9:04 [Patch V3] BaseTools: Fix PcdNvStoreDefaultValueBuffer Value BobCF
2018-12-11 13:42 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox