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>
29 * FIXME: get_option() needs to be abstracted better so that other non-volatile
30 * storage can be used. This will benefit machines without CMOS as well as those
31 * without a battery-backed CMOS (e.g. some laptops).
33 #if CONFIG_HAVE_CMOS_DEFAULT
34 #include <pc80/mc146818rtc.h>
36 static inline int get_option(void *dest
, const char *name
) { return -1; }
39 /* initialize the console */
40 void console_init(void)
42 struct console_driver
*driver
;
43 if(get_option(&console_loglevel
, "debug_level"))
44 console_loglevel
=CONFIG_DEFAULT_CONSOLE_LOGLEVEL
;
46 for(driver
= console_drivers
; driver
< econsole_drivers
; driver
++) {
53 void console_tx_flush(void)
55 struct console_driver
*driver
;
56 for(driver
= console_drivers
; driver
< econsole_drivers
; driver
++) {
57 if (!driver
->tx_flush
)
63 static void __console_tx_byte(unsigned char byte
)
65 struct console_driver
*driver
;
66 for(driver
= console_drivers
; driver
< econsole_drivers
; driver
++) {
67 driver
->tx_byte(byte
);
71 void console_tx_byte(unsigned char byte
)
74 __console_tx_byte('\r');
75 __console_tx_byte(byte
);
78 unsigned char console_rx_byte(void)
80 struct console_driver
*driver
;
81 for(driver
= console_drivers
; driver
< econsole_drivers
; driver
++) {
85 if (driver
== econsole_drivers
)
87 while (!driver
->tst_byte());
88 return driver
->rx_byte();
91 int console_tst_byte(void)
93 struct console_driver
*driver
;
94 for(driver
= console_drivers
; driver
< econsole_drivers
; driver
++)
96 return driver
->tst_byte();
100 #else // __PRE_RAM__ ^^^ NOT defined vvv defined
102 void console_init(void)
104 #if CONFIG_EARLY_CONSOLE
107 enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT
);
108 early_usbdebug_init();
110 #if CONFIG_CONSOLE_SERIAL
113 #if CONFIG_DRIVERS_OXFORD_OXPCIE && CONFIG_CONSOLE_SERIAL8250MEM
116 #if CONFIG_CONSOLE_NE2K
117 ne2k_init(CONFIG_CONSOLE_NE2K_IO_PORT
);
119 #if CONFIG_CONSOLE_CBMEM
122 static const char console_test
[] =
125 COREBOOT_EXTRA_VERSION
129 print_info(console_test
);
131 #endif /* CONFIG_EARLY_CONSOLE */