Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/50765 )
Change subject: cpu/x86/mp_init.c: Copy the stub parameter start32_offset into ramstage ......................................................................
cpu/x86/mp_init.c: Copy the stub parameter start32_offset into ramstage
Keep a copy of start32_offset into ramstage to avoid needing to pass arguments, calling from assembly. Doing this in C code is better than assembly.
Change-Id: Iac04358e377026f45293bbee03e30d792df407fd Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/cpu/x86/mp_init.c M src/cpu/x86/smm/smm_module_loaderv2.c M src/cpu/x86/smm/smm_stub.S M src/include/cpu/x86/smm.h 4 files changed, 10 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/50765/1
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index a760c8b..281dff6 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -686,6 +686,7 @@ uintptr_t perm_smbase; size_t perm_smsize; size_t smm_save_state_size; + uintptr_t reloc_start32_offset; int do_smm; } mp_state;
@@ -755,7 +756,7 @@ stm_setup(mseg, p->cpu, perm_smbase, mp_state.perm_smbase, - runtime->start32_offset); + mp_state.reloc_start32_offset); } }
@@ -796,6 +797,8 @@ } adjust_smm_apic_id_map(&smm_params);
+ mp_state.reloc_start32_offset = smm_params.stub_params->start32_offset; + return 0; }
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c index 05f46f7..9307a47 100644 --- a/src/cpu/x86/smm/smm_module_loaderv2.c +++ b/src/cpu/x86/smm/smm_module_loaderv2.c @@ -447,7 +447,7 @@ printk(BIOS_DEBUG, "%s: runtime.smbase = 0x%x\n", __func__, stub_params->runtime.smbase); printk(BIOS_DEBUG, "%s: runtime.start32_offset = 0x%x\n", __func__, - stub_params->runtime.start32_offset); + stub_params->start32_offset); printk(BIOS_DEBUG, "%s: runtime.smm_size = 0x%zx\n", __func__, smm_size); printk(BIOS_DEBUG, "%s: per_cpu_save_state_size = 0x%x\n", diff --git a/src/cpu/x86/smm/smm_stub.S b/src/cpu/x86/smm/smm_stub.S index 9dac68f..f5b4a3b 100644 --- a/src/cpu/x86/smm/smm_stub.S +++ b/src/cpu/x86/smm/smm_stub.S @@ -32,6 +32,9 @@ * into the table. */ apic_to_cpu_num: .fill CONFIG_MAX_CPUS,1,0xff +/* allows the STM to bring up SMM in 32-bit mode */ +start32_offset: +.long smm_trampoline32 - _start
/* struct smm_runtime begins here. */ smm_runtime: @@ -45,9 +48,6 @@ .long 0 gnvs_ptr: .long 0 -/* allows the STM to bring up SMM in 32-bit mode */ -start32_offset: -.long smm_trampoline32 - _start /* end struct smm_runtime */
.data diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h index a6d087d..c13b8c8 100644 --- a/src/include/cpu/x86/smm.h +++ b/src/include/cpu/x86/smm.h @@ -60,8 +60,6 @@ u32 save_state_size; u32 num_cpus; u32 gnvs_ptr; - /* STM's 32bit entry into SMI handler */ - u32 start32_offset; } __packed;
struct smm_module_params { @@ -90,6 +88,8 @@ * contiguous like the 1:1 mapping it is up to the caller of the stub * loader to adjust this mapping. */ u8 apic_id_to_cpu[CONFIG_MAX_CPUS]; + /* STM's 32bit entry into SMI handler */ + u32 start32_offset; struct smm_runtime runtime; } __packed;