coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
storage.c File Reference
#include <commonlib/storage.h>
#include "sd_mmc.h"
#include "storage.h"
#include <string.h>
Include dependency graph for storage.c:

Go to the source code of this file.

Data Structures

struct  capacity
 

Macros

#define DECIMAL_CAPACITY_MULTIPLIER   1000ULL
 
#define HEX_CAPACITY_MULTIPLIER   1024ULL
 

Functions

static void display_capacity (struct storage_media *media, int partition_number)
 
void storage_display_setup (struct storage_media *media)
 
int storage_startup (struct storage_media *media)
 
int storage_setup_media (struct storage_media *media, struct sd_mmc_ctrlr *ctrlr)
 
static int storage_read (struct storage_media *media, void *dest, uint32_t start, uint32_t block_count)
 
int storage_block_setup (struct storage_media *media, uint64_t start, uint64_t count, int is_read)
 
uint64_t storage_block_read (struct storage_media *media, uint64_t start, uint64_t count, void *buffer)
 
int storage_set_partition (struct storage_media *media, unsigned int partition_number)
 
const char * storage_partition_name (struct storage_media *media, unsigned int partition_number)
 
unsigned int storage_get_current_partition (struct storage_media *media)
 

Macro Definition Documentation

◆ DECIMAL_CAPACITY_MULTIPLIER

#define DECIMAL_CAPACITY_MULTIPLIER   1000ULL

Definition at line 14 of file storage.c.

◆ HEX_CAPACITY_MULTIPLIER

#define HEX_CAPACITY_MULTIPLIER   1024ULL

Definition at line 15 of file storage.c.

Function Documentation

◆ display_capacity()

static void display_capacity ( struct storage_media media,
int  partition_number 
)
static

Definition at line 22 of file storage.c.

References ARRAY_SIZE, capacity::bytes, storage_media::capacity, CONFIG, DECIMAL_CAPACITY_MULTIPLIER, HEX_CAPACITY_MULTIPLIER, IS_SD, media, name, sdhc_debug, storage_partition_name(), and capacity::units.

Referenced by storage_display_setup().

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

◆ storage_block_read()

uint64_t storage_block_read ( struct storage_media media,
uint64_t  start,
uint64_t  count,
void buffer 
)

Definition at line 286 of file storage.c.

References sd_mmc_ctrlr::b_max, buffer, count, storage_media::ctrlr, media, MIN, storage_media::read_bl_len, sd_mmc_trace, storage_block_setup(), and storage_read().

Referenced by partial_block_read(), and storage_test().

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

◆ storage_block_setup()

◆ storage_display_setup()

void storage_display_setup ( struct storage_media media)

Definition at line 88 of file storage.c.

References ARRAY_SIZE, storage_media::capacity, storage_media::cid, CONFIG, display_capacity(), storage_media::erase_blocks, IS_SD, media, sd_mmc_debug, sdhc_debug, and storage_media::write_bl_len.

Referenced by boot_device_init(), storage_startup(), and storage_test().

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

◆ storage_get_current_partition()

unsigned int storage_get_current_partition ( struct storage_media media)

Definition at line 339 of file storage.c.

References EXT_CSD_PART_ACCESS_MASK, media, and storage_media::partition_config.

Referenced by storage_test().

Here is the caller graph for this function:

◆ storage_partition_name()

const char* storage_partition_name ( struct storage_media media,
unsigned int  partition_number 
)

Definition at line 325 of file storage.c.

References CONFIG, IS_SD, media, mmc_partition_name(), name, NULL, and sd_partition_name().

Referenced by display_capacity(), and storage_test().

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

◆ storage_read()

◆ storage_set_partition()

int storage_set_partition ( struct storage_media media,
unsigned int  partition_number 
)

Definition at line 309 of file storage.c.

References CONFIG, IS_SD, media, mmc_set_partition(), sd_mmc_error, and sd_set_partition().

Referenced by storage_test().

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

◆ storage_setup_media()

int storage_setup_media ( struct storage_media media,
struct sd_mmc_ctrlr ctrlr 
)

Definition at line 188 of file storage.c.

References storage_media::ctrlr, media, memset(), sd_mmc_enter_standby(), and storage_startup().

Referenced by boot_device_init(), and storage_test().

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

◆ storage_startup()