# This file include GenVpd class for fix the Vpd type PCD offset, and PcdEntry for describe\r
# and process each entry of vpd type PCD.\r
#\r
-# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#\r
PCD.PcdUnpackValue = str(PCD.PcdValue)\r
\r
- #\r
- # If value is Unicode string (e.g. L""), then use 2-byte alignment\r
- # If value is byte array (e.g. {}), then use 8-byte alignment\r
- #\r
- PCD.PcdOccupySize = int(PCD.PcdSize)\r
- if PCD.PcdUnpackValue.startswith("{"):\r
- Alignment = 8\r
- elif PCD.PcdUnpackValue.startswith("L"):\r
- Alignment = 2\r
- else:\r
- Alignment = 1\r
- if PCD.PcdOccupySize % Alignment != 0:\r
- PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * Alignment\r
-\r
#\r
# Translate PCD size string to an integer value.\r
PackSize = None\r
except:\r
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid PCD size value %s at file: %s line: %s" % (PCD.PcdSize, self.InputFileName, PCD.Lineno))\r
\r
+ #\r
+ # If value is Unicode string (e.g. L""), then use 2-byte alignment\r
+ # If value is byte array (e.g. {}), then use 8-byte alignment\r
+ #\r
+ PCD.PcdOccupySize = PCD.PcdBinSize\r
+ if PCD.PcdUnpackValue.startswith("{"):\r
+ Alignment = 8\r
+ elif PCD.PcdUnpackValue.startswith("L"):\r
+ Alignment = 2\r
+ else:\r
+ Alignment = 1\r
+\r
+ if PCD.PcdOffset != '*':\r
+ if PCD.PcdOccupySize % Alignment != 0:\r
+ if PCD.PcdUnpackValue.startswith("{"):\r
+ EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-byte aligned!" %(PCD.PcdCName), File=self.InputFileName)\r
+ else:\r
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, 'The offset value of PCD %s should be %s-byte aligned.' % (PCD.PcdCName, Alignment))\r
+ else:\r
+ if PCD.PcdOccupySize % Alignment != 0:\r
+ PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * Alignment\r
+\r
if PCD._IsBoolean(PCD.PcdValue, PCD.PcdSize):\r
PCD._PackBooleanValue(PCD.PcdValue)\r
self.FileLinesList[count] = PCD\r