coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
sd_media.c File Reference
#include <boot_device.h>
#include <symbols.h>
#include <console/console.h>
#include <assert.h>
#include <commonlib/storage/sd_mmc.h>
#include <cbfs.h>
#include <soc/ti/am335x/mmc.h>
#include <soc/ti/am335x/header.h>
Include dependency graph for sd_media.c:

Go to the source code of this file.

Macros

#define COREBOOT_IMAGE_OFFSET   (128 * KiB)
 
#define SD_BLOCK_SIZE   512
 

Functions

static size_t partial_block_read (uint8_t *dest, uint64_t block, uint32_t offset, uint32_t count)
 
static ssize_t sd_readat (const struct region_device *rdev, void *dest, size_t offset, size_t count)
 
void boot_device_init (void)
 
const struct region_deviceboot_device_ro (void)
 

Variables

static struct am335x_mmc_host sd_host
 
static struct storage_media media
 
static const struct region_device_ops am335x_sd_ops
 
struct omap_image_headers headers
 
static struct mmap_helper_region_device sd_mdev
 
static bool init_done = false
 

Macro Definition Documentation

◆ COREBOOT_IMAGE_OFFSET

#define COREBOOT_IMAGE_OFFSET   (128 * KiB)

Definition at line 16 of file sd_media.c.

◆ SD_BLOCK_SIZE

#define SD_BLOCK_SIZE   512

Definition at line 18 of file sd_media.c.

Function Documentation

◆ boot_device_init()

void boot_device_init ( void  )

◆ boot_device_ro()

const struct region_device* boot_device_ro ( void  )

Definition at line 115 of file sd_media.c.

References mmap_helper_region_device::rdev, and sd_mdev.

◆ partial_block_read()

static size_t partial_block_read ( uint8_t dest,
uint64_t  block,
uint32_t  offset,
uint32_t  count 
)
static

Definition at line 23 of file sd_media.c.

References assert, BIOS_ERR, count, media, offset, printk, SD_BLOCK_SIZE, and storage_block_read().

Here is the call graph for this function:

◆ sd_readat()

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

Definition at line 45 of file sd_media.c.

Variable Documentation

◆ am335x_sd_ops

const struct region_device_ops am335x_sd_ops
static
Initial value:
= {
.readat = sd_readat,
}
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 sd_readat(const struct region_device *rdev, void *dest, size_t offset, size_t count)
Definition: sd_media.c:45

Definition at line 45 of file sd_media.c.

◆ headers

struct omap_image_headers headers
extern

Definition at line 10 of file header.c.

Referenced by tegra_i2c_request(), and tegra_i2c_send_recv().

◆ init_done

bool init_done = false
static

Definition at line 99 of file sd_media.c.

Referenced by bios_mmap_init(), and boot_device_init().

◆ media

◆ sd_host

struct am335x_mmc_host sd_host
static

Definition at line 1 of file sd_media.c.

Referenced by boot_device_init().

◆ sd_mdev

struct mmap_helper_region_device sd_mdev
static
Initial value:
&am335x_sd_ops, COREBOOT_IMAGE_OFFSET + sizeof(headers), CONFIG_ROM_SIZE,
struct mem_pool cbfs_cache
Definition: cbfs.c:26
#define MMAP_HELPER_DEV_INIT(ops_, offset_, size_, mpool_)
Definition: region.h:219
#define COREBOOT_IMAGE_OFFSET
Definition: sd_media.c:16
struct omap_image_headers headers
Definition: header.c:12
static const struct region_device_ops am335x_sd_ops
Definition: sd_media.c:87

Definition at line 45 of file sd_media.c.

Referenced by boot_device_ro().