Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/63477 )
Change subject: cpu/x86/smm_module_loader: Add a convenient ss_top ......................................................................
cpu/x86/smm_module_loader: Add a convenient ss_top
We don't want to keep track of the real smm size all the time.
As a bonus now ss_start is now really the start of the save state instead of top - MAX(stub_size, save state size).
Change-Id: I0981022e6c0df110d4a342ff06b1a3332911e2b7 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/cpu/x86/smm/smm_module_loader.c 1 file changed, 6 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/77/63477/1
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c index 00dc589..9e87941 100644 --- a/src/cpu/x86/smm/smm_module_loader.c +++ b/src/cpu/x86/smm/smm_module_loader.c @@ -42,6 +42,7 @@ uint8_t active; uintptr_t smbase; uintptr_t ss_start; + uintptr_t ss_top; uintptr_t code_start; uintptr_t code_end; }; @@ -120,13 +121,11 @@ - needed_ss_size * (i % cpus_per_segment) + SMM_ENTRY_OFFSET; cpus[i].smbase = cpus[i].code_start - SMM_ENTRY_OFFSET; - cpus[i].ss_start = - cpus[i].code_start + (SMM_ENTRY_OFFSET - needed_ss_size); + cpus[i].ss_top = cpus[i].code_start + SMM_ENTRY_OFFSET; + cpus[i].ss_start = cpus[i].ss_top - params->real_cpu_save_state_size; cpus[i].code_end = cpus[i].code_start + stub_size; printk(BIOS_DEBUG, " Stub [0x%lx-0x%lx[\n", cpus[i].code_start, cpus[i].code_end); - printk(BIOS_DEBUG, " Save state [0x%lx-0x%lx[\n", - cpus[i].ss_start + needed_ss_size - params->real_cpu_save_state_size, - cpus[i].ss_start + needed_ss_size); + printk(BIOS_DEBUG, " Save state [0x%lx-0x%lx[\n", cpus[i].ss_start, cpus[i].ss_top); cpus[i].active = 1; }
@@ -498,8 +497,7 @@ }
for (int i = 0; i < params->num_cpus; i++) { - smihandler_params->save_state_top[i] = - cpus[i].ss_start + params->per_cpu_save_state_size; + smihandler_params->save_state_top[i] = cpus[i].ss_top; }
const uintptr_t lowest_stub = cpus[params->num_concurrent_save_states - 1].code_start; @@ -611,8 +609,7 @@ }
for (int i = 0; i < params->num_cpus; i++) { - smihandler_params->save_state_top[i] = - cpus[i].ss_start + params->per_cpu_save_state_size; + smihandler_params->save_state_top[i] = cpus[i].ss_top; }
return smm_module_setup_stub(smram_base, smram_size, params, (void *)fx_save_area_base);