aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/qemu/q-reset.c
diff options
context:
space:
mode:
authorThiemo Seufer <ths@networkno.de>2006-05-15 13:59:34 -0400
committerRalf Baechle <ralf@linux-mips.org>2006-06-19 12:39:19 -0400
commitc583122c26ad04bb2379933dc5acc8b9479d6c67 (patch)
tree8afc9153e18b300ab93ff6a675e0c0f6e464c518 /arch/mips/qemu/q-reset.c
parenteae89076e696f51762d81d6e2538c3beb59fa7bd (diff)
[MIPS] Qemu system shutdown support
Signed-off-by: Thiemo Seufer <ths@networkno.de> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/qemu/q-reset.c')
-rw-r--r--arch/mips/qemu/q-reset.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/mips/qemu/q-reset.c b/arch/mips/qemu/q-reset.c
new file mode 100644
index 000000000000..c04ebcfc7843
--- /dev/null
+++ b/arch/mips/qemu/q-reset.c
@@ -0,0 +1,34 @@
1#include <linux/config.h>
2
3#include <asm/io.h>
4#include <asm/reboot.h>
5#include <asm/cacheflush.h>
6#include <asm/qemu.h>
7
8static void qemu_machine_restart(char *command)
9{
10 volatile unsigned int *reg = (unsigned int *)QEMU_RESTART_REG;
11
12 set_c0_status(ST0_BEV | ST0_ERL);
13 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
14 flush_cache_all();
15 write_c0_wired(0);
16 *reg = 42;
17 while (1)
18 cpu_wait();
19}
20
21static void qemu_machine_halt(void)
22{
23 volatile unsigned int *reg = (unsigned int *)QEMU_HALT_REG;
24
25 *reg = 42;
26 while (1)
27 cpu_wait();
28}
29
30void qemu_reboot_setup(void)
31{
32 _machine_restart = qemu_machine_restart;
33 _machine_halt = qemu_machine_halt;
34}