dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0144-Fix-exit-back-to-EFI-firmware.patch

f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
f725e3
Date: Fri, 15 Aug 2014 11:29:22 -0400
f725e3
Subject: [PATCH] Fix exit back to EFI firmware
f725e3
f725e3
Arm/AArch64 machines set up a timer event which is not getting
f725e3
canceled when returning to firmware. This is because grub_exit()
f725e3
calls grub_efi_fini() instead of grub_machine_fini(). The latter
f725e3
will shutdown the timer (and other machine-specific things) as
f725e3
well as make the call to grub_efi_fini().
f725e3
---
f725e3
 grub-core/kern/arm/efi/init.c | 2 +-
f725e3
 grub-core/kern/efi/efi.c      | 3 ++-
f725e3
 2 files changed, 3 insertions(+), 2 deletions(-)
f725e3
f725e3
diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c
f725e3
index 0c17d8390fa..06df60e2f0e 100644
f725e3
--- a/grub-core/kern/arm/efi/init.c
f725e3
+++ b/grub-core/kern/arm/efi/init.c
f725e3
@@ -67,7 +67,7 @@ grub_machine_fini (int flags)
f725e3
 
f725e3
   b = grub_efi_system_table->boot_services;
f725e3
 
f725e3
-  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 0);
f725e3
+  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_CANCEL, 0);
f725e3
   efi_call_1 (b->close_event, tmr_evt);
f725e3
 
f725e3
   grub_efi_fini ();
f725e3
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
f725e3
index 1a8dba531b6..d99a6fbdf0d 100644
f725e3
--- a/grub-core/kern/efi/efi.c
f725e3
+++ b/grub-core/kern/efi/efi.c
f725e3
@@ -27,6 +27,7 @@
f725e3
 #include <grub/term.h>
f725e3
 #include <grub/kernel.h>
f725e3
 #include <grub/mm.h>
f725e3
+#include <grub/loader.h>
f725e3
 
f725e3
 /* The handle of GRUB itself. Filled in by the startup code.  */
f725e3
 grub_efi_handle_t grub_efi_image_handle;
f725e3
@@ -156,7 +157,7 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle)
f725e3
 void
f725e3
 grub_exit (void)
f725e3
 {
f725e3
-  grub_efi_fini ();
f725e3
+  grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
f725e3
   efi_call_4 (grub_efi_system_table->boot_services->exit,
f725e3
               grub_efi_image_handle, GRUB_EFI_LOAD_ERROR, 0, 0);
f725e3
   for (;;) ;