From 128741682250e196ccc9ff0bf9e7a5db5dfcdbd3 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 12 Jan 2014 14:12:15 +0100 Subject: 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 Reviewed-on: http://review.coreboot.org/4674 Reviewed-by: Patrick Georgi Tested-by: build bot (Jenkins) --- src/mainboard/google/link/romstage.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/mainboard/google/link') 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])); } -- cgit v1.2.3