mirror of https://github.com/acidanthera/audk.git
BaseTools/BPDG: Fix the bug to get the PCD Size
The original bug is only consider int format of PcdSize, but forgot the Hex format. The fix is use the already exist variable PCD.PcdBinSize which done to translate PCD size cover 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>
This commit is contained in:
parent
195c94360f
commit
53c1329529
|
@ -2,7 +2,7 @@
|
||||||
# This file include GenVpd class for fix the Vpd type PCD offset, and PcdEntry for describe
|
# This file include GenVpd class for fix the Vpd type PCD offset, and PcdEntry for describe
|
||||||
# and process each entry of vpd type PCD.
|
# and process each entry of vpd type PCD.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -409,11 +409,24 @@ class GenVPD :
|
||||||
#
|
#
|
||||||
PCD.PcdUnpackValue = str(PCD.PcdValue)
|
PCD.PcdUnpackValue = str(PCD.PcdValue)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Translate PCD size string to an integer value.
|
||||||
|
PackSize = None
|
||||||
|
try:
|
||||||
|
PackSize = int(PCD.PcdSize, 10)
|
||||||
|
PCD.PcdBinSize = PackSize
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
PackSize = int(PCD.PcdSize, 16)
|
||||||
|
PCD.PcdBinSize = PackSize
|
||||||
|
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 Unicode string (e.g. L""), then use 2-byte alignment
|
||||||
# If value is byte array (e.g. {}), then use 8-byte alignment
|
# If value is byte array (e.g. {}), then use 8-byte alignment
|
||||||
#
|
#
|
||||||
PCD.PcdOccupySize = int(PCD.PcdSize)
|
PCD.PcdOccupySize = PCD.PcdBinSize
|
||||||
if PCD.PcdUnpackValue.startswith("{"):
|
if PCD.PcdUnpackValue.startswith("{"):
|
||||||
Alignment = 8
|
Alignment = 8
|
||||||
elif PCD.PcdUnpackValue.startswith("L"):
|
elif PCD.PcdUnpackValue.startswith("L"):
|
||||||
|
@ -431,19 +444,6 @@ class GenVPD :
|
||||||
if PCD.PcdOccupySize % Alignment != 0:
|
if PCD.PcdOccupySize % Alignment != 0:
|
||||||
PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * Alignment
|
PCD.PcdOccupySize = (PCD.PcdOccupySize / Alignment + 1) * Alignment
|
||||||
|
|
||||||
#
|
|
||||||
# Translate PCD size string to an integer value.
|
|
||||||
PackSize = None
|
|
||||||
try:
|
|
||||||
PackSize = int(PCD.PcdSize, 10)
|
|
||||||
PCD.PcdBinSize = PackSize
|
|
||||||
except:
|
|
||||||
try:
|
|
||||||
PackSize = int(PCD.PcdSize, 16)
|
|
||||||
PCD.PcdBinSize = PackSize
|
|
||||||
except:
|
|
||||||
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid PCD size value %s at file: %s line: %s" % (PCD.PcdSize, self.InputFileName, PCD.Lineno))
|
|
||||||
|
|
||||||
if PCD._IsBoolean(PCD.PcdValue, PCD.PcdSize):
|
if PCD._IsBoolean(PCD.PcdValue, PCD.PcdSize):
|
||||||
PCD._PackBooleanValue(PCD.PcdValue)
|
PCD._PackBooleanValue(PCD.PcdValue)
|
||||||
self.FileLinesList[count] = PCD
|
self.FileLinesList[count] = PCD
|
||||||
|
|
Loading…
Reference in New Issue