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/x86/cr.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 <cpu/intel/smm_reloc.h>
#include <cpu/intel/em64t100_save_state.h>
#include <cpu/intel/turbo.h>
#include <cpu/intel/common/common.h>
#include <device/device.h>
#include <device/pci.h>
#include <intelblocks/cpulib.h>
#include <lib.h>
#include <soc/msr.h>
#include <soc/cpu.h>
#include <soc/iomap.h>
#include <soc/smm.h>
#include <soc/soc_util.h>
#include <types.h>
Include dependency graph for cpu.c:

Go to the source code of this file.

Functions

bool cpu_soc_is_in_untrusted_mode (void)
 
static void dnv_configure_mca (void)
 
static void configure_thermal_core (void)
 
static void denverton_core_init (struct device *cpu)
 
static void relocation_handler (int cpu, uintptr_t curr_smbase, uintptr_t staggered_smbase)
 
static void get_smm_info (uintptr_t *perm_smbase, size_t *perm_smsize, size_t *smm_save_state_size)
 
static unsigned int detect_num_cpus_via_cpuid (void)
 
static unsigned int detect_num_cpus_via_mch (void)
 
int get_cpu_count (void)
 
static void set_max_turbo_freq (void)
 
static void pre_mp_init (void)
 
static void post_mp_init (void)
 
void mp_init_cpus (struct bus *cpu_bus)
 

Variables

static struct smm_relocation_attrs relo_attrs
 
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 mp_ops mp_ops
 

Function Documentation

◆ configure_thermal_core()

static void configure_thermal_core ( void  )
static

Definition at line 66 of file cpu.c.

References msr_struct::hi, IA32_MISC_ENABLE, IA32_PACKAGE_THERM_INTERRUPT, IA32_THERM_INTERRUPT, msr_struct::lo, rdmsr(), THERMAL_MONITOR_ENABLE_BIT, and wrmsr().

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 26 of file cpu.c.

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

Here is the call graph for this function:

◆ denverton_core_init()

static void denverton_core_init ( struct device cpu)
static

Definition at line 81 of file cpu.c.

◆ detect_num_cpus_via_cpuid()

static unsigned int detect_num_cpus_via_cpuid ( void  )
static

Definition at line 174 of file cpu.c.

References cpuid_ext(), cpuid_result::ebx, and cpuid_result::ecx.

Referenced by get_cpu_count().

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

◆ detect_num_cpus_via_mch()

static unsigned int detect_num_cpus_via_mch ( void  )
static

Definition at line 191 of file cpu.c.

References BIOS_DEBUG, DEFAULT_MCHBAR, MCH_BAR_CORE_DISABLE_MASK, MCH_BAR_CORE_EXISTS_MASK, MMIO32, popcnt(), and printk.

Referenced by get_cpu_count().

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

◆ dnv_configure_mca()

static void dnv_configure_mca ( void  )
static

Definition at line 36 of file cpu.c.

References cpuid, CR4_MCE, cpuid_result::edx, msr_struct::hi, IA32_MCG_CAP, IA32_MCG_CAP_CTL_P_MASK, IA32_MCG_CTL, msr_struct::lo, mca_configure(), rdmsr(), read_cr4(), write_cr4(), and wrmsr().

Here is the call graph for this function:

◆ get_cpu_count()

int get_cpu_count ( void  )

Definition at line 209 of file cpu.c.

References BIOS_DEBUG, detect_num_cpus_via_cpuid(), detect_num_cpus_via_mch(), and printk.

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

◆ mp_init_cpus()

void mp_init_cpus ( struct bus cpu_bus)

Definition at line 288 of file cpu.c.

References mp_init_with_smm().

Here is the call graph for this function:

◆ post_mp_init()

static void post_mp_init ( void  )
static

Definition at line 260 of file cpu.c.

◆ pre_mp_init()

static void pre_mp_init ( void  )
static

Definition at line 254 of file cpu.c.

References x86_mtrr_check(), and x86_setup_mtrrs_with_detect().

Here is the call graph for this function:

◆ relocation_handler()

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

◆ set_max_turbo_freq()

static void set_max_turbo_freq ( void  )
static

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

Definition at line 81 of file cpu.c.

◆ cpu_dev_ops

struct device_operations cpu_dev_ops
static
Initial value:
= {
}
static void denverton_core_init(struct device *cpu)
Definition: cpu.c:81

Definition at line 81 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_DENVERTON_A0_A1
Definition: cpu_ids.h:7
#define CPUID_DENVERTON_B0
Definition: cpu_ids.h:8

Definition at line 81 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,
.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:131
static void pre_mp_init(void)
Definition: cpu.c:254
static void get_smm_info(uintptr_t *perm_smbase, size_t *perm_smsize, size_t *smm_save_state_size)
Definition: cpu.c:149
static void post_mp_init(void)
Definition: cpu.c:260

Definition at line 260 of file cpu.c.

◆ relo_attrs

struct smm_relocation_attrs relo_attrs
static

Definition at line 26 of file cpu.c.

Referenced by get_smm_info(), and relocation_handler().