summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2013-02-06 12:11:57 +0800
committerHung-Te Lin <hungte@chromium.org>2013-02-07 03:36:04 +0100
commitc720d8d5d419d8e9128392cd7ab90e3a3fca1d4b (patch)
tree7ec9a6386f57f463c1d96fd1aa3019b12f2a76d3
parent439e0d2502bb0c38f7e7bf876dd5568331c6fe9c (diff)
cbfs: Fix CBFS max size calculation.
For x86, the old CBFS search behavior was to bypass bootblock and we should keep that. This will speed up searching if a file does not exist in CBFS. For arm, the size in header is correct now so we can remove the hack by CONFIG_ROM_SIZE. Change-Id: I541961bc4dd083a583f8a80b69e293694fb055ef Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: http://review.coreboot.org/2292 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
-rw-r--r--src/lib/cbfs_core.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/cbfs_core.c b/src/lib/cbfs_core.c
index 42b8c0966f..da7bb6a912 100644
--- a/src/lib/cbfs_core.c
+++ b/src/lib/cbfs_core.c
@@ -116,12 +116,12 @@ struct cbfs_file *cbfs_get_file(struct cbfs_media *media, const char *name)
align = ntohl(header->align);
romsize = ntohl(header->romsize);
- // TODO header->romsize seems broken now on ARM. Remove this when it's
- // fixed.
-#if defined(CONFIG_ARCH_ARMV7) && CONFIG_ARCH_ARMV7
- romsize = CONFIG_ROM_SIZE;
+ // TODO Add a "size" in CBFS header for a platform independent way to
+ // determine the end of CBFS data.
+#if defined(CONFIG_ARCH_X86) && CONFIG_ARCH_X86
+ romsize -= htonl(header->bootblocksize);
#endif
- DEBUG("offset: 0x%x, align: %d, romsize: %d\n", offset, align, romsize);
+ DEBUG("CBFS location: 0x%x~0x%x, align: %d\n", offset, romsize, align);
LOG("Looking for '%s' starting from 0x%x.\n", name, offset);
media->open(media);