diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-03-17 15:25:32 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-04-10 13:58:14 +0800 |
commit | c33081c912968da46fd6f0c7d2d2e52b7b410626 (patch) | |
tree | d4c118a8286deefb2e5e9e87e33294e16f8c51fd /BaseTools/Source/Python/AutoGen/AutoGen.py | |
parent | f7b31aa540435f43f5c60e7bde456c272b31f7ee (diff) | |
download | edk2-c33081c912968da46fd6f0c7d2d2e52b7b410626.tar.gz edk2-c33081c912968da46fd6f0c7d2d2e52b7b410626.tar.bz2 edk2-c33081c912968da46fd6f0c7d2d2e52b7b410626.zip |
BaseTools: Fix the bug for VOID* pcd max size from component section
When the Pcd defined in components section, its value's size is larger
than the value's size in [pcd] section, it cause build error, because
original code use the size get in [pcd] section as max size.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/AutoGen.py')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/AutoGen.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 5940e88682..dfc5b10569 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2354,6 +2354,7 @@ class PlatformAutoGen(AutoGen): if FromPcd.MaxDatumSize:
ToPcd.MaxDatumSize = FromPcd.MaxDatumSize
+ ToPcd.MaxSizeUserSet = FromPcd.MaxDatumSize
if FromPcd.DefaultValue:
ToPcd.DefaultValue = FromPcd.DefaultValue
if FromPcd.TokenValue:
@@ -2456,6 +2457,7 @@ class PlatformAutoGen(AutoGen): for Name, Guid in Pcds:
Pcd = Pcds[Name, Guid]
if Pcd.DatumType == "VOID*" and Pcd.MaxDatumSize in ['', None]:
+ Pcd.MaxSizeUserSet = None
Value = Pcd.DefaultValue
if Value in [None, '']:
Pcd.MaxDatumSize = '1'
@@ -4157,9 +4159,12 @@ class ModuleAutoGen(AutoGen): Padding = Padding * 2
ArraySize = ArraySize / 2
if ArraySize < (len(PcdValue) + 1):
- EdkLogger.error("build", AUTOGEN_ERROR,
+ if Pcd.MaxSizeUserSet:
+ EdkLogger.error("build", AUTOGEN_ERROR,
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName)
)
+ else:
+ ArraySize = len(PcdValue) + 1
if ArraySize > len(PcdValue) + 1:
NewValue = NewValue + Padding * (ArraySize - len(PcdValue) - 1)
PcdValue = NewValue + Padding.strip().rstrip(',') + '}'
@@ -4167,9 +4172,12 @@ class ModuleAutoGen(AutoGen): PcdValue = PcdValue.rstrip('}') + ', 0x00' * (ArraySize - len(PcdValue.split(',')))
PcdValue += '}'
else:
- EdkLogger.error("build", AUTOGEN_ERROR,
+ if Pcd.MaxSizeUserSet:
+ EdkLogger.error("build", AUTOGEN_ERROR,
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName)
)
+ else:
+ ArraySize = len(PcdValue) + 1
PcdItem = '%s.%s|%s|0x%X' % \
(Pcd.TokenSpaceGuidCName, TokenCName, PcdValue, PatchPcd[1])
PcdComments = ''
|