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>
This commit is contained in:
parent
5747f6cdd1
commit
cb361da78f
|
@ -43,6 +43,7 @@ struct cpu_smm_info {
|
||||||
uint8_t active;
|
uint8_t active;
|
||||||
uintptr_t smbase;
|
uintptr_t smbase;
|
||||||
uintptr_t ss_start;
|
uintptr_t ss_start;
|
||||||
|
uintptr_t ss_top;
|
||||||
uintptr_t code_start;
|
uintptr_t code_start;
|
||||||
uintptr_t code_end;
|
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);
|
- needed_ss_size * (i % cpus_per_segment);
|
||||||
cpus[i].code_start = cpus[i].smbase + SMM_ENTRY_OFFSET;
|
cpus[i].code_start = cpus[i].smbase + SMM_ENTRY_OFFSET;
|
||||||
cpus[i].code_end = cpus[i].code_start + stub_size;
|
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,
|
printk(BIOS_DEBUG, " Stub [0x%lx-0x%lx[\n", cpus[i].code_start,
|
||||||
cpus[i].code_end);
|
cpus[i].code_end);
|
||||||
printk(BIOS_DEBUG, " Save state [0x%lx-0x%lx[\n",
|
printk(BIOS_DEBUG, " Save state [0x%lx-0x%lx[\n", cpus[i].ss_start,
|
||||||
cpus[i].ss_start + needed_ss_size - params->real_cpu_save_state_size,
|
cpus[i].ss_top);
|
||||||
cpus[i].ss_start + needed_ss_size);
|
|
||||||
cpus[i].active = 1;
|
cpus[i].active = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,10 +434,8 @@ static void setup_smihandler_params(struct smm_runtime *mod_params,
|
||||||
mod_params->cbmemc_size = 0;
|
mod_params->cbmemc_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < loader_params->num_cpus; i++) {
|
for (int i = 0; i < loader_params->num_cpus; i++)
|
||||||
mod_params->save_state_top[i] = cpus[i].ss_start
|
mod_params->save_state_top[i] = cpus[i].ss_top;
|
||||||
+ loader_params->per_cpu_save_state_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue