diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2017-09-05 22:43:05 +0300 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2017-09-08 03:18:04 +0000 |
commit | a7421fb9cb91b4f6467d6e658f00aa8c34d7ebd8 (patch) | |
tree | 1be354fd05ce991e65198a90caf2717e53a56650 /src | |
parent | d87e4b346943110a6d919aa52444bb420e2755be (diff) | |
download | coreboot-a7421fb9cb91b4f6467d6e658f00aa8c34d7ebd8.tar.xz |
arch/x86 postcar: Fix use with stage_cache
Postcar failed when loading from stage_cache, if
romstage did not pass same pcf->stack on normal
and resume paths.
Change-Id: I853afb1fbdb942fd671d89950911c850c96e3af3
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/21444
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/x86/postcar_loader.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c index 287a0d807b..0d2f0b59b5 100644 --- a/src/arch/x86/postcar_loader.c +++ b/src/arch/x86/postcar_loader.c @@ -124,6 +124,17 @@ void *postcar_commit_mtrrs(struct postcar_frame *pcf) return (void *) pcf->stack; } +static void finalize_load(uintptr_t *stack_top_ptr, uintptr_t stack_top) +{ + *stack_top_ptr = stack_top; + /* + * Signal to rest of system that another update was made to the + * postcar program prior to running it. + */ + prog_segment_loaded((uintptr_t)stack_top_ptr, sizeof(uintptr_t), + SEG_FINAL); +} + static void load_postcar_cbfs(struct prog *prog, struct postcar_frame *pcf) { struct rmod_stage_load rsl = { @@ -140,14 +151,7 @@ static void load_postcar_cbfs(struct prog *prog, struct postcar_frame *pcf) if (rsl.params == NULL) die("No parameters found in after CAR program.\n"); - *(uintptr_t *)rsl.params = pcf->stack; - - /* - * Signal to rest of system that another update was made to the - * postcar program prior to running it. - */ - prog_segment_loaded((uintptr_t)rsl.params, sizeof(uintptr_t), - SEG_FINAL); + finalize_load(rsl.params, pcf->stack); if (!IS_ENABLED(CONFIG_NO_STAGE_CACHE)) stage_cache_add(STAGE_POSTCAR, prog); @@ -160,9 +164,11 @@ void run_postcar_phase(struct postcar_frame *pcf) postcar_commit_mtrrs(pcf); - if (!IS_ENABLED(CONFIG_NO_STAGE_CACHE) && romstage_handoff_is_resume()) + if (!IS_ENABLED(CONFIG_NO_STAGE_CACHE) && + romstage_handoff_is_resume()) { stage_cache_load_stage(STAGE_POSTCAR, &prog); - else + finalize_load(prog.arg, pcf->stack); + } else load_postcar_cbfs(&prog, pcf); prog_run(&prog); |