blob: 3f5ca45068bdd4cd1827181735d6d4e95b48eda9 [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>
Aaron Durbin64031672018-04-21 14:45:32 -060018#include <compiler.h>
Stefan Reinauerabc0c852010-11-22 08:09:50 +000019#include <console/console.h>
Patrick Georgibd79c5e2014-11-28 22:35:36 +010020#include <halt.h>
Stefan Reinauerabc0c852010-11-22 08:09:50 +000021
Patrick Georgi394965d2010-11-22 13:07:10 +000022#ifndef __ROMCC__
23#define NORETURN __attribute__((noreturn))
Patrick Georgi394965d2010-11-22 13:07:10 +000024
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020025/*
26 * The method should be overwritten in mainboard directory to signal that a
27 * fatal error had occurred. On boards that do share the same EC and where the
28 * EC is capable of controlling LEDs or a buzzer the method can be overwritten
29 * in EC directory instead.
30 */
Aaron Durbin64031672018-04-21 14:45:32 -060031__weak void die_notify(void)
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020032{
33}
34
Stefan Reinauerabc0c852010-11-22 08:09:50 +000035/* Report a fatal error */
Patrick Georgi394965d2010-11-22 13:07:10 +000036void NORETURN die(const char *msg)
Stefan Reinauerabc0c852010-11-22 08:09:50 +000037{
Stefan Reinauerd6865222015-01-05 13:12:38 -080038 printk(BIOS_EMERG, "%s", msg);
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020039 die_notify();
Patrick Georgibd79c5e2014-11-28 22:35:36 +010040 halt();
Stefan Reinauerabc0c852010-11-22 08:09:50 +000041}
Stefan Reinauerd6865222015-01-05 13:12:38 -080042#endif