Merge HEAD from ../linux-2.6
[linux-2.6] / arch / mips / qemu / q-reset.c
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
8 static 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
21 static 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
30 void qemu_reboot_setup(void)
31 {
32         _machine_restart = qemu_machine_restart;
33         _machine_halt = qemu_machine_halt;
34 }