blob: c04ebcfc7843b6b751cb6a1bdf887a51312c3d4e [file] [log] [blame]
Thiemo Seuferc5831222006-05-15 18:59:34 +01001#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}