From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from nat-hk.nvidia.com (nat-hk.nvidia.com [203.18.50.4]) by mx.groups.io with SMTP id smtpd.web11.7831.1573148766199445321 for ; Thu, 07 Nov 2019 09:46:07 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=kN/J//Hc; spf=pass (domain: nvidia.com, ip: 203.18.50.4, mailfrom: jbrasen@nvidia.com) Received: from hkpgpgate102.nvidia.com (Not Verified[10.18.92.9]) by nat-hk.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 08 Nov 2019 01:46:04 +0800 Received: from HKMAIL104.nvidia.com ([10.18.16.13]) by hkpgpgate102.nvidia.com (PGP Universal service); Thu, 07 Nov 2019 09:46:03 -0800 X-PGP-Universal: processed; by hkpgpgate102.nvidia.com on Thu, 07 Nov 2019 09:46:03 -0800 Received: from HKMAIL101.nvidia.com (10.18.16.10) by HKMAIL104.nvidia.com (10.18.16.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 7 Nov 2019 17:46:03 +0000 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (104.47.45.50) by HKMAIL101.nvidia.com (10.18.16.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 7 Nov 2019 17:46:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=crKDPnZv4an6NR8EJuJmpviRre+0C4pAzFpVxCQIpi8WrL9BNm2Krj5eBSuz2IGr245qv74iXlIMc3lX/7hD+OrOA41fvnRbRN2ryCQjl4QbSgY3BfqRDVDMlhmEo61daqG0Ev2XQKAo6m+n6U6qnEy0Tn4dcScu69V/PXTVhIO9UgYEYS3YTwEBvuTydMPiKWpT4CnlYSnCbKkz93pr0Pz1m5H5cbbHKJfrXNXUVteI58V1L9LMG5jaYDc2+lC4VAlB3E8LhtWdrvO3GIA0mBGim7Pp3nIYLd0UdxqK+9rhy9nH022ANzWl9C4SYDepFGDo++3H72unxM5LPvx+fQ== 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=B9+Cvb6v6xLbpYrNgqV78ntrobw2BouUdCWD7ceTXZA=; b=TZwCTfobTHgr8/r4Qv4hzUrhC9yayCLnKG6ourQc3SSBRIjIel03JyXg7n05ymmKBVZ/RRHYcA/52uZa3aVvBC/05iR5W9Gv6sdKKon8jK3YOcFjl7lO4TL9EuEXabUu5dinjc28k5EFhbRuCkNHd9s9S2qTk+/LwZkpJ62tFYNad8LyzcJ4SjSr4UQsjbdUc59UcL7oO1sCDR1nr6uitQQyQZKjiy13BdP0Gq5VGQKUUhEkO4aqxHm0efYttvka0IXO2Jw0FrfyjH/mEurjMPNJl/x/Si2eFOnil5uZbS2bgmOJ4pG7nPsHOjINFAG90TM8VQK/1puv/0E9c+emxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none Received: from BYAPR12MB3462.namprd12.prod.outlook.com (20.178.196.208) by BYAPR12MB3046.namprd12.prod.outlook.com (20.178.196.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Thu, 7 Nov 2019 17:46:00 +0000 Received: from BYAPR12MB3462.namprd12.prod.outlook.com ([fe80::75d1:6f54:3d0:69d8]) by BYAPR12MB3462.namprd12.prod.outlook.com ([fe80::75d1:6f54:3d0:69d8%6]) with mapi id 15.20.2430.020; Thu, 7 Nov 2019 17:46:00 +0000 From: "Jeff Brasen" To: "Ni, Ray" , "devel@edk2.groups.io" , "afish@apple.com" CC: Ashish Singhal , Laszlo Ersek , "Wang, Jian J" , "Wu, Hao A" , "Gao, Zhichao" , "Kinney, Michael D" Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Thread-Topic: [edk2-devel] [PATCH] Support skipping automatic BM enumeration Thread-Index: AQHVlD5/488eXaMRxUa5BaRrbDICz6d9WZjRgAAW7wCAAAlggIAA2ZOAgADEX9CAADF4gIAAAGDIgAAFpgCAAK41UA== Date: Thu, 7 Nov 2019 17:46:00 +0000 Message-ID: References: <1b91c052-f64c-1dca-98ff-a2777afd7f77@redhat.com> <734D49CCEBEEF84792F5B80ED585239D5C34F98A@SHSMSX104.ccr.corp.intel.com> <6766B443-E14A-4F57-984E-5A865FB22CC9@apple.com> <37D801DD-41E8-452E-9F24-ADF52BFDB676@apple.com> <72ce1d71-2a65-a6c0-1dd8-7628429c5a3c@redhat.com> <746A8D5E-DC45-4D39-9C4D-97A10BE2E0B0@apple.com> <734D49CCEBEEF84792F5B80ED585239D5C35125E@SHSMSX104.ccr.corp.intel.com> ,<734D49CCEBEEF84792F5B80ED585239D5C352ECA@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5C352F7C@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C352F7C@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Enabled=True; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_SiteId=43083d15-7273-40c1-b7db-39efd9ccc17a; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_SetDate=2019-11-07T04:11:42.0477204Z; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Name=Unrestricted; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_ContentBits=11; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Method=Unknown authentication-results: spf=none (sender IP is ) smtp.mailfrom=jbrasen@nvidia.com; x-originating-ip: [216.228.112.21] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2171dceb-7595-49bb-978c-08d763aa5a74 x-ms-traffictypediagnostic: BYAPR12MB3046:|BYAPR12MB3046: x-ms-exchange-purlcount: 6 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 0214EB3F68 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(396003)(136003)(346002)(366004)(376002)(39860400002)(189003)(199004)(8936002)(110136005)(6506007)(25786009)(74316002)(316002)(53546011)(14454004)(26005)(606006)(102836004)(52536014)(76176011)(6116002)(3846002)(99286004)(54906003)(5660300002)(790700001)(6436002)(2906002)(6306002)(54896002)(236005)(186003)(9686003)(55016002)(6246003)(7696005)(229853002)(14444005)(66446008)(76116006)(256004)(33656002)(64756008)(66946007)(66556008)(66476007)(4326008)(66066001)(476003)(486006)(45080400002)(71200400001)(478600001)(8676002)(11346002)(86362001)(446003)(76236002)(7736002)(2501003)(81166006)(81156014)(2201001)(71190400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR12MB3046;H:BYAPR12MB3462.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: doiR6nDO/opX7+q7Jki4P/6VWTYqW7YudpgnAlZOWCyQDjO/UK+footsha3zazJ1Bw0l5iQsh2SMK3mRFxhVZ6P/S6bPTTTh3t5OY9b97sdRUJTpAjOg2NvvILGt929K5h7zQlQXksCPOnVYxFaPiroTYrgyfVLbrInZXgC3Zpo1I58s1DEmgI06qDfJR+UrXs6T90IIJY6+T+y/a7zFHWaLjz4xcL2PNuqDqA/nLbWVcJsY6vjaMuzJjbdRzDw6zHNjpW0D4CizBHKIECSXsyK9QMNxfvjno2O2RGHqqhrCBqRZyiwD/ymAI0u3eQz5UmQVpAcG/hX/mZNxMub4vsgL2MzjL0aQqT8VLqXXnPtqL/zMHFlEOGt/xI/WB+sbQWWtihvvw0mCDS6F8u+Fm1YjebUYTv875XL44cBG2ogJQq/JZBqF16InoLjaMO4zuOK+uCMMf4gM6OwET0JD8DxrspLa22sMG96bp0SE0S4= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 2171dceb-7595-49bb-978c-08d763aa5a74 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Nov 2019 17:46:00.8105 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: srENLMS1ytjjLHhkkA8+oetwsSpDY+eQ7Y7rdDF8kwsUZz+COHkr5bJZQQGvE+9ibOwJVAdmiz/Q5wO8OXhGXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3046 Return-Path: jbrasen@nvidia.com X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1573148764; bh=B9+Cvb6v6xLbpYrNgqV78ntrobw2BouUdCWD7ceTXZA=; h=X-PGP-Universal:ARC-Seal:ARC-Message-Signature: ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic: Thread-Index:Date:Message-ID:References:In-Reply-To: Accept-Language:X-MS-Has-Attach:X-MS-TNEF-Correlator:msip_labels: authentication-results:x-originating-ip:x-ms-publictraffictype: x-ms-office365-filtering-correlation-id:x-ms-traffictypediagnostic: x-ms-exchange-purlcount:x-ms-exchange-transport-forked: x-microsoft-antispam-prvs:x-ms-oob-tlc-oobclassifiers: x-forefront-prvs:x-forefront-antispam-report:received-spf: x-ms-exchange-senderadcheck:x-microsoft-antispam: x-microsoft-antispam-message-info:MIME-Version: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg: Content-Language:Content-Type; b=kN/J//HcIlWqGblX1hIOWym9mUAaieBf9gfYVkAO0aKV6qurCgk0/suR7V4EXYkrG eoS4hnFW+3O6OctIy2vd5FuO2RN25uZUIGC236Wu4rZXItjacOCQj2gd9QIrf9t2pv vRk7/gps0YCj39puzR/q0ymO5LcXkKPtp6c8B8qtWKdHrJa203tepNCEETz/tTz+L9 eerau/qABnEHUfXtg7SPJZv6AeGl+N/WH7rCkUnSn+rE2gWSesVlgpKwxS+m803yep SR/sfcNegjk7UoHqJxU8KyS+y1bwSBJQ/HcJc7V5n04X04GLpJX8OmqnPMetP07b8I eE0kEzOXb/u4w== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BYAPR12MB3462CB208DD1D7886529CDE1CB780BYAPR12MB3462namp_" --_000_BYAPR12MB3462CB208DD1D7886529CDE1CB780BYAPR12MB3462namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Fixing UiApp seems reasonable, I do think we would want a hook to the platf= orm library in here as the enumeration that occurs in the UiApp is intended= to do a full enumeration of the system and there may be platform specifics= to how that occurs. Thanks, Jeff From: Ni, Ray Sent: Thursday, November 7, 2019 12:21 AM To: devel@edk2.groups.io; Jeff Brasen ; afish@apple.co= m Cc: Ashish Singhal ; Laszlo Ersek ; Wang, Jian J ; Wu, Hao A ;= Gao, Zhichao ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeratio= n I treat the issue in this way: 1. Platform Boot Manager library does a good job. It doesn't always cal= l RefreshAll() API to auto-create the boot options 2. But UiApp doesn't. It constantly call RefreshAll(). Do you think that we can fix UiApp instead? For example, introducing a PCD= to control the boot option refresh behavior? Thanks, Ray From: devel@edk2.groups.io > On Behalf Of Jeff Brasen Sent: Thursday, November 7, 2019 3:02 PM To: Ni, Ray >; afish@apple.com Cc: devel@edk2.groups.io; Ashish Singhal >; Laszlo Ersek >; Wang, Jian J >; Wu, Hao A >; Gao, Zhichao >; Kinney, Michael D > Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeratio= n The issue is there are some auto created options we do not want on our pla= tform. Get Outlook for Android ________________________________ From: Ni, Ray > Sent: Wednesday, November 6, 2019 11:59:31 PM To: Jeff Brasen >; afish@app= le.com > Cc: devel@edk2.groups.io >; Ashish Singhal >; Laszlo Ersek >; Wang, Jian J >; Wu, Hao A >; Gao, Z= hichao >; Kinney, Micha= el D > Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeratio= n Jeff, RefreshAllBootOption() only modifies/creates the auto-created boot options= . For the boot options created by platform boot manager library, they stay = with no one touches. And all auto-created boot options are appended in the = end of boot option list (through BootOrder). From: Jeff Brasen > Sent: Thursday, November 7, 2019 12:13 PM To: afish@apple.com; Ni, Ray > Cc: devel@edk2.groups.io; Ashish Singhal >; Laszlo Ersek >; Wang, Jian J >; Wu, Hao A >; Gao, Zhichao >; Kinney, Michael D > Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeratio= n As the suggestions below made sense, we updated our platform boot manager = library to behave in this manner and for normal boots everything works well= . However the UiApp and boot maintenance applications in EDK2 also call Efi= BootManagerRefreshAllBootOption() when ever a user goes into the menu which= will re-create the skipped boot options with no place for the platform cod= e to intervene. What about a solution where we add a new Platform library function that al= lows for override of the behavior of BmEnumerateBootOptions? For example, e= ither a function or protocol that takes the same parameters as this functio= n and only if it returns NULL then we continue to the default enumeration c= ode. Or a function call inserted at the end that would modify the load opt= ion array after the system does the standard enumeration. -Jeff From: afish@apple.com > Sent: Wednesday, November 6, 2019 9:20 AM To: Ni, Ray > Cc: devel@edk2.groups.io; Jeff Brasen >; Ashish Singhal >; Laszlo Ersek >; Wang, Jian J >; Wu, Hao A = >; Gao, Zhichao >; Mike= Kinney > Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeratio= n Ray, Is there an obvious hook point we could point Jeff and Ashish at? Long term it would be a good idea to have a Wiki page to give some guidanc= e on how to customize the BDS. Thanks, Andrew Fish On Nov 5, 2019, at 9:20 PM, Ni, Ray > wrote: Andrew, I agree with your opinion. It's expected that Platform Boot Manager lib calls EfiBootManagerRefreshAl= lBootOption() only in full configuration boot path. The full configuration boot path is chosen when hardware changes happen. S= o it's not expected EfiBootManagerRefresh...() be called in every boot. So you could: 1. Delete the auto-created option pointing to LoadFile instance 2. Create your own one with customized description. From: afish@apple.com > Sent: Wednesday, November 6, 2019 10:47 AM To: devel@edk2.groups.io; jbrasen@nvidia.com<= mailto:jbrasen@nvidia.com> Cc: Ashish Singhal >; Laszlo Ersek >; Ni, Ray >; Wang, Jian J >; Wu, Hao A >; Gao, Zhichao >; Kinney, Michael D > Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeratio= n On Nov 5, 2019, at 7:34 PM, Jeff Brasen > wrote: Wouldn't having a variable that we create and delete on every boot put unn= ecessary stress on the SPI-NOR that the variable store lives on? What about the alternative approach where we allow the platform code to mo= dify the attributes of the auto created variable to disable it with hidden/= !active but still match for detection purposes so that it doesn't delete an= d recreate the modified variable each boot? That way all the logic on what = to disable can still be in the platform code and all the existing logic in = the boot manager can stay basically the same? What changes every boot that forces the variable to need to get modified? I would assume the NOR driver is smart enough to not update a variable tha= t is not changing. The custom BDS could could only create the variable for this device if it = does not exist. [JB] The current flow with no changes in the boot manager would be as foll= ows 1. Scan for instance of the boot option in the variables 2. It will not be found, so create a new boot option store it to a vari= able and update BootOrder 3. Platform code runs creates the options for the boot option it wants = and writes those to variable store 4. Delete/disable the boot option in the variable store When you reboot it won't find the variable so 1/2/4 will re-occur The code that does this (1/2) is EfiBootManagerRefreshAllBootOption in BmB= oot.c If you modify the variable to disable it with hidden/not active it would d= elete that and create a new one as well as the code wouldn't recognize that= is the same boot option. If however we modify EfiBootManagerFindLoadOption to not compare the attri= butes (at least allow for differences in active and hidden) then the when i= t refreshes every thing it would see the match and not delete/create a new = variable in the store and thus we wouldn't have changes every boot. Jeff, Sorry if I'm a little off on the sequence of things as the platform I work= on day to day has a custom BDS and does not use this library..... I though= the patch changed BmEnumerateBootOptions(), so that is going to change how= EfiBootManagerRefreshAllBootOption() works. I'd also point out the patch a= s given is invalid as it changed the behavior of the public library API for= EfiBootManagerRefreshAllBootOption() [1] so for the patch to be valid it w= ould need to change the comments to reflect the new behavior. This is kind = of what Laszlo's technical debt comment was about. I think Laszlo advocated having the BDS platform specific code make sure t= he boot variables are in the correct state. That should happen before the B= oot Manager code runs, and it is not clear to me why the Boot Manager coul= d would need to run if you have a valid EFI nvram variable to boot from. I think the question is how is your use case different than the boot varia= ble that Windows installs? If it works kind of the same way then the answer= is to have the BDS platform specific code write the boot variable. [1] /** The function creates boot options for all possible bootable medias in th= e following order: 1. Removable BlockIo - The boot option only points to the rem= ovable media device, like USB key, DVD, Floppy etc. 2. Fixed BlockIo - The boot option only points to a Fixed= blockIo device, like HardDisk. 3. Non-BlockIo SimpleFileSystem - The boot option points to a device sup= porting SimpleFileSystem Protocol, but not sup= porting BlockIo protocol. 4. LoadFile - The boot option points to the media su= pporting LoadFile protocol. Reference: UEFI Spec chapter 3.3 Boot Option Variables Default Boot Beha= vior The function won't delete the boot option not added by itself. **/ VOID EFIAPI EfiBootManagerRefreshAllBootOption ( VOID ); Thanks, Andrew Fish Thanks, Andrew Fish Thanks, Jeff ________________________________ This email message is for the sole use of the intended recipient(s) and ma= y contain confidential information. Any unauthorized review, use, disclosu= re or distribution is prohibited. If you are not the intended recipient, p= lease contact the sender by reply email and destroy all copies of the origi= nal message. ________________________________ --_000_BYAPR12MB3462CB208DD1D7886529CDE1CB780BYAPR12MB3462namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Fixing UiApp seems reasonable, I do think we would= want a hook to the platform library in here as the enumeration that occurs= in the UiApp is intended to do a full enumeration of the system and there may be platform specifics to how that occurs.

 

