diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-11-04 00:49:44 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-11-15 18:21:48 -0500 |
commit | a57c228935fd55c4a1cf7c0b7823537c81914000 (patch) | |
tree | 36a2aa23cf2f6aec80cb0c46469f8e9cdcddcabe /arch/mips/qemu/q-console.c | |
parent | a8049c53cdad347b5b1234969dba65a179fdf8f1 (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/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 @@ | |||
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 | |||
8 | static inline unsigned int serial_in(int offset) | ||
9 | { | ||
10 | return inb(PORT(offset)); | ||
11 | } | ||
12 | |||
13 | static inline void serial_out(int offset, int value) | ||
14 | { | ||
15 | outb(value, PORT(offset)); | ||
16 | } | ||
17 | |||
18 | int 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 | } | ||