blob: d9e1dee2b9669e2d5bf826a8593309573ef99761 [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>
Elyes Haouas89822ad2022-10-02 12:26:47 +02005#include <stdarg.h>
Stefan Reinauerabc0c852010-11-22 08:09:50 +00006
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +02007/*
8 * The method should be overwritten in mainboard directory to signal that a
9 * fatal error had occurred. On boards that do share the same EC and where the
10 * EC is capable of controlling LEDs or a buzzer the method can be overwritten
11 * in EC directory instead.
12 */
Aaron Durbin64031672018-04-21 14:45:32 -060013__weak void die_notify(void)
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020014{
15}
16
Stefan Reinauerabc0c852010-11-22 08:09:50 +000017/* Report a fatal error */
Jacob Garber913437e2019-05-31 12:53:54 -060018void __noreturn die(const char *fmt, ...)
Stefan Reinauerabc0c852010-11-22 08:09:50 +000019{
Jacob Garber913437e2019-05-31 12:53:54 -060020 va_list args;
21
22 va_start(args, fmt);
23 vprintk(BIOS_EMERG, fmt, args);
24 va_end(args);
25
Patrick Rudolph4b7b18d2017-05-17 19:08:32 +020026 die_notify();
Patrick Georgibd79c5e2014-11-28 22:35:36 +010027 halt();
Stefan Reinauerabc0c852010-11-22 08:09:50 +000028}