Thanks,

Jeff

 

 

From: Ni, Ray <ray.ni@intel.com&= gt;
Sent: Thursday, November 7, 2019 12:21 AM
To: devel@edk2.groups.io; Jeff Brasen <jbrasen@nvidia.com>; a= fish@apple.com
Cc: Ashish Singhal <ashishsingha@nvidia.com>; Laszlo Ersek &l= t;lersek@redhat.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Ha= o A <hao.a.wu@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>;= Kinney, Michael D <michael.d.kinney@intel.com>
Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enu= meration

 

I treat the issue in this way:

  1. Platform Boot Manager library does a good job. It doesn’t alw= ays call RefreshAll() API to auto-create the boot options=
  2. But UiApp doesn’t. It constantly call RefreshAll().<= /o:p>

 

Do you think that we can fix UiApp instead? For ex= ample, introducing a PCD to control the boot option refresh behavior?<= /o:p>

 

Thanks,

Ray

 

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jeff Brasen
Sent: Thursday, November 7, 2019 3:02 PM
To: Ni, Ray <ray.ni@intel.co= m>; afish@apple.com
Cc: devel@edk2.groups.io; Ashish Singhal <ashishsing= ha@nvidia.com>; Laszlo Ersek <lersek@redhat.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao, Zhichao <zhichao.ga= o@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH] Support skipping automatic BM enu= meration

 

The issue= is there are some auto created options we do not want on our platform.


From: Ni, R= ay <ray.ni@intel.com>
Sent: Wednesday, November 6, 2019 11:59:31 PM
To: Jeff Brasen <jbrasen@n= vidia.com>; afish@apple.com <afish@apple.com>
Cc: devel@edk2.groups.io <devel@edk2.groups.io>;= Ashish Singhal <ashishsingha= @nvidia.com>; Laszlo Ersek <= lersek@redhat.com>; Wang, Jian J <jian.j.wang@int= el.com>; Wu, Hao A <hao.a.w= u@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enu= meration

 

Jeff,

RefreshAllBootOption() only modifies/creates the a= uto-created boot options. For the boot options created by platform boot man= ager library, they stay with no one touches. And all auto-created boot opti= ons are appended in the end of boot option list (through BootOrder).

 

From: Jeff Brasen <jbrasen@nvidia.com>
Sent: Thursday, November 7, 2019 12:13 PM
To: afish@apple.com; Ni, Ray= <ray.ni@intel.com>
Cc: devel@edk2.groups.io; Ashish Singhal <ashishsing= ha@nvidia.com>; Laszlo Ersek <lersek@redhat.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao, Zhichao <zhichao.ga= o@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: RE: [edk2-devel] [PATCH] Support skipping automatic BM enu= meration

 

As the suggestions below made sense, we updated ou= r platform boot manager library to behave in this manner and for normal boo= ts everything works well. However the UiApp and boot maintenance applicatio= ns in EDK2 also call EfiBootManagerRefreshAllBootOption() when ever a user goes into the menu which will re-create the skipped boot= options with no place for the platform code to intervene.

 

What about a solution where we add a new Platform = library function that allows for override of the behavior of BmEnumerateBoo= tOptions? For example, either a function or protocol that takes the same pa= rameters as this function and only if it returns NULL then we continue to the default enumeration code. &nbs= p;Or a function call inserted at the end that would modify the load option = array after the system does the standard enumeration.

 

-Jeff

 

 

Ray,

 

Is there an obvious hook point we could point Jeff= and Ashish at? 

 

Long term it would be a good idea to have a Wiki p= age to give some guidance on how to customize the BDS. 

 

Thanks,

 

Andrew Fish

 

On Nov 5, 2019, at 9:20 PM, Ni, Ray <ray.ni@intel.com> wrote:

 

Andrew,

I agree with your opinion.

It’s expected that Platform Boot Manager lib= calls EfiBootManagerRefreshAllBootOption() only in full configuration boot= path.

The full configuration boot path is chosen when ha= rdware changes happen. So it’s not expected EfiBootManagerRefreshR= 30;() be
called in every boot.

