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.151; helo=mga17.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 01E09223522BA for ; Tue, 27 Feb 2018 21:19:49 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Feb 2018 21:25:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,404,1515484800"; d="scan'208";a="23795585" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 27 Feb 2018 21:25:56 -0800 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 27 Feb 2018 21:25:55 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 27 Feb 2018 21:25:55 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.125]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0319.002; Wed, 28 Feb 2018 13:25:53 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] BaseTools: Fix a bug override Pcd by DSC Components section Thread-Index: AQHTrtZT7HYc8D+LvUySwKyDUUSOBKO5S4RA Date: Wed, 28 Feb 2018 05:25:53 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1D4A01@SHSMSX104.ccr.corp.intel.com> References: <1519631356-2620-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1519631356-2620-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: Fix a bug override Pcd by DSC Components section 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: Wed, 28 Feb 2018 05:19:50 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >Yonghong Zhu >Sent: Monday, February 26, 2018 3:49 PM >To: edk2-devel@lists.01.org >Subject: [edk2] [Patch] BaseTools: Fix a bug override Pcd by DSC Component= s >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 >--- > BaseTools/Source/Python/AutoGen/AutoGen.py | 15 ++++++++++++++- > BaseTools/Source/Python/Workspace/DscBuildData.py | 5 +++-- > 2 files changed, 17 insertions(+), 3 deletions(-) > >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py >b/BaseTools/Source/Python/AutoGen/AutoGen.py >index 405bfa1..19c65b3 100644 >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py >@@ -2412,11 +2412,11 @@ class PlatformAutoGen(AutoGen): > ExtraData=3D"%s.%s" % (ToPcd.TokenSpaceGu= idCName, >TokenCName)) > ToPcd.validateranges =3D FromPcd.validateranges > ToPcd.validlists =3D FromPcd.validlists > ToPcd.expressions =3D FromPcd.expressions > >- if ToPcd.DatumType =3D=3D "VOID*" and ToPcd.MaxDatumSize in ['', = None]: >+ if FromPcd !=3D None and ToPcd.DatumType =3D=3D "VOID*" and >ToPcd.MaxDatumSize in ['', None]: > EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified >for PCD %s.%s" \ > % (ToPcd.TokenSpaceGuidCName, TokenCName)) > Value =3D ToPcd.DefaultValue > if Value in [None, '']: > ToPcd.MaxDatumSize =3D '1' >@@ -2485,10 +2485,23 @@ class PlatformAutoGen(AutoGen): > ToPcd =3D Pcds[PcdItem] > Flag =3D True > break > if Flag: > self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Mo= dule) >+ # use PCD value to calculate the MaxDatumSize when it is not spec= ified >+ for Name, Guid in Pcds: >+ Pcd =3D Pcds[Name, Guid] >+ if Pcd.DatumType =3D=3D "VOID*" and Pcd.MaxDatumSize in ['', = None]: >+ Value =3D Pcd.DefaultValue >+ if Value in [None, '']: >+ Pcd.MaxDatumSize =3D '1' >+ elif Value[0] =3D=3D 'L': >+ Pcd.MaxDatumSize =3D str((len(Value) - 2) * 2) >+ elif Value[0] =3D=3D '{': >+ Pcd.MaxDatumSize =3D str(len(Value.split(','))) >+ else: >+ Pcd.MaxDatumSize =3D str(len(Value) - 1) > return Pcds.values() > > ## Resolve library names to library modules > # > # (for Edk.x modules) >diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py >b/BaseTools/Source/Python/Workspace/DscBuildData.py >index 75b877a..32b1df9 100644 >--- a/BaseTools/Source/Python/Workspace/DscBuildData.py >+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py >@@ -677,12 +677,13 @@ class DscBuildData(PlatformBuildClassObject): > MODEL_PCD_FEATURE_FLAG, MODEL_PCD_DYNAMIC, >MODEL_PCD_DYNAMIC_EX]: > RecordList =3D self._RawData[Type, self._Arch, None, Modu= leId] > for TokenSpaceGuid, PcdCName, Setting, Dummy1, Dummy2, >Dummy3, Dummy4,Dummy5 in RecordList: > TokenList =3D GetSplitValueList(Setting) > DefaultValue =3D TokenList[0] >- if len(TokenList) > 1: >- MaxDatumSize =3D TokenList[1] >+ # the format is PcdName| Value | VOID* | MaxDatumSize >+ if len(TokenList) > 2: >+ MaxDatumSize =3D TokenList[2] > else: > MaxDatumSize =3D '' > TypeString =3D self._PCD_TYPE_STRING_[Type] > Pcd =3D PcdClassObject( > PcdCName, >-- >2.6.1.windows.1 > >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel