summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2015-11-30 03:36:50 +0000
committeryzhu52 <yzhu52@Edk2>2015-11-30 03:36:50 +0000
commitfb3d22793e916e4fc8439abc72c1c1a964abf7d0 (patch)
treee5105ed0fcfc0b11e317e2835ca16b30eca0222c /BaseTools
parent404bd44294da1222bd9a00658456af5f9ea5dd7f (diff)
downloadedk2-fb3d22793e916e4fc8439abc72c1c1a964abf7d0.tar.gz
edk2-fb3d22793e916e4fc8439abc72c1c1a964abf7d0.tar.bz2
edk2-fb3d22793e916e4fc8439abc72c1c1a964abf7d0.zip
BaseTools: Add a VPD report subsection of FLASH to the Report
Build Spec already added a VPD report subsection of FLASH to the Report chapter, it provide a simple way for user to determine where the VPD region and VPD PCDs are located in the fd file. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19026 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/Python/build/BuildReport.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index bf5bb8fa17..38e55f3e07 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1387,6 +1387,32 @@ class FdReport(object):
self.BaseAddress = Fd.BaseAddress
self.Size = Fd.Size
self.FdRegionList = [FdRegionReport(FdRegion, Wa) for FdRegion in Fd.RegionList]
+ self.FvPath = os.path.join(Wa.BuildDir, "FV")
+ self.VpdFilePath = os.path.join(self.FvPath, "%s.map" % Wa.Platform.VpdToolGuid)
+ VpdPcdToken = 'gEfiMdeModulePkgTokenSpaceGuid'
+ VpdPcdName = 'PcdVpdBaseAddress'
+ self.VPDInfoList = []
+ for index, FdRegion in enumerate(Fd.RegionList):
+ if (VpdPcdName, VpdPcdToken) == FdRegion.PcdOffset:
+ self.VPDBaseAddress = self.FdRegionList[index].BaseAddress
+ self.VPDSize = self.FdRegionList[index].Size
+ break
+
+ if os.path.isfile(self.VpdFilePath):
+ fd = open(self.VpdFilePath, "r")
+ Lines = fd.readlines()
+ for Line in Lines:
+ Line = Line.strip()
+ if len(Line) == 0 or Line.startswith("#"):
+ continue
+ try:
+ PcdName, SkuId, Offset, Size, Value = Line.split("#")[0].split("|")
+ PcdName, SkuId, Offset, Size, Value = PcdName.strip(), SkuId.strip(), Offset.strip(), Size.strip(), Value.strip()
+ Offset = '0x%08X' % (int(Offset, 16) + self.VPDBaseAddress)
+ self.VPDInfoList.append("%s | %s | %s | %s | %s" % (PcdName, SkuId, Offset, Size, Value))
+ except:
+ EdkLogger.error("BuildReport", CODE_ERROR, "Fail to parse VPD information file %s" % self.VpdFilePath)
+ fd.close()
##
# Generate report for the firmware device.
@@ -1407,6 +1433,15 @@ class FdReport(object):
for FdRegionItem in self.FdRegionList:
FdRegionItem.GenerateReport(File)
+ if len(self.VPDInfoList) > 0:
+ FileWrite(File, gSubSectionStart)
+ FileWrite(File, "FD VPD Region")
+ FileWrite(File, "Base Address: 0x%X" % self.VPDBaseAddress)
+ FileWrite(File, "Size: 0x%X (%.0fK)" % (self.VPDSize, self.VPDSize / 1024.0))
+ FileWrite(File, gSubSectionSep)
+ for item in self.VPDInfoList:
+ FileWrite(File, item)
+ FileWrite(File, gSubSectionEnd)
FileWrite(File, gSectionEnd)