blob: 3fc88a3e4c42c6b834f3a91bb477204fe24d349d [file] [log] [blame]
Angel Ponsb706ab32020-04-02 23:48:09 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauerabc0c852010-11-22 08:09:50 +00002
Stefan Reinauerabc0c852010-11-22 08:09:50 +00003#include <console/console.h>
Patrick Georgibd79c5e2014-11-28 22:35:36 +01004#include <halt.h>
Stefan Reinauerabc0c852010-11-22 08:09:50 +00005
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +02006/*
7 * The method should be overwritten in mainboard directory to signal that a
8 * fatal error had occurred. On boards that do share the same EC and where the
9 * EC is capable of controlling LEDs or a buzzer the method can be overwritten
10 * in EC directory instead.
11 */
Aaron Durbin64031672018-04-21 14:45:32 -060012__weak void die_notify(void)
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020013{
14}
15
Stefan Reinauerabc0c852010-11-22 08:09:50 +000016/* Report a fatal error */
Jacob Garber913437e2019-05-31 12:53:54 -060017void __noreturn die(const char *fmt, ...)
Stefan Reinauerabc0c852010-11-22 08:09:50 +000018{
Jacob Garber913437e2019-05-31 12:53:54 -060019 va_list args;
20
21 va_start(args, fmt);
22 vprintk(BIOS_EMERG, fmt, args);
23 va_end(args);
24
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020025 die_notify();
Patrick Georgibd79c5e2014-11-28 22:35:36 +010026 halt();
Stefan Reinauerabc0c852010-11-22 08:09:50 +000027}