Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37683 )
Change subject: arch/x86: Fix S3 resume without stage cache ......................................................................
arch/x86: Fix S3 resume without stage cache
It is possible to have NO_STAGE_CACHE=n and at the same time have TSEG_STAGE_CACHE=n and CBMEB_STAGE_CACHE=n. This resulted with a failing attempt to load STAGE_POSTCAR from the stage cache, but not loading it from CBFS either.
Change-Id: I0da3e1cf4c92817ffabbb02eda3476ecdfdfa278 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/arch/x86/postcar_loader.c 1 file changed, 19 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/83/37683/1
diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c index b53cbf8..46a62e8 100644 --- a/src/arch/x86/postcar_loader.c +++ b/src/arch/x86/postcar_loader.c @@ -19,6 +19,7 @@ #include <cpu/x86/mtrr.h> #include <cpu/x86/smm.h> #include <program_loading.h> +#include <reset.h> #include <rmodule.h> #include <romstage_handoff.h> #include <stage_cache.h> @@ -208,6 +209,15 @@ MTRR_TYPE_WRBACK); }
+static void postcar_cache_invalid(void) +{ + if (!CONFIG(TSEG_STAGE_CACHE) && !CONFIG(CBMEM_STAGE_CACHE)) + return; + + printk(BIOS_ERR, "postcar cache invalid.\n"); + board_reset(); +} + void run_postcar_phase(struct postcar_frame *pcf) { struct prog prog = @@ -215,14 +225,19 @@
postcar_commit_mtrrs(pcf);
- if (!CONFIG(NO_STAGE_CACHE) && - romstage_handoff_is_resume()) { + if (romstage_handoff_is_resume()) { stage_cache_load_stage(STAGE_POSTCAR, &prog); + /* This is here to allow platforms to pass different stack parameters between S3 resume and normal boot. On the platforms where the values are the same it's a nop. */ - finalize_load(prog.arg, pcf->stack); - } else + if (prog_entry(&prog) != NULL) + finalize_load(prog.arg, pcf->stack); + else + postcar_cache_invalid(); + } + + if (prog_entry(&prog) == NULL) load_postcar_cbfs(&prog, pcf);
/* As postcar exist, it's end of romstage here */