summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-05-15 23:39:23 -0500
committerPatrick Georgi <pgeorgi@google.com>2015-06-02 14:09:31 +0200
commit899d13d0dff9e7495eb17950f19431e9bd344b2f (patch)
tree8901845fc299126a7125ff19fe1f7bde17e3f305 /src/soc
parent68bdd00799c7b2b25f265fa9e31beb709c877eb6 (diff)
cbfs: new API and better program loading
A new CBFS API is introduced to allow making CBFS access easier for providing multiple CBFS sources. That is achieved by decoupling the cbfs source from a CBFS file. A CBFS source is described by a descriptor. It contains the necessary properties for walking a CBFS to locate a file. The CBFS file is then decoupled from the CBFS descriptor in that it's no longer needed to access the contents of the file. All of this is accomplished using the regions infrastructure by repsenting CBFS sources and files as region_devices. Because region_devices can be chained together forming subregions this allows one to decouple a CBFS source from a file. This also allows one to provide CBFS files that came from other sources for payload and/or stage loading. The program loading takes advantage of those very properties by allowing multiple sources for locating a program. Because of this we can reduce the overhead of loading programs because it's all done in the common code paths. Only locating the program is per source. Change-Id: I339b84fce95f03d1dbb63a0f54a26be5eb07f7c8 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9134 Tested-by: build bot (Jenkins) Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/broadcom/cygnus/include/soc/memlayout.ld1
-rw-r--r--src/soc/intel/baytrail/refcode.c67
-rw-r--r--src/soc/intel/baytrail/romstage/raminit.c3
-rw-r--r--src/soc/intel/braswell/romstage/raminit.c3
-rw-r--r--src/soc/intel/broadwell/refcode.c69
-rw-r--r--src/soc/intel/broadwell/romstage/raminit.c3
-rw-r--r--src/soc/nvidia/tegra124/spi.c75
-rw-r--r--src/soc/nvidia/tegra132/ccplex.c15
-rw-r--r--src/soc/nvidia/tegra132/spi.c75
-rw-r--r--src/soc/qualcomm/ipq806x/blobs_init.c12
-rw-r--r--src/soc/qualcomm/ipq806x/include/soc/memlayout.ld3
-rw-r--r--src/soc/samsung/exynos5250/alternate_cbfs.c64
-rw-r--r--src/soc/samsung/exynos5420/alternate_cbfs.c64
13 files changed, 38 insertions, 416 deletions
diff --git a/src/soc/broadcom/cygnus/include/soc/memlayout.ld b/src/soc/broadcom/cygnus/include/soc/memlayout.ld
index 874fae82bf..3f6e8d8298 100644
--- a/src/soc/broadcom/cygnus/include/soc/memlayout.ld
+++ b/src/soc/broadcom/cygnus/include/soc/memlayout.ld
@@ -34,7 +34,6 @@ SECTIONS
VBOOT2_WORK(0x02010000, 16K)
OVERLAP_VERSTAGE_ROMSTAGE(0x02014000, 120K)
PRERAM_CBFS_CACHE(0x02032000, 1K)
- CBFS_HEADER_OFFSET(0x02032800)
STACK(0x02033000, 12K)
REGION(reserved_for_secure_service_api, 0x0203F000, 4K, 4)
SRAM_END(0x02040000)
diff --git a/src/soc/intel/baytrail/refcode.c b/src/soc/intel/baytrail/refcode.c
index 53da81dfc2..0c49a800a6 100644
--- a/src/soc/intel/baytrail/refcode.c
+++ b/src/soc/intel/baytrail/refcode.c
@@ -26,9 +26,6 @@
#include <program_loading.h>
#include <rmodule.h>
#include <stage_cache.h>
-#if IS_ENABLED(CONFIG_CHROMEOS)
-#include <vendorcode/google/chromeos/vboot_handoff.h>
-#endif
#include <soc/ramstage.h>
#include <soc/efi_wrapper.h>
@@ -49,58 +46,10 @@ static efi_wrapper_entry_t load_refcode_from_cache(void)
return (efi_wrapper_entry_t)prog_entry(&refcode);
}
-static void cache_refcode(const struct rmod_stage_load *rsl)
-{
- stage_cache_add(STAGE_REFCODE, rsl->prog);
-}
-
-#if IS_ENABLED(CONFIG_CHROMEOS)
-static int load_refcode_from_vboot(struct rmod_stage_load *refcode)
-{
- struct vboot_handoff *vboot_handoff;
- const struct firmware_component *fwc;
- struct cbfs_stage *stage;
-
- vboot_handoff = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
- fwc = &vboot_handoff->components[CONFIG_VBOOT_REFCODE_INDEX];
-
- if (vboot_handoff == NULL ||
- vboot_handoff->selected_firmware == VB_SELECT_FIRMWARE_READONLY ||
- CONFIG_VBOOT_REFCODE_INDEX >= MAX_PARSED_FW_COMPONENTS ||
- fwc->size == 0 || fwc->address == 0)
- return -1;
-
- printk(BIOS_DEBUG, "refcode loading from vboot rw area.\n");
- stage = (void *)(uintptr_t)fwc->address;
-
- if (rmodule_stage_load(refcode, stage)) {
- printk(BIOS_DEBUG, "Error loading reference code.\n");
- return -1;
- }
- return 0;
-}
-#else
-static int load_refcode_from_vboot(struct rmod_stage_load *refcode)
-{
- return -1;
-}
-#endif
-
-static int load_refcode_from_cbfs(struct rmod_stage_load *refcode)
-{
- printk(BIOS_DEBUG, "refcode loading from cbfs.\n");
-
- if (rmodule_stage_load_from_cbfs(refcode)) {
- printk(BIOS_DEBUG, "Error loading reference code.\n");
- return -1;
- }
-
- return 0;
-}
-
static efi_wrapper_entry_t load_reference_code(void)
{
struct prog prog = {
+ .type = PROG_REFCODE,
.name = CONFIG_CBFS_PREFIX "/refcode",
};
struct rmod_stage_load refcode = {
@@ -112,12 +61,18 @@ static efi_wrapper_entry_t load_reference_code(void)
return load_refcode_from_cache();
}
- if (load_refcode_from_vboot(&refcode) &&
- load_refcode_from_cbfs(&refcode))
- return NULL;
+ if (prog_locate(&prog)) {
+ printk(BIOS_DEBUG, "Couldn't locate reference code.\n");
+ return NULL;
+ }
+
+ if (rmodule_stage_load(&refcode)) {
+ printk(BIOS_DEBUG, "Error loading reference code.\n");
+ return NULL;
+ }
/* Cache loaded reference code. */
- cache_refcode(&refcode);
+ stage_cache_add(STAGE_REFCODE, &prog);
return prog_entry(&prog);
}
diff --git a/src/soc/intel/baytrail/romstage/raminit.c b/src/soc/intel/baytrail/romstage/raminit.c
index 7bbd671b5f..191821ad5b 100644
--- a/src/soc/intel/baytrail/romstage/raminit.c
+++ b/src/soc/intel/baytrail/romstage/raminit.c
@@ -148,8 +148,7 @@ void raminit(struct mrc_params *mp, int prev_sleep_state)
}
/* Determine if mrc.bin is in the cbfs. */
- if (cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "mrc.bin", CBFS_TYPE_MRC,
- NULL) == NULL) {
+ if (cbfs_boot_map_with_leak("mrc.bin", CBFS_TYPE_MRC, NULL) == NULL) {
printk(BIOS_DEBUG, "Couldn't find mrc.bin\n");
return;
}
diff --git a/src/soc/intel/braswell/romstage/raminit.c b/src/soc/intel/braswell/romstage/raminit.c
index 7bbd671b5f..191821ad5b 100644
--- a/src/soc/intel/braswell/romstage/raminit.c
+++ b/src/soc/intel/braswell/romstage/raminit.c
@@ -148,8 +148,7 @@ void raminit(struct mrc_params *mp, int prev_sleep_state)
}
/* Determine if mrc.bin is in the cbfs. */
- if (cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "mrc.bin", CBFS_TYPE_MRC,
- NULL) == NULL) {
+ if (cbfs_boot_map_with_leak("mrc.bin", CBFS_TYPE_MRC, NULL) == NULL) {
printk(BIOS_DEBUG, "Couldn't find mrc.bin\n");
return;
}
diff --git a/src/soc/intel/broadwell/refcode.c b/src/soc/intel/broadwell/refcode.c
index 722669bf33..f1bc4cbb8d 100644
--- a/src/soc/intel/broadwell/refcode.c
+++ b/src/soc/intel/broadwell/refcode.c
@@ -27,9 +27,6 @@
#include <rmodule.h>
#include <stage_cache.h>
#include <string.h>
-#if IS_ENABLED(CONFIG_CHROMEOS)
-#include <vendorcode/google/chromeos/vboot_handoff.h>
-#endif
#include <soc/pei_data.h>
#include <soc/pei_wrapper.h>
#include <soc/pm.h>
@@ -46,58 +43,10 @@ static pei_wrapper_entry_t load_refcode_from_cache(void)
return (pei_wrapper_entry_t)prog_entry(&refcode);
}
-static void cache_refcode(const struct rmod_stage_load *rsl)
-{
- stage_cache_add(STAGE_REFCODE, rsl->prog);
-}
-
-#if IS_ENABLED(CONFIG_CHROMEOS)
-static int load_refcode_from_vboot(struct rmod_stage_load *refcode)
-{
- struct vboot_handoff *vboot_handoff;
- const struct firmware_component *fwc;
- struct cbfs_stage *stage;
-
- vboot_handoff = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
- fwc = &vboot_handoff->components[CONFIG_VBOOT_REFCODE_INDEX];
-
- if (vboot_handoff == NULL ||
- vboot_handoff->selected_firmware == VB_SELECT_FIRMWARE_READONLY ||
- CONFIG_VBOOT_REFCODE_INDEX >= MAX_PARSED_FW_COMPONENTS ||
- fwc->size == 0 || fwc->address == 0)
- return -1;
-
- printk(BIOS_DEBUG, "refcode loading from vboot rw area.\n");
- stage = (void *)(uintptr_t)fwc->address;
-
- if (rmodule_stage_load(refcode, stage)) {
- printk(BIOS_DEBUG, "Error loading reference code.\n");
- return -1;
- }
- return 0;
-}
-#else
-static int load_refcode_from_vboot(struct rmod_stage_load *refcode)
-{
- return -1;
-}
-#endif
-
-static int load_refcode_from_cbfs(struct rmod_stage_load *refcode)
-{
- printk(BIOS_DEBUG, "refcode loading from cbfs.\n");
-
- if (rmodule_stage_load_from_cbfs(refcode)) {
- printk(BIOS_DEBUG, "Error loading reference code.\n");
- return -1;
- }
-
- return 0;
-}
-
-static pei_wrapper_entry_t load_reference_code(void)
+static efi_wrapper_entry_t load_reference_code(void)
{
struct prog prog = {
+ .type = PROG_REFCODE,
.name = CONFIG_CBFS_PREFIX "/refcode",
};
struct rmod_stage_load refcode = {
@@ -109,12 +58,18 @@ static pei_wrapper_entry_t load_reference_code(void)
return load_refcode_from_cache();
}
- if (load_refcode_from_vboot(&refcode) &&
- load_refcode_from_cbfs(&refcode))
- return NULL;
+ if (prog_locate(&prog)) {
+ printk(BIOS_DEBUG, "Couldn't locate reference code.\n");
+ return NULL;
+ }
+
+ if (rmodule_stage_load(&refcode)) {
+ printk(BIOS_DEBUG, "Error loading reference code.\n");
+ return NULL;
+ }
/* Cache loaded reference code. */
- cache_refcode(&refcode);
+ stage_cache_add(STAGE_REFCODE, &prog);
return prog_entry(&prog);
}
diff --git a/src/soc/intel/broadwell/romstage/raminit.c b/src/soc/intel/broadwell/romstage/raminit.c
index 8d373062e3..edc87905d7 100644
--- a/src/soc/intel/broadwell/romstage/raminit.c
+++ b/src/soc/intel/broadwell/romstage/raminit.c
@@ -86,8 +86,7 @@ void raminit(struct pei_data *pei_data)
}
/* Determine if mrc.bin is in the cbfs. */
- entry = (pei_wrapper_entry_t)cbfs_get_file_content(
- CBFS_DEFAULT_MEDIA, "mrc.bin", CBFS_TYPE_MRC, NULL);
+ entry = cbfs_boot_map_with_leak("mrc.bin", CBFS_TYPE_MRC, NULL);
if (entry == NULL) {
printk(BIOS_DEBUG, "Couldn't find mrc.bin\n");
return;
diff --git a/src/soc/nvidia/tegra124/spi.c b/src/soc/nvidia/tegra124/spi.c
index 0cf54956d3..7cc74c2838 100644
--- a/src/soc/nvidia/tegra124/spi.c
+++ b/src/soc/nvidia/tegra124/spi.c
@@ -802,18 +802,6 @@ int spi_xfer(struct spi_slave *slave, const void *dout,
return ret;
}
-static int tegra_spi_cbfs_open(struct cbfs_media *media)
-{
- DEBUG_SPI("tegra_spi_cbfs_open\n");
- return 0;
-}
-
-static int tegra_spi_cbfs_close(struct cbfs_media *media)
-{
- DEBUG_SPI("tegra_spi_cbfs_close\n");
- return 0;
-}
-
#define JEDEC_READ 0x03
#define JEDEC_READ_OUTSIZE 0x04
#define JEDEC_FAST_READ_DUAL 0x3b
@@ -877,69 +865,6 @@ tegra_spi_cbfs_read_exit:
return ret;
}
-static size_t tegra_spi_cbfs_read(struct cbfs_media *media, void *dest,
- size_t offset, size_t count)
-{
- const struct region_device *boot_dev;
-
- boot_dev = media->context;
-
- printk(BIOS_ERR, "%s: reading %zx bytes from %zx\n",
- __func__, count, offset);
- if (rdev_readat(boot_dev, dest, offset, count) < 0)
- return 0;
-
- return count;
-}
-
-static void *tegra_spi_cbfs_map(struct cbfs_media *media, size_t offset,
- size_t count)
-{
- const struct region_device *boot_dev;
- void *map;
-
- DEBUG_SPI("tegra_spi_cbfs_map\n");
-
- boot_dev = media->context;
-
- map = rdev_mmap(boot_dev, offset, count);
-
- if (map == NULL)
- map = (void *)-1;
-
- return map;
-}
-
-static void *tegra_spi_cbfs_unmap(struct cbfs_media *media,
- const void *address)
-{
- const struct region_device *boot_dev;
-
- DEBUG_SPI("tegra_spi_cbfs_unmap\n");
-
- boot_dev = media->context;
-
- rdev_munmap(boot_dev, (void *)address);
-
- return NULL;
-}
-
-int init_default_cbfs_media(struct cbfs_media *media)
-{
- DEBUG_SPI("Initializing CBFS media on SPI\n");
-
- boot_device_init();
-
- media->context = (void *)boot_device_ro();
- media->open = tegra_spi_cbfs_open;
- media->close = tegra_spi_cbfs_close;
- media->read = tegra_spi_cbfs_read;
- media->map = tegra_spi_cbfs_map;
- media->unmap = tegra_spi_cbfs_unmap;
-
- return 0;
-}
-
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
struct tegra_spi_channel *channel = to_tegra_spi(bus);
diff --git a/src/soc/nvidia/tegra132/ccplex.c b/src/soc/nvidia/tegra132/ccplex.c
index 7ab752fbc4..e133b48482 100644
--- a/src/soc/nvidia/tegra132/ccplex.c
+++ b/src/soc/nvidia/tegra132/ccplex.c
@@ -75,10 +75,9 @@ static int ccplex_start(void)
int ccplex_load_mts(void)
{
- struct cbfs_file file;
- ssize_t offset;
- size_t nread;
+ ssize_t nread;
struct stopwatch sw;
+ struct region_device fh;
/*
* MTS location is hard coded to this magic address. The hardware will
@@ -86,21 +85,19 @@ int ccplex_load_mts(void)
* place in the carveout region.
*/
void * const mts = (void *)(uintptr_t)MTS_LOAD_ADDRESS;
- struct cbfs_media *media = CBFS_DEFAULT_MEDIA;
stopwatch_init(&sw);
- offset = cbfs_locate_file(media, &file, MTS_FILE_NAME);
- if (offset < 0) {
+ if (cbfs_boot_locate(&fh, MTS_FILE_NAME, NULL)) {
printk(BIOS_DEBUG, "MTS file not found: %s\n", MTS_FILE_NAME);
return -1;
}
/* Read MTS file into the carveout region. */
- nread = cbfs_read(media, mts, offset, file.len);
+ nread = rdev_readat(&fh, mts, 0, region_device_sz(&fh));
- if (nread != file.len) {
+ if (nread != region_device_sz(&fh)) {
printk(BIOS_DEBUG, "MTS bytes read (%zu) != file length(%u)!\n",
- nread, file.len);
+ nread, region_device_sz(&fh));
return -1;
}
diff --git a/src/soc/nvidia/tegra132/spi.c b/src/soc/nvidia/tegra132/spi.c
index 1650057fab..efe43343ca 100644
--- a/src/soc/nvidia/tegra132/spi.c
+++ b/src/soc/nvidia/tegra132/spi.c
@@ -817,18 +817,6 @@ int spi_xfer(struct spi_slave *slave, const void *dout,
return ret;
}
-static int tegra_spi_cbfs_open(struct cbfs_media *media)
-{
- DEBUG_SPI("tegra_spi_cbfs_open\n");
- return 0;
-}
-
-static int tegra_spi_cbfs_close(struct cbfs_media *media)
-{
- DEBUG_SPI("tegra_spi_cbfs_close\n");
- return 0;
-}
-
#define JEDEC_READ 0x03
#define JEDEC_READ_OUTSIZE 0x04
#define JEDEC_FAST_READ_DUAL 0x3b
@@ -892,69 +880,6 @@ tegra_spi_cbfs_read_exit:
return ret;
}
-static size_t tegra_spi_cbfs_read(struct cbfs_media *media, void *dest,
- size_t offset, size_t count)
-{
- const struct region_device *boot_dev;
-
- boot_dev = media->context;
-
- DEBUG_SPI("%s: reading %zx bytes from %zx\n", __func__, count, offset);
-
- if (rdev_readat(boot_dev, dest, offset, count) < 0)
- return 0;
-
- return count;
-}
-
-static void *tegra_spi_cbfs_map(struct cbfs_media *media, size_t offset,
- size_t count)
-{
- const struct region_device *boot_dev;
- void *map;
-
- DEBUG_SPI("tegra_spi_cbfs_map\n");
-
- boot_dev = media->context;
-
- map = rdev_mmap(boot_dev, offset, count);
-
- if (map == NULL)
- map = (void *)-1;
-
- return map;
-}
-
-static void *tegra_spi_cbfs_unmap(struct cbfs_media *media,
- const void *address)
-{
- const struct region_device *boot_dev;
-
- DEBUG_SPI("tegra_spi_cbfs_unmap\n");
-
- boot_dev = media->context;
-
- rdev_munmap(boot_dev, (void *)address);
-
- return NULL;
-}
-
-int init_default_cbfs_media(struct cbfs_media *media)
-{
- DEBUG_SPI("Initializing CBFS media on SPI\n");
-
- boot_device_init();
-
- media->context = (void *)boot_device_ro();
- media->open = tegra_spi_cbfs_open;
- media->close = tegra_spi_cbfs_close;
- media->read = tegra_spi_cbfs_read;
- media->map = tegra_spi_cbfs_map;
- media->unmap = tegra_spi_cbfs_unmap;
-
- return 0;
-}
-
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
struct tegra_spi_channel *channel = to_tegra_spi(bus);
diff --git a/src/soc/qualcomm/ipq806x/blobs_init.c b/src/soc/qualcomm/ipq806x/blobs_init.c
index ae7e4d4b48..2821677465 100644
--- a/src/soc/qualcomm/ipq806x/blobs_init.c
+++ b/src/soc/qualcomm/ipq806x/blobs_init.c
@@ -32,20 +32,18 @@
static void *load_ipq_blob(const char *file_name)
{
- struct cbfs_file *blob_file;
struct mbn_header *blob_mbn;
void *blob_dest;
+ size_t blob_size;
- blob_file = cbfs_get_file(CBFS_DEFAULT_MEDIA, file_name);
- if (!blob_file)
+ blob_mbn = cbfs_boot_map_with_leak(file_name, CBFS_TYPE_RAW,
+ &blob_size);
+ if (!blob_mbn)
return NULL;
- blob_mbn = (struct mbn_header *)((uintptr_t)blob_file +
- ntohl(blob_file->offset));
-
/* some sanity checks on the headers */
if ((blob_mbn->mbn_version != 3) ||
- (blob_mbn->mbn_total_size > ntohl(blob_file->len)))
+ (blob_mbn->mbn_total_size > blob_size))
return NULL;
blob_dest = (void *) blob_mbn->mbn_destination;
diff --git a/src/soc/qualcomm/ipq806x/include/soc/memlayout.ld b/src/soc/qualcomm/ipq806x/include/soc/memlayout.ld
index 62d755e8e1..426d35b844 100644
--- a/src/soc/qualcomm/ipq806x/include/soc/memlayout.ld
+++ b/src/soc/qualcomm/ipq806x/include/soc/memlayout.ld
@@ -34,9 +34,8 @@ SECTIONS
OVERLAP_VERSTAGE_ROMSTAGE(0x2A012000, 64K)
VBOOT2_WORK(0x2A022000, 16K)
PRERAM_CBMEM_CONSOLE(0x2A026000, 32K)
- CBFS_HEADER_OFFSET(0x2A02E400)
-/* 0x2e404..0x3F000 4 bytes shy of 67KB free */
+/* 0x2e400..0x3F000 67KB free */
/* Keep the below area reserved at all times, it is used by various QCA
components as shared data
diff --git a/src/soc/samsung/exynos5250/alternate_cbfs.c b/src/soc/samsung/exynos5250/alternate_cbfs.c
index 546018a35a..cb6992199d 100644
--- a/src/soc/samsung/exynos5250/alternate_cbfs.c
+++ b/src/soc/samsung/exynos5250/alternate_cbfs.c
@@ -112,70 +112,6 @@ static int sdmmc_cbfs_open(void)
return 0;
}
-static int exynos_cbfs_open(struct cbfs_media *media) {
- return 0;
-}
-
-static int exynos_cbfs_close(struct cbfs_media *media) {
- return 0;
-}
-
-static size_t exynos_cbfs_read(struct cbfs_media *media, void *dest,
- size_t offset, size_t count) {
- const struct region_device *boot_dev;
-
- boot_dev = media->context;
-
- if (rdev_readat(boot_dev, dest, offset, count) < 0)
- return 0;
-
- return count;
-}
-
-static void *exynos_cbfs_map(struct cbfs_media *media, size_t offset,
- size_t count) {
- const struct region_device *boot_dev;
- void *ptr;
-
- boot_dev = media->context;
-
- ptr = rdev_mmap(boot_dev, offset, count);
-
- if (ptr == NULL)
- return (void *)-1;
-
- return ptr;
-}
-
-static void *exynos_cbfs_unmap(struct cbfs_media *media,
- const void *address) {
- const struct region_device *boot_dev;
-
- boot_dev = media->context;
-
- rdev_munmap(boot_dev, (void *)address);
-
- return NULL;
-}
-
-int init_default_cbfs_media(struct cbfs_media *media)
-{
- boot_device_init();
-
- media->context = (void *)boot_device_ro();
-
- if (media->context == NULL)
- return -1;
-
- media->open = exynos_cbfs_open;
- media->close = exynos_cbfs_close;
- media->read = exynos_cbfs_read;
- media->map = exynos_cbfs_map;
- media->unmap = exynos_cbfs_unmap;
-
- return 0;
-}
-
static struct mem_region_device alternate_rdev = MEM_REGION_DEV_INIT(NULL, 0);
const struct region_device *boot_device_ro(void)
diff --git a/src/soc/samsung/exynos5420/alternate_cbfs.c b/src/soc/samsung/exynos5420/alternate_cbfs.c
index 9bba748a84..f3e7504c5f 100644
--- a/src/soc/samsung/exynos5420/alternate_cbfs.c
+++ b/src/soc/samsung/exynos5420/alternate_cbfs.c
@@ -119,70 +119,6 @@ static int sdmmc_cbfs_open(void)
return 0;
}
-static int exynos_cbfs_open(struct cbfs_media *media) {
- return 0;
-}
-
-static int exynos_cbfs_close(struct cbfs_media *media) {
- return 0;
-}
-
-static size_t exynos_cbfs_read(struct cbfs_media *media, void *dest,
- size_t offset, size_t count) {
- const struct region_device *boot_dev;
-
- boot_dev = media->context;
-
- if (rdev_readat(boot_dev, dest, offset, count) < 0)
- return 0;
-
- return count;
-}
-
-static void *exynos_cbfs_map(struct cbfs_media *media, size_t offset,
- size_t count) {
- const struct region_device *boot_dev;
- void *ptr;
-
- boot_dev = media->context;
-
- ptr = rdev_mmap(boot_dev, offset, count);
-
- if (ptr == NULL)
- return (void *)-1;
-
- return ptr;
-}
-
-static void *exynos_cbfs_unmap(struct cbfs_media *media,
- const void *address) {
- const struct region_device *boot_dev;
-
- boot_dev = media->context;
-
- rdev_munmap(boot_dev, (void *)address);
-
- return NULL;
-}
-
-int init_default_cbfs_media(struct cbfs_media *media)
-{
- boot_device_init();
-
- media->context = (void *)boot_device_ro();
-
- if (media->context == NULL)
- return -1;
-
- media->open = exynos_cbfs_open;
- media->close = exynos_cbfs_close;
- media->read = exynos_cbfs_read;
- media->map = exynos_cbfs_map;
- media->unmap = exynos_cbfs_unmap;
-
- return 0;
-}
-
static struct mem_region_device alternate_rdev = MEM_REGION_DEV_INIT(NULL, 0);
const struct region_device *boot_device_ro(void)