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.
Unified · Split
| @@ -354,3 +354,12 @@ void efi_virtmap_unload(void) · 353 unmodified lines | |||
| 354 | efi_set_pgd(current->active_mm); | 354 | efi_set_pgd(current->active_mm); |
| 355 | preempt_enable(); | 355 | preempt_enable(); |
| 356 | } | 356 | } |
| 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 | } | ||
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include <stdarg.h> | 21 | #include <stdarg.h> |
| 22 | 22 | ||
| 23 | #include <linux/compat.h> | 23 | #include <linux/compat.h> |
| 24 | #include <linux/efi.h> | ||
| 24 | #include <linux/export.h> | 25 | #include <linux/export.h> |
| 25 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
| 26 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| @@ -150,6 +151,13 @@ void machine_restart(char *cmd) · 123 unmodified lines | |||
| 150 | local_irq_disable(); | 151 | local_irq_disable(); |
| 151 | smp_send_stop(); | 152 | smp_send_stop(); |
| 152 | 153 | ||
| 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 | |||
| 153 | /* Now call the architecture specific reboot code. */ | 161 | /* Now call the architecture specific reboot code. */ |
| 154 | if (arm_pm_restart) | 162 | if (arm_pm_restart) |
| 155 | arm_pm_restart(reboot_mode, cmd); | 163 | arm_pm_restart(reboot_mode, cmd); |