summaryrefslogtreecommitdiff
path: root/src/soc/intel
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2018-03-14 21:11:21 +0100
committerPatrick Georgi <pgeorgi@google.com>2018-10-08 09:46:30 +0000
commit9360feaf5121fb0b4b2d63e3168effe066650071 (patch)
treedae8bcba4a33a3920e1b57e5f2d9033fa763b32d /src/soc/intel
parent88607a4b1002ed6acc7f316f274feea2fd861095 (diff)
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>
Diffstat (limited to 'src/soc/intel')
-rw-r--r--src/soc/intel/common/block/smm/smihandler.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/smm/smihandler.c b/src/soc/intel/common/block/smm/smihandler.c
index e4c13dd4b9..f90ac578e3 100644
--- a/src/soc/intel/common/block/smm/smihandler.c
+++ b/src/soc/intel/common/block/smm/smihandler.c
@@ -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;