History

efi/arm64: use UEFI for system reset and poweroff

If UEFI Runtime Services are available, they are preferred over direct PSCI calls or other methods to reset the system. For the reset case, we need to hook into machine_restart(), as the arm_pm_restart function pointer may be overwritten by modules.

Ard Biesheuvel committed 11 years ago

Commit 60c0d451 parent 285994a2 files · +17 −0Browse files

Unified · Split

2 files
  1. arch/arm64/kernel/efi.c +9 −0
  2. arch/arm64/kernel/process.c +8 −0
arch/arm64/kernel/efi.c+9−0
@@ -354,3 +354,12 @@ void efi_virtmap_unload(void) · 353 unmodified lines
354354 efi_set_pgd(current->active_mm);
355355 preempt_enable();
356356 }
357+
358+/*
359+ * UpdateCapsule() depends on the system being shutdown via
360+ * ResetSystem().
361+ */
362+bool efi_poweroff_required(void)
363+{
364+ return efi_enabled(EFI_RUNTIME_SERVICES);
365+}
arch/arm64/kernel/process.c+8−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <stdarg.h>
2222
2323 #include <linux/compat.h>
24+#include <linux/efi.h>
2425 #include <linux/export.h>
2526 #include <linux/sched.h>
2627 #include <linux/kernel.h>
@@ -150,6 +151,13 @@ void machine_restart(char *cmd) · 123 unmodified lines
150151 local_irq_disable();
151152 smp_send_stop();
152153
154+ /*
155+ * UpdateCapsule() depends on the system being reset via
156+ * ResetSystem().
157+ */
158+ if (efi_enabled(EFI_RUNTIME_SERVICES))
159+ efi_reboot(reboot_mode, NULL);
160+
153161 /* Now call the architecture specific reboot code. */
154162 if (arm_pm_restart)
155163 arm_pm_restart(reboot_mode, cmd);