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 Georgi | 394965d | 2010-11-22 13:07:10 +0000 | [diff] [blame] | 18 | #ifndef __ROMCC__ |
Patrick Georgi | 394965d | 2010-11-22 13:07:10 +0000 | [diff] [blame] | 19 | |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 20 | /* |
| 21 | * The method should be overwritten in mainboard directory to signal that a |
| 22 | * fatal error had occurred. On boards that do share the same EC and where the |
| 23 | * EC is capable of controlling LEDs or a buzzer the method can be overwritten |
| 24 | * in EC directory instead. |
| 25 | */ |
Aaron Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 26 | __weak void die_notify(void) |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 27 | { |
| 28 | } |
| 29 | |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 30 | /* Report a fatal error */ |
Jacob Garber | 913437e | 2019-05-31 12:53:54 -0600 | [diff] [blame] | 31 | void __noreturn die(const char *fmt, ...) |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 32 | { |
Jacob Garber | 913437e | 2019-05-31 12:53:54 -0600 | [diff] [blame] | 33 | va_list args; |
| 34 | |
| 35 | va_start(args, fmt); |
| 36 | vprintk(BIOS_EMERG, fmt, args); |
| 37 | va_end(args); |
| 38 | |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 39 | die_notify(); |
Patrick Georgi | bd79c5e | 2014-11-28 22:35:36 +0100 | [diff] [blame] | 40 | halt(); |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 41 | } |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 42 | #endif |