Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
Stefan Reinauer | 5ff7c13 | 2011-10-31 12:56:45 -0700 | [diff] [blame] | 3 | * |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation; version 2 of |
| 7 | * the License. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 13 | */ |
| 14 | |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 15 | #include <console/console.h> |
Patrick Georgi | bd79c5e | 2014-11-28 22:35:36 +0100 | [diff] [blame] | 16 | #include <halt.h> |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 17 | |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 18 | /* |
| 19 | * The method should be overwritten in mainboard directory to signal that a |
| 20 | * fatal error had occurred. On boards that do share the same EC and where the |
| 21 | * EC is capable of controlling LEDs or a buzzer the method can be overwritten |
| 22 | * in EC directory instead. |
| 23 | */ |
Aaron Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 24 | __weak void die_notify(void) |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 25 | { |
| 26 | } |
| 27 | |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 28 | /* Report a fatal error */ |
Jacob Garber | 913437e | 2019-05-31 12:53:54 -0600 | [diff] [blame] | 29 | void __noreturn die(const char *fmt, ...) |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 30 | { |
Jacob Garber | 913437e | 2019-05-31 12:53:54 -0600 | [diff] [blame] | 31 | va_list args; |
| 32 | |
| 33 | va_start(args, fmt); |
| 34 | vprintk(BIOS_EMERG, fmt, args); |
| 35 | va_end(args); |
| 36 | |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 37 | die_notify(); |
Patrick Georgi | bd79c5e | 2014-11-28 22:35:36 +0100 | [diff] [blame] | 38 | halt(); |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 39 | } |