From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.32077.1634533818865875390 for ; Sun, 17 Oct 2021 22:10:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=WHkD5v6l; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: chasel.chiu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10140"; a="228051752" X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="228051752" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2021 22:10:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="462195790" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga002.jf.intel.com with ESMTP; 17 Oct 2021 22:10:18 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx605.amr.corp.intel.com (10.18.126.85) 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:10:17 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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:10:17 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx612.amr.corp.intel.com (10.18.126.92) 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:10:16 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.108) by edgegateway.intel.com (192.55.55.68) 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:10:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UnuKfNq/mVLonKb1NBG92HJiXfPXHMqBkBq5+0X8Dxb23l/RYmoH+oQNJouZ2DVzLTNdZFJOcz6+EX2iXgexY3PI99eXUukSKSku0rI2jaVGaC494664ObJWq/TIhBHAT/Kb3q4lNc3jPKx1/qRXR1ZScbcBeuuW+6pNzSMzld2f/17OOLuQnJFf9lzAJBi5npZEbDA2bhFIdZb9G2/9TD8nFG8Kl2SC9eNehL2KuD6P9M9Z4JTVvBR1CHG2Y+xdXYQ4pI1DpNTdTAPYk67K+F4wXMYDag2CrYk8txYhRZUAY4I18RBAQMySytdGRpGmFpFbGMMg2gtS5p+snvaI5Q== 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=XW4Zru36XqA1ZUylR8Y3Fh6POUAx8XWGQfF0/bGCQLU=; b=OB2zZqkBWrjGdZDaf0O9YmWWj70ehDl/+RjiFOsQf2BV9ayaSJ5M3egyArmhOb6kFuctgvzpSLo3+uE3+Xb6Ur0/jKOJ+psodZdV5KAtgW2/+5bY6Cw0p1bMTB3Vd+6BRo3y6AybeXESNUTvNqdfj/wvr34KbIUENmeqN4HkHy85FfVF38bVqTR/gbhnpGqvD+6dYGs2dErYPgTrdbbxTILmU/DB6fdvuS2ew+/BBHn0YT34GM7ZtqQGRBla6kSG0sHWP6gypjskIb4/rIVJnRYEPtBev4s/Rmb32qrMjVyHkOP8L8GkKzicLN4lORggZRP75WWZlgrPrhyn/uy5Wg== 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=XW4Zru36XqA1ZUylR8Y3Fh6POUAx8XWGQfF0/bGCQLU=; b=WHkD5v6lSec6BTaOl/a9UVjF0M5nyIGsYXEgw2r+xSwFG16h2nIa5t78eIed0X5697iSnSmFmmkBEPG8PE0Y+tg9Ph+Z/SeAwAYZyeGi8RivXIeb73Tn1I6eXxS/W7m4L77aipg288FaLIR8H4d0tTdAsZaC1HLI21/jlnUoEJ0= Received: from BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by BN6PR11MB3860.namprd11.prod.outlook.com (2603:10b6:405:77::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Mon, 18 Oct 2021 05:10:13 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::882:4e40:b0e4:239e]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::882:4e40:b0e4:239e%6]) with mapi id 15.20.4608.018; Mon, 18 Oct 2021 05:10:13 +0000 From: "Chiu, Chasel" 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 Thread-Topic: [PATCH] IntelFsp2Pkg: Add support for config editor to handle multiple UPD Thread-Index: AQHXwV0OyrWC8zJ53E+C120KDtMBq6vYOZKQ Date: Mon, 18 Oct 2021 05:10:13 +0000 Message-ID: References: <20211015003844.1285-1-tung.lun.loo@intel.com> In-Reply-To: <20211015003844.1285-1-tung.lun.loo@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.6.200.16 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: 13f4f134-72ff-4e2f-03d5-08d991f590f2 x-ms-traffictypediagnostic: BN6PR11MB3860: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:229; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 47bRo4Tji3vmYGxjCcy7tYB29YxMpv9CtQ77Xyed5zqRfWLI2X30bz/AiREDeeroYDKRIYJIygrOBISrD+uAxBp3Q1IstbG4Q30ONkd3VLuDwQ6TdyWquAZ1xywDeQoKkk8O03eeDw7wczThY2Ix0faXWsJO7Lyabqa9WHaRAVsqqrPAz6L3boG0qOKkSD13RN3Japf0xK0V2ckf37R2ZicTAFlGKKaUUwKSnw02ghb9jMe5OILxRtr/KebR61IMSkN+vWCNR+XuLMTlWMZ1DvfdZCUSPkEfSRp45i9VJp3Ajs15lhSGyds8Wyy1I/HSF/eGrxh0Icq8I8YnBosVNjxvF0ODqyu8l+xNv7ySKaYDhnCzVoVNq+tELM6vwqfh2xQmZaNJB+wCNZInkSRtyPdnVbAHnOmGA0xQyDojdT0xEUzClwK6D2yoZKIc5V3Zy56bMOnzV33RyxLuxION5c2Cf9w4si4svAfjeYZc4XWPuBM/3faAVN/YnXm2fDCEbdZUQMsXr8QTFTpqi0PkifnZ+gFp2BB2qxwbgwEH6J3hBsC64xG4/gs66ghsBML2tcKraF16xRn3WYM8/F8UgvaNpkrbMmBxQqv40RdU+3UiPSbTGop4vCzLO/800Gvs6GK2rL99GzzaE8fte7eWEuOziRjN/Wh9j4zsEl8w34JPN6CrtTUyQZcTqledOtftwtKBbRNbqs4dTYaz0xUN6YpzQBT+syXziM9hcqE8PS9Ec5uh7+ty+evTdb6dS7eoHzpncLZsmDiRA+TSEuea49gDnG2HoDjCviDiXu3nacE= 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:(366004)(6506007)(71200400001)(53546011)(54906003)(107886003)(110136005)(33656002)(966005)(8936002)(508600001)(66476007)(19627235002)(26005)(38100700002)(186003)(4326008)(52536014)(66446008)(86362001)(83380400001)(82960400001)(7696005)(8676002)(2906002)(316002)(122000001)(9686003)(5660300002)(55016002)(76116006)(66946007)(66556008)(64756008)(38070700005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?1RI6UuxOXDo6cjOIV4SnWq+jU5B8SgBXv3Ov/T6rOuDhLPknFOzbM0EqPpGi?= =?us-ascii?Q?Zcy0ApJWhHqPBZurZzAxEkhcrxQcHvaj0iQoM4mnCQnOmIVw4+GWNi00TTmL?= =?us-ascii?Q?dI0xZZ2G7adGoQd+PwED2XKPmf/wCvYmiACOgCwIJ859JlJlPfEa7b16JmLQ?= =?us-ascii?Q?e2gjDP9ncSlCE1McgrY/cWpx+KOHmebLUuDC5uBpqyhJSNihtjSeOVXdo2o/?= =?us-ascii?Q?8BxUMUjLM0VlLkoLcV7I1IBf18KgCCbLg7Wg5U54SJkuvVsaq3DvDhrMEH6p?= =?us-ascii?Q?s9msLpAN7HIwVW9hbFGn7VFL5+is37UJr1vXDydmNnPPL6BBCw5JMGHjhOVe?= =?us-ascii?Q?PTFsNaIj7TRNwLk6MYT086L9JcQLTPn3yTWU88eq80bhVVfGnO+GKffJcZCZ?= =?us-ascii?Q?xX5MRuoPiRmeJPeLzgaKU+hNuYb5ZESgiBdxyCI3jlrKuCCWDTLk53lrl/Xo?= =?us-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: 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: 13f4f134-72ff-4e2f-03d5-08d991f590f2 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2021 05:10:13.2300 (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: Szwb54yvWsiaZUHEFjo9idgMLI8snZj9XFgGs1SLBZkxDhhfKxF2JgufbyaH4sgl4FTIqHoauHk/LKNPqT5XPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB3860 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 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 > ; Desimone, Nathaniel L > ; Zeng, Star ; Chiu, > Chasel > Subject: [PATCH] IntelFsp2Pkg: Add support for config editor to handle mu= ltiple > UPD >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3692 >=20 > In several use cases in bootloader, there are multiple instances of UPD w= ith > same signature header. As such, using previous version of config editor t= o edit > those will result in only overriding the first found instance. This patch= provides > the flexibility to modify the instance 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 +1= 473,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)+ > fsp_instance_root.wait_window(fsp_instance_root)++ > fsp_instance.clear() return bin_segs -- > 2.26.2.windows.1