aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-11-04 00:49:44 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-11-15 18:21:48 -0500
commita57c228935fd55c4a1cf7c0b7823537c81914000 (patch)
tree36a2aa23cf2f6aec80cb0c46469f8e9cdcddcabe /arch/mips
parenta8049c53cdad347b5b1234969dba65a179fdf8f1 (diff)
[MIPS] Qemu: Add early printk, your friend in a cold night.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/qemu/Makefile3
-rw-r--r--arch/mips/qemu/q-console.c26
-rw-r--r--arch/mips/qemu/q-firmware.c6
-rw-r--r--arch/mips/qemu/q-setup.c3
5 files changed, 35 insertions, 5 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2c7d6c240b73..4b07b18e5196 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -361,10 +361,10 @@ config QEMU
361 select PCSPEAKER 361 select PCSPEAKER
362 select SWAP_IO_SPACE 362 select SWAP_IO_SPACE
363 select SYS_HAS_CPU_MIPS32_R1 363 select SYS_HAS_CPU_MIPS32_R1
364 select SYS_HAS_EARLY_PRINTK
364 select SYS_SUPPORTS_32BIT_KERNEL 365 select SYS_SUPPORTS_32BIT_KERNEL
365 select SYS_SUPPORTS_BIG_ENDIAN 366 select SYS_SUPPORTS_BIG_ENDIAN
366 select SYS_SUPPORTS_LITTLE_ENDIAN 367 select SYS_SUPPORTS_LITTLE_ENDIAN
367 select ARCH_SPARSEMEM_ENABLE
368 select GENERIC_HARDIRQS_NO__DO_IRQ 368 select GENERIC_HARDIRQS_NO__DO_IRQ
369 select NR_CPUS_DEFAULT_1 369 select NR_CPUS_DEFAULT_1
370 select SYS_SUPPORTS_SMP 370 select SYS_SUPPORTS_SMP
diff --git a/arch/mips/qemu/Makefile b/arch/mips/qemu/Makefile
index cec24c117f6e..2ba4ef34b4a7 100644
--- a/arch/mips/qemu/Makefile
+++ b/arch/mips/qemu/Makefile
@@ -4,6 +4,7 @@
4 4
5obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o 5obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o
6 6
7obj-$(CONFIG_SMP) += q-smp.o 7obj-$(CONFIG_EARLY_PRINTK) += q-console.o
8obj-$(CONFIG_SMP) += q-smp.o
8 9
9EXTRA_CFLAGS += -Werror 10EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/qemu/q-console.c b/arch/mips/qemu/q-console.c
new file mode 100644
index 000000000000..81101ae5017a
--- /dev/null
+++ b/arch/mips/qemu/q-console.c
@@ -0,0 +1,26 @@
1#include <linux/console.h>
2#include <linux/init.h>
3#include <linux/serial_reg.h>
4#include <asm/io.h>
5
6#define PORT(offset) (0x3f8 + (offset))
7
8static inline unsigned int serial_in(int offset)
9{
10 return inb(PORT(offset));
11}
12
13static inline void serial_out(int offset, int value)
14{
15 outb(value, PORT(offset));
16}
17
18int prom_putchar(char c)
19{
20 while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
21 ;
22
23 serial_out(UART_TX, c);
24
25 return 1;
26}
diff --git a/arch/mips/qemu/q-firmware.c b/arch/mips/qemu/q-firmware.c
index c2239b417587..3ed43f416cd1 100644
--- a/arch/mips/qemu/q-firmware.c
+++ b/arch/mips/qemu/q-firmware.c
@@ -2,6 +2,9 @@
2#include <linux/string.h> 2#include <linux/string.h>
3#include <asm/addrspace.h> 3#include <asm/addrspace.h>
4#include <asm/bootinfo.h> 4#include <asm/bootinfo.h>
5#include <asm/io.h>
6
7#define QEMU_PORT_BASE 0xb4000000
5 8
6void __init prom_init(void) 9void __init prom_init(void)
7{ 10{
@@ -15,4 +18,7 @@ void __init prom_init(void)
15 } else { 18 } else {
16 add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM); 19 add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM);
17 } 20 }
21
22
23 set_io_port_base(QEMU_PORT_BASE);
18} 24}
diff --git a/arch/mips/qemu/q-setup.c b/arch/mips/qemu/q-setup.c
index 23d34c1917c0..969cedc8d8b9 100644
--- a/arch/mips/qemu/q-setup.c
+++ b/arch/mips/qemu/q-setup.c
@@ -6,8 +6,6 @@
6 6
7extern void qemu_reboot_setup(void); 7extern void qemu_reboot_setup(void);
8 8
9#define QEMU_PORT_BASE 0xb4000000
10
11const char *get_system_type(void) 9const char *get_system_type(void)
12{ 10{
13 return "Qemu"; 11 return "Qemu";
@@ -20,6 +18,5 @@ void __init plat_time_init(void)
20 18
21void __init plat_mem_setup(void) 19void __init plat_mem_setup(void)
22{ 20{
23 set_io_port_base(QEMU_PORT_BASE);
24 qemu_reboot_setup(); 21 qemu_reboot_setup();
25} 22}