From d57d5e3b3737607e4351ba460d0248a195279f2d Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Wed, 27 Dec 2023 20:54:19 +0100 Subject: smmstorev2: Load the communication buffer at SMM setup This removes the runtime SMI call to set up the communication buffer for SMMSTORE in favor of setting this buffer up during the installation of the smihandler. The reason is that it's less code in the handler and a time costly SMI is also avoided in ramstage. Signed-off-by: Arthur Heymans Change-Id: I94dce77711f37f87033530f5ae48cb850a39341b Reviewed-on: https://review.coreboot.org/c/coreboot/+/79738 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/cpu/x86/smm/smm_module_handler.c | 6 ++++++ src/cpu/x86/smm/smm_module_loader.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'src/cpu/x86') diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c index 0daae00ebb..6322e59beb 100644 --- a/src/cpu/x86/smm/smm_module_handler.c +++ b/src/cpu/x86/smm/smm_module_handler.c @@ -60,6 +60,12 @@ int get_console_loglevel(void) } #endif +void smm_get_smmstore_com_buffer(uintptr_t *base, size_t *size) +{ + *base = smm_runtime.smmstore_com_buffer_base; + *size = smm_runtime.smmstore_com_buffer_size; +} + void smm_get_cbmemc_buffer(void **buffer_out, size_t *size_out) { *buffer_out = smm_runtime.cbmemc; diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c index ea51d63e83..646f3bb551 100644 --- a/src/cpu/x86/smm/smm_module_loader.c +++ b/src/cpu/x86/smm/smm_module_loader.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -350,6 +351,22 @@ static void setup_smihandler_params(struct smm_runtime *mod_params, if (CONFIG(SMM_PCI_RESOURCE_STORE)) smm_pci_resource_store_init(mod_params); + + if (CONFIG(SMMSTORE_V2)) { + struct smmstore_params_info info; + if (smmstore_get_info(&info) < 0) { + printk(BIOS_INFO, "SMMSTORE: Failed to get meta data\n"); + return; + } + + void *ptr = cbmem_add(CBMEM_ID_SMM_COMBUFFER, info.block_size); + if (!ptr) { + printk(BIOS_ERR, "SMMSTORE: Failed to add com buffer\n"); + return; + } + mod_params->smmstore_com_buffer_base = (uintptr_t)ptr; + mod_params->smmstore_com_buffer_size = info.block_size; + } } static void print_region(const char *name, const struct region region) -- cgit v1.2.3