summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Common/VpdInfoFile.py
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2017-12-19 16:26:16 +0800
committerLiming Gao <liming.gao@intel.com>2017-12-25 11:05:54 +0800
commit8ac167890f2a8ef4918586e7e94190c52d59a4cc (patch)
tree230bea616f2c0f9357417f6cb172a190e2bfc639 /BaseTools/Source/Python/Common/VpdInfoFile.py
parenta09395932d997d41f59ae3ee2f7f77f91f5caa02 (diff)
downloadedk2-8ac167890f2a8ef4918586e7e94190c52d59a4cc.tar.gz
edk2-8ac167890f2a8ef4918586e7e94190c52d59a4cc.tar.bz2
edk2-8ac167890f2a8ef4918586e7e94190c52d59a4cc.zip
BaseTools: Fix VPD data optimization issue
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/Common/VpdInfoFile.py')
-rw-r--r--BaseTools/Source/Python/Common/VpdInfoFile.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
index 130d5c7e0c..716155e96d 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -88,7 +88,7 @@ class VpdInfoFile:
#
# @param offset integer value for VPD's offset in specific SKU.
#
- def Add(self, Vpd, Offset):
+ def Add(self, Vpd, skuname,Offset):
if (Vpd == None):
EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
@@ -111,12 +111,9 @@ class VpdInfoFile:
#
# If there is no Vpd instance in dict, that imply this offset for a given SKU is a new one
#
- self._VpdArray[Vpd] = [Offset]
- else:
- #
- # If there is an offset for a specific SKU in dict, then append this offset for other sku to array.
- #
- self._VpdArray[Vpd].append(Offset)
+ self._VpdArray[Vpd] = {}
+
+ self._VpdArray[Vpd].update({skuname:Offset})
## Generate VPD PCD information into a text file
@@ -138,12 +135,12 @@ class VpdInfoFile:
for PcdItem in GlobalData.MixedPcd:
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
PcdTokenCName = PcdItem[0]
- for Offset in self._VpdArray[Pcd]:
- PcdValue = str(Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[i]].DefaultValue).strip()
+ for skuname in self._VpdArray[Pcd]:
+ PcdValue = str(Pcd.SkuInfoList[skuname].DefaultValue).strip()
if PcdValue == "" :
PcdValue = Pcd.DefaultValue
- Content += "%s.%s|%s|%s|%s|%s \n" % (Pcd.TokenSpaceGuidCName, PcdTokenCName, str(Pcd.SkuInfoList.keys()[i]),str(Offset).strip(), str(Pcd.MaxDatumSize).strip(),PcdValue)
+ Content += "%s.%s|%s|%s|%s|%s \n" % (Pcd.TokenSpaceGuidCName, PcdTokenCName, skuname,str(self._VpdArray[Pcd][skuname]).strip(), str(Pcd.MaxDatumSize).strip(),PcdValue)
i += 1
return SaveFileOnChange(FilePath, Content, False)
@@ -190,10 +187,10 @@ class VpdInfoFile:
VpdObjectTokenCName = PcdItem[0]
for sku in VpdObject.SkuInfoList.keys():
if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:
- if self._VpdArray[VpdObject][VpdObject.SkuInfoList.keys().index(sku)] == "*":
+ if self._VpdArray[VpdObject][sku] == "*":
if Offset == "*":
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName)
- self._VpdArray[VpdObject][VpdObject.SkuInfoList.keys().index(sku)] = Offset
+ self._VpdArray[VpdObject][sku] = Offset
Found = True
if not Found:
EdkLogger.error("BPDG", BuildToolError.PARSER_ERROR, "Can not find PCD defined in VPD guid file.")