coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
cbfs_spi.c File Reference
#include <boot_device.h>
#include <cbfs.h>
#include <console/console.h>
#include <spi_flash.h>
#include <symbols.h>
#include <stdint.h>
#include <timer.h>
Include dependency graph for cbfs_spi.c:

Go to the source code of this file.

Functions

static ssize_t spi_readat (const struct region_device *rd, void *b, size_t offset, size_t size)
 
static ssize_t spi_writeat (const struct region_device *rd, const void *b, size_t offset, size_t size)
 
static ssize_t spi_eraseat (const struct region_device *rd, size_t offset, size_t size)
 
void boot_device_init (void)
 
const struct region_deviceboot_device_ro (void)
 
const struct region_deviceboot_device_rw (void)
 
const struct spi_flashboot_device_spi_flash (void)
 

Variables

static struct spi_flash spi_flash_info
 
static bool spi_flash_init_done
 
static const struct region_device_ops spi_ops
 
static struct mmap_helper_region_device mdev
 

Function Documentation

◆ boot_device_init()

void boot_device_init ( void  )

Definition at line 82 of file cbfs_spi.c.

References spi_flash_info, spi_flash_init_done, and spi_flash_probe().

Referenced by boot_device_spi_flash(), boot_device_wp_region(), find_fmap_directory(), setup_preram_cache(), and vboot_get_cbfs_boot_device().

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

◆ boot_device_ro()

const struct region_device* boot_device_ro ( void  )

Definition at line 97 of file cbfs_spi.c.

References mdev, NULL, mmap_helper_region_device::rdev, and spi_flash_init_done.

Referenced by boot_device_rw().

Here is the caller graph for this function:

◆ boot_device_rw()

const struct region_device* boot_device_rw ( void  )

Definition at line 106 of file cbfs_spi.c.

References boot_device_ro().

Here is the call graph for this function:

◆ boot_device_spi_flash()

const struct spi_flash* boot_device_spi_flash ( void  )

Definition at line 111 of file cbfs_spi.c.

References boot_device_init(), NULL, spi_flash_info, and spi_flash_init_done.

Here is the call graph for this function:

◆ spi_eraseat()

static ssize_t spi_eraseat ( const struct region_device rd,
size_t  offset,
size_t  size 
)
static

Definition at line 62 of file cbfs_spi.c.

◆ spi_readat()

static ssize_t spi_readat ( const struct region_device rd,
void b,
size_t  offset,
size_t  size 
)
static

Definition at line 28 of file cbfs_spi.c.

References BIOS_DEBUG, console_log_level(), KiB, offset, printk, spi_flash_info, spi_flash_read(), stopwatch_duration_usecs(), and stopwatch_init().

Here is the call graph for this function:

◆ spi_writeat()

static ssize_t spi_writeat ( const struct region_device rd,
const void b,
size_t  offset,
size_t  size 
)
static

Definition at line 54 of file cbfs_spi.c.

References offset, spi_flash_info, and spi_flash_write().

Here is the call graph for this function:

Variable Documentation

◆ mdev

struct mmap_helper_region_device mdev
static
Initial value:
=
MMAP_HELPER_DEV_INIT(&spi_ops, 0, CONFIG_ROM_SIZE, &cbfs_cache)
struct mem_pool cbfs_cache
Definition: cbfs.c:26
static const struct region_device_ops spi_ops
Definition: cbfs_spi.c:71
#define MMAP_HELPER_DEV_INIT(ops_, offset_, size_, mpool_)
Definition: region.h:219

Definition at line 62 of file cbfs_spi.c.

Referenced by boot_dev_dma_readat(), boot_dev_mmap(), boot_device_ro(), mdev_eraseat(), mdev_mmap(), mdev_readat(), mdev_writeat(), mem_region_device_init(), mem_region_device_ro_init(), mem_region_device_rw_init(), mmap_helper_rdev_mmap(), mmap_helper_rdev_munmap(), spi_dma_mmap(), and spi_dma_readat_mmap().

◆ spi_flash_info

struct spi_flash spi_flash_info
static

Definition at line 1 of file cbfs_spi.c.

Referenced by boot_device_init(), boot_device_spi_flash(), spi_readat(), and spi_writeat().

◆ spi_flash_init_done

bool spi_flash_init_done
static

Definition at line 18 of file cbfs_spi.c.

Referenced by boot_device_init(), boot_device_ro(), and boot_device_spi_flash().

◆ spi_ops

const struct region_device_ops spi_ops
static
Initial value:
= {
.readat = spi_readat,
.writeat = spi_writeat,
.eraseat = spi_eraseat,
}
static ssize_t spi_readat(const struct region_device *rd, void *b, size_t offset, size_t size)
Definition: cbfs_spi.c:28
static ssize_t spi_writeat(const struct region_device *rd, const void *b, size_t offset, size_t size)
Definition: cbfs_spi.c:54
static ssize_t spi_eraseat(const struct region_device *rd, size_t offset, size_t size)
Definition: cbfs_spi.c:62
void * mmap_helper_rdev_mmap(const struct region_device *, size_t, size_t)
Definition: region.c:303
int mmap_helper_rdev_munmap(const struct region_device *, void *)
Definition: region.c:324

Definition at line 62 of file cbfs_spi.c.