summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYonghong Zhu2016-03-09 00:03:39 -0600
committerYonghong Zhu2016-03-10 03:39:58 -0600
commit815ada26cb7069d1121153c4e661e796c9e1da25 (patch)
treeaa7614cdf52b83a713cce88d92b0f5115c3d278c
parent452582852dc3654ce51e0c6072aaf752d1b0e3ed (diff)
downloadti-edk2-815ada26cb7069d1121153c4e661e796c9e1da25.tar.gz
ti-edk2-815ada26cb7069d1121153c4e661e796c9e1da25.tar.xz
ti-edk2-815ada26cb7069d1121153c4e661e796c9e1da25.zip
BaseTools: report warning if VOID* PCD with {} value is not 8-byte aligned
For VOID* Pcd with {} value, If platform developer wants to put in a specific hex offset value that is not 8-byte aligned for VOID * then we allow it with a warning message. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py10
-rw-r--r--BaseTools/Source/Python/BPDG/GenVpd.py12
2 files changed, 18 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 776743a71..05ce72bd9 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1162,7 +1162,10 @@ class PlatformAutoGen(AutoGen):
1162 except: 1162 except:
1163 EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) 1163 EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
1164 if VpdOffset % Alignment != 0: 1164 if VpdOffset % Alignment != 0:
1165 EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Alignment)) 1165 if PcdValue.startswith("{"):
1166 EdkLogger.warn("build", "The offset value of PCD %s.%s is not 8-byte aligned!" %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName), File=self.MetaFile)
1167 else:
1168 EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Alignment))
1166 VpdFile.Add(Pcd, Sku.VpdOffset) 1169 VpdFile.Add(Pcd, Sku.VpdOffset)
1167 # if the offset of a VPD is *, then it need to be fixed up by third party tool. 1170 # if the offset of a VPD is *, then it need to be fixed up by third party tool.
1168 if not NeedProcessVpdMapFile and Sku.VpdOffset == "*": 1171 if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
@@ -1235,7 +1238,10 @@ class PlatformAutoGen(AutoGen):
1235 except: 1238 except:
1236 EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName)) 1239 EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName))
1237 if VpdOffset % Alignment != 0: 1240 if VpdOffset % Alignment != 0:
1238 EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, Alignment)) 1241 if PcdValue.startswith("{"):
1242 EdkLogger.warn("build", "The offset value of PCD %s.%s is not 8-byte aligned!" %(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName), File=self.MetaFile)
1243 else:
1244 EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, Alignment))
1239 VpdFile.Add(DscPcdEntry, Sku.VpdOffset) 1245 VpdFile.Add(DscPcdEntry, Sku.VpdOffset)
1240 if not NeedProcessVpdMapFile and Sku.VpdOffset == "*": 1246 if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
1241 NeedProcessVpdMapFile = True 1247 NeedProcessVpdMapFile = True
diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py
index ee7e04295..003011b70 100644
--- a/BaseTools/Source/Python/BPDG/GenVpd.py
+++ b/BaseTools/Source/Python/BPDG/GenVpd.py
@@ -420,8 +420,16 @@ class GenVPD :
420 Alignment = 2 420 Alignment = 2
421 else: 421 else:
422 Alignment = 1 422 Alignment = 1
423 if PCD.PcdOccupySize % Alignment != 0: 423
424 PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * Alignment 424 if PCD.PcdOffset != '*':
425 if PCD.PcdOccupySize % Alignment != 0:
426 if PCD.PcdUnpackValue.startswith("{"):
427 EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-byte aligned!" %(PCD.PcdCName), File=self.InputFileName)
428 else:
429 EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, 'The offset value of PCD %s should be %s-byte aligned.' % (PCD.PcdCName, Alignment))
430 else:
431 if PCD.PcdOccupySize % Alignment != 0:
432 PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * Alignment
425 433
426 # 434 #
427 # Translate PCD size string to an integer value. 435 # Translate PCD size string to an integer value.