linux/drivers/firmware/efi/reboot.c
Matt Fleming 44be28e9dd x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
It appears that the BayTrail-T class of hardware requires EFI in order
to powerdown and reboot and no other reliable method exists.

This quirk is generally applicable to all hardware that has the ACPI
Hardware Reduced bit set, since usually ACPI would be the preferred
method.

Cc: Len Brown <len.brown@intel.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2014-07-18 21:23:52 +01:00

57 lines
1.0 KiB
C

/*
* Copyright (C) 2014 Intel Corporation; author Matt Fleming
* Copyright (c) 2014 Red Hat, Inc., Mark Salter <msalter@redhat.com>
*/
#include <linux/efi.h>
#include <linux/reboot.h>
int efi_reboot_quirk_mode = -1;
void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)
{
int efi_mode;
if (!efi_enabled(EFI_RUNTIME_SERVICES))
return;
switch (reboot_mode) {
case REBOOT_WARM:
case REBOOT_SOFT:
efi_mode = EFI_RESET_WARM;
break;
default:
efi_mode = EFI_RESET_COLD;
break;
}
/*
* If a quirk forced an EFI reset mode, always use that.
*/
if (efi_reboot_quirk_mode != -1)
efi_mode = efi_reboot_quirk_mode;
efi.reset_system(efi_mode, EFI_SUCCESS, 0, NULL);
}
bool __weak efi_poweroff_required(void)
{
return false;
}
static void efi_power_off(void)
{
efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
}
static int __init efi_shutdown_init(void)
{
if (!efi_enabled(EFI_RUNTIME_SERVICES))
return -ENODEV;
if (efi_poweroff_required())
pm_power_off = efi_power_off;
return 0;
}
late_initcall(efi_shutdown_init);