coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
lapic_cpu_stop.c File Reference
#include <console/console.h>
#include <cpu/x86/lapic.h>
#include <delay.h>
#include <halt.h>
Include dependency graph for lapic_cpu_stop.c:

Go to the source code of this file.

Macros

#define DEBUG_HALT_SELF   0
 Sending INIT IPI to self is equivalent of asserting #INIT with a bit of delay. More...
 
#define dprintk(LEVEL, args...)   do { } while (0)
 

Functions

static void wait_for_ipi_completion_without_printk (const int timeout_ms)
 
void stop_this_cpu (void)
 Normally this function is defined in lapic.h as an always inline function that just keeps the CPU in a hlt() loop. More...
 

Macro Definition Documentation

◆ DEBUG_HALT_SELF

#define DEBUG_HALT_SELF   0

Sending INIT IPI to self is equivalent of asserting #INIT with a bit of delay.

An undefined number of instruction cycles will complete. All global locks must be released before INIT IPI and no printk is allowed after this. De-asserting INIT IPI is a no-op on later Intel CPUs.

If you set DEBUG_HALT_SELF to 1, printk's after INIT IPI are enabled but running thread may halt without releasing the lock and effectively deadlock other CPUs.

Definition at line 19 of file lapic_cpu_stop.c.

◆ dprintk

#define dprintk (   LEVEL,
  args... 
)    do { } while (0)

Definition at line 24 of file lapic_cpu_stop.c.

Function Documentation

◆ stop_this_cpu()

void stop_this_cpu ( void  )

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. I think all hyperthreading CPUs might need this version, but I could only verify this on the Intel Core Duo

Definition at line 50 of file lapic_cpu_stop.c.

References BIOS_DEBUG, BIOS_SPEW, dprintk, halt(), LAPIC_DM_INIT, LAPIC_INT_ASSERT, LAPIC_INT_LEVELTRIG, lapic_send_ipi_self(), lapicid(), mdelay(), printk, and wait_for_ipi_completion_without_printk().

Referenced by park_this_cpu(), and secondary_cpu_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait_for_ipi_completion_without_printk()

static void wait_for_ipi_completion_without_printk ( const int  timeout_ms)
static

Definition at line 27 of file lapic_cpu_stop.c.

References BIOS_ERR, BIOS_SPEW, dprintk, lapic_busy(), and udelay().

Referenced by stop_this_cpu().

Here is the call graph for this function:
Here is the caller graph for this function: