diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-11-04 05:49:44 +0100 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-11-16 00:21:48 +0100 |
commit | a57c228935fd55c4a1cf7c0b7823537c81914000 (patch) | |
tree | 36a2aa23cf2f6aec80cb0c46469f8e9cdcddcabe /arch/mips/qemu/q-console.c | |
parent | [MIPS] Convert reference to mem_map to pfn_to_page(). (diff) | |
download | linux-a57c228935fd55c4a1cf7c0b7823537c81914000.tar.xz linux-a57c228935fd55c4a1cf7c0b7823537c81914000.zip |
[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/qemu/q-console.c')
-rw-r--r-- | arch/mips/qemu/q-console.c | 26 |
1 files changed, 26 insertions, 0 deletions
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 @@ +#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; +} |