aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/qemu
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2005-09-03 18:56:11 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:06:04 -0400
commit07119621e62de0a2c8db6e4896e762c498bfdd17 (patch)
treec62dd52e8072235c8148e7f31b16ed30c5e45343 /arch/mips/qemu
parent7901c7998267d9d8c3f1b226a8c8cfd7f8e48a01 (diff)
[PATCH] mips: add support for Qemu system architecture
Add support for the virtual MIPS system that is emulated by Qemu. See http://www.linux-mips.org/wiki/Qemu for a detailed current status. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/mips/qemu')
-rw-r--r--arch/mips/qemu/Makefile5
-rw-r--r--arch/mips/qemu/q-firmware.c7
-rw-r--r--arch/mips/qemu/q-int.S17
-rw-r--r--arch/mips/qemu/q-irq.c37
-rw-r--r--arch/mips/qemu/q-mem.c6
-rw-r--r--arch/mips/qemu/q-setup.c20
6 files changed, 92 insertions, 0 deletions
diff --git a/arch/mips/qemu/Makefile b/arch/mips/qemu/Makefile
new file mode 100644
index 000000000000..934944ab9e85
--- /dev/null
+++ b/arch/mips/qemu/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for Qemu specific kernel interface routines under Linux.
3#
4
5obj-y = q-firmware.o q-int.o q-irq.o q-mem.o q-setup.o
diff --git a/arch/mips/qemu/q-firmware.c b/arch/mips/qemu/q-firmware.c
new file mode 100644
index 000000000000..5980f02b2df9
--- /dev/null
+++ b/arch/mips/qemu/q-firmware.c
@@ -0,0 +1,7 @@
1#include <linux/init.h>
2#include <asm/bootinfo.h>
3
4void __init prom_init(void)
5{
6 add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM);
7}
diff --git a/arch/mips/qemu/q-int.S b/arch/mips/qemu/q-int.S
new file mode 100644
index 000000000000..6e3dfe5eb14b
--- /dev/null
+++ b/arch/mips/qemu/q-int.S
@@ -0,0 +1,17 @@
1/*
2 * Qemu interrupt handler code.
3 *
4 * Copyright (C) 2005 by Ralf Baechle
5 */
6#include <asm/asm.h>
7#include <asm/regdef.h>
8#include <asm/stackframe.h>
9
10 .align 5
11 NESTED(qemu_handle_int, PT_SIZE, sp)
12 SAVE_ALL
13 CLI
14 move a0, sp
15 PTR_LA ra, ret_from_irq
16 j do_qemu_int
17 END(qemu_handle_int)
diff --git a/arch/mips/qemu/q-irq.c b/arch/mips/qemu/q-irq.c
new file mode 100644
index 000000000000..2c4e0704ff10
--- /dev/null
+++ b/arch/mips/qemu/q-irq.c
@@ -0,0 +1,37 @@
1#include <linux/init.h>
2#include <linux/linkage.h>
3
4#include <asm/i8259.h>
5#include <asm/mipsregs.h>
6#include <asm/qemu.h>
7#include <asm/system.h>
8#include <asm/time.h>
9
10extern asmlinkage void qemu_handle_int(void);
11
12asmlinkage void do_qemu_int(struct pt_regs *regs)
13{
14 unsigned int pending = read_c0_status() & read_c0_cause();
15
16 if (pending & 0x8000) {
17 ll_timer_interrupt(Q_COUNT_COMPARE_IRQ, regs);
18 return;
19 }
20 if (pending & 0x0400) {
21 int irq = i8259_irq();
22
23 if (likely(irq >= 0))
24 do_IRQ(irq, regs);
25
26 return;
27 }
28}
29
30void __init arch_init_irq(void)
31{
32 set_except_vector(0, qemu_handle_int);
33 mips_hpt_frequency = QEMU_C0_COUNTER_CLOCK; /* 100MHz */
34
35 init_i8259_irqs();
36 set_c0_status(0x8400);
37}
diff --git a/arch/mips/qemu/q-mem.c b/arch/mips/qemu/q-mem.c
new file mode 100644
index 000000000000..d174fac43031
--- /dev/null
+++ b/arch/mips/qemu/q-mem.c
@@ -0,0 +1,6 @@
1#include <linux/init.h>
2
3unsigned long __init prom_free_prom_memory(void)
4{
5 return 0UL;
6}
diff --git a/arch/mips/qemu/q-setup.c b/arch/mips/qemu/q-setup.c
new file mode 100644
index 000000000000..1a80eee8cd35
--- /dev/null
+++ b/arch/mips/qemu/q-setup.c
@@ -0,0 +1,20 @@
1#include <linux/init.h>
2#include <asm/io.h>
3#include <asm/time.h>
4
5#define QEMU_PORT_BASE 0xb4000000
6
7static void __init qemu_timer_setup(struct irqaction *irq)
8{
9 /* set the clock to 100 Hz */
10 outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */
11 outb_p(LATCH & 0xff , 0x40); /* LSB */
12 outb(LATCH >> 8 , 0x40); /* MSB */
13 setup_irq(0, irq);
14}
15
16void __init plat_setup(void)
17{
18 set_io_port_base(QEMU_PORT_BASE);
19 board_timer_setup = qemu_timer_setup;
20}