- Initial checkin of the freebios2 tree
[coreboot.git] / src / include / console / console.h
1 #ifndef CONSOLE_CONSOLE_H_
2 #define CONSOLE_CONSOLE_H_
3
4 #include <stdint.h>
5 #include <console/loglevel.h>
6
7 void console_init(void);
8 void console_tx_byte(unsigned char byte);
9 void console_tx_flush(void);
10 void post_code(uint8_t value);
11 void die(char *msg);
12
13 struct console_driver {
14         void (*init)(void);
15         void (*tx_byte)(unsigned char byte);
16         void (*tx_flush)(void);
17 };
18
19 #define __console       __attribute__((unused, __section__ (".rodata.console_drivers")))
20
21 /* Defined by the linker... */
22 extern struct console_driver console_drivers[];
23 extern struct console_driver econsole_drivers[];
24
25 extern int console_loglevel;
26 int do_printk(int msg_level, const char *fmt, ...);
27
28 #define printk_emerg(fmt, arg...)   do_printk(BIOS_EMERG   ,fmt, ##arg)
29 #define printk_alert(fmt, arg...)   do_printk(BIOS_ALERT   ,fmt, ##arg)
30 #define printk_crit(fmt, arg...)    do_printk(BIOS_CRIT    ,fmt, ##arg)
31 #define printk_err(fmt, arg...)     do_printk(BIOS_ERR     ,fmt, ##arg)
32 #define printk_warning(fmt, arg...) do_printk(BIOS_WARNING ,fmt, ##arg)
33 #define printk_notice(fmt, arg...)  do_printk(BIOS_NOTICE  ,fmt, ##arg)
34 #define printk_info(fmt, arg...)    do_printk(BIOS_INFO    ,fmt, ##arg)
35 #define printk_debug(fmt, arg...)   do_printk(BIOS_DEBUG   ,fmt, ##arg)
36 #define printk_spew(fmt, arg...)    do_printk(BIOS_SPEW    ,fmt, ##arg)
37
38 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_EMERG
39 #undef  printk_emerg
40 #define printk_emerg(fmt, arg...)   do {} while(0)
41 #endif
42 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ALERT
43 #undef  printk_alert
44 #define printk_alart(fmt, arg...)   do {} while(0)
45 #endif
46 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_CRIT
47 #undef  printk_crit
48 #define printk_crit(fmt, arg...)    do {} while(0)
49 #endif
50 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ERR
51 #undef  printk_err
52 #define printk_err(fmt, arg...)     do {} while(0)
53 #endif
54 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_WARNING
55 #undef  printk_warning
56 #define printk_warning(fmt, arg...) do {} while(0)
57 #endif
58 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_NOTICE
59 #undef  printk_notice
60 #define printk_notice(fmt, arg...)  do {} while(0)
61 #endif
62 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_INFO
63 #undef  printk_info
64 #define printk_info(fmt, arg...)    do {} while(0)
65 #endif
66 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_DEBUG
67 #undef  printk_debug
68 #define printk_debug(fmt, arg...)   do {} while(0)
69 #endif
70 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_SPEW
71 #undef  printk_spew
72 #define printk_spew(fmt, arg...)    do {} while(0)
73 #endif
74
75
76 #endif /* CONSOLE_CONSOLE_H_ */