dm thin metadata: fix __udivdi3 undefined on 32-bit
[linux/fpc-iii.git] / drivers / firmware / efi / reboot.c
blob9c59d1c795d1f2d6787b9a3a248f384e4017e8f1
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 int efi_mode;
14 if (!efi_enabled(EFI_RUNTIME_SERVICES))
15 return;
17 switch (reboot_mode) {
18 case REBOOT_WARM:
19 case REBOOT_SOFT:
20 efi_mode = EFI_RESET_WARM;
21 break;
22 default:
23 efi_mode = EFI_RESET_COLD;
24 break;
28 * If a quirk forced an EFI reset mode, always use that.
30 if (efi_reboot_quirk_mode != -1)
31 efi_mode = efi_reboot_quirk_mode;
33 efi.reset_system(efi_mode, EFI_SUCCESS, 0, NULL);
36 bool __weak efi_poweroff_required(void)
38 return false;
41 static void efi_power_off(void)
43 efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
46 static int __init efi_shutdown_init(void)
48 if (!efi_enabled(EFI_RUNTIME_SERVICES))
49 return -ENODEV;
51 if (efi_poweroff_required())
52 pm_power_off = efi_power_off;
54 return 0;
56 late_initcall(efi_shutdown_init);