diff options
-rw-r--r-- | arch/mips/qemu/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/qemu/q-reset.c | 34 | ||||
-rw-r--r-- | arch/mips/qemu/q-setup.c | 4 | ||||
-rw-r--r-- | include/asm-mips/qemu.h | 6 |
4 files changed, 45 insertions, 1 deletions
diff --git a/arch/mips/qemu/Makefile b/arch/mips/qemu/Makefile index 730f459f3e99..078cd3029c9f 100644 --- a/arch/mips/qemu/Makefile +++ b/arch/mips/qemu/Makefile | |||
@@ -2,6 +2,6 @@ | |||
2 | # Makefile for Qemu specific kernel interface routines under Linux. | 2 | # Makefile for Qemu specific kernel interface routines under Linux. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o | 5 | obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o |
6 | 6 | ||
7 | obj-$(CONFIG_SMP) += q-smp.o | 7 | obj-$(CONFIG_SMP) += q-smp.o |
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 | |||
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 | } | ||
diff --git a/arch/mips/qemu/q-setup.c b/arch/mips/qemu/q-setup.c index 022eb1af6db1..f27155bc2d9a 100644 --- a/arch/mips/qemu/q-setup.c +++ b/arch/mips/qemu/q-setup.c | |||
@@ -2,6 +2,8 @@ | |||
2 | #include <asm/io.h> | 2 | #include <asm/io.h> |
3 | #include <asm/time.h> | 3 | #include <asm/time.h> |
4 | 4 | ||
5 | extern void qemu_reboot_setup(void); | ||
6 | |||
5 | #define QEMU_PORT_BASE 0xb4000000 | 7 | #define QEMU_PORT_BASE 0xb4000000 |
6 | 8 | ||
7 | const char *get_system_type(void) | 9 | const char *get_system_type(void) |
@@ -22,4 +24,6 @@ void __init plat_setup(void) | |||
22 | { | 24 | { |
23 | set_io_port_base(QEMU_PORT_BASE); | 25 | set_io_port_base(QEMU_PORT_BASE); |
24 | board_timer_setup = qemu_timer_setup; | 26 | board_timer_setup = qemu_timer_setup; |
27 | |||
28 | qemu_reboot_setup(); | ||
25 | } | 29 | } |
diff --git a/include/asm-mips/qemu.h b/include/asm-mips/qemu.h index 905c39585903..531caf44560c 100644 --- a/include/asm-mips/qemu.h +++ b/include/asm-mips/qemu.h | |||
@@ -21,4 +21,10 @@ | |||
21 | */ | 21 | */ |
22 | #define QEMU_C0_COUNTER_CLOCK 100000000 | 22 | #define QEMU_C0_COUNTER_CLOCK 100000000 |
23 | 23 | ||
24 | /* | ||
25 | * Magic qemu system control location. | ||
26 | */ | ||
27 | #define QEMU_RESTART_REG 0xBFBF0000 | ||
28 | #define QEMU_HALT_REG 0xBFBF0004 | ||
29 | |||
24 | #endif /* __ASM_QEMU_H */ | 30 | #endif /* __ASM_QEMU_H */ |