From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web12.10583.1594774441980997330 for ; Tue, 14 Jul 2020 17:54:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=fBZCsUUO; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: bob.c.feng@intel.com) IronPort-SDR: dP/MqSPF2bOH8DF/E0Ug7o+C+5LrOnVEFW7MN/nPbE9F7liL9zIwRBwF1pXBaHa8WezfL3lv9n FNrhPwTzvNfQ== X-IronPort-AV: E=McAfee;i="6000,8403,9682"; a="128617023" X-IronPort-AV: E=Sophos;i="5.75,353,1589266800"; d="scan'208";a="128617023" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2020 17:54:01 -0700 IronPort-SDR: 420ZjgokA7hjBRP/c+tJ+MMriACTVeVyI7cydpQfR201a7Yufs9LDip26wTba4aMh5/8mAMKPR 3VFvMKqNrqBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,353,1589266800"; d="scan'208";a="326009526" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga007.jf.intel.com with ESMTP; 14 Jul 2020 17:54:01 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 14 Jul 2020 17:54:00 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 14 Jul 2020 17:54:00 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.176) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Jul 2020 17:54:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BHWfE26zwHijrkZJ4cPCPMmi3M1VSqP+HwFY3IQDH3HCGGaKSepIxzwxbxMUbeV3DYIiKboN2I4F57ol+F+NMOyVIxGABTmabbXSmvEUcIB8sc8KC1l23VHmdjLHf0vRKw264qklFub2ZxwjOiL2o4mmJ/tomBCzzxkeoCexQ9OBZ73R3xDoj/eCQNbierA01WD0bzMyUUjXwZwDjTvgocgfnYwiX+PBQVYGQ8nfgwssH/e2eoThQwaMXYvXP/g2c/Rw2MXDkGo658Ks2BZTA4WZgC1pQjyT95wKDXv+7F3IYlwA1T7JQqpow8dKo21Y9nKe8x74REWOz7K++u2D8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c0ma2kfSf4hDuc/zUB02wgAruUg15KUC8SAAbtatnhY=; b=kZ2zvB4Ep0nkdPl4uIQRXwNvjECYFwgdTWDjlliKFTB3Vb6YCx0NsoVflof8aSXuaHBh9W98mJDwDZ+VajVMy6FcWFiZ/UM5j9pQUhcbwvDWq2J5nvM5FX5mc+adk1dNP7e8kp+HaNGbSH5vyY+5IHlLrqr1nuT4QctkDB1lH4O+XYEePrZckjHPR1C5Z1cUUmCnVbwcBBPX8MhOzNUtEKLIiFfZAQ6QfJo8Fs/M4gmOocgKbrol5Otg+aYzmdf8xNvkqyOH+Ero4ZsIlkz8fAz84pYEXnskQHewCrJPHzJK5e9EnneKpA+qE36Mt4FCPUXhGj2kx4h+njPjZfW2hA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c0ma2kfSf4hDuc/zUB02wgAruUg15KUC8SAAbtatnhY=; b=fBZCsUUO6B8FL5/VAb9NXb8vhhcJwzqx2Ep6PRmiaOJix192a0o71uQkcTtJmCRpWQG0pyPCQVzKcbhYDqHsIlnnkMVzOUUPdSr12Aha6FWuCucWC+PjeBq9sPdUN+WrGCcUbVxSS6zagogDYUMLjuXEHlXUIJymc7x9pVNGegg= Received: from BN6PR11MB0068.namprd11.prod.outlook.com (2603:10b6:405:69::17) by BN6PR1101MB2242.namprd11.prod.outlook.com (2603:10b6:405:58::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Wed, 15 Jul 2020 00:53:59 +0000 Received: from BN6PR11MB0068.namprd11.prod.outlook.com ([fe80::6870:82d3:5bde:4153]) by BN6PR11MB0068.namprd11.prod.outlook.com ([fe80::6870:82d3:5bde:4153%6]) with mapi id 15.20.3174.025; Wed, 15 Jul 2020 00:53:59 +0000 From: "Bob Feng" To: "devel@edk2.groups.io" , "Chen, Christine" Subject: Re: [edk2-devel] [Patch v4] BaseTools: Add Guid name support in GenFfs. Thread-Topic: [edk2-devel] [Patch v4] BaseTools: Add Guid name support in GenFfs. Thread-Index: AQHWWZ/6iJSNCMgWRUCXaIepjV6JnqkH0UYg Date: Wed, 15 Jul 2020 00:53:58 +0000 Message-ID: References: <20200714053040.1561-1-yuwei.chen@intel.com> In-Reply-To: <20200714053040.1561-1-yuwei.chen@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.45] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f62de554-836e-4bec-b897-08d828598f10 x-ms-traffictypediagnostic: BN6PR1101MB2242: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1201; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GcT+y5PaAKrUcdIVcQqrY5uetSLRbdJldvdVdGifRrrXa+0x5J5Wl+Fn5n4PgeMuY+QIbg8ZGH2BN8xC0O0TO09gyU6Cpe86KL0rnEHC/l1gUdgYi1mFXkjlhAQSFiomIIOV4QPIJzt1juOKKJTI+Wa/3VJzEAJZ7FpEeG7ERvo6CqoaVdJtBYw00m/SX8HgWMaNTl1Jurb4nUG3FAt/26yq+sTidnBTy9VfZujOIUUV6Zj8uBdiv/ryAahviimMi22ZREaFvZNqT8qhptCJunwK1//kr2Yv6qQEolBfxf+VZn77Uevv/TBMgUTd0mymsuH47/bG4zFPtAbuaT5mI9kYZ8aZSnz5MRgIg2XX+YnSy73CAuWqtP9l5G1gOFUANvEx2Ip0uJ+lhNAbjlHgpg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR11MB0068.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(346002)(136003)(376002)(39860400002)(396003)(366004)(966005)(316002)(66476007)(6506007)(76116006)(52536014)(66556008)(2906002)(64756008)(110136005)(66946007)(53546011)(55016002)(9686003)(7696005)(8676002)(86362001)(5660300002)(186003)(6636002)(26005)(83380400001)(71200400001)(478600001)(8936002)(33656002)(66446008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: uNHcNCMi7favCD5yoDWWagDRJK8U9X+o05waiRIHBnTHLaBfeQThxDDCL0gCB9kyjReK19rwvOZrEbnuJypc2C1Q27WXF93m3xQ7edrmkNhw3bRntLAUB4Aziq+Oany3OhZBc4OLCyd5Dn+n+dHuUZeYrfENw/wZjKu5/oeDv2Hm0pNwgW6OpxnPUxyjso8v6b/OQHfNkZv1px9yokIZkZpnPY5Xdj0uZ7hFsCQpUDwRSv0rvDfbEL2tlRpvslocurwtS4/aNFrBuTSkP1Dfxu+US4umlx19LhH1GC3KEDSeIN1IsBvtTckYlcU+88lxoZLFoLX/Yj9lXz7S8A1Cu06YgfZKC8WkFHtWvOueK7eLNqXOlaxPv08qWGyOLYt49kL+O5aQ1UHYuWIS95CKaiLOzODHq+ggIz7brAcloxzXNopzFIea5BIkt152ZN0RBYmCgJE1G8dIxwLZgqkTL/+WMURCo8InxfamHHxuVNgys2DFujKGGrsfjwyaDaZ7 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN6PR11MB0068.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f62de554-836e-4bec-b897-08d828598f10 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jul 2020 00:53:58.7984 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Vjy2ycD9JDgFMeMUBhZ1r/f1rz/QsV3BdzRU1cbpREd2EqqCAh110v2ehFNkqYh8Noy+VESNEmaYdZKBKSmTTg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2242 Return-Path: bob.c.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng=20 -----Original Message----- From: devel@edk2.groups.io On Behalf Of Yuwei Chen Sent: Tuesday, July 14, 2020 1:31 PM To: devel@edk2.groups.io Subject: [edk2-devel] [Patch v4] BaseTools: Add Guid name support in GenFf= s. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2762 The Fv Section in the FDF files use hard coding Guid values which is incon= venient to manage. This patch adds Guid name support in GenFfs to solve thi= s problem. Signed-off-by: Yuwei Chen --- .../Source/Python/AutoGen/WorkspaceAutoGen.py | 24 +++++++++++++++++++ B= aseTools/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/BaseToo= ls/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 support= ed by the platform. [Valid target: %s]" % (self.BuildTarget, " ".join(self.= Platform.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.Bui= ldTarget, self.ToolChain] + oriInfList =3D Platform.Modules + for ModuleFile in oriInfList: + ModuleData =3D self.BuildDatabase[ModuleFile, Platform._A= rch, 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/Sour= ce/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/Sourc= e/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,=20 +GuidStructureStringToGuidString from Common.StringUtils import NormPath, ReplaceMacro from Common import= GlobalData from Common.Expression import * @@ -1087,6 +1087,8 @@ class Fd= fParser: 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.Curr= entLineNumber) + if self._Token in GlobalData.gGuidDict: + self._Token =3D=20 + GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upp + er() =20 FvObj.FvNameGuid =3D self._Token =20 @@ -2459,6 +2463,8 @@ class FdfParser: raise Warning.ExpectedEquals(self.FileName, self.CurrentL= ineNumber) if not self._GetNextGuid(): raise Warning.Expected("GUID value", self.FileName, self.= CurrentLineNumber) + if self._Token in GlobalData.gGuidDict: + self._Token =3D=20 + GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upp + er() FfsInfObj.OverrideGuid =3D self._Token =20 if self._IsKeyword("RuleOverride"): @@ -2550,6 +2556,8 @@ class FdfParser: raise Warning.Expected("')'", self.FileName, self.Cur= rentLineNumber) self._Token =3D 'PCD('+PcdPair[1]+TAB_SPLIT+PcdPair[0]+')= ' =20 + if self._Token in GlobalData.gGuidDict: + self._Token =3D=20 + GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upp + er() 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=20 + GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upp + er() GuidValue =3D self._Token =20 AttribDict =3D self._GetGuidAttrib() @@ -4049,6 +4059,8 @@ cl= ass FdfParser: elif self._IsKeyword("GUIDED"): GuidValue =3D None if self._GetNextGuid(): + if self._Token in GlobalData.gGuidDict: + self._Token =3D=20 + GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upp + er() GuidValue =3D self._Token =20 if self._IsKeyword("$(NAMED_GUID)"): -- 2.27.0.windows.1