aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bresticker <abrestic@chromium.org>2015-03-25 13:25:44 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-04-01 11:21:58 -0400
commitf45e388ff0f90b922b77bef959a2cfb0645cffbe (patch)
treedd239465dde0fc90608fd3af313ac80ed3a1ca10
parentea925a72a271f6868dddef98426b396f110da211 (diff)
MIPS: Provide fallback reboot/poweroff/halt implementations
If a machine-specific hook is not implemented for restart, poweroff, or halt, fall back to halting secondary CPUs, disabling interrupts, and spinning. In the case of restart, attempt to restart the system via do_kernel_restart() (which will call any registered restart handlers) before halting. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Cc: James Hogan <james.hogan@imgtec.com> Cc: Maciej W. Rozycki <macro@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/9600/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/kernel/reset.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
index 07fc5244aed4..7c746d3458e7 100644
--- a/arch/mips/kernel/reset.c
+++ b/arch/mips/kernel/reset.c
@@ -11,6 +11,7 @@
11#include <linux/pm.h> 11#include <linux/pm.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/reboot.h> 13#include <linux/reboot.h>
14#include <linux/delay.h>
14 15
15#include <asm/reboot.h> 16#include <asm/reboot.h>
16 17
@@ -29,16 +30,40 @@ void machine_restart(char *command)
29{ 30{
30 if (_machine_restart) 31 if (_machine_restart)
31 _machine_restart(command); 32 _machine_restart(command);
33
34#ifdef CONFIG_SMP
35 preempt_disable();
36 smp_send_stop();
37#endif
38 do_kernel_restart(command);
39 mdelay(1000);
40 pr_emerg("Reboot failed -- System halted\n");
41 local_irq_disable();
42 while (1);
32} 43}
33 44
34void machine_halt(void) 45void machine_halt(void)
35{ 46{
36 if (_machine_halt) 47 if (_machine_halt)
37 _machine_halt(); 48 _machine_halt();
49
50#ifdef CONFIG_SMP
51 preempt_disable();
52 smp_send_stop();
53#endif
54 local_irq_disable();
55 while (1);
38} 56}
39 57
40void machine_power_off(void) 58void machine_power_off(void)
41{ 59{
42 if (pm_power_off) 60 if (pm_power_off)
43 pm_power_off(); 61 pm_power_off();
62
63#ifdef CONFIG_SMP
64 preempt_disable();
65 smp_send_stop();
66#endif
67 local_irq_disable();
68 while (1);
44} 69}