aboutsummaryrefslogtreecommitdiff
path: root/src/lib/prog_loaders.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-10-28 17:32:24 -0500
committerAaron Durbin <adurbin@chromium.org>2016-10-31 19:34:20 +0100
commit8cd723bc0cb64f28b1009fd2fa55f6680a402b61 (patch)
tree97aad8d8164e39d12b0c710f6a16b59950a367c7 /src/lib/prog_loaders.c
parent9a2790e328c4cabefa201995aa4812be414d93c3 (diff)
lib/prog_loaders: use common ramstage_cache_invalid()
All current implementations of ramstage_cache_invalid() were just resetting the system based on the RESET_ON_INVALID_RAMSTAGE_CACHE Kconfig option. Move that behavior to a single implementation within prog_loaders.c which removes duplication. Change-Id: I67aae73f9e1305732f90d947fe57c5aaf66ada9e Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/17184 Tested-by: build bot (Jenkins) Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/lib/prog_loaders.c')
-rw-r--r--src/lib/prog_loaders.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/prog_loaders.c b/src/lib/prog_loaders.c
index c0dcd60d61..09933ae70c 100644
--- a/src/lib/prog_loaders.c
+++ b/src/lib/prog_loaders.c
@@ -22,6 +22,7 @@
#include <halt.h>
#include <lib.h>
#include <program_loading.h>
+#include <reset.h>
#include <romstage_handoff.h>
#include <rmodule.h>
#include <rules.h>
@@ -74,7 +75,15 @@ void __attribute__((weak)) stage_cache_add(int stage_id,
const struct prog *stage) {}
void __attribute__((weak)) stage_cache_load_stage(int stage_id,
struct prog *stage) {}
-void __attribute__((weak)) ramstage_cache_invalid(void) {}
+
+static void ramstage_cache_invalid(void)
+{
+ printk(BIOS_ERR, "ramstage cache invalid.\n");
+ if (IS_ENABLED(CONFIG_RESET_ON_INVALID_RAMSTAGE_CACHE)) {
+ hard_reset();
+ halt();
+ }
+}
static void run_ramstage_from_resume(struct romstage_handoff *handoff,
struct prog *ramstage)