X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FBPDG%2FGenVpd.py;h=4ff464756f20dca1a9dff95ca6af7034356db632;hp=ee7e04295f1245afb0f0e0e50a3a6662cb629204;hb=5b97eb4c35316cbe8235ae526209263da818e1a4;hpb=22061fab23a2bc9bf39cb3d1bd0ff0f1264d3859
diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py
index ee7e04295f..4ff464756f 100644
--- a/BaseTools/Source/Python/BPDG/GenVpd.py
+++ b/BaseTools/Source/Python/BPDG/GenVpd.py
@@ -2,7 +2,7 @@
# This file include GenVpd class for fix the Vpd type PCD offset, and PcdEntry for describe
# and process each entry of vpd type PCD.
#
-# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -409,20 +409,6 @@ class GenVPD :
#
PCD.PcdUnpackValue = str(PCD.PcdValue)
- #
- # If value is Unicode string (e.g. L""), then use 2-byte alignment
- # If value is byte array (e.g. {}), then use 8-byte alignment
- #
- PCD.PcdOccupySize = int(PCD.PcdSize)
- if PCD.PcdUnpackValue.startswith("{"):
- Alignment = 8
- elif PCD.PcdUnpackValue.startswith("L"):
- Alignment = 2
- else:
- Alignment = 1
- if PCD.PcdOccupySize % Alignment != 0:
- PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * Alignment
-
#
# Translate PCD size string to an integer value.
PackSize = None
@@ -436,6 +422,28 @@ class GenVPD :
except:
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid PCD size value %s at file: %s line: %s" % (PCD.PcdSize, self.InputFileName, PCD.Lineno))
+ #
+ # If value is Unicode string (e.g. L""), then use 2-byte alignment
+ # If value is byte array (e.g. {}), then use 8-byte alignment
+ #
+ PCD.PcdOccupySize = PCD.PcdBinSize
+ if PCD.PcdUnpackValue.startswith("{"):
+ Alignment = 8
+ elif PCD.PcdUnpackValue.startswith("L"):
+ 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
+
if PCD._IsBoolean(PCD.PcdValue, PCD.PcdSize):
PCD._PackBooleanValue(PCD.PcdValue)
self.FileLinesList[count] = PCD