public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Samer El-Haj-Mahmoud" <samer.el-haj-mahmoud@arm.com>
To: Ard Biesheuvel <Ard.Biesheuvel@arm.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "leif@nuviainc.com" <leif@nuviainc.com>,
	Ard Biesheuvel <Ard.Biesheuvel@arm.com>,
	Pete Batard <pete@akeo.ie>,
	"Andrei Warkentin (awarkentin@vmware.com)"
	<awarkentin@vmware.com>
Subject: Re: [PATCH] ArmPkg/PlatformBootManagerLib: regenerate boot options on boot failure
Date: Tue, 16 Jun 2020 21:40:11 +0000	[thread overview]
Message-ID: <DB7PR08MB32603C129C9A28035B111F82909D0@DB7PR08MB3260.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20200616174834.1110310-1-ard.biesheuvel@arm.com>

Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>


> -----Original Message-----
> From: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Sent: Tuesday, June 16, 2020 1:49 PM
> To: devel@edk2.groups.io
> Cc: leif@nuviainc.com; Ard Biesheuvel <Ard.Biesheuvel@arm.com>; Pete
> Batard <pete@akeo.ie>; Andrei Warkentin (awarkentin@vmware.com)
> <awarkentin@vmware.com>; Samer El-Haj-Mahmoud <Samer.El-Haj-
> Mahmoud@arm.com>
> Subject: [PATCH] ArmPkg/PlatformBootManagerLib: regenerate boot
> options on boot failure
>
> One of the side effects of the recent changes to PlatformBootManagerLib
> changes to avoid connecting all devices on every boot is that we no longer
> default to network boot on a virgin boot, but end up in the UiApp menu. At
> this point, the autogenerated boot options that we used to rely on will be
> instantiated too, but it does break the unattended boot case where devices
> are expected to attempt a network boot on the very first power on.
>
> Let's work around this by refreshing all boot options explicitly in the
> UnableToBoot() handler, and rebooting the system if doing so resulted in a
> change to the total number of configured boot options.
> This way, we ultimately end up in the UiApp as before if no boot options
> could be started, but only after all the autogenerated ones have been
> attempted as well.
> Cc: Pete Batard <pete@akeo.ie>Cc: Andrei Warkentin
> (awarkentin@vmware.com) <awarkentin@vmware.com>Cc: Samer El-Haj-
> Mahmoud <Samer.El-Haj-Mahmoud@arm.com>Signed-off-by: Ard
> Biesheuvel <ard.biesheuvel@arm.com>
> ---
>  ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 34
> ++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>
> diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
> b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
> index 15c5cac1bea0..9905cad22908 100644
> --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
> +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
> @@ -820,6 +820,40 @@ PlatformBootManagerUnableToBoot (
>  {   EFI_STATUS                   Status;   EFI_BOOT_MANAGER_LOAD_OPTION
> BootManagerMenu;+  EFI_BOOT_MANAGER_LOAD_OPTION
> *BootOptions;+  UINTN                        OldBootOptionCount;+  UINTN
> NewBootOptionCount;++  //+  // Record the total number of boot
> configured boot options+  //+  BootOptions =
> EfiBootManagerGetLoadOptions (&OldBootOptionCount,+
> LoadOptionTypeBoot);+  EfiBootManagerFreeLoadOptions (BootOptions,
> OldBootOptionCount);++  //+  // Connect all devices, and regenerate all boot
> options+  //+  EfiBootManagerConnectAll ();+
> EfiBootManagerRefreshAllBootOption ();++  //+  // Record the updated
> number of boot configured boot options+  //+  BootOptions =
> EfiBootManagerGetLoadOptions (&NewBootOptionCount,+
> LoadOptionTypeBoot);+  EfiBootManagerFreeLoadOptions (BootOptions,
> NewBootOptionCount);++  //+  // If the number of configured boot options
> has changed, reboot+  // the system so the new boot options will be taken
> into account+  // while executing the ordinary BDS bootflow sequence.+  //+
> if (NewBootOptionCount != OldBootOptionCount) {+    DEBUG
> ((DEBUG_WARN, "%a: rebooting after refreshing all boot options\n",+
> __FUNCTION__));+    gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0,
> NULL);+  }    Status = EfiBootManagerGetBootManagerMenu
> (&BootManagerMenu);   if (EFI_ERROR (Status)) {--
> 2.27.0

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

  reply	other threads:[~2020-06-16 21:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 17:48 [PATCH] ArmPkg/PlatformBootManagerLib: regenerate boot options on boot failure Ard Biesheuvel
2020-06-16 21:40 ` Samer El-Haj-Mahmoud [this message]
2020-06-17 11:12 ` Leif Lindholm
2020-06-17 11:32   ` Ard Biesheuvel
2020-06-17 12:16     ` Leif Lindholm
2020-06-17 12:28       ` Ard Biesheuvel
2020-06-17 12:40         ` Leif Lindholm
2020-06-17 12:59           ` Ard Biesheuvel
2020-06-17 14:35             ` Leif Lindholm
2020-06-17 18:30               ` Ard Biesheuvel
2020-06-17 13:44 ` [edk2-devel] " Laszlo Ersek
2020-06-17 16:21 ` Andrei Warkentin
2020-06-17 18:18   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB7PR08MB32603C129C9A28035B111F82909D0@DB7PR08MB3260.eurprd08.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox