2 * arch/sh/kernel/early_printk.c
4 * Copyright (C) 1999, 2000 Niibe Yutaka
5 * Copyright (C) 2002 M. R. Brown
6 * Copyright (C) 2004 - 2007 Paul Mundt
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
12 #include <linux/console.h>
13 #include <linux/tty.h>
14 #include <linux/init.h>
16 #include <linux/delay.h>
18 #include <asm/sh_bios.h>
21 * Print a string through the BIOS
23 static void sh_console_write(struct console
*co
, const char *s
,
26 sh_bios_console_write(s
, count
);
30 * Setup initial baud/bits/parity. We do two things here:
31 * - construct a cflag setting for the first rs_open()
32 * - initialize the serial port
33 * Return non-zero if we didn't find a serial port.
35 static int __init
sh_console_setup(struct console
*co
, char *options
)
37 int cflag
= CREAD
| HUPCL
| CLOCAL
;
40 * Now construct a cflag setting.
41 * TODO: this is a totally bogus cflag, as we have
42 * no idea what serial settings the BIOS is using, or
43 * even if its using the serial port at all.
45 cflag
|= B115200
| CS8
| /*no parity*/0;
52 static struct console bios_console
= {
54 .write
= sh_console_write
,
55 .setup
= sh_console_setup
,
56 .flags
= CON_PRINTBUFFER
,
60 static struct console
*early_console
;
62 static int __init
setup_early_printk(char *buf
)
69 if (strstr(buf
, "keep"))
72 if (!strncmp(buf
, "bios", 4))
73 early_console
= &bios_console
;
75 if (likely(early_console
)) {
77 early_console
->flags
&= ~CON_BOOT
;
79 early_console
->flags
|= CON_BOOT
;
80 register_console(early_console
);
85 early_param("earlyprintk", setup_early_printk
);