Timothy Pearson (tpearson@raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13168
-gerrit
commit 77b07718bb39fc9df65f9be446e220ad088e5789 Author: Timothy Pearson tpearson@raptorengineeringinc.com Date: Tue Nov 24 14:12:02 2015 -0600
cpu/amd/fam10h-fam15h: Add new wait_ap_stopped function
Under certain conditions, such as when microcode updates are being performed, it is important to make sure all APs have finished updates and are halted before continuing with the boot process.
Add a new wait_ap_stopped() function to allow for this functionality to be added to the appropriate mainboard romstage source files.
Change-Id: Ib455c937888a58b283bd3f8fda1b486eea41b0a7 Signed-off-by: Timothy Pearson tpearson@raptorengineeringinc.com --- src/cpu/amd/family_10h-family_15h/init_cpus.c | 20 ++++++++++++++++++++ src/include/cpu/amd/multicore.h | 1 + 2 files changed, 21 insertions(+)
diff --git a/src/cpu/amd/family_10h-family_15h/init_cpus.c b/src/cpu/amd/family_10h-family_15h/init_cpus.c index e8e81d2..e2a1bf3 100644 --- a/src/cpu/amd/family_10h-family_15h/init_cpus.c +++ b/src/cpu/amd/family_10h-family_15h/init_cpus.c @@ -299,6 +299,26 @@ void allow_all_aps_stop(u32 bsp_apicid) lapic_write(LAPIC_MSG_REG, (bsp_apicid << 24) | F10_APSTATE_STOPPED); }
+static void wait_ap_stopped(u32 ap_apicid, void *gp) +{ + u32 timeout; + timeout = wait_cpu_state(ap_apicid, F10_APSTATE_ASLEEP, F10_APSTATE_ASLEEP); + printk(BIOS_DEBUG, "* AP %02x", ap_apicid); + if (timeout) { + printk(BIOS_DEBUG, " timed out:%08x\n", timeout); + } else { + printk(BIOS_DEBUG, "stopped\n"); + } +} + +void wait_all_other_cores_stopped(u32 bsp_apicid) +{ + // all aps other than core0 + printk(BIOS_DEBUG, "stopped ap apicid: "); + for_each_ap(bsp_apicid, 2, -1, wait_ap_stopped, (void *)0); + printk(BIOS_DEBUG, "\n"); +} + static void enable_apic_ext_id(u32 node) { u32 val; diff --git a/src/include/cpu/amd/multicore.h b/src/include/cpu/amd/multicore.h index b3a8237..0ddf866 100644 --- a/src/include/cpu/amd/multicore.h +++ b/src/include/cpu/amd/multicore.h @@ -35,6 +35,7 @@ void amd_sibling_init(struct device *cpu); void wait_all_core0_started(void); void wait_all_other_cores_started(u32 bsp_apicid); void wait_all_aps_started(u32 bsp_apicid); +void wait_all_other_cores_stopped(uint32_t bsp_apicid); void allow_all_aps_stop(u32 bsp_apicid); #endif u32 get_initial_apicid(void);