aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard/google')
-rw-r--r--src/mainboard/google/bolt/romstage.c4
-rw-r--r--src/mainboard/google/butterfly/mainboard.c5
-rw-r--r--src/mainboard/google/falco/romstage.c4
-rw-r--r--src/mainboard/google/link/romstage.c4
-rw-r--r--src/mainboard/google/panther/lan.c3
-rw-r--r--src/mainboard/google/peach_pit/romstage.c17
-rw-r--r--src/mainboard/google/peppy/romstage.c4
-rw-r--r--src/mainboard/google/rambi/romstage.c9
-rw-r--r--src/mainboard/google/samus/spd/spd.c13
-rw-r--r--src/mainboard/google/slippy/romstage.c4
-rw-r--r--src/mainboard/google/urara/boardid.c23
11 files changed, 38 insertions, 52 deletions
diff --git a/src/mainboard/google/bolt/romstage.c b/src/mainboard/google/bolt/romstage.c
index 62549f5cdc..f721a705e0 100644
--- a/src/mainboard/google/bolt/romstage.c
+++ b/src/mainboard/google/bolt/romstage.c
@@ -78,8 +78,8 @@ static void copy_spd(struct pei_data *peid)
int spd_index = 0; /* No GPIO selection, force index 0 for now */
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
- CBFS_TYPE_SPD, &spd_file_len);
+ spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
+ &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/butterfly/mainboard.c b/src/mainboard/google/butterfly/mainboard.c
index 1c1814dcf7..6cacc9ae09 100644
--- a/src/mainboard/google/butterfly/mainboard.c
+++ b/src/mainboard/google/butterfly/mainboard.c
@@ -203,9 +203,8 @@ static void mainboard_init(device_t dev)
}
}
} else {
- vpd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
- "vpd.bin", CBFS_TYPE_RAW,
- &search_length);
+ vpd_file = cbfs_boot_map_with_leak("vpd.bin", CBFS_TYPE_RAW,
+ &search_length);
if (vpd_file) {
search_address = (unsigned long)vpd_file;
} else {
diff --git a/src/mainboard/google/falco/romstage.c b/src/mainboard/google/falco/romstage.c
index edbf371009..7282c1ef10 100644
--- a/src/mainboard/google/falco/romstage.c
+++ b/src/mainboard/google/falco/romstage.c
@@ -79,8 +79,8 @@ static void copy_spd(struct pei_data *peid)
size_t spd_file_len;
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
- CBFS_TYPE_SPD, &spd_file_len);
+ spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
+ &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/link/romstage.c b/src/mainboard/google/link/romstage.c
index b345d5ec3e..e9b4a09859 100644
--- a/src/mainboard/google/link/romstage.c
+++ b/src/mainboard/google/link/romstage.c
@@ -92,8 +92,8 @@ static void copy_spd(struct pei_data *peid)
int spd_index = get_gpios(gpio_vector);
printk(BIOS_DEBUG, "spd index %d\n", spd_index);
- spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
- CBFS_TYPE_SPD, &spd_file_len);
+ spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
+ &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/panther/lan.c b/src/mainboard/google/panther/lan.c
index 8a648cb250..4b34c0678c 100644
--- a/src/mainboard/google/panther/lan.c
+++ b/src/mainboard/google/panther/lan.c
@@ -127,8 +127,7 @@ static void program_mac_address(u16 io_base)
search_length = region_device_sz(&rdev);
}
} else {
- search_address = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
- "vpd.bin",
+ search_address = cbfs_boot_map_with_leak("vpd.bin",
CBFS_TYPE_RAW,
&search_length);
}
diff --git a/src/mainboard/google/peach_pit/romstage.c b/src/mainboard/google/peach_pit/romstage.c
index 6734b77fd7..35cf906e16 100644
--- a/src/mainboard/google/peach_pit/romstage.c
+++ b/src/mainboard/google/peach_pit/romstage.c
@@ -21,12 +21,14 @@
#include <arch/exception.h>
#include <arch/stages.h>
#include <armv7.h>
+#include <boot_device.h>
#include <cbfs.h>
#include <cbmem.h>
#include <console/console.h>
#include <device/i2c.h>
#include <drivers/maxim/max77802/max77802.h>
#include <program_loading.h>
+#include <region.h>
#include <soc/clk.h>
#include <soc/cpu.h>
#include <soc/dmc.h>
@@ -176,29 +178,28 @@ static unsigned long primitive_mem_test(void)
/* here is a simple SPI debug test, known to fid trouble */
static void simple_spi_test(void)
{
- struct cbfs_media default_media, *media;
+ const struct region_device *boot_dev;
int i, amt = 4 * MiB, errors = 0;
//u32 *data = (void *)0x40000000;
u32 data[1024];
u32 in;
+ boot_device_init();
+ boot_dev = boot_device_ro();
amt = sizeof(data);
- media = &default_media;
- if (init_default_cbfs_media(media) != 0) {
+ if (boot_dev == NULL) {
printk(BIOS_SPEW, "Failed to initialize default media.\n");
return;
}
-
- media->open(media);
- if (media->read(media, data, (size_t) 0, amt) < amt){
+ if (rdev_readat(boot_dev, data, 0, amt) < amt) {
printk(BIOS_SPEW, "simple_spi_test fails\n");
return;
}
for(i = 0; i < amt; i += 4){
- if (media->read(media, &in, (size_t) i, 4) < 1){
+ if (rdev_readat(boot_dev, &in, i, 4) < 4) {
printk(BIOS_SPEW, "simple_spi_test fails at %d\n", i);
return;
}
@@ -207,7 +208,7 @@ static void simple_spi_test(void)
printk(BIOS_SPEW, "BAD at %d(%p):\nRAM %08lx\nSPI %08lx\n",
i, &data[i/4], (unsigned long)data[i/4], (unsigned long)in);
/* reread it to see which is wrong. */
- if (media->read(media, &in, (size_t) i, 4) < 1){
+ if (rdev_readat(boot_dev, &in, i, 4) < 4) {
printk(BIOS_SPEW, "simple_spi_test fails at %d\n", i);
return;
}
diff --git a/src/mainboard/google/peppy/romstage.c b/src/mainboard/google/peppy/romstage.c
index bd4ce3d3ee..695778346e 100644
--- a/src/mainboard/google/peppy/romstage.c
+++ b/src/mainboard/google/peppy/romstage.c
@@ -82,8 +82,8 @@ static void copy_spd(struct pei_data *peid)
size_t spd_file_len;
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
- CBFS_TYPE_SPD, &spd_file_len);
+ spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
+ &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/rambi/romstage.c b/src/mainboard/google/rambi/romstage.c
index 1fd03bda5a..adbdffb9a0 100644
--- a/src/mainboard/google/rambi/romstage.c
+++ b/src/mainboard/google/rambi/romstage.c
@@ -71,9 +71,10 @@ static void *get_spd_pointer(char *spd_file_content, int total_spds, int *dual)
void mainboard_romstage_entry(struct romstage_params *rp)
{
- struct cbfs_file *spd_file;
void *spd_content;
int dual_channel = 0;
+ void *spd_file;
+ size_t spd_fsize;
struct mrc_params mp = {
.mainboard = {
@@ -83,12 +84,12 @@ void mainboard_romstage_entry(struct romstage_params *rp)
},
};
- spd_file = cbfs_get_file(CBFS_DEFAULT_MEDIA, "spd.bin");
+ spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
+ &spd_fsize);
if (!spd_file)
die("SPD data not found.");
- spd_content = get_spd_pointer(CBFS_SUBHEADER(spd_file),
- ntohl(spd_file->len) / SPD_SIZE,
+ spd_content = get_spd_pointer(spd_file, spd_fsize / SPD_SIZE,
&dual_channel);
mp.mainboard.dram_data[0] = spd_content;
if (dual_channel)
diff --git a/src/mainboard/google/samus/spd/spd.c b/src/mainboard/google/samus/spd/spd.c
index f8b0bf2ea9..1979f8c2f8 100644
--- a/src/mainboard/google/samus/spd/spd.c
+++ b/src/mainboard/google/samus/spd/spd.c
@@ -90,8 +90,8 @@ void mainboard_fill_spd_data(struct pei_data *pei_data)
};
int spd_gpio[4];
int spd_index;
- int spd_file_len;
- struct cbfs_file *spd_file;
+ size_t spd_file_len;
+ char *spd_file;
spd_gpio[0] = get_gpio(spd_bits[0]);
spd_gpio[1] = get_gpio(spd_bits[1]);
@@ -106,10 +106,9 @@ void mainboard_fill_spd_data(struct pei_data *pei_data)
spd_bits[3], spd_gpio[3], spd_bits[2], spd_gpio[2],
spd_bits[1], spd_gpio[1], spd_bits[0], spd_gpio[0]);
- spd_file = cbfs_get_file(CBFS_DEFAULT_MEDIA, "spd.bin");
+ spd_file = cbfs_boot_map_with_leak("spd.bin", 0xab, &spd_file_len);
if (!spd_file)
die("SPD data not found.");
- spd_file_len = ntohl(spd_file->len);
if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
@@ -121,10 +120,8 @@ void mainboard_fill_spd_data(struct pei_data *pei_data)
/* Assume same memory in both channels */
spd_index *= SPD_LEN;
- memcpy(pei_data->spd_data[0][0],
- ((char*)CBFS_SUBHEADER(spd_file)) + spd_index, SPD_LEN);
- memcpy(pei_data->spd_data[1][0],
- ((char*)CBFS_SUBHEADER(spd_file)) + spd_index, SPD_LEN);
+ memcpy(pei_data->spd_data[0][0], spd_file + spd_index, SPD_LEN);
+ memcpy(pei_data->spd_data[1][0], spd_file + spd_index, SPD_LEN);
/* Make sure a valid SPD was found */
if (pei_data->spd_data[0][0][0] == 0)
diff --git a/src/mainboard/google/slippy/romstage.c b/src/mainboard/google/slippy/romstage.c
index 036cbe9c59..6948756729 100644
--- a/src/mainboard/google/slippy/romstage.c
+++ b/src/mainboard/google/slippy/romstage.c
@@ -80,8 +80,8 @@ static void copy_spd(struct pei_data *peid)
size_t spd_file_len;
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
- CBFS_TYPE_SPD, &spd_file_len);
+ spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
+ &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/urara/boardid.c b/src/mainboard/google/urara/boardid.c
index 8fcb5650b6..1d211025fd 100644
--- a/src/mainboard/google/urara/boardid.c
+++ b/src/mainboard/google/urara/boardid.c
@@ -22,7 +22,7 @@
#include <string.h>
#include <boardid.h>
-#include <cbfs_core.h>
+#include <cbfs.h>
#include <console/console.h>
#include "mainboard/google/urara/urara_boardid.h"
@@ -47,28 +47,17 @@ static int cached_board_id = -1;
static uint8_t retrieve_board_id(void)
{
- struct cbfs_file *board_id_file;
const char *board_id_file_name = CBFS_BOARD_ID_FILE_NAME;
char *file_contents;
int i;
- unsigned length;
+ size_t length;
- board_id_file = cbfs_get_file(CBFS_DEFAULT_MEDIA, board_id_file_name);
- if (!board_id_file) {
- printk(BIOS_WARNING,
- "board_id: failed to locate file '%s'\n",
- board_id_file_name);
- return 0;
- }
-
- length = be32_to_cpu(board_id_file->len);
-
- file_contents = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
- board_id_file_name,
- CBFS_TYPE_RAW, NULL);
+ file_contents = cbfs_boot_map_with_leak(board_id_file_name,
+ CBFS_TYPE_RAW, &length);
if (!file_contents) {
- printk(BIOS_WARNING, "board_id: failed to read file '%s'\n",
+ printk(BIOS_WARNING,
+ "board_id: failed to locate file '%s'\n",
board_id_file_name);
return 0;
}