diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2020-08-09 16:01:26 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-09-29 05:59:59 +0000 |
commit | 2f7d4c362ce75803f3df55e401e8831275f18c41 (patch) | |
tree | 88450fbf9124b35cf283664395f3e8f6235debb7 | |
parent | ac0d2ee2de005968b20f421a0ea97edcbea3ea19 (diff) | |
download | coreboot-2f7d4c362ce75803f3df55e401e8831275f18c41.tar.xz |
cpu/x86/smm/smihandler.c: Implement smm_get_save_state()
This will be used in common save_state handling code.
Change-Id: I4cb3180ec565cee931606e8a8f55b78fdb8932ae
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44320
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | src/cpu/x86/smm/smihandler.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/cpu/x86/smm/smihandler.c b/src/cpu/x86/smm/smihandler.c index 99594beae7..077fa8db8f 100644 --- a/src/cpu/x86/smm/smihandler.c +++ b/src/cpu/x86/smm/smihandler.c @@ -128,6 +128,24 @@ uint32_t smm_revision(void) return *(uint32_t *)(SMM_BASE + SMM_ENTRY_OFFSET * 2 - SMM_REVISION_OFFSET_FROM_TOP); } +void *smm_get_save_state(int cpu) +{ + switch (smm_revision()) { + case 0x00030002: + case 0x00030007: + return smm_save_state(SMM_BASE, SMM_LEGACY_ARCH_OFFSET, cpu); + case 0x00030100: + return smm_save_state(SMM_BASE, SMM_EM64T100_ARCH_OFFSET, cpu); + case 0x00030101: /* SandyBridge, IvyBridge, and Haswell */ + return smm_save_state(SMM_BASE, SMM_EM64T101_ARCH_OFFSET, cpu); + case 0x00020064: + case 0x00030064: + return smm_save_state(SMM_BASE, SMM_AMD64_ARCH_OFFSET, cpu); + } + + return NULL; +} + bool smm_region_overlaps_handler(const struct region *r) { const struct region r_smm = {SMM_BASE, SMM_DEFAULT_SIZE}; |