smmstore: Add a key/val store facility in flash, mediated through SMM
It exposes an interface that is as generic as possible, so payloads and/or kernels can use it for their data. Change-Id: I9553922f9dfa60b9d4b3576973ad4b84d3fe2fb5 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/25182 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <intelblocks/pmclib.h>
|
||||
#include <intelblocks/smihandler.h>
|
||||
#include <intelblocks/uart.h>
|
||||
#include <smmstore.h>
|
||||
#include <soc/nvs.h>
|
||||
#include <soc/pm.h>
|
||||
#include <soc/gpio.h>
|
||||
@@ -294,6 +295,27 @@ static void southbridge_smi_gsmi(
|
||||
save_state_ops->set_reg(io_smi, RAX, ret);
|
||||
}
|
||||
|
||||
static void southbridge_smi_store(
|
||||
const struct smm_save_state_ops *save_state_ops)
|
||||
{
|
||||
u8 sub_command, ret;
|
||||
void *io_smi;
|
||||
uint32_t reg_ebx;
|
||||
|
||||
io_smi = find_save_state(save_state_ops, SMMSTORE_APM_CNT);
|
||||
if (!io_smi)
|
||||
return;
|
||||
/* Command and return value in EAX */
|
||||
sub_command = (save_state_ops->get_reg(io_smi, RAX) >> 8) & 0xff;
|
||||
|
||||
/* Parameter buffer in EBX */
|
||||
reg_ebx = save_state_ops->get_reg(io_smi, RBX);
|
||||
|
||||
/* drivers/smmstore/smi.c */
|
||||
ret = smmstore_exec(sub_command, (void *)reg_ebx);
|
||||
save_state_ops->set_reg(io_smi, RAX, ret);
|
||||
}
|
||||
|
||||
static void finalize(void)
|
||||
{
|
||||
static int finalize_done;
|
||||
@@ -366,6 +388,10 @@ void smihandler_southbridge_apmc(
|
||||
if (IS_ENABLED(CONFIG_ELOG_GSMI))
|
||||
southbridge_smi_gsmi(save_state_ops);
|
||||
break;
|
||||
case SMMSTORE_APM_CNT:
|
||||
if (IS_ENABLED(CONFIG_SMMSTORE))
|
||||
southbridge_smi_store(save_state_ops);
|
||||
break;
|
||||
case APM_CNT_FINALIZE:
|
||||
finalize();
|
||||
break;
|
||||
|
Reference in New Issue
Block a user