So you could:

  1. Delete the auto-created option pointing to LoadFile instance
  2. Create your own one with customized description.

 

 

From: afish@apple.com <afish@apple.com> 
Sent: Wednesday,= November 6, 2019 10:47 AM
To: devel@edk2.groups.io; jbrasen@nvidia.com
Cc: Ashish Singh= al <ashishsingha@nvidia.com>; Laszlo Ersek <lersek@redhat= .com>; Ni, Ray <ray.ni@intel.= com>; Wang, Jian J <jian.j.wang@int= el.com>; Wu, Hao A <hao.a.w= u@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: Re: [ed= k2-devel] [PATCH] Support skipping automatic BM enumeration

 

 

 

On Nov 5, 2019, at 7:34 PM, Jeff Brasen <jbrasen@nvidia= .com> wrote:

 


Wouldn't having a variable that we create and delete on every boot put unn= ecessary stress on the SPI-NOR that the variable store lives on?
What about the alternative approach where we allow the platform code to mo= dify the attributes of the auto created variable to disable it with hidden/= !active but still match for detection purposes so that it doesn't delete an= d recreate the modified variable each boot? That way all the logic on what to disable can still be in the = platform code and all the existing logic in the boot manager can stay basic= ally the same?

What changes every boot that forces the variable to need to get modified?<= span class=3D"xapple-converted-space"> 


