coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
smmrelocate.c File Reference
#include <assert.h>
#include <types.h>
#include <string.h>
#include <device/device.h>
#include <device/pci.h>
#include <commonlib/helpers.h>
#include <cpu/x86/mp.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/mtrr.h>
#include <cpu/x86/smm.h>
#include <cpu/intel/em64t101_save_state.h>
#include <cpu/intel/smm_reloc.h>
#include <console/console.h>
#include <smp/node.h>
Include dependency graph for smmrelocate.c:

Go to the source code of this file.

Macros

#define SMRR_SUPPORTED   (1 << 11)
 
#define D_OPEN   (1 << 6)
 
#define D_CLS   (1 << 5)
 
#define D_LCK   (1 << 4)
 
#define G_SMRAME   (1 << 3)
 
#define C_BASE_SEG   ((0 << 2) | (1 << 1) | (0 << 0))
 

Functions

bool cpu_has_alternative_smrr (void)
 
static void write_smrr_alt (struct smm_relocation_params *relo_params)
 
static void fill_in_relocation_params (struct smm_relocation_params *params)
 
static void setup_ied_area (struct smm_relocation_params *params)
 
void smm_lock (void)
 
void smm_info (uintptr_t *perm_smbase, size_t *perm_smsize, size_t *smm_save_state_size)
 
void smm_initialize (void)
 
void smm_relocation_handler (int cpu, uintptr_t curr_smbase, uintptr_t staggered_smbase)
 
void smm_relocate (void)
 

Macro Definition Documentation

◆ C_BASE_SEG

#define C_BASE_SEG   ((0 << 2) | (1 << 1) | (0 << 0))

Definition at line 26 of file smmrelocate.c.

◆ D_CLS

#define D_CLS   (1 << 5)

Definition at line 23 of file smmrelocate.c.

◆ D_LCK

#define D_LCK   (1 << 4)

Definition at line 24 of file smmrelocate.c.

◆ D_OPEN

#define D_OPEN   (1 << 6)

Definition at line 22 of file smmrelocate.c.

◆ G_SMRAME

#define G_SMRAME   (1 << 3)

Definition at line 25 of file smmrelocate.c.

◆ SMRR_SUPPORTED

#define SMRR_SUPPORTED   (1 << 11)

Definition at line 20 of file smmrelocate.c.

Function Documentation

◆ cpu_has_alternative_smrr()

bool cpu_has_alternative_smrr ( void  )

Definition at line 31 of file smmrelocate.c.

References c, cpuid_eax(), and get_fms().

Referenced by fill_in_relocation_params(), per_cpu_smm_trigger(), and smm_relocation_handler().

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

◆ fill_in_relocation_params()

static void fill_in_relocation_params ( struct smm_relocation_params params)
static

Definition at line 66 of file smmrelocate.c.

References BIOS_WARNING, cpu_has_alternative_smrr(), IS_ALIGNED, MTRR_PHYS_MASK_VALID, MTRR_TYPE_WRBACK, params, printk, smm_region(), smm_subregion(), and SMM_SUBREGION_CHIPSET.

Referenced by smm_info().

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

◆ setup_ied_area()

static void setup_ied_area ( struct smm_relocation_params params)
static

Definition at line 95 of file smmrelocate.c.

References memcpy(), memset(), params, and ied_header::signature.

Referenced by smm_info().

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

◆ smm_info()

void smm_info ( uintptr_t perm_smbase,
size_t perm_smsize,
size_t smm_save_state_size 
)

◆ smm_initialize()

void smm_initialize ( void  )

Definition at line 143 of file smmrelocate.c.

References smm_initiate_relocation(), and smm_southbridge_clear_state().

Here is the call graph for this function:

◆ smm_lock()

void smm_lock ( void  )

Definition at line 114 of file smmrelocate.c.

References BIOS_DEBUG, C_BASE_SEG, D_LCK, G_SMRAME, northbridge_write_smram(), and printk.

Here is the call graph for this function:

◆ smm_relocate()

void smm_relocate ( void  )

Definition at line 205 of file smmrelocate.c.

References boot_cpu(), and smm_initiate_relocation().

Here is the call graph for this function:

◆ smm_relocation_handler()

void smm_relocation_handler ( int  cpu,
uintptr_t  curr_smbase,
uintptr_t  staggered_smbase 
)

◆ write_smrr_alt()

static void write_smrr_alt ( struct smm_relocation_params relo_params)
static

Definition at line 47 of file smmrelocate.c.

References BIOS_DEBUG, BIOS_WARNING, CORE2_SMRR_PHYS_BASE, CORE2_SMRR_PHYS_MASK, FEATURE_CONTROL_LOCK_BIT, IA32_FEATURE_CONTROL, msr_struct::lo, printk, rdmsr(), smm_relocation_params::smrr_base, SMRR_ENABLE, smm_relocation_params::smrr_mask, and wrmsr().

Referenced by smm_relocation_handler().

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