diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2022-04-07 21:20:50 +0200 |
---|---|---|
committer | Martin L Roth <gaumless@tutanota.com> | 2022-05-28 05:03:19 +0000 |
commit | cb361da78fc53b7678b43026ae997af708246273 (patch) | |
tree | 4390f291ce162d68b1bdbe34896b289b8dcae8a9 /src | |
parent | 5747f6cdd15d494c101c2d2b2475968d1f7e4745 (diff) |
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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63477
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@tutanota.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu/x86/smm/smm_module_loader.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c index 071b33673d..f97f747132 100644 --- a/src/cpu/x86/smm/smm_module_loader.c +++ b/src/cpu/x86/smm/smm_module_loader.c @@ -43,6 +43,7 @@ struct cpu_smm_info { uint8_t active; uintptr_t smbase; uintptr_t ss_start; + uintptr_t ss_top; uintptr_t code_start; uintptr_t code_end; }; @@ -125,12 +126,12 @@ static int smm_create_map(const uintptr_t smbase, const unsigned int num_cpus, - needed_ss_size * (i % cpus_per_segment); cpus[i].code_start = cpus[i].smbase + SMM_ENTRY_OFFSET; cpus[i].code_end = cpus[i].code_start + stub_size; - cpus[i].ss_start = cpus[i].smbase + SMM_CODE_SEGMENT_SIZE - needed_ss_size; + cpus[i].ss_top = cpus[i].smbase + SMM_CODE_SEGMENT_SIZE; + cpus[i].ss_start = cpus[i].ss_top - params->real_cpu_save_state_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; } @@ -433,10 +434,8 @@ static void setup_smihandler_params(struct smm_runtime *mod_params, mod_params->cbmemc_size = 0; } - for (int i = 0; i < loader_params->num_cpus; i++) { - mod_params->save_state_top[i] = cpus[i].ss_start - + loader_params->per_cpu_save_state_size; - } + for (int i = 0; i < loader_params->num_cpus; i++) + mod_params->save_state_top[i] = cpus[i].ss_top; } /* |