Add a new helper function die_with_post_code() that generates a post code and an error string prior to halting the CPU. BUG=b:124401932 BRANCH=sarien TEST=build coreboot for sarien and arcada platforms Change-Id: I87551d60b253dc13ff76f7898c1f112f573a00a2 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32838 Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* Copyright (C) 2003 Eric Biederman
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation; version 2 of
|
|
* the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#include <console/console.h>
|
|
#include <halt.h>
|
|
|
|
#ifndef __ROMCC__
|
|
|
|
/*
|
|
* The method should be overwritten in mainboard directory to signal that a
|
|
* fatal error had occurred. On boards that do share the same EC and where the
|
|
* EC is capable of controlling LEDs or a buzzer the method can be overwritten
|
|
* in EC directory instead.
|
|
*/
|
|
__weak void die_notify(void)
|
|
{
|
|
}
|
|
|
|
/* Report a fatal error */
|
|
void __noreturn die(const char *msg)
|
|
{
|
|
printk(BIOS_EMERG, "%s", msg);
|
|
die_notify();
|
|
halt();
|
|
}
|
|
|
|
/* Report a fatal error with a post code */
|
|
void __noreturn die_with_post_code(uint8_t value, const char *msg)
|
|
{
|
|
post_code(value);
|
|
die(msg);
|
|
}
|
|
#endif
|