cpu/x86/lapic: Redo DEBUG_HALT_SELF
Change-Id: I7e42519d5bcee95970d366fd64923de874098172 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55189 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
@@ -317,6 +317,12 @@ static int start_cpu(struct device *cpu)
|
|||||||
*/
|
*/
|
||||||
#define DEBUG_HALT_SELF 0
|
#define DEBUG_HALT_SELF 0
|
||||||
|
|
||||||
|
#if DEBUG_HALT_SELF
|
||||||
|
#define dprintk(LEVEL, args...) do { printk(LEVEL, ##args); } while (0)
|
||||||
|
#else
|
||||||
|
#define dprintk(LEVEL, args...) do { } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normally this function is defined in lapic.h as an always inline function
|
* Normally this function is defined in lapic.h as an always inline function
|
||||||
* that just keeps the CPU in a hlt() loop. This does not work on all CPUs.
|
* that just keeps the CPU in a hlt() loop. This does not work on all CPUs.
|
||||||
@@ -339,47 +345,37 @@ void stop_this_cpu(void)
|
|||||||
LAPIC_INT_ASSERT | LAPIC_DM_INIT);
|
LAPIC_INT_ASSERT | LAPIC_DM_INIT);
|
||||||
|
|
||||||
/* wait for the ipi send to finish */
|
/* wait for the ipi send to finish */
|
||||||
#if DEBUG_HALT_SELF
|
dprintk(BIOS_SPEW, "Waiting for send to finish...\n");
|
||||||
printk(BIOS_SPEW, "Waiting for send to finish...\n");
|
|
||||||
#endif
|
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
do {
|
do {
|
||||||
#if DEBUG_HALT_SELF
|
dprintk(BIOS_SPEW, "+");
|
||||||
printk(BIOS_SPEW, "+");
|
|
||||||
#endif
|
|
||||||
udelay(100);
|
udelay(100);
|
||||||
send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY;
|
send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY;
|
||||||
} while (send_status && (timeout++ < 1000));
|
} while (send_status && (timeout++ < 1000));
|
||||||
if (timeout >= 1000) {
|
|
||||||
#if DEBUG_HALT_SELF
|
if (timeout >= 1000)
|
||||||
printk(BIOS_ERR, "timed out\n");
|
dprintk(BIOS_ERR, "timed out\n");
|
||||||
#endif
|
|
||||||
}
|
|
||||||
mdelay(10);
|
mdelay(10);
|
||||||
|
|
||||||
#if DEBUG_HALT_SELF
|
dprintk(BIOS_SPEW, "Deasserting INIT.\n");
|
||||||
printk(BIOS_SPEW, "Deasserting INIT.\n");
|
|
||||||
#endif
|
|
||||||
/* Deassert the LAPIC INIT */
|
/* Deassert the LAPIC INIT */
|
||||||
lapic_write_around(LAPIC_ICR2, SET_LAPIC_DEST_FIELD(id));
|
lapic_write_around(LAPIC_ICR2, SET_LAPIC_DEST_FIELD(id));
|
||||||
lapic_write_around(LAPIC_ICR, LAPIC_INT_LEVELTRIG | LAPIC_DM_INIT);
|
lapic_write_around(LAPIC_ICR, LAPIC_INT_LEVELTRIG | LAPIC_DM_INIT);
|
||||||
|
|
||||||
#if DEBUG_HALT_SELF
|
dprintk(BIOS_SPEW, "Waiting for send to finish...\n");
|
||||||
printk(BIOS_SPEW, "Waiting for send to finish...\n");
|
|
||||||
#endif
|
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
do {
|
do {
|
||||||
#if DEBUG_HALT_SELF
|
dprintk(BIOS_SPEW, "+");
|
||||||
printk(BIOS_SPEW, "+");
|
|
||||||
#endif
|
|
||||||
udelay(100);
|
udelay(100);
|
||||||
send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY;
|
send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY;
|
||||||
} while (send_status && (timeout++ < 1000));
|
} while (send_status && (timeout++ < 1000));
|
||||||
if (timeout >= 1000) {
|
|
||||||
#if DEBUG_HALT_SELF
|
if (timeout >= 1000)
|
||||||
printk(BIOS_ERR, "timed out\n");
|
dprintk(BIOS_ERR, "timed out\n");
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
halt();
|
halt();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user