coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
fast_spi.c File Reference
#include <arch/romstage.h>
#include <device/mmio.h>
#include <assert.h>
#include <device/pci_def.h>
#include <device/pci_ops.h>
#include <console/console.h>
#include <commonlib/helpers.h>
#include <cpu/x86/mtrr.h>
#include <fast_spi_def.h>
#include <intelblocks/fast_spi.h>
#include <intelblocks/gpmr.h>
#include <lib.h>
#include <soc/pci_devs.h>
#include <spi_flash.h>
#include <spi-generic.h>
Include dependency graph for fast_spi.c:

Go to the source code of this file.

Macros

#define __SIMPLE_DEVICE__
 

Functions

voidfast_spi_get_bar (void)
 
void fast_spi_init (void)
 
static void fast_spi_set_bios_control_reg (uint32_t bios_cntl_bit)
 
static void fast_spi_read_post_write (uint8_t reg)
 
void fast_spi_set_bios_interface_lock_down (void)
 
void fast_spi_set_lock_enable (void)
 
void fast_spi_set_ext_bios_lock_enable (void)
 
void fast_spi_set_eiss (void)
 
void fast_spi_set_opcode_menu (void)
 
void fast_spi_lock_bar (void)
 
void fast_spi_pr_dlock (void)
 
void fast_spi_vscc0_lock (void)
 
void fast_spi_set_strap_msg_data (uint32_t soft_reset_data)
 
static void fast_spi_enable_cache_range (unsigned int base, unsigned int size)
 
size_t fast_spi_get_bios_region (size_t *bios_size)
 
static bool fast_spi_ext_bios_cache_range (uintptr_t *base, size_t *size)
 
static void fast_spi_cache_ext_bios_window (void)
 
void fast_spi_cache_ext_bios_postcar (struct postcar_frame *pcf)
 
void fast_spi_cache_bios_region (void)
 
static void fast_spi_enable_ext_bios (void)
 
void fast_spi_early_init (uintptr_t spi_base_address)
 
bool fast_spi_clear_sync_smi_status (void)
 
bool fast_spi_wpd_status (void)
 
void fast_spi_enable_wp (void)
 
void fast_spi_disable_wp (void)
 
void fast_spi_clear_outstanding_status (void)
 

Macro Definition Documentation

◆ __SIMPLE_DEVICE__

#define __SIMPLE_DEVICE__

Definition at line 3 of file fast_spi.c.

Function Documentation

◆ fast_spi_cache_bios_region()

void fast_spi_cache_bios_region ( void  )

Definition at line 292 of file fast_spi.c.

References ALIGN_UP, base, bios_size, fast_spi_cache_ext_bios_window(), fast_spi_enable_cache_range(), fast_spi_get_bios_region(), GiB, log2_ceil(), MiB, and MIN.

Referenced by apollolake_init_cpus(), bootblock_c_entry(), bootblock_soc_early_init(), and post_cpus_add_romcache().

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

◆ fast_spi_cache_ext_bios_postcar()

void fast_spi_cache_ext_bios_postcar ( struct postcar_frame pcf)

Definition at line 280 of file fast_spi.c.

References fast_spi_ext_bios_cache_range(), MTRR_TYPE_WRPROT, postcar_frame_add_mtrr(), and type.

Referenced by fill_postcar_frame().

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

◆ fast_spi_cache_ext_bios_window()

static void fast_spi_cache_ext_bios_window ( void  )
static

Definition at line 269 of file fast_spi.c.

References fast_spi_enable_cache_range(), and fast_spi_ext_bios_cache_range().

Referenced by fast_spi_cache_bios_region().

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

◆ fast_spi_clear_outstanding_status()

void fast_spi_clear_outstanding_status ( void  )

Definition at line 449 of file fast_spi.c.

References fast_spi_get_bar(), spibar, SPIBAR_HSFSTS_CTL, SPIBAR_HSFSTS_W1C_BITS, and write32().

Referenced by fast_spi_lockdown_cfg().

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

◆ fast_spi_clear_sync_smi_status()

bool fast_spi_clear_sync_smi_status ( void  )

Definition at line 407 of file fast_spi.c.

References PCH_DEV_SPI, pci_read_config32(), pci_write_config32(), SPI_BIOS_CONTROL, and SPI_BIOS_CONTROL_SYNC_SS.

Referenced by smihandler_southbridge_tco(), and southbridge_smi_store().

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

◆ fast_spi_disable_wp()

void fast_spi_disable_wp ( void  )

Definition at line 439 of file fast_spi.c.

References PCH_DEV_SPI, pci_read_config8(), pci_write_config8(), SPI_BIOS_CONTROL, and SPI_BIOS_CONTROL_WPD.

Referenced by southbridge_smi_store().

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

◆ fast_spi_early_init()

void fast_spi_early_init ( uintptr_t  spi_base_address)

◆ fast_spi_enable_cache_range()

static void fast_spi_enable_cache_range ( unsigned int  base,
unsigned int  size 
)
static

Definition at line 217 of file fast_spi.c.

References base, BIOS_WARNING, get_free_var_mtrr(), MTRR_TYPE_WRPROT, printk, set_var_mtrr(), and type.

Referenced by fast_spi_cache_bios_region(), and fast_spi_cache_ext_bios_window().

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

◆ fast_spi_enable_ext_bios()

static void fast_spi_enable_ext_bios ( void  )
static

◆ fast_spi_enable_wp()

void fast_spi_enable_wp ( void  )

Definition at line 428 of file fast_spi.c.

References PCH_DEV_SPI, pci_read_config8(), pci_write_config8(), SPI_BIOS_CONTROL, and SPI_BIOS_CONTROL_WPD.

Referenced by fast_spi_lockdown_cfg(), finalize(), smihandler_southbridge_tco(), and southbridge_smi_store().

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

◆ fast_spi_ext_bios_cache_range()

static bool fast_spi_ext_bios_cache_range ( uintptr_t base,
size_t size 
)
static

Definition at line 249 of file fast_spi.c.

References ALIGN_DOWN, ALIGN_UP, base, CONFIG, fast_spi_get_ext_bios_window(), and log2_ceil().

Referenced by fast_spi_cache_ext_bios_postcar(), and fast_spi_cache_ext_bios_window().

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

◆ fast_spi_get_bar()

◆ fast_spi_get_bios_region()

size_t fast_spi_get_bios_region ( size_t bios_size)

Definition at line 232 of file fast_spi.c.

References bios_size, fast_spi_get_bar(), KiB, read32(), SPIBAR_BFPREG, SPIBAR_BFPREG_PRB_MASK, SPIBAR_BFPREG_PRL_MASK, SPIBAR_BFPREG_PRL_SHIFT, and val.

Referenced by bios_mmap_init(), and fast_spi_cache_bios_region().

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

◆ fast_spi_init()

void fast_spi_init ( void  )

Definition at line 41 of file fast_spi.c.

References PCH_DEV_SPI, pci_read_config8(), pci_write_config8(), SPI_BIOS_CONTROL, SPI_BIOS_CONTROL_CACHE_DISABLE, SPI_BIOS_CONTROL_EISS, SPI_BIOS_CONTROL_PREFETCH_ENABLE, and SPI_BIOS_CONTROL_WPD.

Referenced by fast_spi_early_init(), finalize(), and spi_flash_init_cb().

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

◆ fast_spi_lock_bar()

void fast_spi_lock_bar ( void  )

Definition at line 145 of file fast_spi.c.

References CONFIG, fast_spi_get_bar(), spibar, SPIBAR_HSFSTS_CTL, SPIBAR_HSFSTS_FLOCKDN, SPIBAR_HSFSTS_PRR34_LOCKDN, SPIBAR_HSFSTS_WRSDIS, and write16().

Referenced by fast_spi_lockdown_cfg().

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

◆ fast_spi_pr_dlock()

void fast_spi_pr_dlock ( void  )

Definition at line 160 of file fast_spi.c.

References fast_spi_get_bar(), read32(), spibar, SPIBAR_DLOCK, SPIBAR_DLOCK_PR0LOCKDN, SPIBAR_DLOCK_PR1LOCKDN, SPIBAR_DLOCK_PR2LOCKDN, SPIBAR_DLOCK_PR3LOCKDN, SPIBAR_DLOCK_PR4LOCKDN, and write32().

Referenced by fast_spi_lockdown_cfg().

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

◆ fast_spi_read_post_write()

static void fast_spi_read_post_write ( uint8_t  reg)
static

Definition at line 75 of file fast_spi.c.

References PCH_DEV_SPI, and pci_read_config8().

Referenced by fast_spi_set_bios_interface_lock_down(), fast_spi_set_eiss(), fast_spi_set_ext_bios_lock_enable(), and fast_spi_set_lock_enable().

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

◆ fast_spi_set_bios_control_reg()

static void fast_spi_set_bios_control_reg ( uint32_t  bios_cntl_bit)
static

Definition at line 61 of file fast_spi.c.

References assert, PCH_DEV_SPI, pci_read_config32(), pci_write_config32(), and SPI_BIOS_CONTROL.

Referenced by fast_spi_set_bios_interface_lock_down(), fast_spi_set_eiss(), fast_spi_set_ext_bios_lock_enable(), and fast_spi_set_lock_enable().

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

◆ fast_spi_set_bios_interface_lock_down()

void fast_spi_set_bios_interface_lock_down ( void  )

Definition at line 83 of file fast_spi.c.

References fast_spi_read_post_write(), fast_spi_set_bios_control_reg(), SPI_BIOS_CONTROL, and SPI_BIOS_CONTROL_BILD.

Referenced by fast_spi_lockdown_cfg().

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

◆ fast_spi_set_eiss()

void fast_spi_set_eiss ( void  )

Definition at line 116 of file fast_spi.c.

References fast_spi_read_post_write(), fast_spi_set_bios_control_reg(), SPI_BIOS_CONTROL, and SPI_BIOS_CONTROL_EISS.

Referenced by fast_spi_lockdown_cfg().

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

◆ fast_spi_set_ext_bios_lock_enable()

void fast_spi_set_ext_bios_lock_enable ( void  )

Definition at line 103 of file fast_spi.c.

References CONFIG, fast_spi_read_post_write(), fast_spi_set_bios_control_reg(), SPI_BIOS_CONTROL, and SPI_BIOS_CONTROL_EXT_BIOS_LOCK_ENABLE.

Referenced by fast_spi_lockdown_cfg().

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

◆ fast_spi_set_lock_enable()

void fast_spi_set_lock_enable ( void  )

Definition at line 93 of file fast_spi.c.

References fast_spi_read_post_write(), fast_spi_set_bios_control_reg(), SPI_BIOS_CONTROL, and SPI_BIOS_CONTROL_LOCK_ENABLE.

Referenced by fast_spi_lockdown_cfg().

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

◆ fast_spi_set_opcode_menu()

void fast_spi_set_opcode_menu ( void  )

Definition at line 126 of file fast_spi.c.

References fast_spi_get_bar(), SPI_OPMENU_LOWER, SPI_OPMENU_UPPER, SPI_OPPREFIX, SPI_OPTYPE, spibar, SPIBAR_OPMENU_LOWER, SPIBAR_OPMENU_UPPER, SPIBAR_OPTYPE, SPIBAR_PREOP, write16(), and write32().

Referenced by fast_spi_lockdown_cfg(), and mainboard_final().

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

◆ fast_spi_set_strap_msg_data()

void fast_spi_set_strap_msg_data ( uint32_t  soft_reset_data)

Definition at line 193 of file fast_spi.c.

References fast_spi_get_bar(), read32(), spibar, SPIBAR_RESET_CTRL, SPIBAR_RESET_CTRL_SSMC, SPIBAR_RESET_DATA, SPIBAR_RESET_LOCK, SPIBAR_RESET_LOCK_ENABLE, and write32().

Here is the call graph for this function:

◆ fast_spi_vscc0_lock()

void fast_spi_vscc0_lock ( void  )

Definition at line 176 of file fast_spi.c.

References fast_spi_get_bar(), setbits32, spibar, SPIBAR_SFDP0_VSCC0, and SPIBAR_VSCC0_VCL.

Referenced by fast_spi_lockdown_cfg().

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

◆ fast_spi_wpd_status()

bool fast_spi_wpd_status ( void  )

Definition at line 421 of file fast_spi.c.

References PCH_DEV_SPI, pci_read_config16(), SPI_BIOS_CONTROL, and SPI_BIOS_CONTROL_WPD.

Referenced by smihandler_southbridge_tco(), and southbridge_smi_store().

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