<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
The issue is there are some auto created options we do not want on our platform. <br>
<br>
</div>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
<span id="OutlookSignature">
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
Get <a href="https://aka.ms/ghei36">Outlook for Android</a></div>
</span><br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Ni, Ray <ray.ni@intel.com><br>
<b>Sent:</b> Wednesday, November 6, 2019 11:59:31 PM<br>
<b>To:</b> Jeff Brasen <jbrasen@nvidia.com>; afish@apple.com <afish@apple.com><br>
<b>Cc:</b> devel@edk2.groups.io <devel@edk2.groups.io>; Ashish Singhal <ashishsingha@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.gao@intel.com>; Kinney, Michael D
 <michael.d.kinney@intel.com><br>
<b>Subject:</b> RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:Helvetica}
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:µÈÏß}
@font-face
        {font-family:Calibri}
@font-face
        {}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.x_MsoListParagraph, li.x_MsoListParagraph, div.x_MsoListParagraph
        {margin-right:0in;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
p.x_msonormal0, li.x_msonormal0, div.x_msonormal0
        {margin-right:0in;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
span.x_apple-converted-space
        {}
span.x_EmailStyle20
        {font-family:"Calibri",sans-serif;
        color:windowtext}
span.x_EmailStyle22
        {font-family:"Calibri",sans-serif;
        color:windowtext}
.x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
div.x_WordSection1
        {}
ol
        {margin-bottom:0in}
ul
        {margin-bottom:0in}
-->
</style>
<div lang="EN-US" link="blue" vlink="purple">
<div class="x_WordSection1">
<p class="x_MsoNormal">Jeff,</p>
<p class="x_MsoNormal">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).</p>
<p class="x_MsoNormal"> </p>
<div style="border:none; border-left:solid blue 1.5pt; padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b>From:</b> Jeff Brasen <jbrasen@nvidia.com> <br>
<b>Sent:</b> Thursday, November 7, 2019 12:13 PM<br>
<b>To:</b> afish@apple.com; Ni, Ray <ray.ni@intel.com><br>
<b>Cc:</b> devel@edk2.groups.io; Ashish Singhal <ashishsingha@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.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com><br>
<b>Subject:</b> RE: [edk2-devel] [PATCH] Support skipping automatic BM enumeration</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">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 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.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">What about a solution where we add a new Platform library function that allows for override of the behavior of BmEnumerateBootOptions? For example, either a function or protocol that takes the same parameters as this function and only
 if it returns NULL then we continue to the default enumeration code.  Or a function call inserted at the end that would modify the load option array after the system does the standard enumeration.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">-Jeff</p>
<p class="x_MsoNormal"> </p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b>From:</b> <a href="mailto:afish@apple.com">afish@apple.com</a> <<a href="mailto:afish@apple.com">afish@apple.com</a>>
<br>
<b>Sent:</b> Wednesday, November 6, 2019 9:20 AM<br>
<b>To:</b> Ni, Ray <<a href="mailto:ray.ni@intel.com">ray.ni@intel.com</a>><br>
<b>Cc:</b> <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>; Jeff Brasen <<a href="mailto:jbrasen@nvidia.com">jbrasen@nvidia.com</a>>; Ashish Singhal <<a href="mailto:ashishsingha@nvidia.com">ashishsingha@nvidia.com</a>>; Laszlo Ersek <<a href="mailto:lersek@redhat.com">lersek@redhat.com</a>>;
 Wang, Jian J <<a href="mailto:jian.j.wang@intel.com">jian.j.wang@intel.com</a>>; Wu, Hao A <<a href="mailto:hao.a.wu@intel.com">hao.a.wu@intel.com</a>>; Gao, Zhichao <<a href="mailto:zhichao.gao@intel.com">zhichao.gao@intel.com</a>>; Mike Kinney <<a href="mailto:michael.d.kinney@intel.com">michael.d.kinney@intel.com</a>><br>
<b>Subject:</b> Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Ray,</p>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal">Is there an obvious hook point we could point Jeff and Ashish at? </p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal">Long term it would be a good idea to have a Wiki page to give some guidance on how to customize the BDS. </p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal">Thanks,</p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal">Andrew Fish</p>
<div>
<p class="x_MsoNormal" style="margin-bottom:12.0pt"> </p>
<blockquote style="margin-top:5.0pt; margin-bottom:5.0pt">
<div>
<p class="x_MsoNormal">On Nov 5, 2019, at 9:20 PM, Ni, Ray <<a href="mailto:ray.ni@intel.com">ray.ni@intel.com</a>> wrote:</p>
</div>
<p class="x_MsoNormal"> </p>
<div>
<div>
<p class="x_MsoNormal">Andrew,</p>
</div>
<div>
<p class="x_MsoNormal">I agree with your opinion.</p>
</div>
<div>
<p class="x_MsoNormal">It¡¯s expected that Platform Boot Manager lib calls EfiBootManagerRefreshAllBootOption() only in full configuration boot path.</p>
</div>
<div>
<p class="x_MsoNormal">The full configuration boot path is chosen when hardware changes happen. So it¡¯s not expected EfiBootManagerRefresh¡­() be<br>
called in every boot.</p>
</div>
<div>
<p class="x_MsoNormal">So you could:</p>
</div>
<ol start="1" type="1" style="margin-top:0in">
<li class="x_MsoListParagraph" style="margin-top:0in; margin-bottom:0in; margin-bottom:.0001pt">
Delete the auto-created option pointing to LoadFile instance</li><li class="x_MsoListParagraph" style="margin-top:0in; margin-bottom:0in; margin-bottom:.0001pt">
Create your own one with customized description.</li></ol>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div style="border:none; border-left:solid blue 1.5pt; padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<div>
<p class="x_MsoNormal"><b>From:</b><span class="x_apple-converted-space"> </span><a href="mailto:afish@apple.com">afish@apple.com</a> <<a href="mailto:afish@apple.com">afish@apple.com</a>><span class="x_apple-converted-space"> </span><br>
<b>Sent:</b><span class="x_apple-converted-space"> </span>Wednesday, November 6, 2019 10:47 AM<br>
<b>To:</b><span class="x_apple-converted-space"> </span><a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>;
<a href="mailto:jbrasen@nvidia.com">jbrasen@nvidia.com</a><br>
<b>Cc:</b><span class="x_apple-converted-space"> </span>Ashish Singhal <<a href="mailto:ashishsingha@nvidia.com">ashishsingha@nvidia.com</a>>; Laszlo Ersek <<a href="mailto:lersek@redhat.com">lersek@redhat.com</a>>; Ni, Ray <<a href="mailto:ray.ni@intel.com">ray.ni@intel.com</a>>;
 Wang, Jian J <<a href="mailto:jian.j.wang@intel.com">jian.j.wang@intel.com</a>>; Wu, Hao A <<a href="mailto:hao.a.wu@intel.com">hao.a.wu@intel.com</a>>; Gao, Zhichao <<a href="mailto:zhichao.gao@intel.com">zhichao.gao@intel.com</a>>; Kinney, Michael D <<a href="mailto:michael.d.kinney@intel.com">michael.d.kinney@intel.com</a>><br>
<b>Subject:</b><span class="x_apple-converted-space"> </span>Re: [edk2-devel] [PATCH] Support skipping automatic BM enumeration</p>
</div>
</div>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<div>
<p class="x_MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
</p>
</div>
<blockquote style="margin-top:5.0pt; margin-bottom:5.0pt">
<div>
<div>
<p class="x_MsoNormal">On Nov 5, 2019, at 7:34 PM, Jeff Brasen <<a href="mailto:jbrasen@nvidia.com"><span style="color:purple">jbrasen@nvidia.com</span></a>> wrote:</p>
</div>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-family:"Helvetica",sans-serif"><br>
Wouldn't having a variable that we create and delete on every boot put unnecessary stress on the SPI-NOR that the variable store lives on?<br>
What about the alternative approach where we allow the platform code to modify 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 and 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?<br>
<br>
What changes every boot that forces the variable to need to get modified?<span class="x_apple-converted-space"> </span><br>
<br>
I would assume the NOR driver is smart enough to not update a variable that is not changing.<span class="x_apple-converted-space"> </span><br>
<br>
The custom BDS could could only create the variable for this device if it does not exist.<span class="x_apple-converted-space"> </span><br>
<br>
[JB] The current flow with no changes in the boot manager would be as follows</span></p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-family:"Helvetica",sans-serif"> </span></p>
</div>
</div>
<div>
<ol start="1" type="1" style="margin-top:0in">
<li class="x_MsoNormal" style=""><span style="font-family:"Helvetica",sans-serif">Scan for instance of the boot option in the variables</span></li><li class="x_MsoNormal" style=""><span style="font-family:"Helvetica",sans-serif">It will not be found, so create a new boot option store it to a variable and update BootOrder</span></li><li class="x_MsoNormal" style=""><span style="font-family:"Helvetica",sans-serif">Platform code runs creates the options for the boot option it wants and writes those to variable store</span></li><li class="x_MsoNormal" style=""><span style="font-family:"Helvetica",sans-serif">Delete/disable the boot option in the variable store</span></li></ol>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif"> </span></p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-family:"Helvetica",sans-serif">When you reboot it won't find the variable so 1/2/4 will re-occur</span></p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif"> </span></p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-family:"Helvetica",sans-serif">The code that does this (1/2) is EfiBootManagerRefreshAllBootOption in BmBoot.c</span></p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif"> </span></p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-family:"Helvetica",sans-serif">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 recognize that is the same boot option.</span></p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif"> </span></p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-family:"Helvetica",sans-serif">If however we modify EfiBootManagerFindLoadOption to not compare 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 wouldn't have changes every boot.</span></p>
</div>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif"> </span></p>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">Jeff,</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">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 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>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">I think Laszlo advocated having the BDS platform specific code make sure the boot variables are in the correct state. That should 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. </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">I think the question is how is your use case different 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 the boot variable. </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">[1]</p>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="x_MsoNormal">/**</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">  The function creates boot options for all possible bootable medias in the following order:</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">  1. Removable BlockIo            - The boot option only points to the removable media</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">                                    device, like USB key, DVD, Floppy etc.</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">  2. Fixed BlockIo                - The boot option only points to a Fixed blockIo device,</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">                                    like HardDisk.</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">  3. Non-BlockIo SimpleFileSystem - The boot option points to a device supporting</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">                                    SimpleFileSystem Protocol, but not supporting BlockIo</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">                                    protocol.</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">  4. LoadFile                     - The boot option points to the media supporting</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">                                    LoadFile protocol.</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">  Reference: UEFI Spec chapter 3.3 Boot Option Variables Default Boot Behavior</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">  The function won't delete the boot option not added by itself.</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">**/</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">VOID</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">EFIAPI</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">EfiBootManagerRefreshAllBootOption (</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">  VOID</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">  );</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">Thanks,</p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">Andrew Fish</p>
</div>
</div>
</div>
</div>
<div>
<p class="x_MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
</p>
</div>
<blockquote style="margin-top:5.0pt; margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="x_MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif"><br>
</span><span style="font-family:"Helvetica",sans-serif">Thanks,</span><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif"><br>
<br>
</span><span style="font-family:"Helvetica",sans-serif">Andrew Fish</span><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif"><br>
<br>
</span><span style="font-family:"Helvetica",sans-serif">Thanks,</span><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif"><br>
<br>
</span><span style="font-family:"Helvetica",sans-serif">Jeff</span><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif"><br>
<br>
</span></p>
</div>
</div>
<div>
<div class="x_MsoNormal" align="center" style="text-align:center"><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif">
<hr size="2" width="100%" align="center">
</span></div>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif">This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution
 is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.</span></p>
</div>
</div>
<div>
<div class="x_MsoNormal" align="center" style="text-align:center"><span style="font-size:9.0pt; font-family:"Helvetica",sans-serif">
<hr size="2" width="100%" align="center">
</span></div>
</div>
<div>
<div>
<p class="x_MsoNormal"></p>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<p class="x_MsoNormal"> </p>
</div>
</div>
</div>
</div>
</body>
</html>

<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>
Groups.io Links:<p>

You receive all messages sent to this group.


<p>

<a target="_blank" href="https://edk2.groups.io/g/devel/message/50178">View/Reply Online (#50178)</a> |


  


|


  
    <a target="_blank" href="https://groups.io/mt/39747302/1813853">Mute This Topic</a>
  

| <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>



<br>

<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>