From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 84CB1209574C1 for ; Fri, 2 Mar 2018 01:45:08 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2018 01:51:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,411,1515484800"; d="scan'208";a="30915023" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by FMSMGA003.fm.intel.com with ESMTP; 02 Mar 2018 01:51:16 -0800 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: Yunhua Feng , Liming Gao Date: Fri, 2 Mar 2018 17:51:13 +0800 Message-Id: <1519984273-5348-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch] BaseTools: DSC Components section support flexible PCD X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Mar 2018 09:45:09 -0000 From: Yunhua Feng 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 Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- 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