From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Yunhua Feng <yunhuax.feng@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [Patch] BaseTools: DSC Components section support flexible PCD
Date: Fri, 2 Mar 2018 17:51:13 +0800 [thread overview]
Message-ID: <1519984273-5348-1-git-send-email-yonghong.zhu@intel.com> (raw)
From: Yunhua Feng <yunhuax.feng@intel.com>
DSC Components section support flexible PCD, and for binary driver, we
need patch this value. Update the split char ',' not ', ' because some
value may have space, while others may not have this space.
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>
---
BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py | 3 ++-
BaseTools/Source/Python/Workspace/DscBuildData.py | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py
index 882da81..942ba88 100644
--- a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py
+++ b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py
@@ -159,14 +159,15 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
Index = Index + 2
elif ValueString.startswith("{") and ValueString.endswith("}"):
#
# Patch {0x1, 0x2, ...} byte by byte
#
- ValueList = ValueString[1 : len(ValueString) - 1].split(', ')
+ ValueList = ValueString[1 : len(ValueString) - 1].split(',')
Index = 0
try:
for ByteString in ValueList:
+ ByteString = ByteString.strip()
if ByteString.upper().startswith('0X'):
ByteValue = int(ByteString, 16)
else:
ByteValue = int(ByteString)
ByteList[ValueOffset + Index] = ByteValue % 0x100
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index a5089a9..c7c82fb 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -682,10 +682,21 @@ class DscBuildData(PlatformBuildClassObject):
RecordList = self._RawData[Type, self._Arch, None, ModuleId]
for TokenSpaceGuid, PcdCName, Setting, Dummy1, Dummy2, Dummy3, Dummy4,Dummy5 in RecordList:
TokenList = GetSplitValueList(Setting)
DefaultValue = TokenList[0]
# the format is PcdName| Value | VOID* | MaxDatumSize
+ if (PcdCName, TokenSpaceGuid) not in self.DecPcds:
+ EdkLogger.error('build', PARSER_ERROR,
+ "Pcd (%s.%s) defined in DSC is not declared in DEC files. Arch: ['%s']" % (TokenSpaceGuid, PcdCName, self._Arch), File=self.MetaFile, Line=LineNo)
+ else:
+ DatumType = self.DecPcds[(PcdCName, TokenSpaceGuid)].DatumType
+
+ try:
+ DefaultValue = ValueExpressionEx(DefaultValue, DatumType, self._GuidDict)(True)
+ except BadExpression,Value:
+ EdkLogger.error('build', PARSER_ERROR,
+ "Pcd (%s.%s) defined in DSC is not declared in DEC files. Arch: ['%s']" % (TokenSpaceGuid, PcdCName, self._Arch), File=self.MetaFile, Line=LineNo, ExtraData=Value)
if len(TokenList) > 2:
MaxDatumSize = TokenList[2]
else:
MaxDatumSize = ''
TypeString = self._PCD_TYPE_STRING_[Type]
--
2.6.1.windows.1
reply other threads:[~2018-03-02 9:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1519984273-5348-1-git-send-email-yonghong.zhu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox