diff options
author | Aaron Durbin <adurbin@chromium.org> | 2013-10-21 22:24:40 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@google.com> | 2014-01-30 06:05:38 +0100 |
commit | cd3f8ad235b9fbcb21950004f9f31b019e43c08a (patch) | |
tree | ad222041c1ff337b66f09ee07b9f4e6f6361cd81 /src/cpu | |
parent | d0520406ed3f7dc6a36d1b49b2623eafd0b498fb (diff) | |
download | coreboot-cd3f8ad235b9fbcb21950004f9f31b019e43c08a.tar.xz |
x86: Add SMM helper functions to MP infrastructure
In order for the cpu code to start SMM relocation 2 new
functions are added to be shared:
- void smm_initiate_relocation_parallel()
- void smm_initiate_relocation()
The both initiate an SMI on the currently running cpu.
The 2 variants allow for parallel relocation or serialized
relocation.
BUG=chrome-os-partner:22862
BRANCH=None
TEST=Built and booted rambi using these functions.
Change-Id: I325777bac27e9a0efc3f54f7223c38310604c5a2
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/173982
Reviewed-on: http://review.coreboot.org/4891
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/x86/mp_init.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index 242d656144..676c2f6ae4 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -584,3 +584,34 @@ int mp_get_apic_id(int cpu_slot) return cpus[cpu_slot].apic_id; } + +void smm_initiate_relocation_parallel(void) +{ + if ((lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY)) { + printk(BIOS_DEBUG, "Waiting for ICR not to be busy..."); + if (apic_wait_timeout(1000 /* 1 ms */, 50)) { + printk(BIOS_DEBUG, "timed out. Aborting.\n"); + return; + } else + printk(BIOS_DEBUG, "done.\n"); + } + + lapic_write_around(LAPIC_ICR2, SET_LAPIC_DEST_FIELD(lapicid())); + lapic_write_around(LAPIC_ICR, LAPIC_INT_ASSERT | LAPIC_DM_SMI); + if (apic_wait_timeout(1000 /* 1 ms */, 100 /* us */)) { + printk(BIOS_DEBUG, "SMI Relocation timed out.\n"); + } else + printk(BIOS_DEBUG, "Relocation complete.\n"); + +} + +DECLARE_SPIN_LOCK(smm_relocation_lock); + +/* Send SMI to self with single user serialization. */ +void smm_initiate_relocation(void) +{ + spin_lock(&smm_relocation_lock); + smm_initiate_relocation_parallel(); + spin_unlock(&smm_relocation_lock); +} + |