cpu/x86/mp_init: Refactor ICR wait logic
Extracted ICR wait logic into a new function 'icr_wait_timeout'. Change-Id: Ie48899f7afb125061fd7efd44c83f5775c05d254 Signed-off-by: NyeonWoo Kim <knw0507@naver.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/88788 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com> Reviewed-by: Shuo Liu <shuo.liu@intel.com>
This commit is contained in:
parent
eee5be070a
commit
244a34b3d0
1 changed files with 14 additions and 18 deletions
|
|
@ -424,8 +424,7 @@ static enum cb_err apic_wait_timeout(int total_delay, int delay_step)
|
|||
return CB_SUCCESS;
|
||||
}
|
||||
|
||||
/* Send Startup IPI to APs */
|
||||
static enum cb_err send_sipi_to_aps(int ap_count, atomic_t *num_aps, int sipi_vector)
|
||||
static enum cb_err icr_wait_timeout(void)
|
||||
{
|
||||
if (lapic_busy()) {
|
||||
printk(BIOS_DEBUG, "Waiting for ICR not to be busy...\n");
|
||||
|
|
@ -436,6 +435,15 @@ static enum cb_err send_sipi_to_aps(int ap_count, atomic_t *num_aps, int sipi_ve
|
|||
printk(BIOS_DEBUG, "done.\n");
|
||||
}
|
||||
|
||||
return CB_SUCCESS;
|
||||
}
|
||||
|
||||
/* Send Startup IPI to APs */
|
||||
static enum cb_err send_sipi_to_aps(int ap_count, atomic_t *num_aps, int sipi_vector)
|
||||
{
|
||||
if (icr_wait_timeout() != CB_SUCCESS)
|
||||
return CB_ERR;
|
||||
|
||||
lapic_send_ipi_others(LAPIC_INT_ASSERT | LAPIC_MT_STARTUP | sipi_vector);
|
||||
printk(BIOS_DEBUG, "Waiting for SIPI to complete...\n");
|
||||
if (apic_wait_timeout(10000 /* 10 ms */, 50 /* us */) != CB_SUCCESS) {
|
||||
|
|
@ -466,14 +474,8 @@ static enum cb_err start_aps(struct bus *cpu_bus, int ap_count, atomic_t *num_ap
|
|||
|
||||
printk(BIOS_DEBUG, "Attempting to start %d APs\n", ap_count);
|
||||
|
||||
if (lapic_busy()) {
|
||||
printk(BIOS_DEBUG, "Waiting for ICR not to be busy...\n");
|
||||
if (apic_wait_timeout(1000 /* 1 ms */, 50) != CB_SUCCESS) {
|
||||
printk(BIOS_ERR, "timed out. Aborting.\n");
|
||||
return CB_ERR;
|
||||
}
|
||||
printk(BIOS_DEBUG, "done.\n");
|
||||
}
|
||||
if (icr_wait_timeout() != CB_SUCCESS)
|
||||
return CB_ERR;
|
||||
|
||||
/* Send INIT IPI to all but self. */
|
||||
lapic_send_ipi_others(LAPIC_INT_ASSERT | LAPIC_MT_INIT);
|
||||
|
|
@ -651,14 +653,8 @@ static enum cb_err mp_init(struct bus *cpu_bus, struct mp_params *p)
|
|||
|
||||
void smm_initiate_relocation_parallel(void)
|
||||
{
|
||||
if (lapic_busy()) {
|
||||
printk(BIOS_DEBUG, "Waiting for ICR not to be busy...");
|
||||
if (apic_wait_timeout(1000 /* 1 ms */, 50) != CB_SUCCESS) {
|
||||
printk(BIOS_DEBUG, "timed out. Aborting.\n");
|
||||
return;
|
||||
}
|
||||
printk(BIOS_DEBUG, "done.\n");
|
||||
}
|
||||
if (icr_wait_timeout() != CB_SUCCESS)
|
||||
return;
|
||||
|
||||
lapic_send_ipi_self(LAPIC_INT_ASSERT | LAPIC_MT_SMI);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue