diff options
author | Feng, YunhuaX </o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Feng, YunhuaX4e1> | 2018-02-02 14:49:24 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-02-04 11:16:01 +0800 |
commit | bee0f2f167e6e982e665c851d605cd50e7748e08 (patch) | |
tree | 3ad98cf5ba27eb5a51a4d12ff6f1022d5cbcb64d /BaseTools/Source/Python/Workspace/DscBuildData.py | |
parent | 8a641d2b73295d64438012972aac83838de31671 (diff) | |
download | edk2-bee0f2f167e6e982e665c851d605cd50e7748e08.tar.gz edk2-bee0f2f167e6e982e665c851d605cd50e7748e08.tar.bz2 edk2-bee0f2f167e6e982e665c851d605cd50e7748e08.zip |
BaseTools: StructurePcd array Value support flexible format
if StructurePcd set item value is array, support flexible format
like as:
gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array | {flexible format}
{flexible format} = {L"ABC"} | {L'ABC'} | {"ABC"} | {UINT8(0x10)}
| {UINT16(0x10)} | {UINT32(0x10)} | {UINT64(0x10)}
| {DEVICE_PATH("PciRoot(0)/Pci(0,0)")}
| {GUID(gPcdPkgTokenSpaceGuid)}
| {L"ABC", L'ABC', UINT8(0x10)....}
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Workspace/DscBuildData.py')
-rw-r--r-- | BaseTools/Source/Python/Workspace/DscBuildData.py | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index ad5b267fd1..1da4f03ab8 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1528,7 +1528,12 @@ class DscBuildData(PlatformBuildClassObject): FieldName = "." + FieldName
IsArray = self.IsFieldValueAnArray(FieldList[FieldName.strip(".")][0])
if IsArray:
- Value, ValueSize = ParseFieldValue (FieldList[FieldName.strip(".")][0])
+ try:
+ Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], "VOID*", self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2]))
+ Value, ValueSize = ParseFieldValue(Value)
CApp = CApp + ' __FLEXIBLE_SIZE(Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
else:
NewFieldName = ''
@@ -1550,7 +1555,12 @@ class DscBuildData(PlatformBuildClassObject): FieldName = "." + FieldName
IsArray = self.IsFieldValueAnArray(FieldList[FieldName.strip(".")][0])
if IsArray:
- Value, ValueSize = ParseFieldValue (FieldList[FieldName.strip(".")][0])
+ try:
+ Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], "VOID*", self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2]))
+ Value, ValueSize = ParseFieldValue(Value)
CApp = CApp + ' __FLEXIBLE_SIZE(Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
else:
NewFieldName = ''
@@ -1588,6 +1598,13 @@ class DscBuildData(PlatformBuildClassObject): continue
for FieldName in FieldList:
IsArray = self.IsFieldValueAnArray(FieldList[FieldName][0])
+ if IsArray:
+ try:
+ FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], "VOID*", self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1],FieldList[FieldName][2]))
+
try:
Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
except Exception:
@@ -1613,6 +1630,13 @@ class DscBuildData(PlatformBuildClassObject): continue
if Pcd.DefaultFromDSC and FieldList == Pcd.DefaultFromDSC:
IsArray = self.IsFieldValueAnArray(FieldList)
+ if IsArray:
+ try:
+ FieldList = ValueExpressionEx(FieldList, "VOID*")(True)
+ except BadExpression:
+ EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from DSC: %s" %
+ (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldList))
+
Value, ValueSize = ParseFieldValue (FieldList)
if isinstance(Value, str):
CApp = CApp + ' Pcd = %s; // From DSC Default Value %s\n' % (Value, Pcd.DefaultFromDSC)
@@ -1626,6 +1650,13 @@ class DscBuildData(PlatformBuildClassObject): for FieldName in FieldList:
IsArray = self.IsFieldValueAnArray(FieldList[FieldName][0])
+ if IsArray:
+ try:
+ FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], "VOID*", self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
+
try:
Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
except Exception:
|