From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web08.5462.1625448715565850812 for ; Sun, 04 Jul 2021 18:31:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=OyzBBt7A; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: chasel.chiu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10035"; a="205901437" X-IronPort-AV: E=Sophos;i="5.83,325,1616482800"; d="scan'208";a="205901437" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2021 18:31:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,325,1616482800"; d="scan'208";a="410060280" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga003.jf.intel.com with ESMTP; 04 Jul 2021 18:31:51 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) 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.2242.4; Sun, 4 Jul 2021 18:31:50 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Sun, 4 Jul 2021 18:31:50 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Sun, 4 Jul 2021 18:31:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nhl30qGfXfjd6NlYOCkxP8hayMZSB/H3mhdBrEjBtVHgXWprjD58L2XoY7oRHfVv5mHvBpAyKFnpkG9wnvWmsZPw54M+eIqQLZWcK8F5Oykg6b1R6y/KPBCtRuJ5XQ3RHtkAnUas40I336BAfhiHbixwGuqQMxdY7fR8MgvhDquwb9cD3AsfsRhE9stF8fkJpF5R1/wemD1qt/JQTvecX96ddqQnnIQXUZsVJtONScjXTrnjwDFCRaLIQLKe7A560NjaBMQIUCsxOVx4D1SRFS+QjuByTCQeUXWoXMaWjbQ/y2Wz/R5vTp15xOQ6zJtyfkbrjxZlDmzvRXMf5wa6hA== 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=ZID68TdTzHQox69fwUVJBmyXZI6slobHD+SXYpHb7zw=; b=G+K78g4BiZ2WHDlEh3Jlbf0Dj16kDUZKZkDvZ1W2zFiUM80Ca19cLa0Zh9RCizwUOxsneL31APhn4zy69UwtWVzvn0jUO+8Ef9U4l6KFAswA7ylbB5y6GQdzNS2GwgUqAkHuSsaSGxwlw1DlFlQgW/Srf8Zk1WA23zxS//V/6DDBwRuiL4kBTrdTcpKZ95u3kKYSUAqPG1MWdjWfmbnosR4br7jT/UrC/mSoWNMDY8n15JaL4Y27Sm9Ehmwyz6ttTpqn8MDkKGBEPNWu/woYl3JffO8Wr2KYrAAaIwFoaAIv7vJK3bUHkVn9/GKWtOOrcwnPMmtBk5jFsIBLE8WodA== 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=ZID68TdTzHQox69fwUVJBmyXZI6slobHD+SXYpHb7zw=; b=OyzBBt7AdBCA5h+x1F0Me6VwPPLKYB5N/0wf4YHk4OEB2efF7VTCUepoUJsLdIGD3n/IU08f2/iXKRmNs9mwCxumu5Tg4MDwBsBTE+FDHjJIvJ8cBEw5z5CxC5o2NAEzwSoIqEAkC8DBgyNKMfFgY76eIigS5R5OYoCoWkBfihw= Received: from BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by BN7PR11MB2707.namprd11.prod.outlook.com (2603:10b6:406:ac::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Mon, 5 Jul 2021 01:31:44 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::79a3:c273:504e:ace2]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::79a3:c273:504e:ace2%6]) with mapi id 15.20.4287.033; Mon, 5 Jul 2021 01:31:43 +0000 From: "Chiu, Chasel" To: "S, Ashraf Ali" , "devel@edk2.groups.io" CC: "Ni, Ray" , "Desimone, Nathaniel L" , "Zeng, Star" Subject: Re: [PATCH] IntelFsp2Pkg: PatchFv parseInfFile function modification Thread-Topic: [PATCH] IntelFsp2Pkg: PatchFv parseInfFile function modification Thread-Index: AQHXcMbxQ+HcTEuCBE+iDQb6ic9YuaszloEg Date: Mon, 5 Jul 2021 01:31:43 +0000 Message-ID: References: <2e3306a0d9bd579a8e46e469ae222ad2dd511551.1625397705.git.ashraf.ali.s@intel.com> In-Reply-To: <2e3306a0d9bd579a8e46e469ae222ad2dd511551.1625397705.git.ashraf.ali.s@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [36.228.169.143] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ea66f48c-8215-4d0c-982b-08d93f54a5ae x-ms-traffictypediagnostic: BN7PR11MB2707: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:989; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UhDVnIFBe3WSw22SM9l5S5SlMYYQWhogXPSR/eGLnfKvzGqU/OhLPWnJW4Oow8IVkkK0zfNraUW17DQmurlG4H4hnCt/rNw3QJkir8xnrtbTVWA5xKbtCWvoQlW8fo020sn1KzF6ymPUY6Djh0t+vblyzzg0hHTVhc/jOMFQP0GDMLpcZtb8VxheBG8qtRDJN7pMLcOPkEDiIG0cI0U2MPoGHdZHK9TjKFK0vbBvk3C6/xaO56EJtfUjdXgEkZn+VFOr5pA0kl+ieSWc6Mw2UkQQXkqN+0vDsptyCaf/ULQWcjQB77WOUK+wh5+a3pbHRIGdIgUwH4Zb/YJG/37IVPLmtqZQZTFCikYyDKNWJcOhexG5yomuaYdHSqMPjGQWLR118BrrTTAaPKhj5lD6RLNB8naAZZW5dpc+ybgR0+wCjvumOu+x+pJqb3yBRLsTsq+mKMZjyPZHYqVYr6ZMVMnjhncmiQsEqPV//HpUOK23ZeJEcOM0p09wRmDf6X7Eom24DBHyXNRj2TZnA5EH7YJ7MLqj0IWaY8xev9XCVQfYCx5F7xryjliQf0lh2BD3SrhctVxwCpK3mOzajZJ3tOgPA4VboL7ixauSAxfKPswREVKw9FrosBgNkbDo598rf0sjI+iZ/7v6oreaV3DrdQzmMWN6S1HSNPRYd8kuNL0gzfFCdKpjKKa4UOONRZ4YK+k/svzVILbdqp/H8uBeKecrRfOPQSMxAiCDilnUAwI= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(136003)(346002)(396003)(376002)(39860400002)(366004)(66946007)(6506007)(66476007)(66556008)(64756008)(66446008)(83380400001)(8936002)(76116006)(186003)(52536014)(71200400001)(26005)(33656002)(4326008)(86362001)(53546011)(316002)(19627235002)(54906003)(7696005)(8676002)(110136005)(478600001)(2906002)(122000001)(55016002)(9686003)(107886003)(5660300002)(38100700002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?5tmLg7aoDfO7PxjVpdwRQ05+p5/3AqTmalNZigJFL3sULbYWa/ek2R3Ukn/I?= =?us-ascii?Q?ZOzSN/F3wlYYy4aibhB9xTHxW+NEXgfZjsiL5OY9svJPAj9roBBHS2hf9hOW?= =?us-ascii?Q?MddTlwQ448OdZvh/kofxJBfsegeAiGyDeH94bV/yVbV02PWuk/JpgEnX1Mga?= =?us-ascii?Q?KEKSCaiL0Hngd85azV+0UMfNAt7TQphAJYKA2Qa3lbh5b4I1TOyPIi5KgMeB?= =?us-ascii?Q?LXWzazfY8mrxKfzYe2JNijR0aX5Wq8JWKu7y6pSYjaaN+bBmV/4PvFc/lpH0?= =?us-ascii?Q?H/Ms7jrwrHJHy1vW7CSGB7bDV+gPe5SZMF688gAY5VTBBJyf6AFK1q5pZjFU?= =?us-ascii?Q?kH5q7A7zsB3OaOCGFlqSuOxIVQtEIeM53tjr3hxsOovQZYjvXuBcOQ/6tT6+?= =?us-ascii?Q?JjS0JdIOKNZel5z9kP4C8qBc5sl+Un37qgLwIqJGuBKuIBmyd9lwW0PHtDj0?= =?us-ascii?Q?4H2WkBR2J8ozkU/tpNEyGJbbUqTl03Qxl4n9IjxKamQWi2i+fQyyHy1wRS0k?= =?us-ascii?Q?7t308Q2lTu06JghFi/bpoSDqGhaaZbP0LG7ePK+SC+UALu3V6HUganA59vhW?= =?us-ascii?Q?3sFFnUb5MG1Mlfk2KGRCVhM/MqPbxXgCYe4BZ1RrP0VoXdys72hioe0RQO6r?= =?us-ascii?Q?ySxH962L6YMApoI7hqQz/zhUslLupHXebdDO1Ag8g2+YjrkNDwYiH+KA7tUC?= =?us-ascii?Q?dZbw+6uOHuqnMZsVJRm/nAvPGJSbCUY3AiIPtGnWAC3EjP5FVS6GKsLxHocD?= =?us-ascii?Q?ihlZyH+V6RW/M1Ein9nSZcWbg4cnMm84UxJMtB0aUdcSGGAb+dIP1vIc4Wof?= =?us-ascii?Q?YG34DBnEVr/ocX8S6zpVvwH0Qo2l+65vdG0adxQeoCJ/KnTcsCS2NMUfWsY9?= =?us-ascii?Q?STjvsHXqE2Kh+IArgJh4WNqlU9VS2bQ/I/DROSlDwfme+eOlh11Oz5/tz+U9?= =?us-ascii?Q?nbVeE7+PHkB3Y1f46qpDPcTCUMIVkuKLBPZCfKpX0DS13FXDBN2FPxxqylDT?= =?us-ascii?Q?JE456gTvfDN1LUZSVOA+DJYZA4caDNNIyQEUVbuQLkusnjyuhuDhOw2gJ86d?= =?us-ascii?Q?eJELN0EKZjMYC2ZljbsmnI+v/+DdVRx4pAntZa6EOxDRJbUCVj6uTi1URWjl?= =?us-ascii?Q?H+GTh5qNu396iJfLc4ICYzdz5D/QRICYpQ7qVxp0Kvfu3ow2Zqu2v8e/aVeO?= =?us-ascii?Q?gkeead9KrDt76x9vWWO6mFX3aeG6/D4hqCCiJHyKrjKtmJ7HiZaQG/eMcR51?= =?us-ascii?Q?qThbP21BosrK2MhOU4w/wrecyJZcagMpBVxUGwE44iIdJUox0WoBt+3CeV3r?= =?us-ascii?Q?9x4FYF128chs4gFH4AYGpudx?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea66f48c-8215-4d0c-982b-08d93f54a5ae X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2021 01:31:43.7687 (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: JRPOs9jkHHg9xEtr577KmZmvyVJQ9xbYTnC8EyzJIgl9kwCj630BuIC0jkv1XkrhzikbfM4z/ksvuJP84kwIgw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR11MB2707 Return-Path: chasel.chiu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Ashraf. Adding my comments below inline. > -----Original Message----- > From: S, Ashraf Ali > Sent: Sunday, July 4, 2021 7:23 PM > To: devel@edk2.groups.io > Cc: S, Ashraf Ali ; Ni, Ray ; C= hiu, > Chasel ; Desimone, Nathaniel L > ; Zeng, Star > Subject: [PATCH] IntelFsp2Pkg: PatchFv parseInfFile function modification >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3476 >=20 > parseInfFile currently reading the EFI_BASE_ADDRESS from INF, once the > address found still it's continues to read the complete inf file which is= not > required. once the EFI_BASE_ADDRESS read from the INF no need to read > the INF further. > MSFT compiler can generate the map file address 8 or 16 based on which > architecture the INF is compiler. currently it's support for IA32, it can= be > update the X64 in future. > modification of few typo errors in parseModMapFile, getCurr function > required >=20 > Signed-off-by: Ashraf Ali S > Cc: Ray Ni > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Star Zeng > --- > IntelFsp2Pkg/Tools/PatchFv.py | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) >=20 > diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.p= y > index 112de4077a..236019b62d 100644 > --- a/IntelFsp2Pkg/Tools/PatchFv.py > +++ b/IntelFsp2Pkg/Tools/PatchFv.py > @@ -1,6 +1,6 @@ > ## @ PatchFv.py > # > -# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
> +# Copyright (c) 2014 - 2021, Intel Corporation. All rights > +reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -297,17 +297,17 > @@ class Symbols: > # > fvOffset =3D self.getFvOffsetInFd(infFile[0:-4] + ".Fv") > fdIn =3D open(infFile, "r") > - rptLine =3D fdIn.readline() > + rptLines =3D fdIn.readlines() The target line "EFI_BASE_ADDRESS =3D 0x********" is usually the second lin= e in the generated INF file, do you think we really need to change to "read= lines()" to read whole file? It looks to me original readline() implementation is better in efficiency, = but just need to break when the match found. > self.fdBase =3D 0xFFFFFFFF > - while (rptLine !=3D "" ): > + for line in rptLines: > #EFI_BASE_ADDRESS =3D 0xFFFDF400 > - match =3D re.match("^EFI_BASE_ADDRESS\s*=3D\s*(0x[a-fA-F0-9]= +)", > rptLine) > + match =3D > + re.match("^EFI_BASE_ADDRESS\s*=3D\s*(0x[a-fA-F0-9]+)", line) > if match is not None: > self.fdBase =3D int(match.group(1), 16) - fvOffset > - rptLine =3D fdIn.readline() > + break > fdIn.close() > if self.fdBase =3D=3D 0xFFFFFFFF: > - raise Exception("Could not find EFI_BASE_ADDRESS in INF file= !" % > fvFile) > + raise Exception("Could not find EFI_BASE_ADDRESS in INF > + file!" % infFile) > return 0 >=20 > # > @@ -402,6 +402,7 @@ class Symbols: > # > # retval 0 Parsed MOD MAP file successfully > # retval 1 There is no moduleEntryPoint in modSymbol= s > + # retval 2 There is no offset for moduleEntryPoint i= n modSymbols > # > def parseModMapFile(self, moduleName, mapFile): > # > @@ -426,7 +427,7 @@ class Symbols: > else: > #MSFT > #0003:00000190 _gComBase 00007a50 = SerialPo > - patchMapFileMatchString =3D "^\s[0-9a-fA-F]{4}:[0-9a-fA- > F]{8}\s+(\w+)\s+([0-9a-fA-F]{8}\s+)" > + patchMapFileMatchString =3D "^\s[0-9a-fA-F]{4}:[0-9a-fA- > F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)" > matchKeyGroupIndex =3D 1 > matchSymbolGroupIndex =3D 2 > prefix =3D '' > @@ -498,7 +499,7 @@ class Symbols: > # > # Get current character > # > - # retval elf.string[self.index] > + # retval self.string[self.index] > # retval '' Exception > # > def getCurr(self): > -- > 2.30.2.windows.1