blob: 1c60eaa28786113b0989c3e2a9808361a30b8994 [file] [log] [blame]
Stefan Reinauereca92fb2006-08-23 14:28:37 +00001/*
Uwe Hermannc70e9fc2010-02-15 23:10:19 +00002 * This file is part of the coreboot project.
Stefan Reinauer55259bd2010-02-28 18:13:09 +00003 *
4 * Copyright (C) 2010 coresystems GmbH
Stefan Reinauereca92fb2006-08-23 14:28:37 +00005 *
Stefan Reinauer55259bd2010-02-28 18:13:09 +00006 * 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 Reinauereca92fb2006-08-23 14:28:37 +000010 *
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 Reinauer55259bd2010-02-28 18:13:09 +000018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19 * MA 02110-1301 USA
Stefan Reinauereca92fb2006-08-23 14:28:37 +000020 */
21
Stefan Reinauer55259bd2010-02-28 18:13:09 +000022#ifndef __ASSERT_H__
23#define __ASSERT_H__
Uwe Hermannc70e9fc2010-02-15 23:10:19 +000024
Stefan Reinauer55259bd2010-02-28 18:13:09 +000025#if defined(__PRE_RAM__) && !CONFIG_USE_PRINTK_IN_CAR
Stefan Reinauereca92fb2006-08-23 14:28:37 +000026
Stefan Reinauer55259bd2010-02-28 18:13:09 +000027/* 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 Reinauereca92fb2006-08-23 14:28:37 +000038
Stefan Reinauer55259bd2010-02-28 18:13:09 +000039#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 Reinauereca92fb2006-08-23 14:28:37 +000048#else
Stefan Reinauereca92fb2006-08-23 14:28:37 +000049
Stefan Reinauer55259bd2010-02-28 18:13:09 +000050/* 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 Reinauereca92fb2006-08-23 14:28:37 +000064#endif
65
Stefan Reinauer55259bd2010-02-28 18:13:09 +000066#endif // __ASSERT_H__