Add support to run SMM handler in TSEG instead of ASEG
[coreboot.git] / src / include / assert.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2010 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 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
20 #ifndef __ASSERT_H__
21 #define __ASSERT_H__
22
23 #if defined(__PRE_RAM__) && !CONFIG_CACHE_AS_RAM
24
25 /* ROMCC versions */
26 #define ASSERT(x) {                                             \
27         if(!(x)) {                                              \
28                 print_emerg("ASSERTION FAILED: file '");        \
29                 print_emerg(__FILE__);                          \
30                 print_emerg("', line 0x");                      \
31                 print_debug_hex32(__LINE__);                    \
32                 print_emerg("\n");                              \
33                 /* die(""); */                                  \
34         }                                                       \
35 }
36
37 #define BUG() {                                                 \
38         print_emerg("BUG ENCOUNTERED: SYSTEM HALTED at file '");\
39         print_emerg(__FILE__);                                  \
40         print_emerg("', line 0x");                              \
41         print_debug_hex32(__LINE__);                            \
42         print_emerg("\n");                                      \
43         /* die(""); */                                          \
44 }
45
46 #else
47
48 /* GCC and CAR versions */
49 #define ASSERT(x) {                                             \
50         if (!(x)) {                                             \
51                 printk(BIOS_EMERG, "ASSERTION FAILED: file '%s', "      \
52                         " line %d\n", __FILE__, __LINE__);      \
53                 /* die(""); */                                  \
54         }                                                       \
55 }
56 #define BUG() {                                                 \
57         printk(BIOS_EMERG, "BUG ENCOUNTERED: SYSTEM HALTED at file '%s', "      \
58                 " line %d\n", __FILE__, __LINE__);              \
59         /* die(""); */                                          \
60 }
61
62 #endif
63
64 #endif // __ASSERT_H__