X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Finclude%2Fconsole%2Fconsole.h;h=56e202d99be62d7df1fdfafd977619a3167402d4;hb=32da8bed197c5c7efc226dd9cfc3b75bad496f05;hp=f5301ee128c501cfe93a3bfee9221f9c5ee61ae1;hpb=b54deb77f03269419a257d3c5b0f06d38831f125;p=coreboot.git diff --git a/src/include/console/console.h b/src/include/console/console.h index f5301ee12..56e202d99 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -1,13 +1,40 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2003 Eric Biederman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef CONSOLE_CONSOLE_H_ #define CONSOLE_CONSOLE_H_ #include #include +#include -#ifndef __ROMCC__ -void console_init(void); -void post_code(u8 value); -void __attribute__ ((noreturn)) die(const char *msg); +#if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM +#include +#endif +#if CONFIG_USBDEBUG +#include +#endif +#if CONFIG_CONSOLE_NE2K +#include +#endif +#if CONFIG_CONSOLE_CBMEM +#include #endif #ifndef __PRE_RAM__ @@ -15,10 +42,6 @@ void console_tx_byte(unsigned char byte); void console_tx_flush(void); unsigned char console_rx_byte(void); int console_tst_byte(void); -#if CONFIG_CONSOLE_VGA == 1 -void vga_console_init(void); -#endif - struct console_driver { void (*init)(void); void (*tx_byte)(unsigned char byte); @@ -36,7 +59,7 @@ extern struct console_driver econsole_drivers[]; extern int console_loglevel; #else /* __PRE_RAM__ */ -/* Using a global varible can cause problems when we reset the stack +/* Using a global varible can cause problems when we reset the stack * from cache as ram to ram. If we make this a define USE_SHARED_STACK * we could use the same code on all architectures. */ @@ -44,6 +67,9 @@ extern int console_loglevel; #endif #ifndef __ROMCC__ +void console_init(void); +void post_code(u8 value); +void __attribute__ ((noreturn)) die(const char *msg); int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3))); #undef WE_CLEANED_UP_ALL_SIDE_EFFECTS @@ -130,133 +156,11 @@ int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, #define print_info_hex32(HEX) printk(BIOS_INFO, "%08x", (HEX)) #define print_debug_hex32(HEX) printk(BIOS_DEBUG, "%08x", (HEX)) #define print_spew_hex32(HEX) printk(BIOS_SPEW, "%08x", (HEX)) -#else +#else /* __ROMCC__ */ -static void __console_tx_byte(unsigned char byte) -{ - uart_tx_byte(byte); -} - -static void __console_tx_nibble(unsigned nibble) -{ - unsigned char digit; - digit = nibble + '0'; - if (digit > '9') { - digit += 39; - } - __console_tx_byte(digit); -} - -static void __console_tx_char(int loglevel, unsigned char byte) -{ - if (console_loglevel >= loglevel) { - uart_tx_byte(byte); - } -} -static void __console_tx_hex8(int loglevel, unsigned char value) -{ - if (console_loglevel >= loglevel) { - __console_tx_nibble((value >> 4U) & 0x0fU); - __console_tx_nibble(value & 0x0fU); - } -} - -static void __console_tx_hex16(int loglevel, unsigned short value) -{ - if (console_loglevel >= loglevel) { - __console_tx_nibble((value >> 12U) & 0x0fU); - __console_tx_nibble((value >> 8U) & 0x0fU); - __console_tx_nibble((value >> 4U) & 0x0fU); - __console_tx_nibble(value & 0x0fU); - } -} - -static void __console_tx_hex32(int loglevel, unsigned int value) -{ - if (console_loglevel >= loglevel) { - __console_tx_nibble((value >> 28U) & 0x0fU); - __console_tx_nibble((value >> 24U) & 0x0fU); - __console_tx_nibble((value >> 20U) & 0x0fU); - __console_tx_nibble((value >> 16U) & 0x0fU); - __console_tx_nibble((value >> 12U) & 0x0fU); - __console_tx_nibble((value >> 8U) & 0x0fU); - __console_tx_nibble((value >> 4U) & 0x0fU); - __console_tx_nibble(value & 0x0fU); - } -} - -static void __console_tx_string(int loglevel, const char *str) -{ - if (console_loglevel >= loglevel) { - unsigned char ch; - while((ch = *str++) != '\0') { - if (ch == '\n') - __console_tx_byte('\r'); - __console_tx_byte(ch); - } - } -} - -#define FUNCTIONS_FOR_PRINT -#ifdef FUNCTIONS_FOR_PRINT -static void print_emerg_char(unsigned char byte) { __console_tx_char(BIOS_EMERG, byte); } -static void print_emerg_hex8(unsigned char value){ __console_tx_hex8(BIOS_EMERG, value); } -static void print_emerg_hex16(unsigned short value){ __console_tx_hex16(BIOS_EMERG, value); } -static void print_emerg_hex32(unsigned int value) { __console_tx_hex32(BIOS_EMERG, value); } -static void print_emerg(const char *str) { __console_tx_string(BIOS_EMERG, str); } - -static void print_alert_char(unsigned char byte) { __console_tx_char(BIOS_ALERT, byte); } -static void print_alert_hex8(unsigned char value) { __console_tx_hex8(BIOS_ALERT, value); } -static void print_alert_hex16(unsigned short value){ __console_tx_hex16(BIOS_ALERT, value); } -static void print_alert_hex32(unsigned int value) { __console_tx_hex32(BIOS_ALERT, value); } -static void print_alert(const char *str) { __console_tx_string(BIOS_ALERT, str); } - -static void print_crit_char(unsigned char byte) { __console_tx_char(BIOS_CRIT, byte); } -static void print_crit_hex8(unsigned char value) { __console_tx_hex8(BIOS_CRIT, value); } -static void print_crit_hex16(unsigned short value){ __console_tx_hex16(BIOS_CRIT, value); } -static void print_crit_hex32(unsigned int value) { __console_tx_hex32(BIOS_CRIT, value); } -static void print_crit(const char *str) { __console_tx_string(BIOS_CRIT, str); } - -static void print_err_char(unsigned char byte) { __console_tx_char(BIOS_ERR, byte); } -static void print_err_hex8(unsigned char value) { __console_tx_hex8(BIOS_ERR, value); } -static void print_err_hex16(unsigned short value){ __console_tx_hex16(BIOS_ERR, value); } -static void print_err_hex32(unsigned int value) { __console_tx_hex32(BIOS_ERR, value); } -static void print_err(const char *str) { __console_tx_string(BIOS_ERR, str); } - -static void print_warning_char(unsigned char byte) { __console_tx_char(BIOS_WARNING, byte); } -static void print_warning_hex8(unsigned char value) { __console_tx_hex8(BIOS_WARNING, value); } -static void print_warning_hex16(unsigned short value){ __console_tx_hex16(BIOS_WARNING, value); } -static void print_warning_hex32(unsigned int value) { __console_tx_hex32(BIOS_WARNING, value); } -static void print_warning(const char *str) { __console_tx_string(BIOS_WARNING, str); } - -static void print_notice_char(unsigned char byte) { __console_tx_char(BIOS_NOTICE, byte); } -static void print_notice_hex8(unsigned char value) { __console_tx_hex8(BIOS_NOTICE, value); } -static void print_notice_hex16(unsigned short value){ __console_tx_hex16(BIOS_NOTICE, value); } -static void print_notice_hex32(unsigned int value) { __console_tx_hex32(BIOS_NOTICE, value); } -static void print_notice(const char *str) { __console_tx_string(BIOS_NOTICE, str); } - -static void print_info_char(unsigned char byte) { __console_tx_char(BIOS_INFO, byte); } -static void print_info_hex8(unsigned char value) { __console_tx_hex8(BIOS_INFO, value); } -static void print_info_hex16(unsigned short value){ __console_tx_hex16(BIOS_INFO, value); } -static void print_info_hex32(unsigned int value) { __console_tx_hex32(BIOS_INFO, value); } -static void print_info(const char *str) { __console_tx_string(BIOS_INFO, str); } - -static void print_debug_char(unsigned char byte) { __console_tx_char(BIOS_DEBUG, byte); } -static void print_debug_hex8(unsigned char value) { __console_tx_hex8(BIOS_DEBUG, value); } -static void print_debug_hex16(unsigned short value){ __console_tx_hex16(BIOS_DEBUG, value); } -static void print_debug_hex32(unsigned int value) { __console_tx_hex32(BIOS_DEBUG, value); } -static void print_debug(const char *str) { __console_tx_string(BIOS_DEBUG, str); } - -static void print_spew_char(unsigned char byte) { __console_tx_char(BIOS_SPEW, byte); } -static void print_spew_hex8(unsigned char value) { __console_tx_hex8(BIOS_SPEW, value); } -static void print_spew_hex16(unsigned short value){ __console_tx_hex16(BIOS_SPEW, value); } -static void print_spew_hex32(unsigned int value) { __console_tx_hex32(BIOS_SPEW, value); } -static void print_spew(const char *str) { __console_tx_string(BIOS_SPEW, str); } - -#else #define print_emerg(STR) __console_tx_string(BIOS_EMERG, STR) #define print_alert(STR) __console_tx_string(BIOS_ALERT, STR) #define print_crit(STR) __console_tx_string(BIOS_CRIT, STR) @@ -306,8 +210,9 @@ static void print_spew(const char *str) { __console_tx_string(BIOS_SPEW, str); } #define print_info_hex32(HEX) __console_tx_hex32(BIOS_INFO, HEX) #define print_debug_hex32(HEX) __console_tx_hex32(BIOS_DEBUG, HEX) #define print_spew_hex32(HEX) __console_tx_hex32(BIOS_SPEW, HEX) -#endif -#endif +#include "arch/x86/lib/romcc_console.c" + +#endif /* __ROMCC__ */ #endif /* CONSOLE_CONSOLE_H_ */