coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
cpu.c File Reference
#include <console/console.h>
#include <cpu/cpu.h>
#include <cpu/intel/common/common.h>
#include <cpu/intel/em64t100_save_state.h>
#include <cpu/intel/microcode.h>
#include <cpu/intel/smm_reloc.h>
#include <cpu/intel/turbo.h>
#include <cpu/x86/lapic.h>
#include <cpu/x86/mp.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/mtrr.h>
#include <cpu/x86/smm.h>
#include <device/device.h>
#include <reg_script.h>
#include <soc/iosf.h>
#include <soc/msr.h>
#include <soc/pattrs.h>
#include <soc/ramstage.h>
#include <types.h>
Include dependency graph for cpu.c:

Go to the source code of this file.

Functions

static void soc_core_init (struct device *cpu)
 
static void pre_mp_init (void)
 
static int get_cpu_count (void)
 
static void fill_in_relocation_params (struct smm_relocation_params *params)
 
static void get_smm_info (uintptr_t *perm_smbase, size_t *perm_smsize, size_t *smm_save_state_size)
 
static void get_microcode_info (const void **microcode, int *parallel)
 
static void per_cpu_smm_trigger (void)
 
static void relocation_handler (int cpu, uintptr_t curr_smbase, uintptr_t staggered_smbase)
 
static void post_mp_init (void)
 
void mp_init_cpus (struct bus *cpu_bus)
 

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 const struct reg_script package_msr_script []
 
static const struct mp_ops mp_ops
 

Function Documentation

◆ fill_in_relocation_params()

static void fill_in_relocation_params ( struct smm_relocation_params params)
static

Definition at line 120 of file cpu.c.

References MTRR_PHYS_MASK_VALID, MTRR_TYPE_WRBACK, params, and smm_region().

Referenced by get_smm_info().

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

◆ get_cpu_count()

static int get_cpu_count ( void  )
static

Definition at line 113 of file cpu.c.

References pattrs::num_cpus, and pattrs_get().

Here is the call graph for this function:

◆ get_microcode_info()

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

Definition at line 149 of file cpu.c.

References intel_ht_supported(), pattrs::microcode_patch, and pattrs_get().

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

Definition at line 137 of file cpu.c.

References BIOS_DEBUG, fill_in_relocation_params(), printk, smm_reloc_params, smm_subregion(), and SMM_SUBREGION_HANDLER.

Here is the call graph for this function:

◆ mp_init_cpus()

void mp_init_cpus ( struct bus cpu_bus)

Definition at line 197 of file cpu.c.

References mp_init_with_smm().

Here is the call graph for this function:

◆ per_cpu_smm_trigger()

static void per_cpu_smm_trigger ( void  )
static

Definition at line 157 of file cpu.c.

References intel_microcode_load_unlocked(), pattrs::microcode_patch, pattrs_get(), and smm_initiate_relocation().

Here is the call graph for this function:

◆ post_mp_init()

static void post_mp_init ( void  )
static

Definition at line 181 of file cpu.c.

◆ pre_mp_init()

static void pre_mp_init ( void  )
static

◆ relocation_handler()

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

◆ soc_core_init()

static void soc_core_init ( struct device cpu)
static

Definition at line 35 of file cpu.c.

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:61
static struct device_operations cpu_dev_ops
Definition: cpu.c:57

Definition at line 35 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_PKG_CST_CONFIG_CONTROL
Definition: haswell.h:41
#define REG_MSR_OR(reg_, value_)
Definition: reg_script.h:401
#define REG_MSR_RMW(reg_, mask_, value_)
Definition: reg_script.h:397
#define REG_SCRIPT_END
Definition: reg_script.h:427
#define MSR_POWER_MISC
Definition: msr.h:8
#define ENABLE_ULFM_AUTOCM_MASK
Definition: msr.h:11
#define ENABLE_INDP_AUTOCM_MASK
Definition: msr.h:12

Definition at line 1 of file cpu.c.

◆ cpu_dev_ops

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

Definition at line 35 of file cpu.c.

◆ cpu_table

const struct cpu_device_id cpu_table[]
static
Initial value:
= {
{ X86_VENDOR_INTEL, 0x30673 },
{ X86_VENDOR_INTEL, 0x30678 },
{ X86_VENDOR_INTEL, 0x30679 },
{ 0, 0 },
}
#define X86_VENDOR_INTEL
Definition: cpu.h:138

Definition at line 35 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,
.per_cpu_smm_trigger = per_cpu_smm_trigger,
.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
void get_microcode_info(const void **microcode, int *parallel)
Definition: cpu.c:180
static void relocation_handler(int cpu, uintptr_t curr_smbase, uintptr_t staggered_smbase)
Definition: cpu.c:168
static void pre_mp_init(void)
Definition: cpu.c:91
static void get_smm_info(uintptr_t *perm_smbase, size_t *perm_smsize, size_t *smm_save_state_size)
Definition: cpu.c:137
static void per_cpu_smm_trigger(void)
Definition: cpu.c:157
static void post_mp_init(void)
Definition: cpu.c:181

Definition at line 181 of file cpu.c.

◆ package_msr_script

const struct reg_script package_msr_script[]
static
Initial value:
= {
REG_MSR_RMW(MSR_PP1_POWER_LIMIT, ~(0x7f << 17), 0),
}
#define MSR_PP1_POWER_LIMIT
Definition: haswell.h:93
#define MSR_PKG_POWER_LIMIT
Definition: haswell.h:79
#define REG_MSR_WRITE(reg_, value_)
Definition: reg_script.h:395
#define MSR_PKG_TURBO_CFG1
Definition: msr.h:21
#define MSR_CPU_THERM_SENS_CFG
Definition: msr.h:26
#define MSR_CPU_THERM_CFG2
Definition: msr.h:25
#define MSR_CPU_TURBO_WKLD_CFG1
Definition: msr.h:22
#define MSR_CPU_THERM_CFG1
Definition: msr.h:24
#define MSR_CPU_TURBO_WKLD_CFG2
Definition: msr.h:23

Definition at line 35 of file cpu.c.

Referenced by pre_mp_init().