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> |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 5 | |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 6 | /* |
| 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 Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 12 | __weak void die_notify(void) |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 13 | { |
| 14 | } |
| 15 | |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 16 | /* Report a fatal error */ |
Jacob Garber | 913437e | 2019-05-31 12:53:54 -0600 | [diff] [blame] | 17 | void __noreturn die(const char *fmt, ...) |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 18 | { |
Jacob Garber | 913437e | 2019-05-31 12:53:54 -0600 | [diff] [blame] | 19 | va_list args; |
| 20 | |
| 21 | va_start(args, fmt); |
| 22 | vprintk(BIOS_EMERG, fmt, args); |
| 23 | va_end(args); |
| 24 | |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 25 | die_notify(); |
Patrick Georgi | bd79c5e | 2014-11-28 22:35:36 +0100 | [diff] [blame] | 26 | halt(); |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 27 | } |