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>
This commit is contained in:
Arthur Heymans 2020-08-09 16:01:26 +02:00 committed by Patrick Georgi
parent ac0d2ee2de
commit 2f7d4c362c
1 changed files with 18 additions and 0 deletions

View File

@ -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};