efi: Use EFI ResetSystem only when available
authorArd Biesheuvel <ardb@kernel.org>
Thu, 23 Jan 2020 12:12:14 +0000 (13:12 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Sun, 23 Feb 2020 20:59:42 +0000 (21:59 +0100)
Do not attempt to call EFI ResetSystem if the runtime supported mask tells
us it is no longer functional at OS runtime.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/reboot.c

index 7effff969eb9053b16a79a38b60da79f1ba6006d..73089a24f04b637c886b5177cdd852791ae04d83 100644 (file)
@@ -15,7 +15,7 @@ void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)
        const char *str[] = { "cold", "warm", "shutdown", "platform" };
        int efi_mode, cap_reset_mode;
 
-       if (!efi_enabled(EFI_RUNTIME_SERVICES))
+       if (!efi_rt_services_supported(EFI_RT_SUPPORTED_RESET_SYSTEM))
                return;
 
        switch (reboot_mode) {
@@ -64,7 +64,7 @@ static void efi_power_off(void)
 
 static int __init efi_shutdown_init(void)
 {
-       if (!efi_enabled(EFI_RUNTIME_SERVICES))
+       if (!efi_rt_services_supported(EFI_RT_SUPPORTED_RESET_SYSTEM))
                return -ENODEV;
 
        if (efi_poweroff_required()) {