From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web09.32339.1634535891235487663 for ; Sun, 17 Oct 2021 22:44:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=n1BIFNtt; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: tung.lun.loo@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10140"; a="291645632" X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="291645632" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2021 22:44:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="489289431" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga007.fm.intel.com with ESMTP; 17 Oct 2021 22:44:50 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sun, 17 Oct 2021 22:44:50 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sun, 17 Oct 2021 22:44:49 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Sun, 17 Oct 2021 22:44:48 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.177) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Sun, 17 Oct 2021 22:44:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O+RcJrcjwJoxtlQ7tuLcgapEjU5dlR/xOp1p8xx/TtLAgG/QctBtz69ZIUL5ViSfzWvWeTT6j77SHlSVbaRTvgWKSYXm5YcI6mlubYn6JXUGLZ6X/y61ZOmSjQu0CPS07Q8ewDBJOjCQDAJoAuVIEoGx5e+bJr5yFEFxJKBoX8XG3bJax/Hh1h8gPPYUBO3/NSSVSgHKjxPn/BeDdeERES/wuVOTz2vc0YrnyedZA4g3nWv4BWHNvE/8yMXCIQ8wX8Mu9JkLBiEoH9eT1dxnxp7DQ7hkX2Oyy+jT4UqluJzbPBth2qpTQO35O0b8vKkL+zS25JMiXS5+aEWdDi4g+Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dEoa/MeCVF+VN2AUCOiMYARAF2D5ALkCy8dJu/uuDTk=; b=l7aHmp7JQzDFBOFQFhljOCsfScXVWubZyUiNCgavDigc3ZWnoB1H4JI936bA65XWwSWtKfO3iHlsEn7k/7RyFZqKE0g8v5tLWXLX8N0qANXzYSCIY7dY2BPnpAD5n0Erc6xepzCNELO3UrweIeunml+BnHRZrgmkuPHOAsSVQgVcKnHZSAic+2Tp9OzP9HhXq1qOMGhtoCuKs9NdI0Gqrc5B73OU5utlGZ2Y4rCFOiwOLuo689nF/2+QZBeom7Psv53IY8hYnpaX0c/++E5ys0mC+lMgii34a07BP8FyrmCkyBgukqCYctJ/6MIK1LKxLRRyh2WVXH04yBBXGSeOjw== 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=dEoa/MeCVF+VN2AUCOiMYARAF2D5ALkCy8dJu/uuDTk=; b=n1BIFNttcksW1I09JafATpSPmrKWLrVyp2U4VvswpMlKQ+TLlWb1X6/jGvOyjad/D0NjfOmAGU2Xnkg0N6NRYcg9JoXSNNQ5nTw3UpKQSlZnCWhxL/0tS/X7F3lJmB2pynkyL3kmpTqfydN7+wGSVsptouYQ/uUMUie+EvYdYtY= Received: from PH0PR11MB4824.namprd11.prod.outlook.com (2603:10b6:510:38::13) by PH7PR11MB5913.namprd11.prod.outlook.com (2603:10b6:510:137::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Mon, 18 Oct 2021 05:44:47 +0000 Received: from PH0PR11MB4824.namprd11.prod.outlook.com ([fe80::2d99:93e5:2116:29f2]) by PH0PR11MB4824.namprd11.prod.outlook.com ([fe80::2d99:93e5:2116:29f2%7]) with mapi id 15.20.4608.018; Mon, 18 Oct 2021 05:44:46 +0000 From: "Tung Lun" To: "Chiu, Chasel" , "devel@edk2.groups.io" CC: "Ma, Maurice" , "Desimone, Nathaniel L" , "Zeng, Star" Subject: Re: [PATCH] IntelFsp2Pkg: Add support for config editor to handle multiple UPD Thread-Topic: [PATCH] IntelFsp2Pkg: Add support for config editor to handle multiple UPD Thread-Index: AQHXwV0O6StBRfpnwkKekEQlfiM5JavYOiKAgAAJjYA= Date: Mon, 18 Oct 2021 05:44:46 +0000 Message-ID: References: <20211015003844.1285-1-tung.lun.loo@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.200.16 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2b8743ab-75ef-480f-7419-08d991fa64dc x-ms-traffictypediagnostic: PH7PR11MB5913: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:254; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fDoxRXhuioSdVguc2X7TeewM0oP6p+CGOm37NrL7ScGtaarrC92xsj4Gwzlz2OH0N8P3Ucpc53VfIAORmcqqkvZHUAuVnAq0Mh9LgvbmLQIPI0ElB1n5VnbNKLiGryc+eXrzJLryAm9HQBVHp0LDAD04MfVDarBLnmK8lD+G1otHX439wF0boXEBPLmM0O4dpVqHku6fpUyA2aZ4Y7bVKSAsmZYqH3tc3yIgeGrC8mw1CbHGWG11QCaK5eBVnr2rHbpSyEoGlm3C/O+R7OhexJhPZs7p1c4do7JTxF1CBQ1AQjn5nqxRqbFpBS/qEC7tVu9miG/TQzUzSDKiFn7HvfIdAkg1Pz4TmSBw7R5rT5K+Q9l8i+3LrYxVTlShIrwfMlBTSt5cxIDCbXaNfWcX7TzXcVfgu+gRRHqHytUacBx1UIPM2j6Zc/sLuLgzkpplrKJMpiCuOG6zfqZcVibY1B48yzw3H9Ji/KQRLsHf9YVolDroqI0daG8L5kpefwyRGMTEV7IX0p1PDkdo9zDIy4db8tEsybav88cCBHVl6tlGaGqYEYg0jkAqx1rA6vo+xXEK8XI8GoMViLpDP5WIMYR1MHkpV2PPEj3f0KxYcDnPaj7q1CSLNLbtEmlGD7N+8IAe0hv/FmCvyqLOWTiuHPyrck6gGv6OMEykR/X34gKb/f97PtcjXhH89MoyPSmanGXdITrKpKF5gBH+cPGTpOQstygV7+8TzhpVTsIcyYQKXd6PK5N7ejN6CPGXgnN8tVvYLyouX9bYVDuf5T0Nb3dtZvqW9haS7LeMQGwDa9o= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB4824.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(4326008)(6506007)(53546011)(19627235002)(966005)(83380400001)(122000001)(86362001)(8676002)(76116006)(66446008)(64756008)(66476007)(66946007)(7696005)(54906003)(5660300002)(52536014)(110136005)(9686003)(82960400001)(66556008)(8936002)(508600001)(2906002)(316002)(71200400001)(107886003)(26005)(186003)(38100700002)(55016002)(33656002)(38070700005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?B/ZSzLtmo6B6Wfi+Z3Kbkw6vERZZgm7HD6ewi76uVRamR8g1tNi4sePwj5KK?= =?us-ascii?Q?R3Cczfp2FLs5lN5hlz1cN7NxbsmodK7+BjHNAT/1dD9Y6KHZpsWErMoeCiya?= =?us-ascii?Q?1kJ4mw/V4uQnxW3YVnLfPnv8tRs0IFXCu2rc4TuG0EoupW1aAuo66PD4+S+L?= =?us-ascii?Q?fnynXWWb8vZt9KWXMHSeUPLx1RikxxjypBuQ+sB1cCAzXnxbCpkqiQQGQyKx?= =?us-ascii?Q?eRRdigjx/j+fDw/oJEk7tjuMDJ66UXjeE78KuGneQS1NOp/csJlAZ8Jtx0nR?= =?us-ascii?Q?qNoH2/B47jPm1QOKhug5bWGxfiK0ReRUd09m2g0rTb35IdFKurjhsB8guvQD?= =?us-ascii?Q?u/74WRoz2m7We2TpR/Ye5C7IpX/acYZCeudGhecPFloIm3zJDZPw2Ea26/Mh?= =?us-ascii?Q?yfYWWuF3/TFKwWqC+2M3/L+rSQ5zvB+RsQq/7V6vuKAYywugylM1RhAkK3/4?= =?us-ascii?Q?GNLCE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MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB4824.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b8743ab-75ef-480f-7419-08d991fa64dc X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2021 05:44:46.8372 (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: jdW1lMJXDRomxcmTAKaBXoGcKIE3/04g9ic733bhKZy/z9y+xDintJT9GuOwdoz3z/aZh2wiav+PeoL+MzN96g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB5913 Return-Path: tung.lun.loo@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sure Chasel, thanks for the feedback. Will work on it. -----Original Message----- From: Chiu, Chasel =20 Sent: Monday, October 18, 2021 1:10 PM To: Loo, Tung Lun ; devel@edk2.groups.io Cc: Ma, Maurice ; Desimone, Nathaniel L ; Zeng, Star Subject: RE: [PATCH] IntelFsp2Pkg: Add support for config editor to handle = multiple UPD Hi Tung Lun, Should we update ConfigEditorUserManual.md for this new function? Thanks, Chasel > -----Original Message----- > From: Loo, Tung Lun > Sent: Friday, October 15, 2021 8:39 AM > To: devel@edk2.groups.io > Cc: Loo, Tung Lun ; Ma, Maurice=20 > ; Desimone, Nathaniel L=20 > ; Zeng, Star ;=20 > Chiu, Chasel > Subject: [PATCH] IntelFsp2Pkg: Add support for config editor to handle=20 > multiple UPD >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3692 >=20 > In several use cases in bootloader, there are multiple instances of=20 > UPD with same signature header. As such, using previous version of=20 > config editor to edit those will result in only overriding the first=20 > found instance. This patch provides the flexibility to modify the instanc= e specified. >=20 > Cc: Maurice Ma > Cc: Nate DeSimone > Cc: Star Zeng > Cc: Chasel Chiu >=20 > Signed-off-by: Loo Tung Lun > --- > IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py | 94 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- > --------------------------- > 1 file changed, 62 insertions(+), 32 deletions(-) >=20 > diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > index b593885807..91c4180085 100644 > --- a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > +++ b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > @@ -1351,24 +1351,20 @@ option format '%s' !" % option) > act_cfg['value'] = option =3D act_cfg['option'] - > cfg_val =3D ''- bin_val =3D '' = for i in option.split(','): > if act_cfg['value'] in i:- bin_val =3D i+ > self.data_diff +=3D \+ '\n\nBinary: = ' \+ + > act_cfg['name'] + ': ' \+ + i + '\n' = elif > config_val in i:- cfg_val =3D i- = if cfg_val !=3D '' and > bin_val !=3D '':- self.data_diff +=3D '\n\nBin= ary: ' \- > + act_cfg['name'] \- + ': ' + bin_val.repl= ace(' ', '') \- > + '\nConfig file: ' \- + act_cfg['name']= + ': ' \- > + cfg_val.replace(' ', '') + '\n'+ self.da= ta_diff +=3D \+ > '\nConfig file: ' \+ + act_cfg['na= me'] + ': ' + i > else:- self.data_diff +=3D '\n\nBinary: ' \= + > self.data_diff +=3D '\n\nBinary: ' \ = + act_cfg['name'] + ': ' + > act_cfg['value'] \- + '\nConfig file: ' + ac= t_cfg['name'] \+ > + '\nConfig file: ' + act_cfg['name'] \ += ': ' + config_val + '\n' > def set_field_value(self, top, value_bytes, force=3DFalse):@@ -1477,33=20 > +1473,67 @@ for '%s' !" % (act_cfg['value'], act_cfg['path'])) > def get_bin_segment(self, bin_data): cfg_segs =3D self.get_c= fg_segment() > bin_segs =3D []+ fsp_instance =3D [] for seg in cfg_segs: = key =3D > seg[0].encode()+ print("key ", key) if key =3D=3D = 0: > bin_segs.append([seg[0], 0, len(bin_data)]) break = pos =3D > bin_data.find(key)- if pos >=3D 0:- # ensure no= other match for the > key- next_pos =3D bin_data.find(key, pos + len(seg[0]))- = if > next_pos >=3D 0:- if key =3D=3D b'$SKLFSP$' or key =3D= =3D b'$BSWFSP$':- > string =3D ('Warning: Multiple matches for %s in '- = 'binary!\n\nA > workaround applied to such '- 'FSP 1.x b= inary to use second'- > ' match instead of first match!' % key)- > messagebox.showwarning('Warning!', string)- pos = =3D next_pos- > else:- print("Warning: Multiple matches for '%s' "= - > "in binary, the 1st instance will be used !"- = % seg[0])- > bin_segs.append([seg[0], pos, seg[2]])- self.binseg_dict[s= eg[0]] =3D pos- > else:+ while pos !=3D -1:+ fsp_instance.append(= pos)+ pos =3D > bin_data.find(key, pos + len(seg[0]))+ if len(fsp_instance) <= =3D 0: > bin_segs.append([seg[0], -1, seg[2]]) self.binseg_dict[se= g[0]] =3D -1- > continue++ elif len(fsp_instance) =3D=3D 1:+ bi= n_segs.append([seg[0], > fsp_instance[0], seg[2]])+ self.binseg_dict[seg[0]] =3D fs= p_instance[0]+ > fsp_instance.clear()++ else:++ fsp_instance_roo= t =3D tkinter.Tk()++ > canvas1 =3D tkinter.Canvas(fsp_instance_root,+ = width=3D400, > height=3D400)+ canvas1.pack()++ entry1 =3D > tkinter.Entry(fsp_instance_root)+ canvas1.create_window(20= 0, 220, > window=3Dentry1)++ text =3D "Multiple instances available = for " +\+ > seg[0] + "\n\nThe available instances are\n"+ for edx, ins= in > enumerate(fsp_instance):+ text +=3D "\nInstance" + str= (edx + 1) + > ' :offset ' +\+ str(hex(ins))+ te= xt +=3D "\n\nPlease enter the > instance number between 1 and "\+ + str(len(fsp_instan= ce))+ > label1 =3D tkinter.Label(+ fsp_instance_root,+ = text=3Dtext, > wraplength=3D380, justify=3D'left')+ canvas1.create_window= (200, 90, > window=3Dlabel1)++ def getfspinstance():+ = x1 =3D entry1.get()+ > fsp_instance_option =3D int(x1)+ if fsp_instance_optio= n <=3D > len(fsp_instance):+ bin_segs.append([seg[0],+ > fsp_instance[fsp_instance_option - 1],+ = seg[2]])+ > self.binseg_dict[seg[0]] =3D fsp_instance[+ fs= p_instance_option - > 1]+ fsp_instance_root.destroy()++ butto= n2 =3D > tkinter.Button(fsp_instance_root,+ = text=3D'Enter the > instance',+ command=3Dlambda: get= fspinstance())+ > canvas1.create_window(200, 250, window=3Dbutton2)+=20 > fsp_instance_root.wait_window(fsp_instance_root)++ > fsp_instance.clear() return bin_segs -- > 2.26.2.windows.1