diff options
author | Thiemo Seufer <ths@networkno.de> | 2006-05-15 13:59:34 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-06-19 12:39:19 -0400 |
commit | c583122c26ad04bb2379933dc5acc8b9479d6c67 (patch) | |
tree | 8afc9153e18b300ab93ff6a675e0c0f6e464c518 /arch | |
parent | eae89076e696f51762d81d6e2538c3beb59fa7bd (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')
-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 |
3 files changed, 39 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 | } |