From nobody Fri May 3 14:08:28 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 151963136243647.709294215490104; Sun, 25 Feb 2018 23:49:22 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E4EBD21F6A6E0; Sun, 25 Feb 2018 23:43:14 -0800 (PST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 B16ED22436945 for ; Sun, 25 Feb 2018 23:43:13 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2018 23:49:18 -0800 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by orsmga005.jf.intel.com with ESMTP; 25 Feb 2018 23:49:17 -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=134.134.136.24; helo=mga09.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,396,1515484800"; d="scan'208";a="203749673" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Mon, 26 Feb 2018 15:49:16 +0800 Message-Id: <1519631356-2620-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [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: , 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" 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 Reviewed-by: Liming Gao --- 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.TokenSpaceGui= dCName, TokenCName)) ToPcd.validateranges =3D FromPcd.validateranges ToPcd.validlists =3D FromPcd.validlists ToPcd.expressions =3D FromPcd.expressions =20 - if ToPcd.DatumType =3D=3D "VOID*" and ToPcd.MaxDatumSize in ['', N= one]: + 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], Mod= ule) + # use PCD value to calculate the MaxDatumSize when it is not speci= fied + for Name, Guid in Pcds: + Pcd =3D Pcds[Name, Guid] + if Pcd.DatumType =3D=3D "VOID*" and Pcd.MaxDatumSize in ['', N= one]: + 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() =20 ## 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, Modul= eId] for TokenSpaceGuid, PcdCName, Setting, Dummy1, Dummy2, Dum= my3, 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, --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel