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. |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 3 | * |
| 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 |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * the License. |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 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 |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
| 19 | * MA 02110-1301 USA |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 20 | */ |
| 21 | |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 22 | #ifndef __ASSERT_H__ |
| 23 | #define __ASSERT_H__ |
Uwe Hermann | c70e9fc | 2010-02-15 23:10:19 +0000 | [diff] [blame] | 24 | |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 25 | #if defined(__PRE_RAM__) && !CONFIG_USE_PRINTK_IN_CAR |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 26 | |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 27 | /* ROMCC versions */ |
| 28 | #define ASSERT(x) { \ |
| 29 | if(!(x)) { \ |
| 30 | print_emerg("ASSERTION FAILED: file '"); \ |
| 31 | print_emerg(__FILE__); \ |
| 32 | print_emerg("', line 0x"); \ |
| 33 | print_debug_hex32(__LINE__); \ |
| 34 | print_emerg("\r\n"); \ |
| 35 | /* die(""); */ \ |
| 36 | } \ |
| 37 | } |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 38 | |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 39 | #define BUG() { \ |
| 40 | print_emerg("BUG ENCOUNTERED: SYSTEM HALTED at file '");\ |
| 41 | print_emerg(__FILE__); \ |
| 42 | print_emerg("', line 0x"); \ |
| 43 | print_debug_hex32(__LINE__); \ |
| 44 | print_emerg("\r\n"); \ |
| 45 | /* die(""); */ \ |
| 46 | } |
| 47 | |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 48 | #else |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 49 | |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 50 | /* GCC and CAR versions */ |
| 51 | #define ASSERT(x) { \ |
| 52 | if (!(x)) { \ |
| 53 | printk_emerg("ASSERTION FAILED: file '%s', " \ |
| 54 | " line %d\n", __FILE__, __LINE__); \ |
| 55 | /* die(""); */ \ |
| 56 | } \ |
| 57 | } |
| 58 | #define BUG() { \ |
| 59 | printk_emerg("BUG ENCOUNTERED: SYSTEM HALTED at file '%s', " \ |
| 60 | " line %d\n", __FILE__, __LINE__); \ |
| 61 | /* die(""); */ \ |
| 62 | } |
| 63 | |
Stefan Reinauer | eca92fb | 2006-08-23 14:28:37 +0000 | [diff] [blame] | 64 | #endif |
| 65 | |
Stefan Reinauer | 55259bd | 2010-02-28 18:13:09 +0000 | [diff] [blame] | 66 | #endif // __ASSERT_H__ |