From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 41E592034860B for ; Mon, 21 May 2018 22:17:22 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 22:17:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,429,1520924400"; d="scan'208";a="230535062" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 21 May 2018 22:17:21 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 21 May 2018 22:17:21 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 21 May 2018 22:17:21 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.210]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.6]) with mapi id 14.03.0319.002; Tue, 22 May 2018 13:17:19 +0800 From: "Zhu, Yonghong" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" CC: "Feng, YunhuaX" , "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [edk2] [Patch] BaseTools: Report more clear error message when PCD type mismatch Thread-Index: AQHT8Doj0S8OlMi0yUSSu+7bYvinbaQ7N9ag Date: Tue, 22 May 2018 05:17:19 +0000 Message-ID: References: <1526821052-34192-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1526821052-34192-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: Report more clear error message when PCD type mismatch X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2018 05:17:22 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yong= hong Zhu Sent: Sunday, May 20, 2018 8:58 PM To: edk2-devel@lists.01.org Cc: Feng, YunhuaX ; Gao, Liming Subject: [edk2] [Patch] BaseTools: Report more clear error message when PCD= type mismatch From: Yunhua Feng Error message is not clear when PCD type defined in driver's Library is dif= ferent with PCD type defined in DSC components or PCD type defined in DSC P= CD section. Case as below: DSC: [PcdsFixedAtBuild] PcdToken.PcdCName | "A" [Components] TestPkg/TestDriver.inf { PcdToken.PcdCName | "B" } Library: [Pcd] PcdToken.PcdCName Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/AutoGen/AutoGen.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 1715101..584971e 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2330,11 +2330,11 @@ class PlatformAutoGen(AutoGen): ## Override PCD setting (type, value, ...) # # @param ToPcd The PCD to be overrided # @param FromPcd The PCD overrideing from # - def _OverridePcd(self, ToPcd, FromPcd, Module=3D""): + def _OverridePcd(self, ToPcd, FromPcd, Module=3D"", Msg=3D"", Library= =3D""): # # in case there's PCDs coming from FDF file, which have no type gi= ven. # at this point, ToPcd.Type has the type found from dependent # package # @@ -2350,14 +2350,16 @@ class PlatformAutoGen(AutoGen): and (ToPcd.Type !=3D FromPcd.Type) and (ToPcd.Type in From= Pcd.Type): if ToPcd.Type.strip() =3D=3D TAB_PCDS_DYNAMIC_EX: ToPcd.Type =3D FromPcd.Type elif ToPcd.Type and FromPcd.Type \ and ToPcd.Type !=3D FromPcd.Type: + if Library: + Module =3D str(Module) + " 's library file (" + str(Li= brary) + ")" EdkLogger.error("build", OPTION_CONFLICT, "Mismatched PCD = type", - ExtraData=3D"%s.%s is defined as [%s] in m= odule %s, but as [%s] in platform."\ + ExtraData=3D"%s.%s is used as [%s] in=20 + module %s, but as [%s] in %s."\ % (ToPcd.TokenSpaceGuidCName, To= kenCName, - ToPcd.Type, Module, FromPcd.T= ype), + ToPcd.Type, Module,=20 + FromPcd.Type, Msg), File=3Dself.MetaFile) =20 if FromPcd.MaxDatumSize: ToPcd.MaxDatumSize =3D FromPcd.MaxDatumSize ToPcd.MaxSizeUserSet =3D FromPcd.MaxDatumSize @@ -2414,21 = +2416,21 @@ class PlatformAutoGen(AutoGen): # # @param Module The module from which the PCD setting will be over= rided # # @retval PCD_list The list PCDs with settings from platform # - def ApplyPcdSetting(self, Module, Pcds): + def ApplyPcdSetting(self, Module, Pcds, Library=3D""): # for each PCD in module for Name, Guid in Pcds: PcdInModule =3D Pcds[Name, Guid] # find out the PCD setting in platform if (Name, Guid) in self.Platform.Pcds: PcdInPlatform =3D self.Platform.Pcds[Name, Guid] else: PcdInPlatform =3D None # then override the settings if any - self._OverridePcd(PcdInModule, PcdInPlatform, Module) + self._OverridePcd(PcdInModule, PcdInPlatform, Module,=20 + Msg=3D"DSC PCD sections", Library=3DLibrary) # resolve the VariableGuid value for SkuId in PcdInModule.SkuInfoList: Sku =3D PcdInModule.SkuInfoList[SkuId] if Sku.VariableGuid =3D=3D '': continue Sku.VariableGuidValue =3D GuidValue(Sku.VariableGuid, self= .PackageList, self.MetaFile.Path) @@ -2456,11 +2458,11 @@ class PlatformAut= oGen(AutoGen): if PcdItem in Pcds: ToPcd =3D Pcds[PcdItem] Flag =3D True break if Flag: - self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Mod= ule) + self._OverridePcd(ToPcd, PlatformModule.Pcds[Key],=20 + Module, Msg=3D"DSC Components Module scoped PCD section",=20 + Library=3DLibrary) # 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 TAB_VOID and not Pcd.MaxDatumSize: Pcd.MaxSizeUserSet =3D None @@ -3669,19 +3671,21 @@ class = ModuleAutoGen(AutoGen): def _GetLibraryPcdList(self): if self._LibraryPcdList is None: Pcds =3D OrderedDict() if not self.IsLibrary: # get PCDs from dependent libraries + self._LibraryPcdList =3D [] for Library in self.DependentLibraryList: + PcdsInLibrary =3D OrderedDict() self.UpdateComments(self._PcdComments, Library.PcdComm= ents) for Key in Library.Pcds: # skip duplicated PCDs if Key in self.Module.Pcds or Key in Pcds: continue Pcds[Key] =3D copy.copy(Library.Pcds[Key]) - # apply PCD settings from platform - self._LibraryPcdList =3D self.PlatformInfo.ApplyPcdSetting= (self.Module, Pcds) + PcdsInLibrary[Key] =3D Pcds[Key] + =20 + self._LibraryPcdList.extend(self.PlatformInfo.ApplyPcdSetting(self.Mod + ule, PcdsInLibrary, Library=3DLibrary)) else: self._LibraryPcdList =3D [] return self._LibraryPcdList =20 ## Get the GUID value mapping -- 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel