coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
lapic_cpu_init.c File Reference
#include <cpu/x86/cr.h>
#include <cpu/x86/gdt.h>
#include <cpu/x86/lapic.h>
#include <cpu/x86/smi_deprecated.h>
#include <acpi/acpi.h>
#include <delay.h>
#include <lib.h>
#include <string.h>
#include <symbols.h>
#include <console/console.h>
#include <device/device.h>
#include <device/path.h>
#include <smp/atomic.h>
#include <smp/spinlock.h>
#include <cpu/cpu.h>
#include <cpu/intel/speedstep.h>
#include <smp/node.h>
#include <stdlib.h>
#include <thread.h>
Include dependency graph for lapic_cpu_init.c:

Go to the source code of this file.

Macros

#define AP_SIPI_VECTOR   0x1000
 

Functions

static void setup_secondary_gdt (void)
 
static void copy_secondary_start_to_lowest_1M (void)
 
static void recover_lowest_1M (void)
 
static uint32_t wait_for_ipi_completion (const int timeout_ms)
 
static int lapic_start_cpu (unsigned long apicid)
 
 DECLARE_SPIN_LOCK (start_cpu_lock)
 
static int start_cpu (struct device *cpu)
 
asmlinkage void secondary_cpu_init (unsigned int index)
 
static void start_other_cpus (struct bus *cpu_bus, struct device *bsp_cpu)
 
static void wait_other_cpus_stop (struct bus *cpu_bus)
 
void initialize_cpus (struct bus *cpu_bus)
 

Variables

static char * lowmem_backup
 
static char * lowmem_backup_ptr
 
static int lowmem_backup_size
 
static atomic_t active_cpus = ATOMIC_INIT(1)
 
static unsigned int last_cpu_index = 0
 
static voidstacks [CONFIG_MAX_CPUS]
 
volatile unsigned long secondary_stack
 
volatile unsigned int secondary_cpu_index
 

Macro Definition Documentation

◆ AP_SIPI_VECTOR

#define AP_SIPI_VECTOR   0x1000

Definition at line 32 of file lapic_cpu_init.c.

Function Documentation

◆ copy_secondary_start_to_lowest_1M()

static void copy_secondary_start_to_lowest_1M ( void  )
static

Definition at line 54 of file lapic_cpu_init.c.

References _secondary_start, _secondary_start_end, acpi_is_wakeup_s3(), AP_SIPI_VECTOR, BIOS_DEBUG, die(), lowmem_backup, lowmem_backup_ptr, lowmem_backup_size, malloc(), memcpy(), NULL, printk, and setup_secondary_gdt().

Referenced by initialize_cpus().

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

◆ DECLARE_SPIN_LOCK()

DECLARE_SPIN_LOCK ( start_cpu_lock  )

◆ initialize_cpus()

void initialize_cpus ( struct bus cpu_bus)

◆ lapic_start_cpu()

static int lapic_start_cpu ( unsigned long  apicid)
static

Definition at line 106 of file lapic_cpu_init.c.

References AP_SIPI_VECTOR, BIOS_ERR, BIOS_SPEW, BIOS_WARNING, LAPIC_DM_INIT, LAPIC_DM_STARTUP, LAPIC_ESR, LAPIC_INT_ASSERT, LAPIC_INT_LEVELTRIG, lapic_read(), lapic_send_ipi(), LAPIC_SPIV, lapic_write(), mdelay(), printk, udelay(), and wait_for_ipi_completion().

Referenced by start_cpu().

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

◆ recover_lowest_1M()

static void recover_lowest_1M ( void  )
static

Definition at line 84 of file lapic_cpu_init.c.

References acpi_is_wakeup_s3(), lowmem_backup, lowmem_backup_ptr, lowmem_backup_size, and memcpy().

Referenced by initialize_cpus().

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

◆ secondary_cpu_init()

asmlinkage void secondary_cpu_init ( unsigned int  index)

◆ setup_secondary_gdt()

static void setup_secondary_gdt ( void  )
inlinestatic

Definition at line 38 of file lapic_cpu_init.c.

References _secondary_gdt_addr, gdt, and gdt_end.

Referenced by copy_secondary_start_to_lowest_1M().

Here is the caller graph for this function:

◆ start_cpu()

static int start_cpu ( struct device cpu)
static

◆ start_other_cpus()

static void start_other_cpus ( struct bus cpu_bus,
struct device bsp_cpu 
)
static

Definition at line 315 of file lapic_cpu_init.c.

References device_path::apic, apic_path::apic_id, BIOS_ERR, bus::children, DEVICE_PATH_APIC, device::enabled, device::initialized, device::path, printk, device::sibling, start_cpu(), device_path::type, and udelay().

Referenced by initialize_cpus().

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

◆ wait_for_ipi_completion()

static uint32_t wait_for_ipi_completion ( const int  timeout_ms)
static

Definition at line 90 of file lapic_cpu_init.c.

References BIOS_SPEW, lapic_busy(), printk, and udelay().

Referenced by lapic_start_cpu().

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

◆ wait_other_cpus_stop()

static void wait_other_cpus_stop ( struct bus cpu_bus)
static

Definition at line 340 of file lapic_cpu_init.c.

References active_cpus, device_path::apic, apic_path::apic_id, atomic_read, BIOS_DEBUG, BIOS_ERR, BIOS_INFO, checkstack(), bus::children, DEVICE_PATH_APIC, device::initialized, last_cpu_index, device::path, printk, device::sibling, SPEEDSTEP_APIC_MAGIC, stacks, device_path::type, and udelay().

Referenced by initialize_cpus().

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

Variable Documentation

◆ active_cpus

atomic_t active_cpus = ATOMIC_INIT(1)
static

Definition at line 207 of file lapic_cpu_init.c.

Referenced by secondary_cpu_init(), and wait_other_cpus_stop().

◆ last_cpu_index

unsigned int last_cpu_index = 0
static

Definition at line 219 of file lapic_cpu_init.c.

Referenced by start_cpu(), and wait_other_cpus_stop().

◆ lowmem_backup

char* lowmem_backup
static

Definition at line 34 of file lapic_cpu_init.c.

Referenced by copy_secondary_start_to_lowest_1M(), and recover_lowest_1M().

◆ lowmem_backup_ptr

char* lowmem_backup_ptr
static

Definition at line 35 of file lapic_cpu_init.c.

Referenced by copy_secondary_start_to_lowest_1M(), and recover_lowest_1M().

◆ lowmem_backup_size

int lowmem_backup_size
static

Definition at line 36 of file lapic_cpu_init.c.

Referenced by copy_secondary_start_to_lowest_1M(), and recover_lowest_1M().

◆ secondary_cpu_index

volatile unsigned int secondary_cpu_index

Definition at line 222 of file lapic_cpu_init.c.

Referenced by start_cpu().

◆ secondary_stack

volatile unsigned long secondary_stack

Definition at line 221 of file lapic_cpu_init.c.

Referenced by start_cpu().

◆ stacks

void* stacks[CONFIG_MAX_CPUS]
static

Definition at line 220 of file lapic_cpu_init.c.

Referenced by start_cpu(), and wait_other_cpus_stop().