Add support to run SMM handler in TSEG instead of ASEG
[coreboot.git] / src / cpu / x86 / smm / smiutil.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2008-2009 coresystems GmbH
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; version 2 of
9  * the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  */
21
22 #include <arch/io.h>
23 #include <arch/romcc_io.h>
24 #include <cpu/x86/cache.h>
25 #include <cpu/x86/smm.h>
26 #include <console/console.h>
27 #include <console/vtxprintf.h>
28
29 #if CONFIG_CONSOLE_SERIAL8250MEM
30 static u32 serial8250mem_base_address = 0;
31 #endif
32
33 void console_tx_flush(void)
34 {
35         // the tx_byte functions take care of the flush.
36         // if not, this should be implemented.
37 }
38
39 void console_tx_byte(unsigned char byte)
40 {
41         if (byte == '\n')
42                 console_tx_byte('\r');
43
44 #if CONFIG_CONSOLE_SERIAL8250MEM
45         if (serial8250mem_base_address)
46                 uart8250_mem_tx_byte(serial8250mem_base_address, byte);
47 #endif
48 #if CONFIG_CONSOLE_SERIAL8250
49         uart8250_tx_byte(CONFIG_TTYS0_BASE, byte);
50 #endif
51 #if CONFIG_USBDEBUG
52         usbdebug_tx_byte(byte);
53 #endif
54 #if CONFIG_CONSOLE_NE2K
55         ne2k_append_data(&byte, 1, CONFIG_CONSOLE_NE2K_IO_PORT);
56 #endif
57 }
58
59 void console_init(void)
60 {
61 #if CONFIG_DEBUG_SMI
62         console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
63 #if CONFIG_CONSOLE_SERIAL8250
64         uart_init();
65 #endif
66 #if CONFIG_CONSOLE_SERIAL8250MEM
67         serial8250mem_base_address = uart_mem_init();
68 #endif
69 #else
70         console_loglevel = 1;
71 #endif
72 }
73