blob: 76c456d1fb53be6f557b079a9915c20411dc8822 [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 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; version 2 of
7 * the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Stefan Reinauerabc0c852010-11-22 08:09:50 +000013 */
14
Stefan Reinauerabc0c852010-11-22 08:09:50 +000015#include <console/console.h>
Patrick Georgibd79c5e2014-11-28 22:35:36 +010016#include <halt.h>
Stefan Reinauerabc0c852010-11-22 08:09:50 +000017
Patrick Georgi394965d2010-11-22 13:07:10 +000018#ifndef __ROMCC__
Patrick Georgi394965d2010-11-22 13:07:10 +000019
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020020/*
21 * The method should be overwritten in mainboard directory to signal that a
22 * fatal error had occurred. On boards that do share the same EC and where the
23 * EC is capable of controlling LEDs or a buzzer the method can be overwritten
24 * in EC directory instead.
25 */
Aaron Durbin64031672018-04-21 14:45:32 -060026__weak void die_notify(void)
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020027{
28}
29
Stefan Reinauerabc0c852010-11-22 08:09:50 +000030/* Report a fatal error */
Jacob Garber913437e2019-05-31 12:53:54 -060031void __noreturn die(const char *fmt, ...)
Stefan Reinauerabc0c852010-11-22 08:09:50 +000032{
Jacob Garber913437e2019-05-31 12:53:54 -060033 va_list args;
34
35 va_start(args, fmt);
36 vprintk(BIOS_EMERG, fmt, args);
37 va_end(args);
38
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