coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
media.c File Reference
#include <boot_device.h>
#include <cbfs.h>
#include <symbols.h>
#include <device/mmio.h>
#include <soc/addressmap.h>
#include <soc/spi.h>
#include <soc/clock.h>
#include <console/console.h>
#include <spi_sdcard.h>
Include dependency graph for media.c:

Go to the source code of this file.

Macros

#define MSEL_SPI0x1(m)   (((m) == 5) || ((m) == 14))
 
#define MSEL_SPI0x4(m)   (((m) == 6) || ((m) == 10) || ((m) == 15))
 
#define MSEL_SPI1x1(m)   ((m) == 12)
 
#define MSEL_SPI1x4(m)   (((m) == 7) || ((m) == 13))
 
#define MSEL_SPI1SD(m)   ((m) == 8)
 
#define MSEL_SPI2x1(m)   ((m) == 9)
 
#define MSEL_SPI2SD(m)   ((m) == 11)
 

Functions

static ssize_t unleashed_sd_readat (const struct region_device *rdev, void *dest, size_t offset, size_t count)
 
const struct region_deviceboot_device_ro (void)
 
void boot_device_init (void)
 

Variables

static struct spi_sdcard card
 
static struct mem_region_device spi_mdev
 
static const struct region_device_ops unleashed_sd_ops
 
static struct mmap_helper_region_device sd_mdev
 
static const struct fu540_spi_mmap_config spi_mmap_config
 

Macro Definition Documentation

◆ MSEL_SPI0x1

#define MSEL_SPI0x1 (   m)    (((m) == 5) || ((m) == 14))

Definition at line 18 of file media.c.

◆ MSEL_SPI0x4

#define MSEL_SPI0x4 (   m)    (((m) == 6) || ((m) == 10) || ((m) == 15))

Definition at line 19 of file media.c.

◆ MSEL_SPI1SD

#define MSEL_SPI1SD (   m)    ((m) == 8)

Definition at line 22 of file media.c.

◆ MSEL_SPI1x1

#define MSEL_SPI1x1 (   m)    ((m) == 12)

Definition at line 20 of file media.c.

◆ MSEL_SPI1x4

#define MSEL_SPI1x4 (   m)    (((m) == 7) || ((m) == 13))

Definition at line 21 of file media.c.

◆ MSEL_SPI2SD

#define MSEL_SPI2SD (   m)    ((m) == 11)

Definition at line 24 of file media.c.

◆ MSEL_SPI2x1

#define MSEL_SPI2x1 (   m)    ((m) == 9)

Definition at line 23 of file media.c.

Function Documentation

◆ boot_device_init()

void boot_device_init ( void  )

Definition at line 70 of file media.c.

References card, die(), FU540_MSEL, fu540_spi_mmap(), m, MSEL_SPI0x1, MSEL_SPI0x4, MSEL_SPI2SD, read32(), slave, spi_mmap_config, spi_sdcard_init(), and spi_setup_slave().

Here is the call graph for this function:

◆ boot_device_ro()

const struct region_device* boot_device_ro ( void  )

Definition at line 48 of file media.c.

References die(), FU540_MSEL, m, MSEL_SPI0x1, MSEL_SPI0x4, MSEL_SPI2SD, NULL, mem_region_device::rdev, mmap_helper_region_device::rdev, read32(), sd_mdev, and spi_mdev.

Here is the call graph for this function:

◆ unleashed_sd_readat()

static ssize_t unleashed_sd_readat ( const struct region_device rdev,
void dest,
size_t  offset,
size_t  count 
)
static

Definition at line 32 of file media.c.

Variable Documentation

◆ card

◆ sd_mdev

struct mmap_helper_region_device sd_mdev
static
Initial value:
=
struct mem_pool cbfs_cache
Definition: cbfs.c:26
#define MMAP_HELPER_DEV_INIT(ops_, offset_, size_, mpool_)
Definition: region.h:219
static const struct region_device_ops unleashed_sd_ops
Definition: media.c:39

Definition at line 32 of file media.c.

Referenced by boot_device_ro().

◆ spi_mdev

struct mem_region_device spi_mdev
static
Initial value:
=
MEM_REGION_DEV_RO_INIT((void *)0x20000000, CONFIG_ROM_SIZE)
#define MEM_REGION_DEV_RO_INIT(base_, size_)
Definition: region.h:208

Definition at line 1 of file media.c.

Referenced by boot_device_ro().

◆ spi_mmap_config

const struct fu540_spi_mmap_config spi_mmap_config
static
Initial value:
= {
.cmd_en = 1,
.addr_len = 4,
.pad_cnt = 6,
.cmd_proto = FU540_SPI_PROTO_S,
.addr_proto = FU540_SPI_PROTO_Q,
.data_proto = FU540_SPI_PROTO_Q,
.cmd_code = 0xec,
.pad_code = 0
}
#define FU540_SPI_PROTO_Q
Definition: spi.h:12
#define FU540_SPI_PROTO_S
Definition: spi.h:8

Definition at line 59 of file media.c.

Referenced by boot_device_init().

◆ unleashed_sd_ops

const struct region_device_ops unleashed_sd_ops
static
Initial value:
= {
}
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
static ssize_t unleashed_sd_readat(const struct region_device *rdev, void *dest, size_t offset, size_t count)
Definition: media.c:32

Definition at line 32 of file media.c.