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>
This commit is contained in:
@ -2421,7 +2421,7 @@ class PlatformAutoGen(AutoGen):
|
|||||||
ToPcd.validlists = FromPcd.validlists
|
ToPcd.validlists = FromPcd.validlists
|
||||||
ToPcd.expressions = FromPcd.expressions
|
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" \
|
EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \
|
||||||
% (ToPcd.TokenSpaceGuidCName, TokenCName))
|
% (ToPcd.TokenSpaceGuidCName, TokenCName))
|
||||||
Value = ToPcd.DefaultValue
|
Value = ToPcd.DefaultValue
|
||||||
@ -2494,6 +2494,19 @@ class PlatformAutoGen(AutoGen):
|
|||||||
break
|
break
|
||||||
if Flag:
|
if Flag:
|
||||||
self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Module)
|
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()
|
return Pcds.values()
|
||||||
|
|
||||||
## Resolve library names to library modules
|
## Resolve library names to library modules
|
||||||
|
@ -679,8 +679,9 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
for TokenSpaceGuid, PcdCName, Setting, Dummy1, Dummy2, Dummy3, Dummy4,Dummy5 in RecordList:
|
for TokenSpaceGuid, PcdCName, Setting, Dummy1, Dummy2, Dummy3, Dummy4,Dummy5 in RecordList:
|
||||||
TokenList = GetSplitValueList(Setting)
|
TokenList = GetSplitValueList(Setting)
|
||||||
DefaultValue = TokenList[0]
|
DefaultValue = TokenList[0]
|
||||||
if len(TokenList) > 1:
|
# the format is PcdName| Value | VOID* | MaxDatumSize
|
||||||
MaxDatumSize = TokenList[1]
|
if len(TokenList) > 2:
|
||||||
|
MaxDatumSize = TokenList[2]
|
||||||
else:
|
else:
|
||||||
MaxDatumSize = ''
|
MaxDatumSize = ''
|
||||||
TypeString = self._PCD_TYPE_STRING_[Type]
|
TypeString = self._PCD_TYPE_STRING_[Type]
|
||||||
|
Reference in New Issue
Block a user