coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <console/console.h>
#include <cpu/x86/cr.h>
#include <cpu/x86/mp.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/cache.h>
#include <security/intel/stm/SmmStm.h>
#include <stdbool.h>
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | VMX_BASIC_MSR_BITS |
union | VMX_BASIC_MSR |
struct | SMM_MONITOR_CTL_MSR_BITS |
struct | mp_state |
union | SMM_MONITOR_CTL_MSR |
Macros | |
#define | TXT_EVTYPE_BASE 0x400 |
#define | TXT_EVTYPE_STM_HASH (TXT_EVTYPE_BASE + 14) |
#define | RDWR_ACCS 3 |
#define | FULL_ACCS 7 |
#define | SIZE_4KB 0x00001000 |
#define | SIZE_4MB 0x00400000 |
#define | PTP_SIZE SIZE_4KB |
#define | IA32_PG_P (1 << 0) |
#define | IA32_PG_RW (1 << 1) |
#define | IA32_PG_PS (1 << 7) |
#define | STM_PAGE_SHIFT 12 |
#define | STM_PAGE_MASK 0xFFF |
#define | STM_SIZE_TO_PAGES(a) (((a) >> STM_PAGE_SHIFT) + (((a)&STM_PAGE_MASK) ? 1 : 0)) |
#define | STM_PAGES_TO_SIZE(a) ((a) << STM_PAGE_SHIFT) |
#define | STM_ACCESS_DENIED 15 |
#define | STM_UNSUPPORTED 3 |
#define | STM_BUFFER_TOO_SMALL 1 |
#define | STM_SM_MONITOR_STATE_ENABLED 1 |
Functions | |
static bool | handle_single_resource (STM_RSC *resource, STM_RSC *record) |
static void | add_single_resource (STM_RSC *resource) |
static void | add_resource (STM_RSC *resource_list, uint32_t num_entries) |
static bool | validate_resource (STM_RSC *resource_list, uint32_t num_entries) |
static uint32_t | get_resource_size (STM_RSC *resource_list, uint32_t num_entries) |
int | add_pi_resource (STM_RSC *resource_list, uint32_t num_entries) |
int32_t | delete_pi_resource (STM_RSC *resource_list, uint32_t num_entries) |
int32_t | get_pi_resource (STM_RSC *resource_list, uint32_t *resource_size) |
static uint32_t | get_vmcs_size (void) |
void | stm_gen_4g_pagetable_x64 (uint32_t pagetable_base) |
bool | stm_check_stm_image (void *stm_image, uint32_t stm_imagesize) |
void * | get_stm_resource (void) |
Variables | |
struct mp_state | mp_state |
STM_RSC_END | m_rsc_end_node |
uint8_t * | m_stm_resources_ptr = NULL |
uint32_t | m_stm_resource_total_size = 0x0 |
uint32_t | m_stm_resource_size_used = 0x0 |
uint32_t | m_stm_resource_size_available = 0x0 |
uint8_t * | stm_resource_heap = NULL |
uint32_t | m_stm_state = 0 |
#define STM_PAGES_TO_SIZE | ( | a | ) | ((a) << STM_PAGE_SHIFT) |
#define STM_SIZE_TO_PAGES | ( | a | ) | (((a) >> STM_PAGE_SHIFT) + (((a)&STM_PAGE_MASK) ? 1 : 0)) |
#define TXT_EVTYPE_STM_HASH (TXT_EVTYPE_BASE + 14) |
Definition at line 470 of file SmmStm.c.
References add_resource(), BIOS_DEBUG, get_resource_size(), m_rsc_end_node, m_stm_resource_size_available, m_stm_resource_size_used, m_stm_resource_total_size, m_stm_resources_ptr, memcpy(), memset(), NULL, printk, stm_resource_heap, validate_resource(), and wbinvd().
Referenced by add_msr_resources(), and add_simple_resources().
Definition at line 276 of file SmmStm.c.
References add_single_resource(), count, and END_OF_RESOURCES.
Referenced by add_pi_resource().
Definition at line 234 of file SmmStm.c.
References END_OF_RESOURCES, handle_single_resource(), STM_RSC::header, STM_RSC_DESC_HEADER::length, m_rsc_end_node, m_stm_resource_size_available, m_stm_resource_size_used, m_stm_resource_total_size, m_stm_resources_ptr, memcpy(), and STM_RSC_DESC_HEADER::rsc_type.
Referenced by add_resource().
Definition at line 523 of file SmmStm.c.
References m_rsc_end_node, m_stm_resource_size_available, m_stm_resource_size_used, m_stm_resource_total_size, m_stm_resources_ptr, memcpy(), and NULL.
Definition at line 551 of file SmmStm.c.
References m_stm_resource_size_used, m_stm_resources_ptr, and memcpy().
Definition at line 431 of file SmmStm.c.
References count, and END_OF_RESOURCES.
Referenced by add_pi_resource().
Definition at line 675 of file SmmStm.c.
References m_stm_resources_ptr.
Referenced by setup_smm_descriptor().
Definition at line 567 of file SmmStm.c.
References BIOS_DEBUG, VMX_BASIC_MSR::bits, IA32_VMX_BASIC_MSR, VMX_BASIC_MSR::msr, printk, rdmsr(), STM_PAGES_TO_SIZE, STM_SIZE_TO_PAGES, VMX_BASIC_MSR_BITS::stm_supported, and VMX_BASIC_MSR_BITS::vmcs_size.
Referenced by stm_check_stm_image().
Definition at line 109 of file SmmStm.c.
References resource::base, STM_RSC_MEM_DESC::base, STM_RSC_IO_DESC::base, STM_RSC_PCI_CFG_DESC::base, STM_RSC::io, IO_RANGE, STM_RSC_PCI_CFG_DESC::last_node_index, STM_RSC_MEM_DESC::length, STM_RSC_IO_DESC::length, STM_RSC_PCI_CFG_DESC::length, MACHINE_SPECIFIC_REG, STM_RSC::mem, MEM_RANGE, memcmp(), MMIO_RANGE, STM_RSC::msr, STM_RSC_MSR_DESC::msr_index, STM_RSC_PCI_CFG_DESC::originating_bus_number, STM_RSC::pci_cfg, PCI_CFG_RANGE, STM_RSC_PCI_CFG_DESC::pci_device_path, STM_RSC_MSR_DESC::read_mask, STM_RSC_PCI_CFG_DESC::rw_attributes, STM_RSC_MEM_DESC::rwx_attributes, TRAPPED_IO_RANGE, and STM_RSC_MSR_DESC::write_mask.
Referenced by add_single_resource().
Definition at line 632 of file SmmStm.c.
References SOFTWARE_STM_HEADER::additional_dynamic_memory_size, mp_state::cpu_count, HARDWARE_STM_HEADER::cr3_offset, get_vmcs_size(), STM_HEADER::hw_stm_hdr, SOFTWARE_STM_HEADER::per_proc_dynamic_memory_size, SOFTWARE_STM_HEADER::static_image_size, STM_PAGES_TO_SIZE, STM_SIZE_TO_PAGES, and STM_HEADER::sw_stm_hdr.
Referenced by load_stm_image().
Definition at line 592 of file SmmStm.c.
References IA32_PG_P, IA32_PG_PS, IA32_PG_RW, PTP_SIZE, and SIZE_4KB.
Referenced by load_stm_image().
Definition at line 308 of file SmmStm.c.
References resource::base, BIOS_DEBUG, count, END_OF_RESOURCES, FULL_ACCS, IO_RANGE, MACHINE_SPECIFIC_REG, MEM_RANGE, MMIO_RANGE, PCI_CFG_RANGE, printk, and TRAPPED_IO_RANGE.
Referenced by add_pi_resource().
STM_RSC_END m_rsc_end_node |
Definition at line 86 of file SmmStm.c.
Referenced by add_pi_resource(), add_single_resource(), and delete_pi_resource().
uint32_t m_stm_resource_size_available = 0x0 |
Definition at line 93 of file SmmStm.c.
Referenced by add_pi_resource(), add_single_resource(), and delete_pi_resource().
uint32_t m_stm_resource_size_used = 0x0 |
Definition at line 92 of file SmmStm.c.
Referenced by add_pi_resource(), add_single_resource(), delete_pi_resource(), and get_pi_resource().
uint32_t m_stm_resource_total_size = 0x0 |
Definition at line 91 of file SmmStm.c.
Referenced by add_pi_resource(), add_single_resource(), and delete_pi_resource().
Definition at line 90 of file SmmStm.c.
Referenced by add_pi_resource(), add_resources_cmd(), add_single_resource(), delete_pi_resource(), get_pi_resource(), and get_stm_resource().
Definition at line 95 of file SmmStm.c.
Referenced by add_pi_resource(), and stm_setup().