2 * This file is part of the coreboot project.
4 * Copyright (C) 2003 Eric Biederman
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include <console/console.h>
25 #if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM
29 #if CONFIG_CONSOLE_NE2K
30 #include <console/ne2k.h>
35 #include <pc80/mc146818rtc.h>
37 /* initialize the console */
38 void console_init(void)
40 struct console_driver *driver;
41 if(get_option(&console_loglevel, "debug_level"))
42 console_loglevel=CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
44 for(driver = console_drivers; driver < econsole_drivers; driver++) {
51 static void __console_tx_byte(unsigned char byte)
53 struct console_driver *driver;
54 for(driver = console_drivers; driver < econsole_drivers; driver++) {
55 driver->tx_byte(byte);
59 void console_tx_flush(void)
61 struct console_driver *driver;
62 for(driver = console_drivers; driver < econsole_drivers; driver++) {
63 if (!driver->tx_flush)
69 void console_tx_byte(unsigned char byte)
72 __console_tx_byte('\r');
73 __console_tx_byte(byte);
76 unsigned char console_rx_byte(void)
78 struct console_driver *driver;
79 for(driver = console_drivers; driver < econsole_drivers; driver++) {
83 if (driver == econsole_drivers)
85 while (!driver->tst_byte());
86 return driver->rx_byte();
89 int console_tst_byte(void)
91 struct console_driver *driver;
92 for(driver = console_drivers; driver < econsole_drivers; driver++)
94 return driver->tst_byte();
100 void console_init(void)
103 enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);
104 early_usbdebug_init();
106 #if CONFIG_CONSOLE_SERIAL8250
109 #if CONFIG_DRIVERS_OXFORD_OXPCIE && CONFIG_CONSOLE_SERIAL8250MEM
112 #if CONFIG_CONSOLE_NE2K
113 ne2k_init(CONFIG_CONSOLE_NE2K_IO_PORT);
115 static const char console_test[] =
118 COREBOOT_EXTRA_VERSION
122 print_info(console_test);