I would assume the NOR driver is smart enough to not update a variable tha= t is not changing. 

The custom BDS could could only create the variable for this device if it = does not exist. 

[JB] The current flow with no changes in the boot manager would be as foll= ows

 

  1. Scan for instance of the boot= option in the variables
  2. It will not be found, so create a new boot option store it= to a variable and update BootOrder
  3. Platform code runs creates the options for the = boot option it wants and writes those to variable store
  4. Delete/disable the boot = option in the variable store

 

When you reboot it won't find the variable so 1/2/4 will re-occu= r

 

The code that does this (1/2) is EfiBootManagerRefreshAllBo= otOption in BmBoot.c

 

If you modify the variable to disable it with hidden/not active = it would delete that and create a new one as well as the code wouldn't reco= gnize that is the same boot option.

 

If however we modify EfiBootManagerFindLoadOption to not co= mpare the attributes (at least allow for differences in active and hidden) = then the when it refreshes every thing it would see the match and not delete/create a new variable in the store and thus we w= ouldn't have changes every boot.

 

 

Jeff,

 

Sorry if I'm a little off on the sequence of thing= s as the platform I work on day to day has a custom BDS and does not use th= is library..... I though the patch changed BmEnumerateBootOptions(), s= o that is going to change how EfiBootManagerRefreshAllBootOption() works. I'd also point out the patch as given is invalid as it changed the= behavior of the public library API for EfiBootManagerRefreshAllBootOption(= ) [1] so for the patch to be valid it would need to change the comments to = reflect the new behavior. This is kind of what Laszlo's technical debt comment was about. <= /p>

 

I think Laszlo advocated having the BDS platform s= pecific code make sure the boot variables are in the correct state. That sh= ould happen before the Boot Manager code runs, and it is  not clear to= me why the Boot Manager could would need to run if you have a valid EFI nvram variable to boot from. 

 

I think the question is how is your use case diffe= rent than the boot variable that Windows installs? If it works kind of the = same way then the answer is to have the BDS platform specific code write th= e boot variable. 

 

 

[1]

/**

  The function creates boot options for all p= ossible bootable medias in the following order:

  1. Removable BlockIo       &= nbsp;    - The boot option only points to the removable media

              &= nbsp;                    = device, like USB key, DVD, Floppy etc.

  2. Fixed BlockIo        = ;        - The boot option only points to a Fixed block= Io device,

              &= nbsp;                    = like HardDisk.

  3. Non-BlockIo SimpleFileSystem - The boot = option points to a device supporting

              &= nbsp;                    = SimpleFileSystem Protocol, but not supporting BlockIo

              &= nbsp;                    = protocol.

  4. LoadFile         &nb= sp;           - The boot option points to the medi= a supporting

              &= nbsp;                    = LoadFile protocol.

  Reference: UEFI Spec chapter 3.3 Boot Optio= n Variables Default Boot Behavior

 

  The function won't delete the boot option n= ot added by itself.

**/

VOID

EFIAPI

EfiBootManagerRefreshAllBootOption (

  VOID

  );

 

Thanks,

 

Andrew Fish

 


Thanks= ,

Andrew= Fish

Thanks= ,

Jeff


This email message is for the sole use of the in= tended recipient(s) and may contain confidential information.  Any una= uthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact t= he sender by reply email and destroy all copies of the original message.


 

--_000_BYAPR12MB3462CB208DD1D7886529CDE1CB780BYAPR12MB3462namp_--