coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
cpu.c File Reference
#include <acpi/acpi.h>
#include <assert.h>
#include <console/console.h>
#include "chip.h"
#include <cpu/cpu.h>
#include <cpu/x86/mp.h>
#include <cpu/intel/microcode.h>
#include <cpu/intel/turbo.h>
#include <cpu/intel/common/common.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/mtrr.h>
#include <cpu/x86/smm.h>
#include <cpu/intel/em64t100_save_state.h>
#include <cpu/intel/smm_reloc.h>
#include <device/device.h>
#include <device/pci.h>
#include <fsp/api.h>
#include <intelblocks/cpulib.h>
#include <intelblocks/fast_spi.h>
#include <intelblocks/mp_init.h>
#include <intelblocks/msr.h>
#include <intelblocks/sgx.h>
#include <reg_script.h>
#include <soc/cpu.h>
#include <soc/iomap.h>
#include <soc/pci_devs.h>
#include <soc/pm.h>
#include <types.h>
Include dependency graph for cpu.c:

Go to the source code of this file.

Data Structures

struct  smm_relocation_attrs
 

Functions

bool cpu_soc_is_in_untrusted_mode (void)
 
void soc_core_init (struct device *cpu)
 
static void soc_init_core (struct device *cpu)
 
static void pre_mp_init (void)
 
static void read_cpu_topology (unsigned int *num_phys, unsigned int *num_virt)
 
int get_cpu_count (void)
 
void get_microcode_info (const void **microcode, int *parallel)
 
static void get_smm_info (uintptr_t *perm_smbase, size_t *perm_smsize, size_t *smm_save_state_size)
 
static void relocation_handler (int cpu, uintptr_t curr_smbase, uintptr_t staggered_smbase)
 
static void post_mp_init (void)
 
void soc_init_cpus (struct bus *cpu_bus)
 
void apollolake_init_cpus (struct device *dev)
 

Variables

static const struct reg_script core_msr_script []
 
static struct device_operations cpu_dev_ops
 
static const struct cpu_device_id cpu_table []
 
static const struct cpu_driver driver __cpu_driver
 
static struct smm_relocation_attrs relo_attrs
 
static const struct mp_ops mp_ops
 

Function Documentation

◆ apollolake_init_cpus()

void apollolake_init_cpus ( struct device dev)

Definition at line 263 of file cpu.c.

References CONFIG, fast_spi_cache_bios_region(), device::link_list, and soc_init_cpus().

Here is the call graph for this function:

◆ cpu_soc_is_in_untrusted_mode()

bool cpu_soc_is_in_untrusted_mode ( void  )

Definition at line 49 of file cpu.c.

References ENABLE_IA_UNTRUSTED, msr_struct::lo, MSR_POWER_MISC, and rdmsr().

Here is the call graph for this function:

◆ get_cpu_count()

int get_cpu_count ( void  )

Definition at line 168 of file cpu.c.

References BIOS_DEBUG, printk, and read_cpu_topology().

Here is the call graph for this function:

◆ get_microcode_info()

void get_microcode_info ( const void **  microcode,
int *  parallel 
)

Definition at line 180 of file cpu.c.

References intel_microcode_find(), and intel_microcode_load_unlocked().

Here is the call graph for this function:

◆ get_smm_info()

static void get_smm_info ( uintptr_t perm_smbase,
size_t perm_smsize,
size_t smm_save_state_size 
)
static

◆ post_mp_init()

static void post_mp_init ( void  )
static

Definition at line 238 of file cpu.c.

◆ pre_mp_init()

static void pre_mp_init ( void  )
static

Definition at line 147 of file cpu.c.

References CONFIG, fsps_load(), x86_mtrr_check(), and x86_setup_mtrrs_with_detect().

Here is the call graph for this function:

◆ read_cpu_topology()

static void read_cpu_topology ( unsigned int *  num_phys,
unsigned int *  num_virt 
)
static

Definition at line 159 of file cpu.c.

References msr_struct::lo, MSR_CORE_THREAD_COUNT, and rdmsr().

Referenced by get_cpu_count().

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

◆ relocation_handler()

static void relocation_handler ( int  cpu,
uintptr_t  curr_smbase,
uintptr_t  staggered_smbase 
)
static

◆ soc_core_init()

◆ soc_init_core()

static void soc_init_core ( struct device cpu)
static

Definition at line 94 of file cpu.c.

◆ soc_init_cpus()

void soc_init_cpus ( struct bus cpu_bus)

Definition at line 256 of file cpu.c.

References mp_init_with_smm().

Here is the call graph for this function:

Variable Documentation

◆ __cpu_driver

const struct cpu_driver driver __cpu_driver
static
Initial value:
= {
.ops = &cpu_dev_ops,
.id_table = cpu_table,
}
static const struct cpu_device_id cpu_table[]
Definition: cpu.c:103
static struct device_operations cpu_dev_ops
Definition: cpu.c:99

Definition at line 94 of file cpu.c.

◆ core_msr_script

const struct reg_script core_msr_script[]
static
Initial value:
= {
}
#define MSR_POWER_CTL
Definition: haswell.h:56
#define MSR_PMG_IO_CAPTURE_BASE
Definition: haswell.h:42
#define MSR_PKG_CST_CONFIG_CONTROL
Definition: haswell.h:41
#define IA32_MISC_ENABLE
Definition: msr.h:45
#define PMG_IO_BASE_CST_RNG_BLK_SIZE
Definition: iomap.h:21
#define ACPI_PMIO_CST_REG
Definition: iomap.h:23
#define REG_MSR_WRITE(reg_, value_)
Definition: reg_script.h:395
#define REG_MSR_RMW(reg_, mask_, value_)
Definition: reg_script.h:397
#define REG_SCRIPT_END
Definition: reg_script.h:427
#define CST_CFG_LOCK_MASK
Definition: msr.h:16
#define IO_MWAIT_REDIRECT_MASK
Definition: msr.h:14
#define POWER_CTL_C1E_MASK
Definition: msr.h:50
#define CORE_C_STATE_LIMIT_C10_MASK
Definition: msr.h:12
#define PKG_C_STATE_LIMIT_C2_MASK
Definition: msr.h:10
#define MONITOR_MWAIT_DIS_MASK
Definition: turbo.h:10

Definition at line 1 of file cpu.c.

Referenced by soc_core_init().

◆ cpu_dev_ops

struct device_operations cpu_dev_ops
static
Initial value:
= {
.init = soc_init_core,
}
static void soc_init_core(struct device *cpu)
Definition: cpu.c:94

Definition at line 94 of file cpu.c.

◆ cpu_table

const struct cpu_device_id cpu_table[]
static
Initial value:
= {
{ 0, 0 },
}
#define X86_VENDOR_INTEL
Definition: cpu.h:138
#define CPUID_APOLLOLAKE_E0
Definition: cpu_ids.h:29
#define CPUID_APOLLOLAKE_A0
Definition: cpu_ids.h:27
#define CPUID_GLK_A0
Definition: cpu_ids.h:30
#define CPUID_GLK_R0
Definition: cpu_ids.h:32
#define CPUID_GLK_B0
Definition: cpu_ids.h:31
#define CPUID_APOLLOLAKE_B0
Definition: cpu_ids.h:28

Definition at line 94 of file cpu.c.

◆ mp_ops

const struct mp_ops mp_ops
static
Initial value:
= {
.pre_mp_init = pre_mp_init,
.get_cpu_count = get_cpu_count,
.get_smm_info = get_smm_info,
.get_microcode_info = get_microcode_info,
.pre_mp_smm_init = smm_southbridge_clear_state,
.relocation_handler = relocation_handler,
.post_mp_init = post_mp_init,
}
void smm_southbridge_clear_state(void)
Definition: smm.c:22
int get_cpu_count(void)
Definition: cpu.c:10
static void relocation_handler(int cpu, uintptr_t curr_smbase, uintptr_t staggered_smbase)
Definition: cpu.c:215
static void pre_mp_init(void)
Definition: cpu.c:147
static void get_smm_info(uintptr_t *perm_smbase, size_t *perm_smsize, size_t *smm_save_state_size)
Definition: cpu.c:190
void get_microcode_info(const void **microcode, int *parallel)
Definition: cpu.c:180
static void post_mp_init(void)
Definition: cpu.c:238

Definition at line 238 of file cpu.c.

◆ relo_attrs

struct smm_relocation_attrs relo_attrs
static

Definition at line 94 of file cpu.c.

Referenced by get_smm_info(), and relocation_handler().