Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 1 | /* |
Uwe Hermann | c70e9fc | 2010-02-15 23:10:19 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Uwe Hermann | 2bb4acf | 2010-03-01 17:19:55 +0000 | [diff] [blame] | 3 | * |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 4 | * Copyright (C) 2010 coresystems GmbH |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 5 | * |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 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 |
Uwe Hermann | 2bb4acf | 2010-03-01 17:19:55 +0000 | [diff] [blame] | 8 | * published by the Free Software Foundation; version 2 of the License. |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 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 |
Uwe Hermann | 2bb4acf | 2010-03-01 17:19:55 +0000 | [diff] [blame] | 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 20 | #ifndef __ASSERT_H__ |
| 21 | #define __ASSERT_H__ |
Uwe Hermann | c70e9fc | 2010-02-15 23:10:19 +0000 | [diff] [blame] | 22 | |
Stefan Reinauer | 704b596 | 2010-08-30 17:53:13 +0000 | [diff] [blame^] | 23 | #if defined(__PRE_RAM__) && !CONFIG_CACHE_AS_RAM |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 24 | |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 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__); \ |
Stefan Reinauer | 64ed2b7 | 2010-03-31 14:47:43 +0000 | [diff] [blame] | 32 | print_emerg("\n"); \ |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 33 | /* die(""); */ \ |
| 34 | } \ |
| 35 | } |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 36 | |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 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__); \ |
Stefan Reinauer | 64ed2b7 | 2010-03-31 14:47:43 +0000 | [diff] [blame] | 42 | print_emerg("\n"); \ |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 43 | /* die(""); */ \ |
| 44 | } |
| 45 | |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 46 | #else |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 47 | |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 48 | /* GCC and CAR versions */ |
| 49 | #define ASSERT(x) { \ |
| 50 | if (!(x)) { \ |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 51 | printk(BIOS_EMERG, "ASSERTION FAILED: file '%s', " \ |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 52 | " line %d\n", __FILE__, __LINE__); \ |
| 53 | /* die(""); */ \ |
| 54 | } \ |
| 55 | } |
| 56 | #define BUG() { \ |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 57 | printk(BIOS_EMERG, "BUG ENCOUNTERED: SYSTEM HALTED at file '%s', " \ |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 58 | " line %d\n", __FILE__, __LINE__); \ |
| 59 | /* die(""); */ \ |
| 60 | } |
| 61 | |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 62 | #endif |
Uwe Hermann | 2bb4acf | 2010-03-01 17:19:55 +0000 | [diff] [blame] | 63 | |
| 64 | #endif // __ASSERT_H__ |