File 0001-Disable-the-watchdog-timer-on-EFI-platforms.patch of Package grub
From 5330b06e9281e421eab1f6aa305c8a378629b79c Mon Sep 17 00:00:00 2001
From: Linn Crosetto <linn.crosetto@hp.com>
Date: Thu, 14 Feb 2013 15:29:40 -0700
Subject: [PATCH 1/7] Disable the watchdog timer on EFI platforms
Adding a call to EFI boot services' SetWatchdogTimer(), to disable
the timer on EFI platforms. The UEFI specification requires the
watchdog timer to be set to a period of 5 minutes and armed
when invoking an EFI boot option. If GRUB does not disable the
timer, the platform will be reset if ExitBootServices() is
not called within this time period.
Signed-off-by: Linn Crosetto <linn.crosetto@hp.com>
---
efi/efimisc.c | 16 ++++++++++++++++
efi/grub/efi/efi.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/efi/efimisc.c b/efi/efimisc.c
index 480ba25..6d5c174 100644
--- a/efi/efimisc.c
+++ b/efi/efimisc.c
@@ -43,6 +43,8 @@ grub_efi_init (void)
/* First of all, initialize the console so that GRUB can display
messages. */
grub_console_init ();
+ /* Disable the system's watchdog timer. */
+ grub_efi_disable_watchdog ();
/* Initialize the memory management system. */
grub_efi_mm_init ();
grub_efidisk_init ();
@@ -663,3 +665,17 @@ grub_save_saved_default (int new_default)
Call_Service_1 (file->close, file);
return ret;
}
+
+void
+grub_efi_disable_watchdog ()
+{
+ grub_efi_boot_services_t *b;
+ grub_efi_status_t status;
+
+ b = grub_efi_system_table->boot_services;
+ status = Call_Service_4 (b->set_watchdog_timer, 0, 0x0, 0, NULL);
+ if (status != GRUB_EFI_SUCCESS && status != GRUB_EFI_UNSUPPORTED)
+ {
+ grub_printf("failed to disable the system's watchdog timer");
+ }
+}
diff --git a/efi/grub/efi/efi.h b/efi/grub/efi/efi.h
index 936759b..362d679 100644
--- a/efi/grub/efi/efi.h
+++ b/efi/grub/efi/efi.h
@@ -67,6 +67,7 @@ void grub_efi_mm_fini (void);
void grub_efi_init (void);
void grub_efi_fini (void);
void grub_efi_set_prefix (void);
+void grub_efi_disable_watchdog (void);
/* Variables. */
extern void *mmap_buf;
--
1.8.3.1