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>
This commit is contained in:
parent
df327f4a88
commit
a0a26a77c0
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue