blob: e57c4e4bf29e816341ac50d044f25f3a2b971be8 [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 Rudolph4b7b18d2017-05-17 19:08:32 +020018/*
19 * The method should be overwritten in mainboard directory to signal that a
20 * fatal error had occurred. On boards that do share the same EC and where the
21 * EC is capable of controlling LEDs or a buzzer the method can be overwritten
22 * in EC directory instead.
23 */
Aaron Durbin64031672018-04-21 14:45:32 -060024__weak void die_notify(void)
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020025{
26}
27
Stefan Reinauerabc0c852010-11-22 08:09:50 +000028/* Report a fatal error */
Jacob Garber913437e2019-05-31 12:53:54 -060029void __noreturn die(const char *fmt, ...)
Stefan Reinauerabc0c852010-11-22 08:09:50 +000030{
Jacob Garber913437e2019-05-31 12:53:54 -060031 va_list args;
32
33 va_start(args, fmt);
34 vprintk(BIOS_EMERG, fmt, args);
35 va_end(args);
36
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020037 die_notify();
Patrick Georgibd79c5e2014-11-28 22:35:36 +010038 halt();
Stefan Reinauerabc0c852010-11-22 08:09:50 +000039}