sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / drivers / firmware / efi / reboot.c
blob62ead9b9d871a606af7c0b575f382377f7f82aaa
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>
8 int efi_reboot_quirk_mode = -1;
10 void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)
12 const char *str[] = { "cold", "warm", "shutdown", "platform" };
13 int efi_mode, cap_reset_mode;
15 if (!efi_enabled(EFI_RUNTIME_SERVICES))
16 return;
18 switch (reboot_mode) {
19 case REBOOT_WARM:
20 case REBOOT_SOFT:
21 efi_mode = EFI_RESET_WARM;
22 break;
23 default:
24 efi_mode = EFI_RESET_COLD;
25 break;
29 * If a quirk forced an EFI reset mode, always use that.
31 if (efi_reboot_quirk_mode != -1)
32 efi_mode = efi_reboot_quirk_mode;
34 if (efi_capsule_pending(&cap_reset_mode)) {
35 if (efi_mode != cap_reset_mode)
36 printk(KERN_CRIT "efi: %s reset requested but pending "
37 "capsule update requires %s reset... Performing "
38 "%s reset.\n", str[efi_mode], str[cap_reset_mode],
39 str[cap_reset_mode]);
40 efi_mode = cap_reset_mode;
43 efi.reset_system(efi_mode, EFI_SUCCESS, 0, NULL);
46 bool __weak efi_poweroff_required(void)
48 return false;
51 static void efi_power_off(void)
53 efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
56 static int __init efi_shutdown_init(void)
58 if (!efi_enabled(EFI_RUNTIME_SERVICES))
59 return -ENODEV;
61 if (efi_poweroff_required())
62 pm_power_off = efi_power_off;
64 return 0;
66 late_initcall(efi_shutdown_init);