summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2018-02-26 15:36:47 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-02-28 13:42:57 +0800
commit8ed0f5f188b36bb669e1d29199968d84c2ad5369 (patch)
tree68c92846c2721399a270fedcb454fc825bdddd48 /BaseTools
parent1a7e6a252ec1c23d889850e46c2373e400b6491f (diff)
downloadedk2-8ed0f5f188b36bb669e1d29199968d84c2ad5369.tar.gz
edk2-8ed0f5f188b36bb669e1d29199968d84c2ad5369.tar.bz2
edk2-8ed0f5f188b36bb669e1d29199968d84c2ad5369.zip
BaseTools: Fix a bug override Pcd by DSC Components section
The case is: define a VOID* pcd in DEC file, eg: Value is {0x1}. then override this PCD on DSC component section, eg: Value is {0x1, 0x2, 0x3}, the max size of this PCD is calculate wrong which cause build error. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> (cherry picked from commit cdbf45ad859b1e75e055f1fd06d0c8a10452b3aa)
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py15
-rw-r--r--BaseTools/Source/Python/Workspace/DscBuildData.py5
2 files changed, 17 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 1787decd1d..e2589cfbae 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2421,7 +2421,7 @@ class PlatformAutoGen(AutoGen):
ToPcd.validlists = FromPcd.validlists
ToPcd.expressions = FromPcd.expressions
- if ToPcd.DatumType == "VOID*" and ToPcd.MaxDatumSize in ['', None]:
+ if FromPcd != None and ToPcd.DatumType == "VOID*" and ToPcd.MaxDatumSize in ['', None]:
EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \
% (ToPcd.TokenSpaceGuidCName, TokenCName))
Value = ToPcd.DefaultValue
@@ -2494,6 +2494,19 @@ class PlatformAutoGen(AutoGen):
break
if Flag:
self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Module)
+ # use PCD value to calculate the MaxDatumSize when it is not specified
+ for Name, Guid in Pcds:
+ Pcd = Pcds[Name, Guid]
+ if Pcd.DatumType == "VOID*" and Pcd.MaxDatumSize in ['', None]:
+ Value = Pcd.DefaultValue
+ if Value in [None, '']:
+ Pcd.MaxDatumSize = '1'
+ elif Value[0] == 'L':
+ Pcd.MaxDatumSize = str((len(Value) - 2) * 2)
+ elif Value[0] == '{':
+ Pcd.MaxDatumSize = str(len(Value.split(',')))
+ else:
+ Pcd.MaxDatumSize = str(len(Value) - 1)
return Pcds.values()
## Resolve library names to library modules
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index ea8d1847f7..66402c52b7 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -679,8 +679,9 @@ class DscBuildData(PlatformBuildClassObject):
for TokenSpaceGuid, PcdCName, Setting, Dummy1, Dummy2, Dummy3, Dummy4,Dummy5 in RecordList:
TokenList = GetSplitValueList(Setting)
DefaultValue = TokenList[0]
- if len(TokenList) > 1:
- MaxDatumSize = TokenList[1]
+ # the format is PcdName| Value | VOID* | MaxDatumSize
+ if len(TokenList) > 2:
+ MaxDatumSize = TokenList[2]
else:
MaxDatumSize = ''
TypeString = self._PCD_TYPE_STRING_[Type]