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>
27 #include <pc80/mc146818rtc.h>
29 /* initialize the console */
30 void console_init(void)
32 struct console_driver *driver;
33 if(get_option(&console_loglevel, "debug_level"))
34 console_loglevel=CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
36 for(driver = console_drivers; driver < econsole_drivers; driver++) {
43 void console_tx_flush(void)
45 struct console_driver *driver;
46 for(driver = console_drivers; driver < econsole_drivers; driver++) {
47 if (!driver->tx_flush)
53 static void __console_tx_byte(unsigned char byte)
55 struct console_driver *driver;
56 for(driver = console_drivers; driver < econsole_drivers; driver++) {
57 driver->tx_byte(byte);
61 void console_tx_byte(unsigned char byte)
64 __console_tx_byte('\r');
65 __console_tx_byte(byte);
68 unsigned char console_rx_byte(void)
70 struct console_driver *driver;
71 for(driver = console_drivers; driver < econsole_drivers; driver++) {
75 if (driver == econsole_drivers)
77 while (!driver->tst_byte());
78 return driver->rx_byte();
81 int console_tst_byte(void)
83 struct console_driver *driver;
84 for(driver = console_drivers; driver < econsole_drivers; driver++)
86 return driver->tst_byte();
90 #else // __PRE_RAM__ ^^^ NOT defined vvv defined
92 void console_init(void)
95 enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);
96 early_usbdebug_init();
98 #if CONFIG_CONSOLE_SERIAL8250
101 #if CONFIG_DRIVERS_OXFORD_OXPCIE && CONFIG_CONSOLE_SERIAL8250MEM
104 #if CONFIG_CONSOLE_NE2K
105 ne2k_init(CONFIG_CONSOLE_NE2K_IO_PORT);
107 #if CONFIG_CONSOLE_CBMEM
110 static const char console_test[] =
113 COREBOOT_EXTRA_VERSION
117 print_info(console_test);