public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v2] MdeModulePkg/UefiBootManagerLib: Signal ReadyToBoot on platform recovery
@ 2023-10-31 17:37 Neal Gompa
  2023-10-31 22:27 ` Jeremy Linton
  2023-11-02 10:20 ` Laszlo Ersek
  0 siblings, 2 replies; 14+ messages in thread
From: Neal Gompa @ 2023-10-31 17:37 UTC (permalink / raw)
  To: devel
  Cc: Neal Gompa, Pete Batard, Daniel P . Berrangé, Gerd Hoffmann,
	Samer El-Haj-Mahmoud, Laszlo Ersek

From: Neal Gompa <ngompa@fedoraproject.org>

Currently, the ReadyToBoot event is only signaled when a formal Boot
Manager option is executed (in BmBoot.c -> EfiBootManagerBoot ()).

However, the introduction of Platform Recovery in UEFI 2.5 makes it
necessary to signal ReadyToBoot when a Platform Recovery boot loader
runs because otherwise it may lead to the execution of a boot loader
that has similar requirements to a regular one that is not launched
as a Boot Manager option.

This is especially critical to ensuring that the graphical console
is actually usable during platform recovery, as some platforms do
rely on the ConsolePrefDxe driver, which only performs console
initialization after ReadyToBoot is triggered.

This patch fixes that behavior by calling EfiSignalEventReadyToBoot ()
in EfiBootManagerProcessLoadOption () when invoking platform recovery,
which is the function that sets up the platform recovery boot process.

The expected behavior has been clarified in the UEFI 2.10 specification
to explicitly indicate this behavior is required for correct operation.

This is a rebased version of the patch originally written by Pete Batard.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2831

Cc: Pete Batard <pete@akeo.ie>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Cc: Laszlo Ersek <lersek@redhat.com>

Co-authored-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Neal Gompa <ngompa@fedoraproject.org>
---
 .../Library/UefiBootManagerLib/BmLoadOption.c         | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
index 2087f0b91d..83a2f893e4 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
@@ -1416,6 +1416,17 @@ EfiBootManagerProcessLoadOption (
     return EFI_SUCCESS;
   }
 
+  if (LoadOption->OptionType == LoadOptionTypePlatformRecovery) {
+    //
+    // Signal the EVT_SIGNAL_READY_TO_BOOT event when we are about to load and execute the boot option.
+    //
+    EfiSignalEventReadyToBoot ();
+    //
+    // Report Status Code to indicate ReadyToBoot was signaled
+    //
+    REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT));
+  }
+
   //
   // Load and start the load option.
   //
-- 
2.41.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110438): https://edk2.groups.io/g/devel/message/110438
Mute This Topic: https://groups.io/mt/102302654/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-12-22  3:04 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 17:37 [edk2-devel] [PATCH v2] MdeModulePkg/UefiBootManagerLib: Signal ReadyToBoot on platform recovery Neal Gompa
2023-10-31 22:27 ` Jeremy Linton
2023-11-02 10:35   ` Laszlo Ersek
2023-11-24 23:36     ` Neal Gompa
2023-12-07  4:47       ` Neal Gompa
2023-12-07  7:40         ` Ard Biesheuvel
2023-12-12  8:11           ` Ard Biesheuvel
2023-12-18 21:55             ` Ard Biesheuvel
2023-12-19 11:50               ` Leif Lindholm
2023-12-19 12:59                 ` 回复: " gaoliming via groups.io
2023-12-19 13:59                   ` Ard Biesheuvel
2023-12-19 14:11                     ` Samer El-Haj-Mahmoud
2023-12-22  3:03                       ` Neal Gompa
2023-11-02 10:20 ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox