diff options
author | Richard Henderson <rth@twiddle.net> | 2013-07-12 09:36:21 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2013-11-16 16:33:15 -0800 |
commit | 7f3bbb82e0c371d6881129f776c90130ba66f051 (patch) | |
tree | e2bb143c17545c720484602fbaa829eae2e66119 /arch/alpha/kernel | |
parent | fddd87d6e135924b92499917bace103e46c22d00 (diff) | |
download | op-kernel-dev-7f3bbb82e0c371d6881129f776c90130ba66f051.zip op-kernel-dev-7f3bbb82e0c371d6881129f776c90130ba66f051.tar.gz |
alpha: Primitive support for CPU power down.
Use WTINT to wait for the next interrupt. Squash the WTINT call
if the PALcode doesn't support it (e.g. MILO). No attempt is yet
made to skip clock ticks during normal scheduling in order to stay
in power down mode longer.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'arch/alpha/kernel')
-rw-r--r-- | arch/alpha/kernel/process.c | 17 | ||||
-rw-r--r-- | arch/alpha/kernel/traps.c | 15 |
2 files changed, 32 insertions, 0 deletions
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index f2360a7..1941a07 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c @@ -46,6 +46,23 @@ void (*pm_power_off)(void) = machine_power_off; EXPORT_SYMBOL(pm_power_off); +#ifdef CONFIG_ALPHA_WTINT +/* + * Sleep the CPU. + * EV6, LCA45 and QEMU know how to power down, skipping N timer interrupts. + */ +void arch_cpu_idle(void) +{ + wtint(0); + local_irq_enable(); +} + +void arch_cpu_idle_dead(void) +{ + wtint(INT_MAX); +} +#endif /* ALPHA_WTINT */ + struct halt_info { int mode; char *restart_cmd; diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index bd0665c..9c4c189 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c @@ -241,6 +241,21 @@ do_entIF(unsigned long type, struct pt_regs *regs) (const char *)(data[1] | (long)data[2] << 32), data[0]); } +#ifdef CONFIG_ALPHA_WTINT + if (type == 4) { + /* If CALL_PAL WTINT is totally unsupported by the + PALcode, e.g. MILO, "emulate" it by overwriting + the insn. */ + unsigned int *pinsn + = (unsigned int *) regs->pc - 1; + if (*pinsn == PAL_wtint) { + *pinsn = 0x47e01400; /* mov 0,$0 */ + imb(); + regs->r0 = 0; + return; + } + } +#endif /* ALPHA_WTINT */ die_if_kernel((type == 1 ? "Kernel Bug" : "Instruction fault"), regs, type, NULL); } |