2020-04-02 23:48:09 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2010-11-22 09:09:50 +01:00
|
|
|
|
|
|
|
#include <console/console.h>
|
2014-11-28 22:35:36 +01:00
|
|
|
#include <halt.h>
|
2010-11-22 09:09:50 +01:00
|
|
|
|
2017-05-17 19:08:32 +02:00
|
|
|
/*
|
|
|
|
* The method should be overwritten in mainboard directory to signal that a
|
|
|
|
* fatal error had occurred. On boards that do share the same EC and where the
|
|
|
|
* EC is capable of controlling LEDs or a buzzer the method can be overwritten
|
|
|
|
* in EC directory instead.
|
|
|
|
*/
|
2018-04-21 22:45:32 +02:00
|
|
|
__weak void die_notify(void)
|
2017-05-17 19:08:32 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-11-22 09:09:50 +01:00
|
|
|
/* Report a fatal error */
|
console: Make die() and friends variadic
die() currently only accepts a fixed message string, which is rather
inconvenient when there is extra information that would be helpful to
print in the error message. This currently requires an extra call to
printk(), which is somewhat awkward:
printk(BIOS_EMERG, "Bad table, opcode %d at %d", id, i);
die(""); // what do I say here?
die() already has a printk() inside it to print the error message, so
let's just make it variadic to combine the two.
die("Bad table, opcode %d at %d", id, i); // much better
Forwarding variadic arguments from one function to another is rather
tricky, so die_with_post_code() is redefined as a variadic macro
instead.
Change-Id: I28b9eac32899a1aa89e086e0d3889b75459581aa
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33153
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
2019-05-31 20:53:54 +02:00
|
|
|
void __noreturn die(const char *fmt, ...)
|
2010-11-22 09:09:50 +01:00
|
|
|
{
|
console: Make die() and friends variadic
die() currently only accepts a fixed message string, which is rather
inconvenient when there is extra information that would be helpful to
print in the error message. This currently requires an extra call to
printk(), which is somewhat awkward:
printk(BIOS_EMERG, "Bad table, opcode %d at %d", id, i);
die(""); // what do I say here?
die() already has a printk() inside it to print the error message, so
let's just make it variadic to combine the two.
die("Bad table, opcode %d at %d", id, i); // much better
Forwarding variadic arguments from one function to another is rather
tricky, so die_with_post_code() is redefined as a variadic macro
instead.
Change-Id: I28b9eac32899a1aa89e086e0d3889b75459581aa
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33153
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
2019-05-31 20:53:54 +02:00
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
|
|
|
vprintk(BIOS_EMERG, fmt, args);
|
|
|
|
va_end(args);
|
|
|
|
|
2017-05-17 19:08:32 +02:00
|
|
|
die_notify();
|
2014-11-28 22:35:36 +01:00
|
|
|
halt();
|
2010-11-22 09:09:50 +01:00
|
|
|
}
|