aboutsummaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-03-20 08:30:09 +1300
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-03-25 11:07:22 +0100
commit5a2a1d8093d0372d7fc2ad1a9ae4893c888e6623 (patch)
tree8d489fa970e2d9c8e2d49cf25afcf7366b891213 /arch/x86
parent37c9f9cc86a2bcd8707d519945cecf08c079ef19 (diff)
downloadu-boot-5a2a1d8093d0372d7fc2ad1a9ae4893c888e6623.zip
u-boot-5a2a1d8093d0372d7fc2ad1a9ae4893c888e6623.tar.gz
u-boot-5a2a1d8093d0372d7fc2ad1a9ae4893c888e6623.tar.bz2
x86: Exit EFI boot services before starting kernel
When running the EFI app, we need to exit boot services before jumping to Linux. At some point it may be possible to jump to Linux and pass on the system table, and: * install the device-tree as configuration table * use LoadImage() to load the kernel image (e.g. from memory) * start the image with StartImage() This should allow the Linux efistub to be used. For now, this is not implemented. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/lib/bootm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index 9beb376..61cb7bc 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <bootstage.h>
#include <command.h>
+#include <efi.h>
#include <hang.h>
#include <log.h>
#include <asm/global_data.h>
@@ -156,6 +157,23 @@ int boot_linux_kernel(ulong setup_base, ulong entry, bool image_64bit)
#ifdef CONFIG_SYS_COREBOOT
timestamp_add_now(TS_U_BOOT_START_KERNEL);
#endif
+
+ /*
+ * Exit EFI boot services just before jumping, after all console
+ * output, since the console won't be available afterwards.
+ */
+ if (IS_ENABLED(CONFIG_EFI_APP)) {
+ int ret;
+
+ ret = efi_store_memory_map(efi_get_priv());
+ if (ret)
+ return ret;
+ printf("Exiting EFI boot services\n");
+ ret = efi_call_exit_boot_services();
+ if (ret)
+ return ret;
+ }
+
if (image_64bit) {
if (!cpu_has_64bit()) {
puts("Cannot boot 64-bit kernel on 32-bit machine\n");