Revision: 19077
          http://sourceforge.net/p/edk2/code/19077
Author:   vanjeff
Date:     2015-12-01 02:32:08 +0000 (Tue, 01 Dec 2015)
Log Message:
-----------
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.

(Sync patch r19026 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/19026

Modified Paths:
--------------
    branches/UDK2015/BaseTools/Source/Python/build/BuildReport.py

Modified: branches/UDK2015/BaseTools/Source/Python/build/BuildReport.py
===================================================================
--- branches/UDK2015/BaseTools/Source/Python/build/BuildReport.py       
2015-12-01 02:31:39 UTC (rev 19076)
+++ branches/UDK2015/BaseTools/Source/Python/build/BuildReport.py       
2015-12-01 02:32:08 UTC (rev 19077)
@@ -1385,7 +1385,33 @@
         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.
     #
@@ -1405,6 +1431,15 @@
             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)
 
 


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to