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 | * Copyright (C) 2003 Eric Biederman |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <arch/io.h> |
Aaron Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 18 | #include <compiler.h> |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 19 | #include <console/console.h> |
Patrick Georgi | bd79c5e | 2014-11-28 22:35:36 +0100 | [diff] [blame] | 20 | #include <halt.h> |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 21 | |
Patrick Georgi | 394965d | 2010-11-22 13:07:10 +0000 | [diff] [blame] | 22 | #ifndef __ROMCC__ |
| 23 | #define NORETURN __attribute__((noreturn)) |
Patrick Georgi | 394965d | 2010-11-22 13:07:10 +0000 | [diff] [blame] | 24 | |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 25 | /* |
| 26 | * The method should be overwritten in mainboard directory to signal that a |
| 27 | * fatal error had occurred. On boards that do share the same EC and where the |
| 28 | * EC is capable of controlling LEDs or a buzzer the method can be overwritten |
| 29 | * in EC directory instead. |
| 30 | */ |
Aaron Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 31 | __weak void die_notify(void) |
Patrick Rudolph | 4b7b18d | 2017-05-17 19:08:32 +0200 | [diff] [blame] | 32 | { |
| 33 | } |
| 34 | |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 35 | /* Report a fatal error */ |
Patrick Georgi | 394965d | 2010-11-22 13:07:10 +0000 | [diff] [blame] | 36 | void NORETURN die(const char *msg) |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 37 | { |
Stefan Reinauer | d686522 | 2015-01-05 13:12:38 -0800 | [diff] [blame] | 38 | printk(BIOS_EMERG, "%s", msg); |
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 |