- Remove all of the annoying $Id strings
[coreboot.git] / src / console / console.c
1 /*
2  * Bootstrap code for the INTEL 
3  */
4
5 #include <arch/io.h>
6 #include <console/console.h>
7 #include <string.h>
8 #include <pc80/mc146818rtc.h>
9
10
11 static int initialized;
12
13 /* initialize the console */
14 void console_init(void)
15 {
16         struct console_driver *driver;
17         if(get_option(&console_loglevel, "debug_level"))
18                 console_loglevel=DEFAULT_CONSOLE_LOGLEVEL;
19
20         for(driver = console_drivers; driver < econsole_drivers; driver++) {
21                 if (!driver->init)
22                         continue;
23                 driver->init();
24         }
25         initialized = 1;
26 }
27
28 static void __console_tx_byte(unsigned char byte)
29 {
30         struct console_driver *driver;
31         for(driver = console_drivers; driver < econsole_drivers; driver++) {
32                 driver->tx_byte(byte);
33         }
34 }
35
36 void console_tx_flush(void)
37 {
38         struct console_driver *driver;
39         for(driver = console_drivers; driver < econsole_drivers; driver++) {
40                 if (!driver->tx_flush) 
41                         continue;
42                 driver->tx_flush();
43         }
44 }
45
46 void console_tx_byte(unsigned char byte)
47 {
48         if (!initialized)
49                 return;
50         if (byte == '\n')
51                 __console_tx_byte('\r');
52         __console_tx_byte(byte);
53 }
54
55 /*
56  *    Write POST information
57  */
58 void post_code(uint8_t value)
59 {
60 #ifdef CONFIG_SERIAL_POST
61         printk_info("POST: 0x%02x\n", value);
62 #elsif !define(NO_POST)
63         outb(value, 0x80);
64 #endif
65 }
66
67 /* Report a fatal error */
68 void die(char *msg)
69 {
70         printk_emerg("%s", msg);
71         post_code(0xff);
72         while (1);              /* Halt */
73 }