blob: 79babeceee99cd1f93c7ef59a4fa8585257f72ab [file] [log] [blame]
Stefan Reinauerabc0c852010-11-22 08:09:50 +00001/*
2 * This file is part of the coreboot project.
Stefan Reinauer5ff7c132011-10-31 12:56:45 -07003 *
Stefan Reinauerabc0c852010-11-22 08:09:50 +00004 * Copyright (C) 2003 Eric Biederman
5 *
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.
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.
Stefan Reinauerabc0c852010-11-22 08:09:50 +000015 */
16
17#include <arch/io.h>
Stefan Reinauerabc0c852010-11-22 08:09:50 +000018#include <console/console.h>
Patrick Georgibd79c5e2014-11-28 22:35:36 +010019#include <halt.h>
Stefan Reinauerabc0c852010-11-22 08:09:50 +000020
Patrick Georgi394965d2010-11-22 13:07:10 +000021#ifndef __ROMCC__
22#define NORETURN __attribute__((noreturn))
Patrick Georgi394965d2010-11-22 13:07:10 +000023
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020024/*
25 * The method should be overwritten in mainboard directory to signal that a
26 * fatal error had occurred. On boards that do share the same EC and where the
27 * EC is capable of controlling LEDs or a buzzer the method can be overwritten
28 * in EC directory instead.
29 */
30__attribute__ ((weak)) void die_notify(void)
31{
32}
33
Stefan Reinauerabc0c852010-11-22 08:09:50 +000034/* Report a fatal error */
Patrick Georgi394965d2010-11-22 13:07:10 +000035void NORETURN die(const char *msg)
Stefan Reinauerabc0c852010-11-22 08:09:50 +000036{
Stefan Reinauerd6865222015-01-05 13:12:38 -080037 printk(BIOS_EMERG, "%s", msg);
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020038 die_notify();
Patrick Georgibd79c5e2014-11-28 22:35:36 +010039 halt();
Stefan Reinauerabc0c852010-11-22 08:09:50 +000040}
Stefan Reinauerd6865222015-01-05 13:12:38 -080041#endif