Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/62500 )
Change subject: cpu/x86/smm: Add weak SoC and mainboard init and exit methods ......................................................................
cpu/x86/smm: Add weak SoC and mainboard init and exit methods
This change provides hooks for the SoC and mainboard so they can perform any initialization and cleanup in the SMM handler.
For example, if we have a UART enabled firmware with DEBUG_SMI, the UART controller could have been powered off by the OS. In this case we need to power on the UART when entering SMM, and then power it off before we exit. If the OS had the UART enabled when entering SMM, we should snapshot the UART register state, and restore it on exit. Otherwise we risk clearing some interrupt enable bits.
BUG=b:221231786, b:217968734 TEST=Build test guybrush
Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: I946619cd62a974a98c575a92943b43ea639fc329 --- M src/cpu/x86/smm/smm_module_handler.c M src/include/cpu/x86/smm.h 2 files changed, 16 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/00/62500/1
diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c index 49ea016..b8cb95d 100644 --- a/src/cpu/x86/smm/smm_module_handler.c +++ b/src/cpu/x86/smm/smm_module_handler.c @@ -162,6 +162,9 @@
init_cbmemc_region();
+ smm_soc_early_init(); + smm_mainboard_early_init(); + console_init();
printk(BIOS_SPEW, "\nSMI# #%d\n", cpu); @@ -191,6 +194,9 @@ die("SMM Handler caused a stack overflow\n"); }
+ smm_mainboard_exit(); + smm_soc_exit(); + smi_release_lock();
/* De-assert SMI# signal to allow another SMI */ @@ -211,3 +217,8 @@ int __weak mainboard_smi_apmc(u8 data) { return 0; } void __weak mainboard_smi_sleep(u8 slp_typ) {} void __weak mainboard_smi_finalize(void) {} + +void __weak smm_soc_early_init(void) {} +void __weak smm_mainboard_early_init(void) {} +void __weak smm_mainboard_exit(void) {} +void __weak smm_soc_exit(void) {} diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h index 28d95e1..625f808 100644 --- a/src/include/cpu/x86/smm.h +++ b/src/include/cpu/x86/smm.h @@ -51,6 +51,11 @@ void mainboard_smi_sleep(u8 slp_typ); void mainboard_smi_finalize(void);
+void smm_soc_early_init(void); +void smm_mainboard_early_init(void); +void smm_mainboard_exit(void); +void smm_soc_exit(void); + /* This is the SMM handler. */ extern unsigned char _binary_smm_start[]; extern unsigned char _binary_smm_end[];