Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/44174 )
Change subject: [TESTONLY] smm loader v2 fixups for B85M Pro4 ......................................................................
[TESTONLY] smm loader v2 fixups for B85M Pro4
Change-Id: I754c661fbad0bc5fbddfab9747607e664ad1e2b6 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/cpu/x86/mp_init.c M src/cpu/x86/smm/smm_module_loaderv2.c M src/include/cpu/x86/smm.h M src/mainboard/asrock/b85m_pro4/Kconfig 4 files changed, 17 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/44174/1
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index caed8f4..375c94e 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -726,8 +726,18 @@ * the location of the new SMBASE. If using SMM modules then this * calculation needs to match that of the module loader. */ - perm_smbase = mp_state.perm_smbase; - perm_smbase -= cpu * runtime->save_state_size; + if (CONFIG(X86_SMM_LOADER_VERSION2)) { + perm_smbase = smm_get_cpu_smbase(cpu); + mp_state.perm_smbase = perm_smbase; + + if (!perm_smbase) { + printk(BIOS_ERR, "%s: bad SMBASE for CPU %d\n", __func__, cpu); + return; + } + } else { + perm_smbase = mp_state.perm_smbase; + perm_smbase -= cpu * runtime->save_state_size; + }
printk(BIOS_DEBUG, "New SMBASE 0x%08lx\n", perm_smbase);
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c index c084f74..e6ccfdf 100644 --- a/src/cpu/x86/smm/smm_module_loaderv2.c +++ b/src/cpu/x86/smm/smm_module_loaderv2.c @@ -173,7 +173,7 @@ * input: cpu_num - cpu number which is used as an index into the * map to return the smbase */ -int smm_get_cpu_smbase(unsigned int cpu_num) +u32 smm_get_cpu_smbase(unsigned int cpu_num) { if (cpu_num < CONFIG_MAX_CPUS) { if (cpus[cpu_num].active) diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h index 7838223..084d150 100644 --- a/src/include/cpu/x86/smm.h +++ b/src/include/cpu/x86/smm.h @@ -149,21 +149,19 @@ struct smm_runtime *runtime;
/* The following are only used by X86_SMM_LOADER_VERSION2 */ - #if CONFIG(X86_SMM_LOADER_VERSION2) +#if CONFIG(X86_SMM_LOADER_VERSION2) unsigned int smm_entry; unsigned int smm_main_entry_offset; unsigned int smram_start; unsigned int smram_end; - #endif +#endif };
/* Both of these return 0 on success, < 0 on failure. */ int smm_setup_relocation_handler(struct smm_loader_params *params); int smm_load_module(void *smram, size_t size, struct smm_loader_params *params);
-#if CONFIG(X86_SMM_LOADER_VERSION2) -int smm_get_cpu_smbase(unsigned int cpu_num); -#endif +u32 smm_get_cpu_smbase(unsigned int cpu_num);
/* Backup and restore default SMM region. */ void *backup_default_smm_area(void); diff --git a/src/mainboard/asrock/b85m_pro4/Kconfig b/src/mainboard/asrock/b85m_pro4/Kconfig index dc65120..2afc334 100644 --- a/src/mainboard/asrock/b85m_pro4/Kconfig +++ b/src/mainboard/asrock/b85m_pro4/Kconfig @@ -17,6 +17,7 @@ select SERIRQ_CONTINUOUS_MODE select SOUTHBRIDGE_INTEL_LYNXPOINT select SUPERIO_NUVOTON_NCT6776 + select X86_SMM_LOADER_VERSION2
config MAINBOARD_DIR string