Thiemo Seufer | c583122 | 2006-05-15 18:59:34 +0100 | [diff] [blame] | 1 | |
| 2 | #include <asm/io.h> |
| 3 | #include <asm/reboot.h> |
| 4 | #include <asm/cacheflush.h> |
| 5 | #include <asm/qemu.h> |
| 6 | |
| 7 | static void qemu_machine_restart(char *command) |
| 8 | { |
| 9 | volatile unsigned int *reg = (unsigned int *)QEMU_RESTART_REG; |
| 10 | |
| 11 | set_c0_status(ST0_BEV | ST0_ERL); |
| 12 | change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); |
| 13 | flush_cache_all(); |
| 14 | write_c0_wired(0); |
| 15 | *reg = 42; |
| 16 | while (1) |
| 17 | cpu_wait(); |
| 18 | } |
| 19 | |
| 20 | static void qemu_machine_halt(void) |
| 21 | { |
| 22 | volatile unsigned int *reg = (unsigned int *)QEMU_HALT_REG; |
| 23 | |
| 24 | *reg = 42; |
| 25 | while (1) |
| 26 | cpu_wait(); |
| 27 | } |
| 28 | |
| 29 | void qemu_reboot_setup(void) |
| 30 | { |
| 31 | _machine_restart = qemu_machine_restart; |
| 32 | _machine_halt = qemu_machine_halt; |
| 33 | } |