Stefan Reinauer | 2a8ad41 | 2010-09-27 18:49:46 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2003 Eric Biederman |
| 5 | * |
| 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. |
| 9 | * |
| 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. |
| 14 | * |
| 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 |
| 18 | */ |
| 19 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 20 | #ifndef CONSOLE_CONSOLE_H_ |
| 21 | #define CONSOLE_CONSOLE_H_ |
| 22 | |
Stefan Reinauer | 4f7a5c4 | 2010-09-27 20:51:33 +0000 | [diff] [blame] | 23 | #include <stdint.h> |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 24 | #include <console/loglevel.h> |
Alexandru Gagniuc | 5005bb06 | 2011-04-11 20:17:22 +0000 | [diff] [blame^] | 25 | #include <console/post_codes.h> |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 26 | |
Myles Watson | b54deb7 | 2010-04-02 21:39:12 +0000 | [diff] [blame] | 27 | #ifndef __PRE_RAM__ |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 28 | void console_tx_byte(unsigned char byte); |
| 29 | void console_tx_flush(void); |
Greg Watson | e54d55b | 2004-03-13 03:40:51 +0000 | [diff] [blame] | 30 | unsigned char console_rx_byte(void); |
| 31 | int console_tst_byte(void); |
Myles Watson | 127e976 | 2010-08-04 19:29:11 +0000 | [diff] [blame] | 32 | #if CONFIG_USBDEBUG |
| 33 | #include <usbdebug.h> |
| 34 | #endif |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 35 | |
| 36 | struct console_driver { |
| 37 | void (*init)(void); |
| 38 | void (*tx_byte)(unsigned char byte); |
| 39 | void (*tx_flush)(void); |
Greg Watson | e54d55b | 2004-03-13 03:40:51 +0000 | [diff] [blame] | 40 | unsigned char (*rx_byte)(void); |
| 41 | int (*tst_byte)(void); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 44 | #define __console __attribute__((used, __section__ (".rodata.console_drivers"))) |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 45 | |
| 46 | /* Defined by the linker... */ |
| 47 | extern struct console_driver console_drivers[]; |
| 48 | extern struct console_driver econsole_drivers[]; |
| 49 | |
Luc Verhaegen | a9c5ea0 | 2009-06-03 14:19:33 +0000 | [diff] [blame] | 50 | extern int console_loglevel; |
Stefan Reinauer | 0c781b2 | 2010-04-01 09:50:32 +0000 | [diff] [blame] | 51 | #else |
| 52 | /* __PRE_RAM__ */ |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 53 | /* Using a global varible can cause problems when we reset the stack |
Stefan Reinauer | 0c781b2 | 2010-04-01 09:50:32 +0000 | [diff] [blame] | 54 | * from cache as ram to ram. If we make this a define USE_SHARED_STACK |
| 55 | * we could use the same code on all architectures. |
| 56 | */ |
| 57 | #define console_loglevel CONFIG_DEFAULT_CONSOLE_LOGLEVEL |
Stefan Reinauer | 3817494 | 2010-12-17 01:51:34 +0000 | [diff] [blame] | 58 | #if CONFIG_CONSOLE_SERIAL8250 |
| 59 | #include <uart8250.h> |
| 60 | #endif |
Stefan Reinauer | 0c781b2 | 2010-04-01 09:50:32 +0000 | [diff] [blame] | 61 | #endif |
Stefan Reinauer | b8ac05d | 2010-03-31 00:06:12 +0000 | [diff] [blame] | 62 | |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 63 | #ifndef __ROMCC__ |
Stefan Reinauer | 720297c | 2010-04-02 22:11:20 +0000 | [diff] [blame] | 64 | void console_init(void); |
| 65 | void post_code(u8 value); |
| 66 | void __attribute__ ((noreturn)) die(const char *msg); |
Carl-Daniel Hailfinger | 90308bb | 2009-01-20 18:37:26 +0000 | [diff] [blame] | 67 | int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3))); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 68 | |
Stefan Reinauer | f0aa09b | 2010-03-23 13:23:40 +0000 | [diff] [blame] | 69 | #undef WE_CLEANED_UP_ALL_SIDE_EFFECTS |
| 70 | /* We saw some strange effects in the past like coreboot crashing while |
| 71 | * disabling cache as ram for a maximum console log level of 6 and above while |
| 72 | * it worked fine without. In order to catch such issues reliably we are |
| 73 | * always doing a function call to do_printk with the full number of arguments. |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 74 | * Our favorite reason to do it this way was: |
| 75 | * disable_car(); |
| 76 | * printk(BIOS_DEBUG, "CAR disabled\n"); // oops, garbage stack pointer |
| 77 | * move_stack(); |
Stefan Reinauer | f0aa09b | 2010-03-23 13:23:40 +0000 | [diff] [blame] | 78 | * This slightly increases the code size and some unprinted strings will end |
| 79 | * up in the final coreboot binary (most of them compressed). If you want to |
| 80 | * avoid this, do a |
| 81 | * #define WE_CLEANED_UP_ALL_SIDE_EFFECTS |
| 82 | */ |
| 83 | #ifdef WE_CLEANED_UP_ALL_SIDE_EFFECTS |
Stefan Reinauer | 0001a7f | 2009-07-21 21:25:45 +0000 | [diff] [blame] | 84 | |
Stefan Reinauer | f0aa09b | 2010-03-23 13:23:40 +0000 | [diff] [blame] | 85 | #define printk(LEVEL, fmt, args...) \ |
| 86 | do { \ |
| 87 | if (CONFIG_MAXIMUM_CONSOLE_LOGLEVEL >= LEVEL) { \ |
| 88 | do_printk(LEVEL, fmt, ##args); \ |
| 89 | } \ |
| 90 | } while(0) |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 91 | |
Stefan Reinauer | f0aa09b | 2010-03-23 13:23:40 +0000 | [diff] [blame] | 92 | #else |
| 93 | |
| 94 | #define printk(LEVEL, fmt, args...) \ |
| 95 | do { \ |
| 96 | if (CONFIG_MAXIMUM_CONSOLE_LOGLEVEL >= LEVEL) { \ |
| 97 | do_printk(LEVEL, fmt, ##args); \ |
| 98 | } else { \ |
| 99 | do_printk(BIOS_NEVER, fmt, ##args); \ |
| 100 | } \ |
| 101 | } while(0) |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 102 | #endif |
| 103 | |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 104 | #define print_emerg(STR) printk(BIOS_EMERG, "%s", (STR)) |
| 105 | #define print_alert(STR) printk(BIOS_ALERT, "%s", (STR)) |
| 106 | #define print_crit(STR) printk(BIOS_CRIT, "%s", (STR)) |
| 107 | #define print_err(STR) printk(BIOS_ERR, "%s", (STR)) |
| 108 | #define print_warning(STR) printk(BIOS_WARNING,"%s", (STR)) |
| 109 | #define print_notice(STR) printk(BIOS_NOTICE, "%s", (STR)) |
| 110 | #define print_info(STR) printk(BIOS_INFO, "%s", (STR)) |
| 111 | #define print_debug(STR) printk(BIOS_DEBUG, "%s", (STR)) |
| 112 | #define print_spew(STR) printk(BIOS_SPEW, "%s", (STR)) |
Eric Biederman | 9b4336c | 2003-07-19 04:28:22 +0000 | [diff] [blame] | 113 | |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 114 | #define print_emerg_char(CH) printk(BIOS_EMERG, "%c", (CH)) |
| 115 | #define print_alert_char(CH) printk(BIOS_ALERT, "%c", (CH)) |
| 116 | #define print_crit_char(CH) printk(BIOS_CRIT, "%c", (CH)) |
| 117 | #define print_err_char(CH) printk(BIOS_ERR, "%c", (CH)) |
| 118 | #define print_warning_char(CH) printk(BIOS_WARNING,"%c", (CH)) |
| 119 | #define print_notice_char(CH) printk(BIOS_NOTICE, "%c", (CH)) |
| 120 | #define print_info_char(CH) printk(BIOS_INFO, "%c", (CH)) |
| 121 | #define print_debug_char(CH) printk(BIOS_DEBUG, "%c", (CH)) |
| 122 | #define print_spew_char(CH) printk(BIOS_SPEW, "%c", (CH)) |
Eric Biederman | 9b4336c | 2003-07-19 04:28:22 +0000 | [diff] [blame] | 123 | |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 124 | #define print_emerg_hex8(HEX) printk(BIOS_EMERG, "%02x", (HEX)) |
| 125 | #define print_alert_hex8(HEX) printk(BIOS_ALERT, "%02x", (HEX)) |
| 126 | #define print_crit_hex8(HEX) printk(BIOS_CRIT, "%02x", (HEX)) |
| 127 | #define print_err_hex8(HEX) printk(BIOS_ERR, "%02x", (HEX)) |
| 128 | #define print_warning_hex8(HEX) printk(BIOS_WARNING,"%02x", (HEX)) |
| 129 | #define print_notice_hex8(HEX) printk(BIOS_NOTICE, "%02x", (HEX)) |
| 130 | #define print_info_hex8(HEX) printk(BIOS_INFO, "%02x", (HEX)) |
| 131 | #define print_debug_hex8(HEX) printk(BIOS_DEBUG, "%02x", (HEX)) |
| 132 | #define print_spew_hex8(HEX) printk(BIOS_SPEW, "%02x", (HEX)) |
Eric Biederman | 9b4336c | 2003-07-19 04:28:22 +0000 | [diff] [blame] | 133 | |
Stefan Reinauer | f0aa09b | 2010-03-23 13:23:40 +0000 | [diff] [blame] | 134 | #define print_emerg_hex16(HEX) printk(BIOS_EMERG, "%04x", (HEX)) |
| 135 | #define print_alert_hex16(HEX) printk(BIOS_ALERT, "%04x", (HEX)) |
| 136 | #define print_crit_hex16(HEX) printk(BIOS_CRIT, "%04x", (HEX)) |
| 137 | #define print_err_hex16(HEX) printk(BIOS_ERR, "%04x", (HEX)) |
| 138 | #define print_warning_hex16(HEX) printk(BIOS_WARNING,"%04x", (HEX)) |
| 139 | #define print_notice_hex16(HEX) printk(BIOS_NOTICE, "%04x", (HEX)) |
| 140 | #define print_info_hex16(HEX) printk(BIOS_INFO, "%04x", (HEX)) |
| 141 | #define print_debug_hex16(HEX) printk(BIOS_DEBUG, "%04x", (HEX)) |
| 142 | #define print_spew_hex16(HEX) printk(BIOS_SPEW, "%04x", (HEX)) |
Eric Biederman | 9b4336c | 2003-07-19 04:28:22 +0000 | [diff] [blame] | 143 | |
Stefan Reinauer | f0aa09b | 2010-03-23 13:23:40 +0000 | [diff] [blame] | 144 | #define print_emerg_hex32(HEX) printk(BIOS_EMERG, "%08x", (HEX)) |
| 145 | #define print_alert_hex32(HEX) printk(BIOS_ALERT, "%08x", (HEX)) |
| 146 | #define print_crit_hex32(HEX) printk(BIOS_CRIT, "%08x", (HEX)) |
| 147 | #define print_err_hex32(HEX) printk(BIOS_ERR, "%08x", (HEX)) |
| 148 | #define print_warning_hex32(HEX) printk(BIOS_WARNING,"%08x", (HEX)) |
| 149 | #define print_notice_hex32(HEX) printk(BIOS_NOTICE, "%08x", (HEX)) |
| 150 | #define print_info_hex32(HEX) printk(BIOS_INFO, "%08x", (HEX)) |
| 151 | #define print_debug_hex32(HEX) printk(BIOS_DEBUG, "%08x", (HEX)) |
| 152 | #define print_spew_hex32(HEX) printk(BIOS_SPEW, "%08x", (HEX)) |
Stefan Reinauer | 16ce01b | 2011-01-28 08:05:54 +0000 | [diff] [blame] | 153 | |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 154 | #else |
Stefan Reinauer | 0c781b2 | 2010-04-01 09:50:32 +0000 | [diff] [blame] | 155 | |
Stefan Reinauer | 3817494 | 2010-12-17 01:51:34 +0000 | [diff] [blame] | 156 | /* __ROMCC__ */ |
| 157 | |
Stefan Reinauer | 85b0fa1 | 2010-12-17 00:08:21 +0000 | [diff] [blame] | 158 | #if CONFIG_CONSOLE_SERIAL8250 |
Stefan Reinauer | 3817494 | 2010-12-17 01:51:34 +0000 | [diff] [blame] | 159 | #include "lib/uart8250.c" |
Stefan Reinauer | 85b0fa1 | 2010-12-17 00:08:21 +0000 | [diff] [blame] | 160 | #endif |
Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 161 | #if CONFIG_CONSOLE_NE2K |
| 162 | #include "lib/ne2k.c" |
| 163 | #endif |
| 164 | |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 165 | static void __console_tx_byte(unsigned char byte) |
| 166 | { |
Stefan Reinauer | 85b0fa1 | 2010-12-17 00:08:21 +0000 | [diff] [blame] | 167 | #if CONFIG_CONSOLE_SERIAL8250 |
| 168 | uart8250_tx_byte(CONFIG_TTYS0_BASE, byte); |
| 169 | #endif |
Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 170 | #if CONFIG_CONSOLE_NE2K |
| 171 | ne2k_append_data_byte(byte, CONFIG_CONSOLE_NE2K_IO_PORT); |
| 172 | #endif |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | static void __console_tx_nibble(unsigned nibble) |
| 176 | { |
| 177 | unsigned char digit; |
| 178 | digit = nibble + '0'; |
| 179 | if (digit > '9') { |
| 180 | digit += 39; |
| 181 | } |
| 182 | __console_tx_byte(digit); |
| 183 | } |
| 184 | |
| 185 | static void __console_tx_char(int loglevel, unsigned char byte) |
| 186 | { |
Stefan Reinauer | 0c781b2 | 2010-04-01 09:50:32 +0000 | [diff] [blame] | 187 | if (console_loglevel >= loglevel) { |
Stefan Reinauer | 85b0fa1 | 2010-12-17 00:08:21 +0000 | [diff] [blame] | 188 | #if CONFIG_CONSOLE_SERIAL8250 |
| 189 | uart8250_tx_byte(CONFIG_TTYS0_BASE, byte); |
| 190 | #endif |
Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 191 | #if CONFIG_CONSOLE_NE2K |
Stefan Reinauer | 85b0fa1 | 2010-12-17 00:08:21 +0000 | [diff] [blame] | 192 | ne2k_append_data_byte(byte, CONFIG_CONSOLE_NE2K_IO_PORT); |
| 193 | ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); |
Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 194 | #endif |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 195 | } |
| 196 | } |
| 197 | |
| 198 | static void __console_tx_hex8(int loglevel, unsigned char value) |
| 199 | { |
Stefan Reinauer | 0c781b2 | 2010-04-01 09:50:32 +0000 | [diff] [blame] | 200 | if (console_loglevel >= loglevel) { |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 201 | __console_tx_nibble((value >> 4U) & 0x0fU); |
| 202 | __console_tx_nibble(value & 0x0fU); |
| 203 | } |
Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 204 | #if CONFIG_CONSOLE_NE2K |
| 205 | ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); |
| 206 | #endif |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | static void __console_tx_hex16(int loglevel, unsigned short value) |
| 210 | { |
Stefan Reinauer | 0c781b2 | 2010-04-01 09:50:32 +0000 | [diff] [blame] | 211 | if (console_loglevel >= loglevel) { |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 212 | __console_tx_nibble((value >> 12U) & 0x0fU); |
| 213 | __console_tx_nibble((value >> 8U) & 0x0fU); |
| 214 | __console_tx_nibble((value >> 4U) & 0x0fU); |
| 215 | __console_tx_nibble(value & 0x0fU); |
| 216 | } |
Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 217 | #if CONFIG_CONSOLE_NE2K |
| 218 | ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); |
| 219 | #endif |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | static void __console_tx_hex32(int loglevel, unsigned int value) |
| 223 | { |
Stefan Reinauer | 0c781b2 | 2010-04-01 09:50:32 +0000 | [diff] [blame] | 224 | if (console_loglevel >= loglevel) { |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 225 | __console_tx_nibble((value >> 28U) & 0x0fU); |
| 226 | __console_tx_nibble((value >> 24U) & 0x0fU); |
| 227 | __console_tx_nibble((value >> 20U) & 0x0fU); |
| 228 | __console_tx_nibble((value >> 16U) & 0x0fU); |
| 229 | __console_tx_nibble((value >> 12U) & 0x0fU); |
| 230 | __console_tx_nibble((value >> 8U) & 0x0fU); |
| 231 | __console_tx_nibble((value >> 4U) & 0x0fU); |
| 232 | __console_tx_nibble(value & 0x0fU); |
| 233 | } |
Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 234 | #if CONFIG_CONSOLE_NE2K |
| 235 | ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); |
| 236 | #endif |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | static void __console_tx_string(int loglevel, const char *str) |
| 240 | { |
Stefan Reinauer | 0c781b2 | 2010-04-01 09:50:32 +0000 | [diff] [blame] | 241 | if (console_loglevel >= loglevel) { |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 242 | unsigned char ch; |
| 243 | while((ch = *str++) != '\0') { |
| 244 | if (ch == '\n') |
| 245 | __console_tx_byte('\r'); |
| 246 | __console_tx_byte(ch); |
| 247 | } |
Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 248 | #if CONFIG_CONSOLE_NE2K |
| 249 | ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); |
| 250 | #endif |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 251 | } |
| 252 | } |
| 253 | |
| 254 | #define FUNCTIONS_FOR_PRINT |
| 255 | #ifdef FUNCTIONS_FOR_PRINT |
| 256 | static void print_emerg_char(unsigned char byte) { __console_tx_char(BIOS_EMERG, byte); } |
| 257 | static void print_emerg_hex8(unsigned char value){ __console_tx_hex8(BIOS_EMERG, value); } |
| 258 | static void print_emerg_hex16(unsigned short value){ __console_tx_hex16(BIOS_EMERG, value); } |
| 259 | static void print_emerg_hex32(unsigned int value) { __console_tx_hex32(BIOS_EMERG, value); } |
| 260 | static void print_emerg(const char *str) { __console_tx_string(BIOS_EMERG, str); } |
| 261 | |
| 262 | static void print_alert_char(unsigned char byte) { __console_tx_char(BIOS_ALERT, byte); } |
| 263 | static void print_alert_hex8(unsigned char value) { __console_tx_hex8(BIOS_ALERT, value); } |
| 264 | static void print_alert_hex16(unsigned short value){ __console_tx_hex16(BIOS_ALERT, value); } |
| 265 | static void print_alert_hex32(unsigned int value) { __console_tx_hex32(BIOS_ALERT, value); } |
| 266 | static void print_alert(const char *str) { __console_tx_string(BIOS_ALERT, str); } |
| 267 | |
| 268 | static void print_crit_char(unsigned char byte) { __console_tx_char(BIOS_CRIT, byte); } |
| 269 | static void print_crit_hex8(unsigned char value) { __console_tx_hex8(BIOS_CRIT, value); } |
| 270 | static void print_crit_hex16(unsigned short value){ __console_tx_hex16(BIOS_CRIT, value); } |
| 271 | static void print_crit_hex32(unsigned int value) { __console_tx_hex32(BIOS_CRIT, value); } |
| 272 | static void print_crit(const char *str) { __console_tx_string(BIOS_CRIT, str); } |
| 273 | |
| 274 | static void print_err_char(unsigned char byte) { __console_tx_char(BIOS_ERR, byte); } |
| 275 | static void print_err_hex8(unsigned char value) { __console_tx_hex8(BIOS_ERR, value); } |
| 276 | static void print_err_hex16(unsigned short value){ __console_tx_hex16(BIOS_ERR, value); } |
| 277 | static void print_err_hex32(unsigned int value) { __console_tx_hex32(BIOS_ERR, value); } |
| 278 | static void print_err(const char *str) { __console_tx_string(BIOS_ERR, str); } |
| 279 | |
| 280 | static void print_warning_char(unsigned char byte) { __console_tx_char(BIOS_WARNING, byte); } |
| 281 | static void print_warning_hex8(unsigned char value) { __console_tx_hex8(BIOS_WARNING, value); } |
| 282 | static void print_warning_hex16(unsigned short value){ __console_tx_hex16(BIOS_WARNING, value); } |
| 283 | static void print_warning_hex32(unsigned int value) { __console_tx_hex32(BIOS_WARNING, value); } |
| 284 | static void print_warning(const char *str) { __console_tx_string(BIOS_WARNING, str); } |
| 285 | |
| 286 | static void print_notice_char(unsigned char byte) { __console_tx_char(BIOS_NOTICE, byte); } |
| 287 | static void print_notice_hex8(unsigned char value) { __console_tx_hex8(BIOS_NOTICE, value); } |
| 288 | static void print_notice_hex16(unsigned short value){ __console_tx_hex16(BIOS_NOTICE, value); } |
| 289 | static void print_notice_hex32(unsigned int value) { __console_tx_hex32(BIOS_NOTICE, value); } |
| 290 | static void print_notice(const char *str) { __console_tx_string(BIOS_NOTICE, str); } |
| 291 | |
| 292 | static void print_info_char(unsigned char byte) { __console_tx_char(BIOS_INFO, byte); } |
| 293 | static void print_info_hex8(unsigned char value) { __console_tx_hex8(BIOS_INFO, value); } |
| 294 | static void print_info_hex16(unsigned short value){ __console_tx_hex16(BIOS_INFO, value); } |
| 295 | static void print_info_hex32(unsigned int value) { __console_tx_hex32(BIOS_INFO, value); } |
| 296 | static void print_info(const char *str) { __console_tx_string(BIOS_INFO, str); } |
| 297 | |
| 298 | static void print_debug_char(unsigned char byte) { __console_tx_char(BIOS_DEBUG, byte); } |
| 299 | static void print_debug_hex8(unsigned char value) { __console_tx_hex8(BIOS_DEBUG, value); } |
| 300 | static void print_debug_hex16(unsigned short value){ __console_tx_hex16(BIOS_DEBUG, value); } |
| 301 | static void print_debug_hex32(unsigned int value) { __console_tx_hex32(BIOS_DEBUG, value); } |
| 302 | static void print_debug(const char *str) { __console_tx_string(BIOS_DEBUG, str); } |
| 303 | |
| 304 | static void print_spew_char(unsigned char byte) { __console_tx_char(BIOS_SPEW, byte); } |
| 305 | static void print_spew_hex8(unsigned char value) { __console_tx_hex8(BIOS_SPEW, value); } |
| 306 | static void print_spew_hex16(unsigned short value){ __console_tx_hex16(BIOS_SPEW, value); } |
| 307 | static void print_spew_hex32(unsigned int value) { __console_tx_hex32(BIOS_SPEW, value); } |
| 308 | static void print_spew(const char *str) { __console_tx_string(BIOS_SPEW, str); } |
| 309 | |
| 310 | #else |
| 311 | #define print_emerg(STR) __console_tx_string(BIOS_EMERG, STR) |
| 312 | #define print_alert(STR) __console_tx_string(BIOS_ALERT, STR) |
| 313 | #define print_crit(STR) __console_tx_string(BIOS_CRIT, STR) |
| 314 | #define print_err(STR) __console_tx_string(BIOS_ERR, STR) |
| 315 | #define print_warning(STR) __console_tx_string(BIOS_WARNING, STR) |
| 316 | #define print_notice(STR) __console_tx_string(BIOS_NOTICE, STR) |
| 317 | #define print_info(STR) __console_tx_string(BIOS_INFO, STR) |
| 318 | #define print_debug(STR) __console_tx_string(BIOS_DEBUG, STR) |
| 319 | #define print_spew(STR) __console_tx_string(BIOS_SPEW, STR) |
| 320 | |
| 321 | #define print_emerg_char(CH) __console_tx_char(BIOS_EMERG, CH) |
| 322 | #define print_alert_char(CH) __console_tx_char(BIOS_ALERT, CH) |
| 323 | #define print_crit_char(CH) __console_tx_char(BIOS_CRIT, CH) |
| 324 | #define print_err_char(CH) __console_tx_char(BIOS_ERR, CH) |
| 325 | #define print_warning_char(CH) __console_tx_char(BIOS_WARNING, CH) |
| 326 | #define print_notice_char(CH) __console_tx_char(BIOS_NOTICE, CH) |
| 327 | #define print_info_char(CH) __console_tx_char(BIOS_INFO, CH) |
| 328 | #define print_debug_char(CH) __console_tx_char(BIOS_DEBUG, CH) |
| 329 | #define print_spew_char(CH) __console_tx_char(BIOS_SPEW, CH) |
| 330 | |
| 331 | #define print_emerg_hex8(HEX) __console_tx_hex8(BIOS_EMERG, HEX) |
| 332 | #define print_alert_hex8(HEX) __console_tx_hex8(BIOS_ALERT, HEX) |
| 333 | #define print_crit_hex8(HEX) __console_tx_hex8(BIOS_CRIT, HEX) |
| 334 | #define print_err_hex8(HEX) __console_tx_hex8(BIOS_ERR, HEX) |
| 335 | #define print_warning_hex8(HEX) __console_tx_hex8(BIOS_WARNING, HEX) |
| 336 | #define print_notice_hex8(HEX) __console_tx_hex8(BIOS_NOTICE, HEX) |
| 337 | #define print_info_hex8(HEX) __console_tx_hex8(BIOS_INFO, HEX) |
| 338 | #define print_debug_hex8(HEX) __console_tx_hex8(BIOS_DEBUG, HEX) |
| 339 | #define print_spew_hex8(HEX) __console_tx_hex8(BIOS_SPEW, HEX) |
| 340 | |
| 341 | #define print_emerg_hex16(HEX) __console_tx_hex16(BIOS_EMERG, HEX) |
| 342 | #define print_alert_hex16(HEX) __console_tx_hex16(BIOS_ALERT, HEX) |
| 343 | #define print_crit_hex16(HEX) __console_tx_hex16(BIOS_CRIT, HEX) |
| 344 | #define print_err_hex16(HEX) __console_tx_hex16(BIOS_ERR, HEX) |
| 345 | #define print_warning_hex16(HEX) __console_tx_hex16(BIOS_WARNING, HEX) |
| 346 | #define print_notice_hex16(HEX) __console_tx_hex16(BIOS_NOTICE, HEX) |
| 347 | #define print_info_hex16(HEX) __console_tx_hex16(BIOS_INFO, HEX) |
| 348 | #define print_debug_hex16(HEX) __console_tx_hex16(BIOS_DEBUG, HEX) |
| 349 | #define print_spew_hex16(HEX) __console_tx_hex16(BIOS_SPEW, HEX) |
| 350 | |
| 351 | #define print_emerg_hex32(HEX) __console_tx_hex32(BIOS_EMERG, HEX) |
| 352 | #define print_alert_hex32(HEX) __console_tx_hex32(BIOS_ALERT, HEX) |
| 353 | #define print_crit_hex32(HEX) __console_tx_hex32(BIOS_CRIT, HEX) |
| 354 | #define print_err_hex32(HEX) __console_tx_hex32(BIOS_ERR, HEX) |
| 355 | #define print_warning_hex32(HEX) __console_tx_hex32(BIOS_WARNING, HEX) |
| 356 | #define print_notice_hex32(HEX) __console_tx_hex32(BIOS_NOTICE, HEX) |
| 357 | #define print_info_hex32(HEX) __console_tx_hex32(BIOS_INFO, HEX) |
| 358 | #define print_debug_hex32(HEX) __console_tx_hex32(BIOS_DEBUG, HEX) |
| 359 | #define print_spew_hex32(HEX) __console_tx_hex32(BIOS_SPEW, HEX) |
| 360 | #endif |
| 361 | |
Patrick Georgi | 12584e2 | 2010-05-08 09:14:51 +0000 | [diff] [blame] | 362 | /* if included by romcc, include the sources, too. romcc can't use prototypes */ |
| 363 | #include <console/console.c> |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 364 | #include <console/post.c> |
| 365 | #include <console/die.c> |
Patrick Georgi | 12584e2 | 2010-05-08 09:14:51 +0000 | [diff] [blame] | 366 | #endif |
| 367 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 368 | #endif /* CONSOLE_CONSOLE_H_ */ |