2 * Copyright (C) 2014 Intel Corporation; author Matt Fleming
3 * Copyright (c) 2014 Red Hat, Inc., Mark Salter <msalter@redhat.com>
6 #include <linux/reboot.h>
8 int efi_reboot_quirk_mode
= -1;
10 void efi_reboot(enum reboot_mode reboot_mode
, const char *__unused
)
14 if (!efi_enabled(EFI_RUNTIME_SERVICES
))
17 switch (reboot_mode
) {
20 efi_mode
= EFI_RESET_WARM
;
23 efi_mode
= EFI_RESET_COLD
;
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)
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
))
51 if (efi_poweroff_required())
52 pm_power_off
= efi_power_off
;
56 late_initcall(efi_shutdown_init
);