diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2016-01-29 04:44:54 +0000 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-02-24 15:30:08 +0800 |
commit | f3962f2ff0a5a841a1c35ec00b0902aab153006a (patch) | |
tree | a6f2d1b789fa26675f16e1f36ff6e5238874a3c5 /BaseTools/Source | |
parent | 7c43c0b0310adcee16a1f465f7b5cfdf9692a5d1 (diff) | |
download | edk2-platforms-f3962f2ff0a5a841a1c35ec00b0902aab153006a.tar.xz |
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 <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@19765 6f19259b-4bc3-4df7-8a09-765794883524
(cherry picked from commit ca85291f1f020652254457cc9edbb3caf6a2ed56)
Diffstat (limited to 'BaseTools/Source')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/AutoGen.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index dfb5b72b13..55a59dabc0 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1154,7 +1154,14 @@ class PlatformAutoGen(AutoGen): 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 @@ class PlatformAutoGen(AutoGen): 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 == "*":
|