blob: 966449b286b3df0e2a440728006e2e53b5031e81 [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.
Uwe Hermann2bb4acf2010-03-01 17:19:55 +00003 *
Stefan Reinauer55259bd2010-02-28 18:13:09 +00004 * 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
Uwe Hermann2bb4acf2010-03-01 17:19:55 +00008 * published by the Free Software Foundation; version 2 of the License.
Stefan Reinauereca92fb2006-08-23 14:28:37 +00009 *
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 Hermann2bb4acf2010-03-01 17:19:55 +000017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stefan Reinauereca92fb2006-08-23 14:28:37 +000018 */
19
Stefan Reinauer55259bd2010-02-28 18:13:09 +000020#ifndef __ASSERT_H__
21#define __ASSERT_H__
Uwe Hermannc70e9fc2010-02-15 23:10:19 +000022
Hung-Te Lin34c59332014-02-21 16:22:52 +080023#include <console/console.h>
24
Stefan Reinauer55259bd2010-02-28 18:13:09 +000025/* GCC and CAR versions */
26#define ASSERT(x) { \
27 if (!(x)) { \
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000028 printk(BIOS_EMERG, "ASSERTION FAILED: file '%s', " \
Stefan Reinauer55259bd2010-02-28 18:13:09 +000029 " line %d\n", __FILE__, __LINE__); \
30 /* die(""); */ \
31 } \
32}
33#define BUG() { \
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000034 printk(BIOS_EMERG, "BUG ENCOUNTERED: SYSTEM HALTED at file '%s', " \
Stefan Reinauer55259bd2010-02-28 18:13:09 +000035 " line %d\n", __FILE__, __LINE__); \
36 /* die(""); */ \
37}
38
Hung-Te Lin34c59332014-02-21 16:22:52 +080039#define assert(statement) ASSERT(statement)
Uwe Hermann2bb4acf2010-03-01 17:19:55 +000040
41#endif // __ASSERT_H__