summaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2024-01-04 17:28:33 +0100
committerFelix Held <felix-coreboot@felixheld.de>2024-01-11 22:35:04 +0000
commita0a26a77c0ed00a43f6832a2985d37a0a67975ff (patch)
tree3b55e12aa28f4ea7beff607c938b3bb4c134361a /src/drivers
parentdf327f4a88bcfd6bc5db8256698f9e293bb9e03f (diff)
downloadcoreboot-a0a26a77c0ed00a43f6832a2985d37a0a67975ff.tar.gz
coreboot-a0a26a77c0ed00a43f6832a2985d37a0a67975ff.tar.bz2
coreboot-a0a26a77c0ed00a43f6832a2985d37a0a67975ff.zip
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 <felix-coreboot@felixheld.de> Change-Id: Ib14de0d120ae5c7db3bb7a529837ababe653e1a2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/79766 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/smmstore/ramstage.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/drivers/smmstore/ramstage.c b/src/drivers/smmstore/ramstage.c
index ef80e221bc0a..e59090dad3fc 100644
--- a/src/drivers/smmstore/ramstage.c
+++ b/src/drivers/smmstore/ramstage.c
@@ -5,6 +5,7 @@
#include <commonlib/helpers.h>
#include <commonlib/region.h>
#include <console/console.h>
+#include <smm_call.h>
#include <smmstore.h>
#include <types.h>
#include <cbmem.h>
@@ -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;
}