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_NE2K
26 #include <console/ne2k.h>
31 #include <pc80/mc146818rtc.h>
33 /* initialize the console */
34 void console_init(void)
36 struct console_driver *driver;
37 if(get_option(&console_loglevel, "debug_level"))
38 console_loglevel=CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
40 for(driver = console_drivers; driver < econsole_drivers; driver++) {
47 static void __console_tx_byte(unsigned char byte)
49 struct console_driver *driver;
50 for(driver = console_drivers; driver < econsole_drivers; driver++) {
51 driver->tx_byte(byte);
55 void console_tx_flush(void)
57 struct console_driver *driver;
58 for(driver = console_drivers; driver < econsole_drivers; driver++) {
59 if (!driver->tx_flush)
65 void console_tx_byte(unsigned char byte)
68 __console_tx_byte('\r');
69 __console_tx_byte(byte);
72 unsigned char console_rx_byte(void)
74 struct console_driver *driver;
75 for(driver = console_drivers; driver < econsole_drivers; driver++) {
79 if (driver == econsole_drivers)
81 while (!driver->tst_byte());
82 return driver->rx_byte();
85 int console_tst_byte(void)
87 struct console_driver *driver;
88 for(driver = console_drivers; driver < econsole_drivers; driver++)
90 return driver->tst_byte();
96 void console_init(void)
99 enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);
100 early_usbdebug_init();
102 #if CONFIG_CONSOLE_NE2K
103 ne2k_init(CONFIG_CONSOLE_NE2K_IO_PORT);
105 static const char console_test[] =
108 COREBOOT_EXTRA_VERSION
112 print_info(console_test);