summaryrefslogtreecommitdiff
path: root/src/mainboard/google
diff options
context:
space:
mode:
authorVladimir Serbinenko <phcoder@gmail.com>2014-01-12 14:12:15 +0100
committerVladimir Serbinenko <phcoder@gmail.com>2014-01-12 17:41:58 +0100
commit128741682250e196ccc9ff0bf9e7a5db5dfcdbd3 (patch)
tree77f3adb8046d81cacd650ad77aa4aaf18cc6d3a7 /src/mainboard/google
parent0af61b6c82d7ff02426a26bf435b7c6ee768a602 (diff)
downloadcoreboot-128741682250e196ccc9ff0bf9e7a5db5dfcdbd3.tar.xz
CBFS: use cbfs_get_file_content whenever possible rather than cbfs_get_file
Number one reason to use cbfs_get_file was to get file length. With previous patch no more need for this. Change-Id: I330dda914d800c991757c5967b11963276ba9e00 Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/4674 Reviewed-by: Patrick Georgi <patrick@georgi-clan.de> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/mainboard/google')
-rw-r--r--src/mainboard/google/bolt/romstage.c12
-rw-r--r--src/mainboard/google/butterfly/mainboard.c10
-rw-r--r--src/mainboard/google/falco/romstage.c12
-rw-r--r--src/mainboard/google/link/romstage.c12
-rw-r--r--src/mainboard/google/peppy/romstage.c12
-rw-r--r--src/mainboard/google/slippy/romstage.c12
6 files changed, 41 insertions, 29 deletions
diff --git a/src/mainboard/google/bolt/romstage.c b/src/mainboard/google/bolt/romstage.c
index a74f10c2ef..b698ec3a88 100644
--- a/src/mainboard/google/bolt/romstage.c
+++ b/src/mainboard/google/bolt/romstage.c
@@ -73,25 +73,27 @@ const struct rcba_config_instruction rcba_config[] = {
/* Copy SPD data for on-board memory */
static void copy_spd(struct pei_data *peid)
{
- struct cbfs_file *spd_file;
+ char *spd_file;
+ size_t spd_file_len;
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(CBFS_DEFAULT_MEDIA, "spd.bin");
+ spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab,
+ &spd_file_len);
if (!spd_file)
die("SPD data not found.");
- if (ntohl(spd_file->len) <
+ if (spd_file_len <
((spd_index + 1) * sizeof(peid->spd_data[0]))) {
printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
spd_index = 0;
}
- if (spd_file->len < sizeof(peid->spd_data[0]))
+ if (spd_file_len < sizeof(peid->spd_data[0]))
die("Missing SPD data.");
memcpy(peid->spd_data[0],
- ((char*)CBFS_SUBHEADER(spd_file)) +
+ spd_file +
spd_index * sizeof(peid->spd_data[0]),
sizeof(peid->spd_data[0]));
}
diff --git a/src/mainboard/google/butterfly/mainboard.c b/src/mainboard/google/butterfly/mainboard.c
index 1623fe01c6..f65d14c7f5 100644
--- a/src/mainboard/google/butterfly/mainboard.c
+++ b/src/mainboard/google/butterfly/mainboard.c
@@ -299,7 +299,7 @@ static void verb_setup(void)
static void mainboard_init(device_t dev)
{
u32 search_address = 0x0;
- u32 search_length = -1;
+ size_t search_length = -1;
u16 io_base = 0;
struct device *ethernet_dev = NULL;
#if CONFIG_CHROMEOS
@@ -307,10 +307,12 @@ static void mainboard_init(device_t dev)
search_length = find_fmap_entry("RO_VPD", (void **)vpd_region_ptr);
search_address = (unsigned long)(*vpd_region_ptr);
#else
- struct cbfs_file *vpd_file = cbfs_get_file(CBFS_DEFAULT_MEDIA, "vpd.bin");
+ void *vpd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "vpd.bin", &search_length);
if (vpd_file) {
- search_length = ntohl(vpd_file->len);
- search_address = (unsigned long)CBFS_SUBHEADER(vpd_file);
+ search_address = (unsigned long)vpd_file;
+ } else {
+ search_length = -1;
+ search_address = 0;
}
#endif
diff --git a/src/mainboard/google/falco/romstage.c b/src/mainboard/google/falco/romstage.c
index 0ad4b9763f..ca843e8b9f 100644
--- a/src/mainboard/google/falco/romstage.c
+++ b/src/mainboard/google/falco/romstage.c
@@ -75,20 +75,22 @@ static void copy_spd(struct pei_data *peid)
{
const int gpio_vector[] = {13, 9, 47, -1};
int spd_index = get_gpios(gpio_vector);
- struct cbfs_file *spd_file;
+ char *spd_file;
+ size_t spd_file_len;
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_get_file(CBFS_DEFAULT_MEDIA, "spd.bin");
+ spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab,
+ &spd_file_len);
if (!spd_file)
die("SPD data not found.");
- if (ntohl(spd_file->len) <
+ if (spd_file_len <
((spd_index + 1) * sizeof(peid->spd_data[0]))) {
printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
spd_index = 0;
}
- if (spd_file->len < sizeof(peid->spd_data[0]))
+ if (spd_file_len < sizeof(peid->spd_data[0]))
die("Missing SPD data.");
/* Index 0-2 are 4GB config with both CH0 and CH1
@@ -98,7 +100,7 @@ static void copy_spd(struct pei_data *peid)
peid->dimm_channel1_disabled = 3;
memcpy(peid->spd_data[0],
- ((char*)CBFS_SUBHEADER(spd_file)) +
+ spd_file +
spd_index * sizeof(peid->spd_data[0]),
sizeof(peid->spd_data[0]));
}
diff --git a/src/mainboard/google/link/romstage.c b/src/mainboard/google/link/romstage.c
index 27a22f7d2f..1aa309a4fa 100644
--- a/src/mainboard/google/link/romstage.c
+++ b/src/mainboard/google/link/romstage.c
@@ -125,24 +125,26 @@ static void rcba_config(void)
static void copy_spd(struct pei_data *peid)
{
const int gpio_vector[] = {41, 42, 43, 10, -1};
- struct cbfs_file *spd_file;
+ char *spd_file;
+ size_t spd_file_len;
int spd_index = get_gpios(gpio_vector);
printk(BIOS_DEBUG, "spd index %d\n", spd_index);
- spd_file = cbfs_get_file(CBFS_DEFAULT_MEDIA, "spd.bin");
+ spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab,
+ &spd_file_len);
if (!spd_file)
die("SPD data not found.");
- if (ntohl(spd_file->len) < ((spd_index + 1) * sizeof(peid->spd_data[0]))) {
+ if (spd_file_len < ((spd_index + 1) * sizeof(peid->spd_data[0]))) {
printk(BIOS_ERR, "spd index override to 0 - old hardware?\n");
spd_index = 0;
}
- if (spd_file->len < sizeof(peid->spd_data[0]))
+ if (spd_file_len < sizeof(peid->spd_data[0]))
die("Missing SPD data.");
memcpy(peid->spd_data[0],
- ((char*)CBFS_SUBHEADER(spd_file)) +
+ spd_file +
spd_index * sizeof(peid->spd_data[0]),
sizeof(peid->spd_data[0]));
}
diff --git a/src/mainboard/google/peppy/romstage.c b/src/mainboard/google/peppy/romstage.c
index c6696c09f6..4e723269ff 100644
--- a/src/mainboard/google/peppy/romstage.c
+++ b/src/mainboard/google/peppy/romstage.c
@@ -78,10 +78,12 @@ static void copy_spd(struct pei_data *peid)
{
const int gpio_vector[] = {13, 9, 47, -1};
int spd_index = get_gpios(gpio_vector);
- struct cbfs_file *spd_file;
+ char *spd_file;
+ size_t spd_file_len;
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_get_file(CBFS_DEFAULT_MEDIA, "spd.bin");
+ spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab,
+ &spd_file_len);
if (!spd_file)
die("SPD data not found.");
@@ -101,17 +103,17 @@ static void copy_spd(struct pei_data *peid)
break;
}
- if (ntohl(spd_file->len) <
+ if (spd_file_len <
((spd_index + 1) * sizeof(peid->spd_data[0]))) {
printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
spd_index = 0;
}
- if (spd_file->len < sizeof(peid->spd_data[0]))
+ if (spd_file_len < sizeof(peid->spd_data[0]))
die("Missing SPD data.");
memcpy(peid->spd_data[0],
- ((char*)CBFS_SUBHEADER(spd_file)) +
+ spd_file +
spd_index * sizeof(peid->spd_data[0]),
sizeof(peid->spd_data[0]));
}
diff --git a/src/mainboard/google/slippy/romstage.c b/src/mainboard/google/slippy/romstage.c
index fdbac97695..e2fa0113ab 100644
--- a/src/mainboard/google/slippy/romstage.c
+++ b/src/mainboard/google/slippy/romstage.c
@@ -76,24 +76,26 @@ static void copy_spd(struct pei_data *peid)
{
const int gpio_vector[] = {13, 9, 47, -1};
int spd_index = get_gpios(gpio_vector);
- struct cbfs_file *spd_file;
+ char *spd_file;
+ size_t spd_file_len;
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_get_file(CBFS_DEFAULT_MEDIA, "spd.bin");
+ spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab,
+ &spd_file_len);
if (!spd_file)
die("SPD data not found.");
- if (ntohl(spd_file->len) <
+ if (spd_file_len <
((spd_index + 1) * sizeof(peid->spd_data[0]))) {
printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
spd_index = 0;
}
- if (spd_file->len < sizeof(peid->spd_data[0]))
+ if (spd_file_len < sizeof(peid->spd_data[0]))
die("Missing SPD data.");
memcpy(peid->spd_data[0],
- ((char*)CBFS_SUBHEADER(spd_file)) +
+ spd_file +
spd_index * sizeof(peid->spd_data[0]),
sizeof(peid->spd_data[0]));
}