Hello Aaron Durbin,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/34991
to review the following change.
Change subject: arch/x86: Include stack_top region into postcar_frame ......................................................................
arch/x86: Include stack_top region into postcar_frame
This patch signals to the system that stack region also needs to be accounted for as it holds MTRR related values.
Change-Id: I9279bbd66be0ad309bdabbbb90bf59c6f5967c47 Signed-off-by: Aaron Durbin adurbin@chromium.org Signed-off-by: Subrata Banik subrata.banik@intel.com --- M src/arch/x86/include/arch/cpu.h M src/arch/x86/postcar_loader.c 2 files changed, 12 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/34991/1
diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index 9aa446e..075e890 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -298,6 +298,7 @@ */
struct postcar_frame { + uintptr_t stack_top; uintptr_t stack; uint32_t upper_mask; int max_var_mtrrs; diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c index b1b2da0..d017260 100644 --- a/src/arch/x86/postcar_loader.c +++ b/src/arch/x86/postcar_loader.c @@ -66,7 +66,10 @@
postcar_frame_prepare(pcf); pcf->stack = (uintptr_t)stack; - pcf->stack += stack_size; + /* Keep track of stack top to calculate size used */ + pcf->stack_top = pcf->stack; + pcf->stack_top += stack_size; + return 0; }
@@ -143,15 +146,18 @@ return (void *) pcf->stack; }
-static void finalize_load(uintptr_t *stack_top_ptr, uintptr_t stack_top) +static void finalize_load(uintptr_t *stack_top_ptr, + const struct postcar_frame *pcf) { - *stack_top_ptr = stack_top; + *stack_top_ptr = 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)stack_top_ptr, sizeof(uintptr_t), SEG_FINAL); + /* Also signal the stack region that was written as well */ + prog_segment_loaded(pcf->stack, pcf->stack_top - pcf->stack, SEG_FINAL); }
static void load_postcar_cbfs(struct prog *prog, struct postcar_frame *pcf) @@ -173,7 +179,7 @@ die_with_post_code(POST_INVALID_ROM, "No parameters found in after CAR program.\n");
- finalize_load(rsl.params, pcf->stack); + finalize_load(rsl.params, pcf);
stage_cache_add(STAGE_POSTCAR, prog); } @@ -191,7 +197,7 @@ /* 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); + finalize_load(prog.arg, pcf); } else load_postcar_cbfs(&prog, pcf);