Revision: 19765
          http://sourceforge.net/p/edk2/code/19765
Author:   yzhu52
Date:     2016-01-29 04:44:54 +0000 (Fri, 29 Jan 2016)
Log Message:
-----------
BaseTools: Fix a bug for VpdOffset calculate

The VpdOffset value in the DSC both support integer and Hex value, so we
fix the bug to support both format.

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

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py

Modified: trunk/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py       2016-01-29 
00:54:32 UTC (rev 19764)
+++ trunk/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py       2016-01-29 
04:44:54 UTC (rev 19765)
@@ -1154,7 +1154,14 @@
                                 Alignment = 2
                             else:
                                 Alignment = 1
-                            if int(Sku.VpdOffset) % Alignment != 0:
+                            try:
+                                VpdOffset = int(Sku.VpdOffset)
+                            except:
+                                try:
+                                    VpdOffset = int(Sku.VpdOffset, 16)
+                                except:
+                                    EdkLogger.error("build", FORMAT_INVALID, 
"Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, 
Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
+                            if VpdOffset % Alignment != 0:
                                 EdkLogger.error("build", FORMAT_INVALID, 'The 
offset value of PCD %s.%s should be %s-byte aligned.' % 
(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Alignment))
                         VpdFile.Add(Pcd, Sku.VpdOffset)
                         # if the offset of a VPD is *, then it need to be 
fixed up by third party tool.
@@ -1220,7 +1227,14 @@
                                         Alignment = 2
                                     else:
                                         Alignment = 1
-                                    if int(Sku.VpdOffset) % Alignment != 0:
+                                    try:
+                                        VpdOffset = int(Sku.VpdOffset)
+                                    except:
+                                        try:
+                                            VpdOffset = int(Sku.VpdOffset, 16)
+                                        except:
+                                            EdkLogger.error("build", 
FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, 
DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName))
+                                    if VpdOffset % Alignment != 0:
                                         EdkLogger.error("build", 
FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % 
(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, Alignment))
                                 VpdFile.Add(DscPcdEntry, Sku.VpdOffset)
                                 if not NeedProcessVpdMapFile and Sku.VpdOffset 
== "*":


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to