summaryrefslogtreecommitdiff
path: root/src/lib/cbfs.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-11-06 19:29:44 -0800
committerJulius Werner <jwerner@chromium.org>2019-11-14 03:30:11 +0000
commitcefe89ee7916b2c1fd6401456313f8a4d110735c (patch)
tree6056fae9fa141ee118d38a51bc17e3aebc0fd452 /src/lib/cbfs.c
parent6abbd5b0acec1a874160ff5061d4077663649253 (diff)
lib/fmap: Add optional pre-RAM cache
This patch adds an optional pre-RAM cache for the FMAP which most platforms should be able to use, complementing the recently added post-RAM FMAP cache in CBMEM. vboot systems currently read the FMAP about half a dozen times from flash in verstage, which will all be coalesced into a single read with this patch. It will also help future vboot improvements since when FMAP reads become "free" vboot doesn't need to keep track of so much information separately. In order to make sure we have a single, well-defined point where the new cache is first initialized, eliminate the build-time hardcoding of the CBFS section offsets, so that all CBFS accesses explicitly read the FMAP. Add FMAP_CACHEs to all platforms that can afford it (other than the RISC-V things where I have no idea how they work), trying to take the space from things that look like they were oversized anyway (pre-RAM consoles and CBFS caches). Change-Id: I2820436776ef620bdc4481b5cd4b6957764248ea Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36657 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Joel Kitching <kitching@google.com>
Diffstat (limited to 'src/lib/cbfs.c')
-rw-r--r--src/lib/cbfs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 1601f201fe..27a1592e2b 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -26,7 +26,6 @@
#include <symbols.h>
#include <timestamp.h>
#include <fmap.h>
-#include "fmap_config.h"
#include <security/vboot/vboot_crtm.h>
#define ERROR(x...) printk(BIOS_ERR, "CBFS: " x)
@@ -310,7 +309,10 @@ int cbfs_master_header_props(struct cbfs_props *props)
if (bdev == NULL)
return -1;
- size_t fmap_top = ___FMAP__COREBOOT_BASE + ___FMAP__COREBOOT_SIZE;
+ struct region fmap_region;
+ if (fmap_locate_area("COREBOOT", &fmap_region))
+ return -1;
+ size_t fmap_top = region_end(&fmap_region);
/* Find location of header using signed 32-bit offset from
* end of CBFS region. */