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>
39 #include <pc80/mc146818rtc.h>
41 /* initialize the console */
42 void console_init(void)
44 struct console_driver *driver;
45 if(get_option(&console_loglevel, "debug_level"))
46 console_loglevel=CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
48 for(driver = console_drivers; driver < econsole_drivers; driver++) {
55 static void __console_tx_byte(unsigned char byte)
57 struct console_driver *driver;
58 for(driver = console_drivers; driver < econsole_drivers; driver++) {
59 driver->tx_byte(byte);
63 void console_tx_flush(void)
65 struct console_driver *driver;
66 for(driver = console_drivers; driver < econsole_drivers; driver++) {
67 if (!driver->tx_flush)
73 void console_tx_byte(unsigned char byte)
76 __console_tx_byte('\r');
77 __console_tx_byte(byte);
80 unsigned char console_rx_byte(void)
82 struct console_driver *driver;
83 for(driver = console_drivers; driver < econsole_drivers; driver++) {
87 if (driver == econsole_drivers)
89 while (!driver->tst_byte());
90 return driver->rx_byte();
93 int console_tst_byte(void)
95 struct console_driver *driver;
96 for(driver = console_drivers; driver < econsole_drivers; driver++)
98 return driver->tst_byte();
104 void console_init(void)
107 enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);
108 early_usbdebug_init();
110 #if CONFIG_CONSOLE_SERIAL8250
113 #if CONFIG_DRIVERS_OXFORD_OXPCIE && CONFIG_CONSOLE_SERIAL8250MEM
116 #if CONFIG_CONSOLE_NE2K
117 ne2k_init(CONFIG_CONSOLE_NE2K_IO_PORT);
119 static const char console_test[] =
122 COREBOOT_EXTRA_VERSION
126 print_info(console_test);