Angel Pons | b706ab3 | 2020-04-02 23:48:09 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 2 | |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 3 | #include <console/console.h> |
Patrick Georgi | bd79c5e | 2014-11-28 22:35:36 +0100 | [diff] [blame] | 4 | #include <halt.h> |
Elyes Haouas | 89822ad | 2022-10-02 12:26:47 +0200 | [diff] [blame] | 5 | #include <stdarg.h> |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 6 | |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 7 | /* |
| 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 Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 13 | __weak void die_notify(void) |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 14 | { |
| 15 | } |
| 16 | |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 17 | /* Report a fatal error */ |
Jacob Garber | 913437e | 2019-05-31 12:53:54 -0600 | [diff] [blame] | 18 | void __noreturn die(const char *fmt, ...) |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 19 | { |
Jacob Garber | 913437e | 2019-05-31 12:53:54 -0600 | [diff] [blame] | 20 | va_list args; |
| 21 | |
| 22 | va_start(args, fmt); |
| 23 | vprintk(BIOS_EMERG, fmt, args); |
| 24 | va_end(args); |
| 25 | |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 26 | die_notify(); |
Patrick Georgi | bd79c5e | 2014-11-28 22:35:36 +0100 | [diff] [blame] | 27 | halt(); |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 28 | } |