summaryrefslogtreecommitdiff
path: root/src/cpu/x86
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/x86')
-rw-r--r--src/cpu/x86/smm/smihandler.c8
-rw-r--r--src/cpu/x86/smm/smm_module_handler.c7
2 files changed, 15 insertions, 0 deletions
diff --git a/src/cpu/x86/smm/smihandler.c b/src/cpu/x86/smm/smihandler.c
index 8fd95bb563..8f7ebfbf66 100644
--- a/src/cpu/x86/smm/smihandler.c
+++ b/src/cpu/x86/smm/smihandler.c
@@ -120,6 +120,14 @@ static inline void *smm_save_state(uintptr_t base, int arch_offset, int node)
return (void *)base;
}
+/* This returns the SMM revision from the savestate of CPU0,
+ which is assumed to be the same for all CPU's. See the memory
+ map in smmhandler.S */
+uint32_t smm_revision(void)
+{
+ return *(uint32_t *)(SMM_BASE + SMM_ENTRY_OFFSET * 2 - SMM_REVISION_OFFSET_FROM_TOP);
+}
+
bool smm_region_overlaps_handler(const struct region *r)
{
const struct region r_smm = {SMM_BASE, SMM_DEFAULT_SIZE};
diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c
index 0884819ea2..d987ddc476 100644
--- a/src/cpu/x86/smm/smm_module_handler.c
+++ b/src/cpu/x86/smm/smm_module_handler.c
@@ -106,6 +106,13 @@ void *smm_get_save_state(int cpu)
return base;
}
+uint32_t smm_revision(void)
+{
+ const uintptr_t save_state = (uintptr_t)(smm_get_save_state(0));
+
+ return *(uint32_t *)(save_state + smm_runtime->save_state_size - SMM_REVISION_OFFSET_FROM_TOP);
+}
+
bool smm_region_overlaps_handler(const struct region *r)
{
const struct region r_smm = {smm_runtime->smbase, smm_runtime->smm_size};