summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiao Wang <shankerwangmiao@gmail.com>2024-08-07 12:37:11 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-14 16:34:32 +0300
commit0a993247a99799c1f678563a00349f247d83b0f0 (patch)
treee0e16aed97868eebaaf5231adabc5f9407e857c0
parentb4542a5de28c6751e7ef2a3823fa56909b427b5f (diff)
downloadlinux-0a993247a99799c1f678563a00349f247d83b0f0.tar.xz
LoongArch: Enable general EFI poweroff method
commit e688c220732e518c2eb1639e9ef77d4a9311713c upstream. efi_shutdown_init() can register a general sys_off handler named efi_power_off(). Enable this by providing efi_poweroff_required(), like arm and x86. Since EFI poweroff is also supported on LoongArch, and the enablement makes the poweroff function usable for hardwares which lack ACPI S5. We prefer ACPI poweroff rather than EFI poweroff (like x86), so we only require EFI poweroff if acpi_gbl_reduced_hardware or acpi_no_s5 is true. Cc: stable@vger.kernel.org Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Miao Wang <shankerwangmiao@gmail.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/loongarch/kernel/efi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
index 000825406c1f..2bf86aeda874 100644
--- a/arch/loongarch/kernel/efi.c
+++ b/arch/loongarch/kernel/efi.c
@@ -66,6 +66,12 @@ void __init efi_runtime_init(void)
set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
}
+bool efi_poweroff_required(void)
+{
+ return efi_enabled(EFI_RUNTIME_SERVICES) &&
+ (acpi_gbl_reduced_hardware || acpi_no_s5);
+}
+
unsigned long __initdata screen_info_table = EFI_INVALID_TABLE_ADDR;
#if defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON)