aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/kernel/process.c2
-rw-r--r--arch/x86/kernel/reboot.c6
-rw-r--r--drivers/firmware/efi/Makefile2
-rw-r--r--drivers/firmware/efi/reboot.c26
-rw-r--r--include/linux/efi.h4
5 files changed, 33 insertions, 7 deletions
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 55d4ba47a907..deed6fa96bb0 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -662,7 +662,7 @@ void
662machine_restart (char *restart_cmd) 662machine_restart (char *restart_cmd)
663{ 663{
664 (void) notify_die(DIE_MACHINE_RESTART, restart_cmd, NULL, 0, 0, 0); 664 (void) notify_die(DIE_MACHINE_RESTART, restart_cmd, NULL, 0, 0, 0);
665 (*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL); 665 efi_reboot(REBOOT_WARM, NULL);
666} 666}
667 667
668void 668void
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 52b1157c53eb..09e709fd1830 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -528,11 +528,7 @@ static void native_machine_emergency_restart(void)
528 break; 528 break;
529 529
530 case BOOT_EFI: 530 case BOOT_EFI:
531 if (efi_enabled(EFI_RUNTIME_SERVICES)) 531 efi_reboot(reboot_mode, NULL);
532 efi.reset_system(reboot_mode == REBOOT_WARM ?
533 EFI_RESET_WARM :
534 EFI_RESET_COLD,
535 EFI_SUCCESS, 0, NULL);
536 reboot_type = BOOT_BIOS; 532 reboot_type = BOOT_BIOS;
537 break; 533 break;
538 534
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
index a204d1474cec..d8be608a9f3b 100644
--- a/drivers/firmware/efi/Makefile
+++ b/drivers/firmware/efi/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for linux kernel 2# Makefile for linux kernel
3# 3#
4obj-$(CONFIG_EFI) += efi.o vars.o 4obj-$(CONFIG_EFI) += efi.o vars.o reboot.o
5obj-$(CONFIG_EFI_VARS) += efivars.o 5obj-$(CONFIG_EFI_VARS) += efivars.o
6obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o 6obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o
7obj-$(CONFIG_UEFI_CPER) += cper.o 7obj-$(CONFIG_UEFI_CPER) += cper.o
diff --git a/drivers/firmware/efi/reboot.c b/drivers/firmware/efi/reboot.c
new file mode 100644
index 000000000000..81bf925f70f5
--- /dev/null
+++ b/drivers/firmware/efi/reboot.c
@@ -0,0 +1,26 @@
1/*
2 * Copyright (C) 2014 Intel Corporation; author Matt Fleming
3 * Copyright (c) 2014 Red Hat, Inc., Mark Salter <msalter@redhat.com>
4 */
5#include <linux/efi.h>
6#include <linux/reboot.h>
7
8void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)
9{
10 int efi_mode;
11
12 if (!efi_enabled(EFI_RUNTIME_SERVICES))
13 return;
14
15 switch (reboot_mode) {
16 case REBOOT_WARM:
17 case REBOOT_SOFT:
18 efi_mode = EFI_RESET_WARM;
19 break;
20 default:
21 efi_mode = EFI_RESET_COLD;
22 break;
23 }
24
25 efi.reset_system(efi_mode, EFI_SUCCESS, 0, NULL);
26}
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 3a64f2f85821..e6980ba528ec 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -20,6 +20,7 @@
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/pfn.h> 21#include <linux/pfn.h>
22#include <linux/pstore.h> 22#include <linux/pstore.h>
23#include <linux/reboot.h>
23 24
24#include <asm/page.h> 25#include <asm/page.h>
25 26
@@ -928,11 +929,14 @@ static inline bool efi_enabled(int feature)
928{ 929{
929 return test_bit(feature, &efi.flags) != 0; 930 return test_bit(feature, &efi.flags) != 0;
930} 931}
932extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
931#else 933#else
932static inline bool efi_enabled(int feature) 934static inline bool efi_enabled(int feature)
933{ 935{
934 return false; 936 return false;
935} 937}
938static inline void
939efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
936#endif 940#endif
937 941
938/* 942/*