coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <acpi/acpi_gnvs.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <rmodule.h>
#include <cbmem.h>
#include <cpu/x86/smm.h>
#include <commonlib/helpers.h>
#include <console/console.h>
#include <security/intel/stm/SmmStm.h>
Go to the source code of this file.
Data Structures | |
struct | cpu_smm_info |
Macros | |
#define | FXSAVE_SIZE 512 |
#define | SMM_CODE_SEGMENT_SIZE 0x10000 |
#define | SMM_MINIMUM_STACK_SIZE 32 |
Functions | |
static int | smm_create_map (uintptr_t smbase, unsigned int num_cpus, const struct smm_loader_params *params) |
u32 | smm_get_cpu_smbase (unsigned int cpu_num) |
static int | smm_place_entry_code (uintptr_t smbase, unsigned int num_cpus, uintptr_t stack_top, const struct smm_loader_params *params) |
int | smm_setup_stack (const uintptr_t perm_smbase, const size_t perm_smram_size, const unsigned int total_cpus, const size_t stack_size) |
static int | smm_stub_place_staggered_entry_points (char *base, const struct smm_loader_params *params, const struct rmodule *smm_stub) |
static int | smm_module_setup_stub (const uintptr_t smbase, const size_t smm_size, struct smm_loader_params *params, void *const fxsave_area) |
int | smm_setup_relocation_handler (struct smm_loader_params *params) |
static int | smm_load_module_aseg (const uintptr_t smram_base, const size_t smram_size, struct smm_loader_params *params) |
int | smm_load_module (const uintptr_t smram_base, const size_t smram_size, struct smm_loader_params *params) |
Variables | |
static uint8_t | fxsave_area_relocation [CONFIG_MAX_CPUS][FXSAVE_SIZE] |
unsigned char | _binary_smmstub_start [] |
struct cpu_smm_info | cpus [CONFIG_MAX_CPUS] = { 0 } |
static uintptr_t | stack_top |
static size_t | g_stack_size |
#define FXSAVE_SIZE 512 |
Definition at line 14 of file smm_module_loader.c.
#define SMM_CODE_SEGMENT_SIZE 0x10000 |
Definition at line 15 of file smm_module_loader.c.
#define SMM_MINIMUM_STACK_SIZE 32 |
Definition at line 39 of file smm_module_loader.c.
|
static |
Definition at line 88 of file smm_module_loader.c.
References _binary_smmstub_start, cpu_smm_info::active, ARRAY_SIZE, base, BIOS_DEBUG, BIOS_ERR, cpu_smm_info::code_end, cpu_smm_info::code_start, cpus, cpu_smm_info::entry, params, printk, rmodule_memory_size(), rmodule_parse(), cpu_smm_info::smbase, SMM_ENTRY_OFFSET, and cpu_smm_info::ss_start.
Referenced by smm_load_module(), and smm_load_module_aseg().
Definition at line 159 of file smm_module_loader.c.
References cpus, and cpu_smm_info::smbase.
Referenced by smm_do_relocation().
int smm_load_module | ( | const uintptr_t | smram_base, |
const size_t | smram_size, | ||
struct smm_loader_params * | params | ||
) |
Definition at line 458 of file smm_module_loader.c.
References _binary_smm_start, acpi_get_gnvs(), base, BIOS_DEBUG, BIOS_ERR, cbmem_entry_find(), cbmem_entry_size(), cbmem_entry_start(), CBMEM_ID_CONSOLE, smm_runtime::cbmemc, smm_runtime::cbmemc_size, CONFIG, cpus, DEBUG_SMI, FXSAVE_SIZE, smm_runtime::gnvs_ptr, memset(), NULL, smm_runtime::num_cpus, params, printk, rmodule_entry(), rmodule_load(), rmodule_load_alignment(), rmodule_memory_size(), rmodule_parameters(), rmodule_parse(), smm_runtime::save_state_size, smm_runtime::save_state_top, smm_runtime::smbase, SMM_CODE_SEGMENT_SIZE, smm_create_map(), SMM_DEFAULT_SIZE, smm_load_module_aseg(), smm_module_setup_stub(), smm_runtime::smm_size, cpu_smm_info::ss_start, and stack_top.
|
static |
Definition at line 622 of file smm_module_loader.c.
References _binary_smm_start, acpi_get_gnvs(), ALIGN_DOWN, BIOS_DEBUG, BIOS_ERR, cpu_smm_info::code_end, cpus, FXSAVE_SIZE, smm_runtime::gnvs_ptr, smm_runtime::num_cpus, params, printk, rmodule_entry(), rmodule_load(), rmodule_load_alignment(), rmodule_memory_size(), rmodule_parameters(), rmodule_parse(), smm_runtime::save_state_size, smm_runtime::save_state_top, smm_runtime::smbase, SMM_BASE, smm_create_map(), SMM_DEFAULT_SIZE, smm_module_setup_stub(), smm_runtime::smm_size, and cpu_smm_info::ss_start.
Referenced by smm_load_module().
|
static |
Definition at line 298 of file smm_module_loader.c.
References _binary_smmstub_start, smm_stub_params::apic_id_to_cpu, base, BIOS_DEBUG, BIOS_ERR, smm_stub_params::c_handler, smm_stub_params::fxsave_area, smm_stub_params::fxsave_area_size, FXSAVE_SIZE, g_stack_size, params, printk, rmodule_load(), rmodule_memory_size(), rmodule_parameters(), rmodule_parse(), SMM_ENTRY_OFFSET, smm_stub_place_staggered_entry_points(), smm_stub_size(), smm_stub_params::stack_size, stack_top, smm_stub_params::stack_top, and smm_stub_params::start32_offset.
Referenced by smm_load_module(), smm_load_module_aseg(), and smm_setup_relocation_handler().
|
static |
Definition at line 196 of file smm_module_loader.c.
References BIOS_DEBUG, BIOS_ERR, BIOS_INFO, cpu_smm_info::code_end, cpu_smm_info::code_start, cpus, memcpy(), printk, SMM_ENTRY_OFFSET, and stack_top.
Referenced by smm_stub_place_staggered_entry_points().
int smm_setup_relocation_handler | ( | struct smm_loader_params * | params | ) |
Definition at line 406 of file smm_module_loader.c.
References BIOS_SPEW, fxsave_area_relocation, NULL, params, printk, SMM_DEFAULT_BASE, SMM_DEFAULT_SIZE, and smm_module_setup_stub().
int smm_setup_stack | ( | const uintptr_t | perm_smbase, |
const size_t | perm_smram_size, | ||
const unsigned int | total_cpus, | ||
const size_t | stack_size | ||
) |
Definition at line 235 of file smm_module_loader.c.
References BIOS_ERR, g_stack_size, printk, SMM_MINIMUM_STACK_SIZE, and stack_top.
Referenced by load_smm_handlers().
|
static |
Definition at line 259 of file smm_module_loader.c.
References base, params, rmodule_entry_offset(), smm_place_entry_code(), and stack_top.
Referenced by smm_module_setup_stub().
|
extern |
Referenced by smm_create_map(), smm_module_setup_stub(), and smm_stub_size().
struct cpu_smm_info cpus[CONFIG_MAX_CPUS] = { 0 } |
Definition at line 36 of file smm_module_loader.c.
Referenced by smm_create_map(), smm_get_cpu_smbase(), smm_load_module(), smm_load_module_aseg(), and smm_place_entry_code().
|
static |
Definition at line 19 of file smm_module_loader.c.
Referenced by smm_setup_relocation_handler().
|
static |
Definition at line 233 of file smm_module_loader.c.
Referenced by smm_module_setup_stub(), and smm_setup_stack().
|
static |
Definition at line 232 of file smm_module_loader.c.
Referenced by finalize_load(), smm_load_module(), smm_module_setup_stub(), smm_place_entry_code(), smm_setup_stack(), smm_stub_place_staggered_entry_points(), start_cpu(), and threads_initialize().