From nobody Mon Dec 23 04:52:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 15199842814619.402823391954144; Fri, 2 Mar 2018 01:51:21 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 51A5622546B91; Fri, 2 Mar 2018 01:45:10 -0800 (PST) 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) 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 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 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; 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 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,411,1515484800"; d="scan'208";a="30915023" From: Yonghong Zhu To: edk2-devel@lists.01.org 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: [edk2] [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: , Cc: Yunhua Feng , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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/BaseT= ools/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=3D0): Index =3D Index + 2 elif ValueString.startswith("{") and ValueString.endswith("}"): # # Patch {0x1, 0x2, ...} byte by byte # - ValueList =3D ValueString[1 : len(ValueString) - 1].split(', ') + ValueList =3D ValueString[1 : len(ValueString) - 1].split(',') Index =3D 0 try: for ByteString in ValueList: + ByteString =3D ByteString.strip() if ByteString.upper().startswith('0X'): ByteValue =3D int(ByteString, 16) else: ByteValue =3D int(ByteString) ByteList[ValueOffset + Index] =3D 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 =3D self._RawData[Type, self._Arch, None, Modul= eId] for TokenSpaceGuid, PcdCName, Setting, Dummy1, Dummy2, Dum= my3, Dummy4,Dummy5 in RecordList: TokenList =3D GetSplitValueList(Setting) DefaultValue =3D 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._Ar= ch), File=3Dself.MetaFile, Line=3DLineNo) + else: + DatumType =3D self.DecPcds[(PcdCName, TokenSpaceGu= id)].DatumType + + try: + DefaultValue =3D ValueExpressionEx(DefaultValue, D= atumType, 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._Ar= ch), File=3Dself.MetaFile, Line=3DLineNo, ExtraData=3DValue) if len(TokenList) > 2: MaxDatumSize =3D TokenList[2] else: MaxDatumSize =3D '' TypeString =3D self._PCD_TYPE_STRING_[Type] --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel