![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <device/mmio.h>
#include <commonlib/helpers.h>
#include <console/console.h>
#include <fast_spi_def.h>
#include <intelblocks/fast_spi.h>
#include <soc/pci_devs.h>
#include <spi_flash.h>
#include <string.h>
#include <timer.h>
Go to the source code of this file.
Data Structures | |
struct | fast_spi_flash_ctx |
Macros | |
#define | BOILERPLATE_CREATE_CTX(ctx) |
#define | SPI_FPR_SHIFT 12 |
#define | SPI_FPR_MASK 0x7fff |
#define | SPI_FPR_BASE_SHIFT 0 |
#define | SPI_FPR_LIMIT_SHIFT 16 |
#define | SPI_FPR_RPE (1 << 15) /* Read Protect */ |
#define | SPI_FPR_WPE (1 << 31) /* Write Protect */ |
#define | SPI_FPR(base, limit) |
Enumerations | |
enum | errors { SUCCESS = 0 , E_TIMEOUT = -1 , E_HW_ERROR = -2 , E_ARGUMENT = -3 } |
Variables | |
const struct spi_flash_ops | fast_spi_flash_ops |
const struct spi_ctrlr | fast_spi_flash_ctrlr |
#define BOILERPLATE_CREATE_CTX | ( | ctx | ) |
Definition at line 14 of file fast_spi_flash.c.
#define SPI_FPR | ( | base, | |
limit | |||
) |
Definition at line 357 of file fast_spi_flash.c.
#define SPI_FPR_BASE_SHIFT 0 |
Definition at line 353 of file fast_spi_flash.c.
#define SPI_FPR_LIMIT_SHIFT 16 |
Definition at line 354 of file fast_spi_flash.c.
#define SPI_FPR_MASK 0x7fff |
Definition at line 352 of file fast_spi_flash.c.
#define SPI_FPR_RPE (1 << 15) /* Read Protect */ |
Definition at line 355 of file fast_spi_flash.c.
#define SPI_FPR_SHIFT 12 |
Definition at line 351 of file fast_spi_flash.c.
#define SPI_FPR_WPE (1 << 31) /* Write Protect */ |
Definition at line 356 of file fast_spi_flash.c.
enum errors |
Enumerator | |
---|---|
SUCCESS | |
E_TIMEOUT | |
E_HW_ERROR | |
E_ARGUMENT |
Definition at line 23 of file fast_spi_flash.c.
|
static |
Definition at line 35 of file fast_spi_flash.c.
References fast_spi_get_bar(), and fast_spi_flash_ctx::mmio_base.
|
static |
Definition at line 85 of file fast_spi_flash.c.
References memcpy(), fast_spi_flash_ctx::mmio_base, and SPIBAR_FDATA.
Referenced by fast_spi_flash_read().
|
static |
Definition at line 149 of file fast_spi_flash.c.
References BIOS_ERR, E_TIMEOUT, printk, SPIBAR_HWSEQ_XFER_TIMEOUT_MS, start_hwseq_xfer(), SUCCESS, wait_for_hwseq_spi_cycle_complete(), and wait_for_hwseq_xfer().
Referenced by fast_spi_flash_erase(), fast_spi_flash_read(), and fast_spi_flash_write().
int fast_spi_cycle_in_progress | ( | void | ) |
Definition at line 164 of file fast_spi_flash.c.
References BIOS_ERR, BOILERPLATE_CREATE_CTX, printk, SPIBAR_HWSEQ_XFER_TIMEOUT_MS, SUCCESS, and wait_for_hwseq_spi_cycle_complete().
Referenced by fast_spi_lockdown_cfg().
|
static |
Definition at line 41 of file fast_spi_flash.c.
References addr, ALIGN_DOWN, fast_spi_flash_ctx::mmio_base, and read32().
Referenced by fast_spi_flash_read_sfdp_param(), wait_for_hwseq_spi_cycle_complete(), and wait_for_hwseq_xfer().
|
static |
Definition at line 49 of file fast_spi_flash.c.
References addr, ALIGN_DOWN, fast_spi_flash_ctx::mmio_base, val, and write32().
Referenced by fast_spi_flash_read_sfdp_param(), and start_hwseq_xfer().
|
static |
Definition at line 340 of file fast_spi_flash.c.
References BIOS_ERR, spi_slave::bus, spi_slave::cs, and printk.
|
static |
Definition at line 192 of file fast_spi_flash.c.
References BIOS_ERR, BIOS_SPEW, BOILERPLATE_CREATE_CTX, E_ARGUMENT, exec_sync_hwseq_xfer(), IS_ALIGNED, KiB, offset, printk, SPIBAR_HSFSTS_CYCLE_4K_ERASE, SPIBAR_HSFSTS_CYCLE_64K_ERASE, and SUCCESS.
Definition at line 310 of file fast_spi_flash.c.
References BOILERPLATE_CREATE_CTX, fast_spi_flash_ops, fast_spi_flash_read_sfdp_param(), KiB, memcpy(), spi_flash::ops, spi_flash::page_size, spi_flash::sector_size, spi_flash::size, and spi_flash::spi.
|
static |
Definition at line 365 of file fast_spi_flash.c.
|
static |
Definition at line 228 of file fast_spi_flash.c.
References addr, BOILERPLATE_CREATE_CTX, buf, drain_xfer_fifo(), exec_sync_hwseq_xfer(), get_xfer_len(), SPIBAR_HSFSTS_CYCLE_READ, and SUCCESS.
|
static |
Definition at line 67 of file fast_spi_flash.c.
References fast_spi_flash_ctrlr_reg_read(), fast_spi_flash_ctrlr_reg_write(), SPIBAR_PTDATA, SPIBAR_PTINX, SPIBAR_PTINX_HORD_JEDEC, and SPIBAR_PTINX_IDX_MASK.
Referenced by fast_spi_flash_probe().
Definition at line 281 of file fast_spi_flash.c.
|
static |
Definition at line 255 of file fast_spi_flash.c.
References addr, BOILERPLATE_CREATE_CTX, buf, exec_sync_hwseq_xfer(), fill_xfer_fifo(), get_xfer_len(), SPIBAR_HSFSTS_CYCLE_WRITE, and SUCCESS.
|
static |
Definition at line 77 of file fast_spi_flash.c.
References memcpy(), fast_spi_flash_ctx::mmio_base, and SPIBAR_FDATA.
Referenced by fast_spi_flash_write().
Definition at line 180 of file fast_spi_flash.c.
References addr, ALIGN_UP, MIN, spi_flash::page_size, and SPIBAR_FDATA_FIFO_SIZE.
Referenced by fast_spi_flash_read(), and fast_spi_flash_write().
|
static |
Definition at line 93 of file fast_spi_flash.c.
References fast_spi_flash_ctrlr_reg_write(), SPIBAR_FADDR, SPIBAR_HSFSTS_CTL, SPIBAR_HSFSTS_FCYCLE_MASK, SPIBAR_HSFSTS_FDBC, SPIBAR_HSFSTS_FGO, and SPIBAR_HSFSTS_W1C_BITS.
Referenced by exec_sync_hwseq_xfer().
|
static |
Definition at line 132 of file fast_spi_flash.c.
References E_TIMEOUT, fast_spi_flash_ctrlr_reg_read(), SPIBAR_HSFSTS_CTL, SPIBAR_HSFSTS_SCIP, SPIBAR_HWSEQ_XFER_TIMEOUT_MS, stopwatch_expired(), stopwatch_init_msecs_expire(), and SUCCESS.
Referenced by exec_sync_hwseq_xfer(), and fast_spi_cycle_in_progress().
|
static |
Definition at line 107 of file fast_spi_flash.c.
References BIOS_ERR, E_HW_ERROR, E_TIMEOUT, fast_spi_flash_ctrlr_reg_read(), printk, SPIBAR_HSFSTS_CTL, SPIBAR_HSFSTS_FCERR, SPIBAR_HSFSTS_FDONE, SPIBAR_HWSEQ_XFER_TIMEOUT_MS, stopwatch_expired(), stopwatch_init_msecs_expire(), and SUCCESS.
Referenced by exec_sync_hwseq_xfer().
const struct spi_ctrlr fast_spi_flash_ctrlr |
Definition at line 365 of file fast_spi_flash.c.
const struct spi_flash_ops fast_spi_flash_ops |
Definition at line 281 of file fast_spi_flash.c.
Referenced by fast_spi_flash_probe().