From nobody Sat May 4 06:31:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+62399+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+62399+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1594625958; cv=none; d=zohomail.com; s=zohoarc; b=PKZ5gwt+xwR4PfmnFC5cFfiqohN2QVZUyawkzaeeZB2OAxDGtyXlI38XWrW+n/p332esIMG/IHjKBfXFcDAcl9hqimSeU3Vpmz5PlWp0Ke2Gez1tnQnxSDvWexUKE8OxhNoJNcl49QV2RTU65QhO4ZfIOPh6hA1c3mb2eNgtZig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594625958; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=tpPsr0biOjhBWI9o+DmglNanDdUYOAlXC1perxDQQeA=; b=C23FjehOcoGAZ/ZMx0HPG4u6E7YDgonJZFDQUWFZ1IBOzQTcB3+ez3atEhWoa89LmEI87oPvvCSzmTI668/30tmqR3/MRP5nq0++tuO3Dxl1OWprwRJKCkVsvbBZC6wAUgbrp5FJcCUUcBerhNw7NJ0X/7Ftc9SI3SfZI20cIrY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+62399+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1594625958485381.93434041927344; Mon, 13 Jul 2020 00:39:18 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id mhmSYY1788612xuOyMnQznim; Mon, 13 Jul 2020 00:39:18 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.14493.1594625956842993844 for ; Mon, 13 Jul 2020 00:39:17 -0700 IronPort-SDR: kLDYwA6iwxxmPsU7YXR9qVVwaSN9XI9Q6I/rUwlT+3MnbDScfnJGLopLsHbMwT7yJasKC2Fp8H TFVKlC1hsyYg== X-IronPort-AV: E=McAfee;i="6000,8403,9680"; a="146605109" X-IronPort-AV: E=Sophos;i="5.75,346,1589266800"; d="scan'208";a="146605109" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2020 00:39:15 -0700 IronPort-SDR: PeLn/XVu5FTyJNmJwWBwOQ98/ADxs0tlM4fLP3zI3zk8eG8kb9Ijd8RwdPTBOCFTuvXPTnVCHz YbVUiVuyKl0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,346,1589266800"; d="scan'208";a="315982947" X-Received: from yuweipc.ccr.corp.intel.com ([10.239.158.23]) by orsmga008.jf.intel.com with ESMTP; 13 Jul 2020 00:39:13 -0700 From: "Yuwei Chen" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao Subject: [edk2-devel] [Patch v4] BaseTools: Add Guid name support in GenFfs. Date: Mon, 13 Jul 2020 15:39:13 +0800 Message-Id: <20200713073913.1970-1-yuwei.chen@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,yuwei.chen@intel.com X-Gm-Message-State: PmEd3BWFxUjCdltx3uEJAblix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1594625958; bh=Qbe1L+PA2gtMCEegsuLEE6CRJQkLHtwBy9PRrMS3v64=; h=Cc:Date:From:Reply-To:Subject:To; b=J6t/Ck+plwWq2HStvtLapB9CIbFarChXUqJ775zlQQhwF4ecS+y73JMr/W2RDKNWezJ ajcj3NyxHamq9rUWdsngkTIhNlWm7p6ediVU7oEALZhP2ytA5UlT+QsDWSVq5h1CBakbD RVyJ/A6FtYUGN8yYWFyeVOzDsJhxkhAgHvg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2762 The Fv Section in the FDF files use hard coding Guid values which is inconvenient to manage. This patch adds Guid name support in GenFfs to solve this problem. v4 add comments for new function without functional modification. Change-Id: I29b52663613286c6210d99eaaa09338677a21b31 Signed-off-by: Yuwei Chen Cc: Bob Feng Cc: Liming Gao --- .../Source/Python/AutoGen/WorkspaceAutoGen.py | 24 +++++++++++++++++++ BaseTools/Source/Python/Common/GlobalData.py | 1 + BaseTools/Source/Python/GenFds/FdfParser.py | 14 ++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py b/BaseTool= s/Source/Python/AutoGen/WorkspaceAutoGen.py index 668126aaac..d2e59ca34f 100644 --- a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py @@ -109,6 +109,10 @@ class WorkspaceAutoGen(AutoGen): # Mark now build in AutoGen Phase # GlobalData.gAutoGenPhase =3D True + # + # Collect Platform Guids to support Guid name in Fdfparser. + # + self.CollectPlatformGuids() self.ProcessModuleFromPdf() self.ProcessPcdType() self.ProcessMixedPcd() @@ -153,6 +157,26 @@ class WorkspaceAutoGen(AutoGen): EdkLogger.error("build", PARAMETER_INVALID, ExtraData=3D"Build target [%s] is not supporte= d by the platform. [Valid target: %s]" % (self.BuildTarget, " ".join(self.P= latform.BuildTargets))) + + def CollectPlatformGuids(self): + oriInfList =3D [] + oriPkgSet =3D set() + PlatformPkg =3D set() + for Arch in self.ArchList: + Platform =3D self.BuildDatabase[self.MetaFile, Arch, self.Buil= dTarget, self.ToolChain] + oriInfList =3D Platform.Modules + for ModuleFile in oriInfList: + ModuleData =3D self.BuildDatabase[ModuleFile, Platform._Ar= ch, Platform._Target, Platform._Toolchain] + oriPkgSet.update(ModuleData.Packages) + for Pkg in oriPkgSet: + Guids =3D Pkg.Guids + GlobalData.gGuidDict.update(Guids) + if Platform.Packages: + PlatformPkg.update(Platform.Packages) + for Pkg in PlatformPkg: + Guids =3D Pkg.Guids + GlobalData.gGuidDict.update(Guids) + @cached_property def FdfProfile(self): if not self.FdfFile: diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Sourc= e/Python/Common/GlobalData.py index 8ac29eb7a6..61ab3f7e24 100755 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -29,6 +29,7 @@ gProcessingFile =3D '' gBuildingModule =3D '' gSkuids =3D [] gDefaultStores =3D [] +gGuidDict =3D {} =20 # definition for a MACRO name. used to create regular expressions below. _MacroNamePattern =3D "[A-Z][A-Z0-9_]*" diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 9b04a76af8..ea2401b0e4 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -18,7 +18,7 @@ from uuid import UUID =20 from Common.BuildToolError import * from Common import EdkLogger -from Common.Misc import PathClass, tdict, ProcessDuplicatedInf +from Common.Misc import PathClass, tdict, ProcessDuplicatedInf, GuidStruct= ureStringToGuidString from Common.StringUtils import NormPath, ReplaceMacro from Common import GlobalData from Common.Expression import * @@ -1087,6 +1087,8 @@ class FdfParser: return False if GlobalData.gGuidPattern.match(self._Token) is not None: return True + elif self._Token in GlobalData.gGuidDict: + return True else: self._UndoToken() return False @@ -2248,6 +2250,8 @@ class FdfParser: =20 if not self._GetNextGuid(): raise Warning.Expected("GUID value", self.FileName, self.Curre= ntLineNumber) + if self._Token in GlobalData.gGuidDict: + self._Token =3D GuidStructureStringToGuidString(GlobalData.gGu= idDict[self._Token]).upper() =20 FvObj.FvNameGuid =3D self._Token =20 @@ -2459,6 +2463,8 @@ class FdfParser: raise Warning.ExpectedEquals(self.FileName, self.CurrentLi= neNumber) if not self._GetNextGuid(): raise Warning.Expected("GUID value", self.FileName, self.C= urrentLineNumber) + if self._Token in GlobalData.gGuidDict: + self._Token =3D GuidStructureStringToGuidString(GlobalData= .gGuidDict[self._Token]).upper() FfsInfObj.OverrideGuid =3D self._Token =20 if self._IsKeyword("RuleOverride"): @@ -2550,6 +2556,8 @@ class FdfParser: raise Warning.Expected("')'", self.FileName, self.Curr= entLineNumber) self._Token =3D 'PCD('+PcdPair[1]+TAB_SPLIT+PcdPair[0]+')' =20 + if self._Token in GlobalData.gGuidDict: + self._Token =3D GuidStructureStringToGuidString(GlobalData.gGu= idDict[self._Token]).upper() FfsFileObj.NameGuid =3D self._Token =20 self._GetFilePart(FfsFileObj) @@ -2980,6 +2988,8 @@ class FdfParser: elif self._IsKeyword("GUIDED"): GuidValue =3D None if self._GetNextGuid(): + if self._Token in GlobalData.gGuidDict: + self._Token =3D GuidStructureStringToGuidString(Global= Data.gGuidDict[self._Token]).upper() GuidValue =3D self._Token =20 AttribDict =3D self._GetGuidAttrib() @@ -4049,6 +4059,8 @@ class FdfParser: elif self._IsKeyword("GUIDED"): GuidValue =3D None if self._GetNextGuid(): + if self._Token in GlobalData.gGuidDict: + self._Token =3D GuidStructureStringToGuidString(Global= Data.gGuidDict[self._Token]).upper() GuidValue =3D self._Token =20 if self._IsKeyword("$(NAMED_GUID)"): --=20 2.27.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#62399): https://edk2.groups.io/g/devel/message/62399 Mute This Topic: https://groups.io/mt/75472556/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-