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>
This commit is contained in:
Yonghong Zhu 2016-03-09 14:03:39 +08:00
parent 452582852d
commit 815ada26cb
2 changed files with 18 additions and 4 deletions

View File

@ -1162,6 +1162,9 @@ class PlatformAutoGen(AutoGen):
except:
EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
if VpdOffset % Alignment != 0:
if PcdValue.startswith("{"):
EdkLogger.warn("build", "The offset value of PCD %s.%s is not 8-byte aligned!" %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName), File=self.MetaFile)
else:
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.
@ -1235,6 +1238,9 @@ class PlatformAutoGen(AutoGen):
except:
EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName))
if VpdOffset % Alignment != 0:
if PcdValue.startswith("{"):
EdkLogger.warn("build", "The offset value of PCD %s.%s is not 8-byte aligned!" %(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName), File=self.MetaFile)
else:
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 == "*":

View File

@ -420,6 +420,14 @@ class GenVPD :
Alignment = 2
else:
Alignment = 1
if PCD.PcdOffset != '*':
if PCD.PcdOccupySize % Alignment != 0:
if PCD.PcdUnpackValue.startswith("{"):
EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-byte aligned!" %(PCD.PcdCName), File=self.InputFileName)
else:
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, 'The offset value of PCD %s should be %s-byte aligned.' % (PCD.PcdCName, Alignment))
else:
if PCD.PcdOccupySize % Alignment != 0:
PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * Alignment