From a0a26a77c0ed00a43f6832a2985d37a0a67975ff Mon Sep 17 00:00:00 2001 From: Felix Held Date: Thu, 4 Jan 2024 17:28:33 +0100 Subject: drivers/smmstore/ramstage: use call_smm Use call_smm instead of open-coding the same in inline assembly functionality in init_store. The local ebx variable is dropped, since call_smm takes a pointer to the argument instead of an integer, and the local eax variable is renamed to res to make the code a bit clearer, since the EAX register is used for both passing the command and subcommand to the APMC SMI handler and to get the return value from the handler. TEST=SMMSTORE V2 still works with the EDK2 payload on Careena Signed-off-by: Felix Held Change-Id: Ib14de0d120ae5c7db3bb7a529837ababe653e1a2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/79766 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/drivers/smmstore/ramstage.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/smmstore/ramstage.c b/src/drivers/smmstore/ramstage.c index ef80e221bc..e59090dad3 100644 --- a/src/drivers/smmstore/ramstage.c +++ b/src/drivers/smmstore/ramstage.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -37,8 +38,7 @@ void lb_smmstorev2(struct lb_header *header) static void init_store(void *unused) { struct smmstore_params_init args; - uint32_t eax = ~0; - uint32_t ebx; + uint32_t ret = ~0; if (smmstore_get_info(&info) < 0) { printk(BIOS_INFO, "SMMSTORE: Failed to get meta data\n"); @@ -53,20 +53,13 @@ static void init_store(void *unused) args.com_buffer = (uintptr_t)ptr; args.com_buffer_size = info.block_size; - ebx = (uintptr_t)&args; printk(BIOS_INFO, "SMMSTORE: Setting up SMI handler\n"); /* Issue SMI using APM to update the com buffer and to lock the SMMSTORE */ - __asm__ __volatile__ ( - "outb %%al, %%dx" - : "=a" (eax) - : "a" ((SMMSTORE_CMD_INIT << 8) | APM_CNT_SMMSTORE), - "b" (ebx), - "d" (APM_CNT) - : "memory"); + ret = call_smm(APM_CNT_SMMSTORE, SMMSTORE_CMD_INIT, &args); - if (eax != SMMSTORE_RET_SUCCESS) { + if (ret != SMMSTORE_RET_SUCCESS) { printk(BIOS_ERR, "SMMSTORE: Failed to install com buffer\n"); return; } -- cgit v1.2.3