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.93; helo=mga11.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 5BE1521164EF8 for ; Wed, 24 Oct 2018 07:35:05 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2018 07:35:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,420,1534834800"; d="scan'208";a="268419129" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 24 Oct 2018 07:35:04 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 07:35:03 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 07:35:03 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.161]) with mapi id 14.03.0415.000; Wed, 24 Oct 2018 22:34:59 +0800 From: "Gao, Liming" To: "Feng, Bob C" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] BaseTool: Filter out unused structure pcds Thread-Index: AQHUZ6N3zAC4wbPSVkyNFcfcXN9KDaUufing Date: Wed, 24 Oct 2018 14:34:58 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E35C922@SHSMSX104.ccr.corp.intel.com> References: <20181019120009.21856-1-bob.c.feng@intel.com> In-Reply-To: <20181019120009.21856-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmY0OGVmZjItMmFmMS00NDM0LThjODItYzk3OGNiOWZjZDIyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoidEdnM1JhNEJLejZ1RXljemUyVU1CNWFLbW5uVktlTFpJd0tvOWFcL3Zoa1ZxWEZabFFBNSt1WGhXR3hkY2NkeFoifQ== dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTool: Filter out unused structure pcds X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2018 14:35:05 -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 Bo= bCF > Sent: Friday, October 19, 2018 8:00 PM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [edk2] [Patch] BaseTool: Filter out unused structure pcds >=20 > The current code handle all the structure pcds > even if there is no module or library use them. > This patch is going to filter out the unused structure pcds. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Bob Feng > Cc: Liming Gao > --- > .../Source/Python/Workspace/DscBuildData.py | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) >=20 > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTool= s/Source/Python/Workspace/DscBuildData.py > index e481ea4f64..31bce16d15 100644 > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py > @@ -274,10 +274,11 @@ class DscBuildData(PlatformBuildClassObject): > self._RFCLanguages =3D None > self._ISOLanguages =3D None > self._VpdToolGuid =3D None > self._MacroDict =3D None > self.DefaultStores =3D None > + self.UsedStructurePcd =3D None >=20 > ## handle Override Path of Module > def _HandleOverridePath(self): > RecordList =3D self._RawData[MODEL_META_DATA_COMPONENT, self._Ar= ch] > for Record in RecordList: > @@ -1476,10 +1477,11 @@ class DscBuildData(PlatformBuildClassObject): > if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[M= ODEL_PCD_DYNAMIC_HII], > self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: > str_pcd_obj_str.DefaultFromDSC =3D {skuname:= {defaultstore: > str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_p= cd_obj.SkuInfoList[skuname].HiiDefaultValue) for defaultstore > in DefaultStores} for skuname in str_pcd_obj.SkuInfoList} > else: > str_pcd_obj_str.DefaultFromDSC =3D {skuname:= {defaultstore: > str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_p= cd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in > DefaultStores} for skuname in str_pcd_obj.SkuInfoList} > S_pcd_set[Pcd] =3D str_pcd_obj_str > + self.FilterStrcturePcd(S_pcd_set) > if S_pcd_set: > GlobalData.gStructurePcd[self.Arch] =3D S_pcd_set > for stru_pcd in S_pcd_set.values(): > for skuid in SkuIds: > if skuid in stru_pcd.SkuOverrideValues: > @@ -1571,10 +1573,27 @@ class DscBuildData(PlatformBuildClassObject): > elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pc= d.SkuInfoList: > del pcd.SkuInfoList[TAB_COMMON] >=20 > map(self.FilterSkuSettings, [Pcds[pcdkey] for pcdkey in Pcds if = Pcds[pcdkey].Type in DynamicPcdType]) > return Pcds > + #Filter the StrucutrePcd that is not used by any module in dsc file = and fdf file. > + def FilterStrcturePcd(self, S_pcd_set): > + if not self.UsedStructurePcd: > + FdfInfList =3D [] > + if GlobalData.gFdfParser: > + FdfInfList =3D GlobalData.gFdfParser.Profile.InfList > + FdfModuleList =3D [PathClass(NormPath(Inf), GlobalData.gWork= space, Arch=3Dself._Arch) for Inf in FdfInfList] > + AllModulePcds =3D set() > + ModuleSet =3D set(self._Modules.keys() + self.LibraryInstanc= es + FdfModuleList) > + for ModuleFile in ModuleSet: > + ModuleData =3D self._Bdb[ModuleFile, self._Arch, self._T= arget, self._Toolchain] > + AllModulePcds =3D AllModulePcds | set(ModuleData.Pcds.ke= ys()) > + > + self.UsedStructurePcd =3D AllModulePcds > + UnusedStruPcds =3D set(S_pcd_set.keys()) - self.UsedStructurePcd > + for (Token, TokenSpaceGuid) in UnusedStruPcds: > + del S_pcd_set[(Token, TokenSpaceGuid)] >=20 > ## Retrieve non-dynamic PCD settings > # > # @param Type PCD type > # > -- > 2.18.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel