From nobody Sat Sep 21 00:55:31 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+62474+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+62474+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1594704645; cv=none; d=zohomail.com; s=zohoarc; b=VixwHD6NEYhEGUN/xZ5sOQsOYuInqEfMrRQUVFp4CEtG+2Rsuff0ETXu6B3peKfjEiwUchxgubJW6eRNcI3DKS3znr9aKJqWwvzwz2VtWU70xeZJCgQ424WQfh1YHkKpKsK8+yYliEs2ZLE7lGUBmLYHSKBkg1fNaf7rQl4PhfU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594704645; h=Content-Transfer-Encoding:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=JPxhHVG51YJme4Trxw3wHag9v3NUFGcYBhW01/+MvrU=; b=a3pgRL2xDaEZmJ9P4M7IUx+RCm0vXEVzItSxR1bRZiC3LEByj7MDLUyA34nHazLgXGYSW8BtSvS2fWZQ/5aMTN/tISdb5LaBnE9/CkjfbMcoS5rX/8LJArqf35IlTSFgvx5dS2vJ7vemq6JEpL14cKZgqmlwipLyTB0cEIg1Ifc= 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+62474+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 1594704645237191.54935940405824; Mon, 13 Jul 2020 22:30:45 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id VbV1YY1788612xA9R4adqm7h; Mon, 13 Jul 2020 22:30:44 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web12.13986.1594704642579791351 for ; Mon, 13 Jul 2020 22:30:42 -0700 IronPort-SDR: 1w9WOx03IlGIEoZ8sTbAALxg22zqsO4TbziYCg6iYp0eeCcyqrJmFn/LwzOMtAhHQfxpDtUYke WJ7bhq0mT3VA== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="233663547" X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="233663547" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2020 22:30:41 -0700 IronPort-SDR: Y95dMDz/1XElXqv/e7V7u2HKH1QIEkVsrPGlcsjwqND1/beGnx52D+N+a6de7PEOZOK0aNdJUh 2AAy+RZGImCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="459558476" X-Received: from yuweipc.ccr.corp.intel.com ([10.239.158.23]) by orsmga005.jf.intel.com with ESMTP; 13 Jul 2020 22:30:40 -0700 From: "Yuwei Chen" To: devel@edk2.groups.io Subject: [edk2-devel] [Patch v4] BaseTools: Add Guid name support in GenFfs. Date: Tue, 14 Jul 2020 13:30:40 +0800 Message-Id: <20200714053040.1561-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: JrIEUqvkH1ZDg2JGDUHCoG7dx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1594704644; bh=r48bTMydkGLyGrHJ5qFgFCBHosZWnaKW8GGsL9Uj+8c=; h=Date:From:Reply-To:Subject:To; b=EKMvNzoDE7cOhzU/MKkNsPhmOynjPoA16JWzqjVqerErYrkm1UiKXfpAfoAc7cV7S+U +vJj29384JR32iUVwCruOlZNQjZlDP+IrZOk5NzW9XH1OcG03Ip8SIM98j6p1bpto09KM 5TuiIcnMhbjUXSOGDIJcWDlJXD7SQnwoeZI= 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. Signed-off-by: Yuwei Chen Reviewed-by: Bob Feng=20 --- .../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..f86c749c08 100644 --- a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py @@ -108,6 +108,10 @@ class WorkspaceAutoGen(AutoGen): # # Mark now build in AutoGen Phase # + # + # Collect Platform Guids to support Guid name in Fdfparser. + # + self.CollectPlatformGuids() GlobalData.gAutoGenPhase =3D True self.ProcessModuleFromPdf() self.ProcessPcdType() @@ -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 (#62474): https://edk2.groups.io/g/devel/message/62474 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-