2006-08-23 16:28:37 +02:00
|
|
|
/*
|
2010-02-16 00:10:19 +01:00
|
|
|
* This file is part of the coreboot project.
|
2010-03-01 18:19:55 +01:00
|
|
|
*
|
2010-02-28 19:13:09 +01:00
|
|
|
* Copyright (C) 2010 coresystems GmbH
|
2006-08-23 16:28:37 +02:00
|
|
|
*
|
2010-02-28 19:13:09 +01:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
2010-03-01 18:19:55 +01:00
|
|
|
* published by the Free Software Foundation; version 2 of the License.
|
2006-08-23 16:28:37 +02:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2010-03-01 18:19:55 +01:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2006-08-23 16:28:37 +02:00
|
|
|
*/
|
|
|
|
|
2010-02-28 19:13:09 +01:00
|
|
|
#ifndef __ASSERT_H__
|
|
|
|
#define __ASSERT_H__
|
2010-02-16 00:10:19 +01:00
|
|
|
|
2010-02-28 19:13:09 +01:00
|
|
|
#if defined(__PRE_RAM__) && !CONFIG_USE_PRINTK_IN_CAR
|
2006-08-23 16:28:37 +02:00
|
|
|
|
2010-02-28 19:13:09 +01:00
|
|
|
/* ROMCC versions */
|
|
|
|
#define ASSERT(x) { \
|
|
|
|
if(!(x)) { \
|
|
|
|
print_emerg("ASSERTION FAILED: file '"); \
|
|
|
|
print_emerg(__FILE__); \
|
|
|
|
print_emerg("', line 0x"); \
|
|
|
|
print_debug_hex32(__LINE__); \
|
|
|
|
print_emerg("\r\n"); \
|
|
|
|
/* die(""); */ \
|
|
|
|
} \
|
|
|
|
}
|
2006-08-23 16:28:37 +02:00
|
|
|
|
2010-02-28 19:13:09 +01:00
|
|
|
#define BUG() { \
|
|
|
|
print_emerg("BUG ENCOUNTERED: SYSTEM HALTED at file '");\
|
|
|
|
print_emerg(__FILE__); \
|
|
|
|
print_emerg("', line 0x"); \
|
|
|
|
print_debug_hex32(__LINE__); \
|
|
|
|
print_emerg("\r\n"); \
|
|
|
|
/* die(""); */ \
|
|
|
|
}
|
2006-08-23 16:28:37 +02:00
|
|
|
|
|
|
|
#else
|
2010-02-28 19:13:09 +01:00
|
|
|
|
|
|
|
/* GCC and CAR versions */
|
|
|
|
#define ASSERT(x) { \
|
|
|
|
if (!(x)) { \
|
|
|
|
printk_emerg("ASSERTION FAILED: file '%s', " \
|
|
|
|
" line %d\n", __FILE__, __LINE__); \
|
|
|
|
/* die(""); */ \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
#define BUG() { \
|
|
|
|
printk_emerg("BUG ENCOUNTERED: SYSTEM HALTED at file '%s', " \
|
|
|
|
" line %d\n", __FILE__, __LINE__); \
|
|
|
|
/* die(""); */ \
|
|
|
|
}
|
|
|
|
|
2006-08-23 16:28:37 +02:00
|
|
|
#endif
|
2010-03-01 18:19:55 +01:00
|
|
|
|
|
|
|
#endif // __ASSERT_H__
|