summaryrefslogtreecommitdiff
path: root/src/southbridge
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/southbridge
parent0af61b6c82d7ff02426a26bf435b7c6ee768a602 (diff)
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/southbridge')
-rw-r--r--src/southbridge/intel/lynxpoint/spi_loading.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/southbridge/intel/lynxpoint/spi_loading.c b/src/southbridge/intel/lynxpoint/spi_loading.c
index 1ae7a263eb..57e3af8cbd 100644
--- a/src/southbridge/intel/lynxpoint/spi_loading.c
+++ b/src/southbridge/intel/lynxpoint/spi_loading.c
@@ -28,7 +28,7 @@
#if CONFIG_VBOOT_VERIFY_FIRMWARE
#include <vendorcode/google/chromeos/chromeos.h>
#else
-static inline void *vboot_get_payload(int *len) { return NULL; }
+static inline void *vboot_get_payload(size_t *len) { return NULL; }
#endif
#define CACHELINE_SIZE 64
@@ -73,26 +73,18 @@ static inline void *spi_mirror(void *file_start, int file_len)
void *cbfs_load_payload(struct cbfs_media *media, const char *name)
{
- int file_len;
+ size_t file_len;
void *file_start;
- struct cbfs_file *file;
file_start = vboot_get_payload(&file_len);
if (file_start != NULL)
return spi_mirror(file_start, file_len);
- file = cbfs_get_file(media, name);
+ file_start = cbfs_get_file_content(media, name, CBFS_TYPE_PAYLOAD, &file_len);
- if (file == NULL)
+ if (file_start == NULL)
return NULL;
- if (ntohl(file->type) != CBFS_TYPE_PAYLOAD)
- return NULL;
-
- file_len = ntohl(file->len);
-
- file_start = CBFS_SUBHEADER(file);
-
return spi_mirror(file_start, file_len);
}