Skip to content

Commit

Permalink
[MIPS] Qemu: Add early printk, your friend in a cold night.
Browse files Browse the repository at this point in the history
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Ralf Baechle committed Nov 15, 2007
1 parent a8049c5 commit a57c228
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,10 @@ config QEMU
select PCSPEAKER
select SWAP_IO_SPACE
select SYS_HAS_CPU_MIPS32_R1
select SYS_HAS_EARLY_PRINTK
select SYS_SUPPORTS_32BIT_KERNEL
select SYS_SUPPORTS_BIG_ENDIAN
select SYS_SUPPORTS_LITTLE_ENDIAN
select ARCH_SPARSEMEM_ENABLE
select GENERIC_HARDIRQS_NO__DO_IRQ
select NR_CPUS_DEFAULT_1
select SYS_SUPPORTS_SMP
Expand Down
3 changes: 2 additions & 1 deletion arch/mips/qemu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o

obj-$(CONFIG_SMP) += q-smp.o
obj-$(CONFIG_EARLY_PRINTK) += q-console.o
obj-$(CONFIG_SMP) += q-smp.o

EXTRA_CFLAGS += -Werror
26 changes: 26 additions & 0 deletions arch/mips/qemu/q-console.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <linux/console.h>
#include <linux/init.h>
#include <linux/serial_reg.h>
#include <asm/io.h>

#define PORT(offset) (0x3f8 + (offset))

static inline unsigned int serial_in(int offset)
{
return inb(PORT(offset));
}

static inline void serial_out(int offset, int value)
{
outb(value, PORT(offset));
}

int prom_putchar(char c)
{
while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
;

serial_out(UART_TX, c);

return 1;
}
6 changes: 6 additions & 0 deletions arch/mips/qemu/q-firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#include <linux/string.h>
#include <asm/addrspace.h>
#include <asm/bootinfo.h>
#include <asm/io.h>

#define QEMU_PORT_BASE 0xb4000000

void __init prom_init(void)
{
Expand All @@ -15,4 +18,7 @@ void __init prom_init(void)
} else {
add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM);
}


set_io_port_base(QEMU_PORT_BASE);
}
3 changes: 0 additions & 3 deletions arch/mips/qemu/q-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

extern void qemu_reboot_setup(void);

#define QEMU_PORT_BASE 0xb4000000

const char *get_system_type(void)
{
return "Qemu";
Expand All @@ -20,6 +18,5 @@ void __init plat_time_init(void)

void __init plat_mem_setup(void)
{
set_io_port_base(QEMU_PORT_BASE);
qemu_reboot_setup();
}

0 comments on commit a57c228

Please sign in to comment.