coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ramstage.c File Reference
#include <acpi/acpi.h>
#include <arch/mmio.h>
#include <bootmem.h>
#include <bootstate.h>
#include <cbfs.h>
#include <console/console.h>
#include <cpu/intel/common/common.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/smm.h>
#include <device/pci_ops.h>
#include <security/intel/cbnt/cbnt.h>
#include <types.h>
#include "txt.h"
#include "txt_platform.h"
#include "txt_register.h"
#include "txt_getsec.h"
Include dependency graph for ramstage.c:

Go to the source code of this file.

Functions

static void log_ibb_measurements (void)
 
void bootmem_platform_add_ranges (void)
 
static bool get_wake_error_status (void)
 
static void check_secrets_txt (void *unused)
 
 BOOT_STATE_INIT_ENTRY (BS_POST_DEVICE, BS_ON_ENTRY, check_secrets_txt, NULL)
 
static void init_intel_txt (void *unused)
 Log TXT startup errors, check all bits for TXT, run BIOSACM using GETSEC[ENTERACCS]. More...
 
 BOOT_STATE_INIT_ENTRY (BS_DEV_INIT, BS_ON_EXIT, init_intel_txt, NULL)
 
static void push_sinit_heap (u8 **heap_ptr, void *data, size_t data_length)
 
static void txt_heap_fill_common_bdr (struct txt_biosdataregion *bdr)
 
static void txt_heap_fill_bios_spec (struct txt_bios_spec_ver_element *spec)
 
static void txt_heap_push_bdr_for_two_acms (u8 **heap_struct)
 
static void txt_heap_push_bdr_for_one_acm (u8 **heap_struct)
 
static void txt_initialize_heap (void)
 
__weak bool skip_intel_txt_lockdown (void)
 
static void lockdown_intel_txt (void *unused)
 Finalize the TXT device. More...
 
 BOOT_STATE_INIT_ENTRY (BS_POST_DEVICE, BS_ON_EXIT, lockdown_intel_txt, NULL)
 

Function Documentation

◆ BOOT_STATE_INIT_ENTRY() [1/3]

BOOT_STATE_INIT_ENTRY ( BS_DEV_INIT  ,
BS_ON_EXIT  ,
init_intel_txt  ,
NULL   
)

◆ BOOT_STATE_INIT_ENTRY() [2/3]

BOOT_STATE_INIT_ENTRY ( BS_POST_DEVICE  ,
BS_ON_ENTRY  ,
check_secrets_txt  ,
NULL   
)

◆ BOOT_STATE_INIT_ENTRY() [3/3]

BOOT_STATE_INIT_ENTRY ( BS_POST_DEVICE  ,
BS_ON_EXIT  ,
lockdown_intel_txt  ,
NULL   
)

◆ bootmem_platform_add_ranges()

◆ check_secrets_txt()

static void check_secrets_txt ( void unused)
static

◆ get_wake_error_status()

static bool get_wake_error_status ( void  )
static

Definition at line 80 of file ramstage.c.

References read8(), TXT_ESTS, and TXT_ESTS_WAKE_ERROR_STS.

Referenced by init_intel_txt().

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

◆ init_intel_txt()

static void init_intel_txt ( void unused)
static

Log TXT startup errors, check all bits for TXT, run BIOSACM using GETSEC[ENTERACCS].

If a "TXT reset" is detected or "memory had secrets" is set, then do nothing as

  1. Running ACMs will cause a TXT-RESET
  2. Memory will be scrubbed in BS_DEV_INIT
  3. TXT-RESET will be issued by code above later

Definition at line 123 of file ramstage.c.

References ACMINPUT_NOP, ACMINPUT_SCHECK, ACMSTS_BIOS_TRUSTED, ACMSTS_IBB_MEASURED, ACMSTS_TXT_DISABLED, acpi_is_wakeup_s3(), BIOS_ERR, BIOS_INFO, CONFIG, get_wake_error_status(), intel_cbnt_log_registers(), intel_txt_log_bios_acm_error(), intel_txt_log_spad(), intel_txt_prepare_txt_env(), intel_txt_run_bios_acm(), log_ibb_measurements(), printk, read64(), txt_dump_chipset_info(), and TXT_SPAD.

Here is the call graph for this function:

◆ lockdown_intel_txt()

static void lockdown_intel_txt ( void unused)
static

Finalize the TXT device.

  • Lock TXT register.
  • Protect TSEG using DMA protected regions.
  • Setup TXT regions.
  • Place SINIT ACM in TXT_SINIT memory segment.
  • Fill TXT BIOSDATA region.

Chapter 5.10.1 SMM in the Intel TXT for Servers Environment Disable MSEG.

Definition at line 364 of file ramstage.c.

References _Static_assert(), ACMINPUT_LOCK_CONFIG, ACMSTS_TXT_DISABLED, acpi_is_wakeup_s3(), ALIGN_DOWN, BIOS_DEBUG, BIOS_ERR, BIOS_INFO, CONFIG, dpr_register::epm, getsec_parameter(), GETSEC_PARAMS_TXT_EXT_CRTM_SUPPORT, intel_txt_run_bios_acm(), dpr_register::lock, MiB, NULL, printk, dpr_register::prs, dpr_register::raw, read32(), read64(), dpr_register::size, skip_intel_txt_lockdown(), smm_region(), dpr_register::top, TXT_CAPABILITIES, TXT_CAPABILITIES_DPR, TXT_DPR, txt_dump_regions(), txt_get_chipset_dpr(), TXT_HEAP_BASE, TXT_HEAP_SIZE, txt_initialize_heap(), TXT_MSEG_BASE, TXT_MSEG_SIZE, TXT_SINIT_BASE, TXT_SINIT_SIZE, TXT_SPAD, and write64().

Here is the call graph for this function:

◆ log_ibb_measurements()

static void log_ibb_measurements ( void  )
static

Definition at line 22 of file ramstage.c.

References BIOS_INFO, printk, read64(), read8(), TXT_MSEG_BASE, and TXT_MSEG_SIZE.

Referenced by init_intel_txt().

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

◆ push_sinit_heap()

static void push_sinit_heap ( u8 **  heap_ptr,
void data,
size_t  data_length 
)
static

Definition at line 189 of file ramstage.c.

References memcpy().

Referenced by txt_heap_push_bdr_for_one_acm(), txt_heap_push_bdr_for_two_acms(), and txt_initialize_heap().

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

◆ skip_intel_txt_lockdown()

__weak bool skip_intel_txt_lockdown ( void  )

Definition at line 350 of file ramstage.c.

◆ txt_heap_fill_bios_spec()

◆ txt_heap_fill_common_bdr()

static void txt_heap_fill_common_bdr ( struct txt_biosdataregion bdr)
static

◆ txt_heap_push_bdr_for_one_acm()

static void txt_heap_push_bdr_for_one_acm ( u8 **  heap_struct)
static

Definition at line 281 of file ramstage.c.

References cbfs_map(), txt_extended_data_element_header::data, HEAP_EXTDATA_TYPE_ACM, HEAP_EXTDATA_TYPE_END, memset(), NULL, push_sinit_heap(), read64(), txt_heap_fill_bios_spec(), txt_heap_fill_common_bdr(), TXT_SINIT_BASE, and TXT_SINIT_SIZE.

Referenced by txt_initialize_heap().

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

◆ txt_heap_push_bdr_for_two_acms()

static void txt_heap_push_bdr_for_two_acms ( u8 **  heap_struct)
static

◆ txt_initialize_heap()

static void txt_initialize_heap ( void  )
static

Definition at line 319 of file ramstage.c.

References cbfs_file_exists(), NULL, push_sinit_heap(), read64(), TXT_HEAP_BASE, txt_heap_push_bdr_for_one_acm(), and txt_heap_push_bdr_for_two_acms().

Referenced by lockdown_intel_txt().

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