Blob Blame History Raw
From a919488cc979e1c4f5bd468bb97c6e9562af0e5a Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
Date: Fri, 15 Aug 2014 11:29:22 -0400
Subject: [PATCH] Fix exit back to EFI firmware

Arm/AArch64 machines set up a timer event which is not getting
canceled when returning to firmware. This is because grub_exit()
calls grub_efi_fini() instead of grub_machine_fini(). The latter
will shutdown the timer (and other machine-specific things) as
well as make the call to grub_efi_fini().
---
 grub-core/kern/arm/efi/init.c | 2 +-
 grub-core/kern/efi/efi.c      | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c
index 0c17d83..06df60e 100644
--- a/grub-core/kern/arm/efi/init.c
+++ b/grub-core/kern/arm/efi/init.c
@@ -67,7 +67,7 @@ grub_machine_fini (int flags)
 
   b = grub_efi_system_table->boot_services;
 
-  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 0);
+  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_CANCEL, 0);
   efi_call_1 (b->close_event, tmr_evt);
 
   grub_efi_fini ();
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 394e9fd..1e96754 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -27,6 +27,7 @@
 #include <grub/term.h>
 #include <grub/kernel.h>
 #include <grub/mm.h>
+#include <grub/loader.h>
 
 /* The handle of GRUB itself. Filled in by the startup code.  */
 grub_efi_handle_t grub_efi_image_handle;
@@ -156,7 +157,7 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle)
 void
 grub_exit (void)
 {
-  grub_efi_fini ();
+  grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
   efi_call_4 (grub_efi_system_table->boot_services->exit,
               grub_efi_image_handle, GRUB_EFI_LOAD_ERROR, 0, 0);
   for (;;) ;
-- 
1.9.3