cpu/x86/smm/smmhandler.c: Get revision using C code
This allows to remove some assembly code. Tested with QEMU Q35 to still print the revision correctly. Change-Id: I36fb0e8bb1f46806b11ef8102ce74c0d10fd3927 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44319 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
258ceb7507
commit
ac0d2ee2de
|
@ -141,9 +141,10 @@ bool smm_region_overlaps_handler(const struct region *r)
|
||||||
* @param smm_revision revision of the smm state save map
|
* @param smm_revision revision of the smm state save map
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void smi_handler(u32 smm_revision)
|
void smi_handler(void)
|
||||||
{
|
{
|
||||||
unsigned int node;
|
unsigned int node;
|
||||||
|
const uint32_t smm_rev = smm_revision();
|
||||||
smm_state_save_area_t state_save;
|
smm_state_save_area_t state_save;
|
||||||
u32 smm_base = SMM_BASE; /* ASEG */
|
u32 smm_base = SMM_BASE; /* ASEG */
|
||||||
|
|
||||||
|
@ -171,7 +172,7 @@ void smi_handler(u32 smm_revision)
|
||||||
|
|
||||||
printk(BIOS_SPEW, "\nSMI# #%d\n", node);
|
printk(BIOS_SPEW, "\nSMI# #%d\n", node);
|
||||||
|
|
||||||
switch (smm_revision) {
|
switch (smm_rev) {
|
||||||
case 0x00030002:
|
case 0x00030002:
|
||||||
case 0x00030007:
|
case 0x00030007:
|
||||||
state_save.type = LEGACY;
|
state_save.type = LEGACY;
|
||||||
|
@ -199,7 +200,7 @@ void smi_handler(u32 smm_revision)
|
||||||
SMM_AMD64_ARCH_OFFSET, node);
|
SMM_AMD64_ARCH_OFFSET, node);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(BIOS_DEBUG, "smm_revision: 0x%08x\n", smm_revision);
|
printk(BIOS_DEBUG, "smm_revision: 0x%08x\n", smm_rev);
|
||||||
printk(BIOS_DEBUG, "SMI# not supported on your CPU\n");
|
printk(BIOS_DEBUG, "SMI# not supported on your CPU\n");
|
||||||
/* Don't release lock, so no further SMI will happen,
|
/* Don't release lock, so no further SMI will happen,
|
||||||
* if we don't handle it anyways.
|
* if we don't handle it anyways.
|
||||||
|
|
|
@ -165,10 +165,6 @@ untampered_lapic:
|
||||||
addl $SMM_STACK_SIZE, %ebx
|
addl $SMM_STACK_SIZE, %ebx
|
||||||
movl %ebx, %esp
|
movl %ebx, %esp
|
||||||
|
|
||||||
/* Get SMM revision */
|
|
||||||
movl $0xa8000 + 0x7efc, %ebx /* core 0 address */
|
|
||||||
subl %ebp, %ebx /* subtract core X offset */
|
|
||||||
|
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
/* Backup IA32_EFER. Preserves ebx. */
|
/* Backup IA32_EFER. Preserves ebx. */
|
||||||
movl $(IA32_EFER), %ecx
|
movl $(IA32_EFER), %ecx
|
||||||
|
@ -179,13 +175,7 @@ untampered_lapic:
|
||||||
/* Enable long mode. Preserves ebx. */
|
/* Enable long mode. Preserves ebx. */
|
||||||
#include <cpu/x86/64bit/entry64.inc>
|
#include <cpu/x86/64bit/entry64.inc>
|
||||||
|
|
||||||
mov (%ebx), %rdi
|
|
||||||
|
|
||||||
#else
|
|
||||||
movl (%ebx), %eax
|
|
||||||
pushl %eax
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Call C handler */
|
/* Call C handler */
|
||||||
call smi_handler
|
call smi_handler
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,6 @@ void smm_init_completion(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Entry from smmhandler.S. */
|
/* Entry from smmhandler.S. */
|
||||||
void smi_handler(u32 smm_revision);
|
void smi_handler(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue