summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2016-05-02 17:22:29 +0800
committerPatrick Georgi <pgeorgi@google.com>2016-05-03 19:00:36 +0200
commit58a150a1a332a749d38a656be2fe665da2a971c2 (patch)
tree2956a2dbf6e64ad508aa437f51ad98bdfaa38f5e /src/lib
parent919be612b8383d75a1ea55db6552aa7648af66d1 (diff)
downloadcoreboot-58a150a1a332a749d38a656be2fe665da2a971c2.tar.xz
lib/cbfs: Use fmap derived information about the COREBOOT region
It used to use CONFIG_CBFS_SIZE. The plan is that CBFS_SIZE only informs default*.fmd generation, while everything else derives its information from there. Also document the existing assumption that boot media should access the COREBOOT region (and not any other potentially existing fmap region containing a CBFS). Change-Id: I08254e4510f71edf99c2c8b56ac8f92008727c4a Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: https://review.coreboot.org/14572 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.inc7
-rw-r--r--src/lib/cbfs.c9
2 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 3352a3027f..4c6a395efc 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -179,6 +179,13 @@ $(call src-to-obj,smm,$(dir)/version.c) : $(obj)/build.h
$(call src-to-obj,verstage,$(dir)/version.c) : $(obj)/build.h
$(call src-to-obj,postcar,$(dir)/version.c) : $(obj)/build.h
+$(call src-to-obj,bootblock,$(dir)/cbfs.c) : $(obj)/fmap_config.h
+$(call src-to-obj,romstage,$(dir)/cbfs.c) : $(obj)/fmap_config.h
+$(call src-to-obj,ramstage,$(dir)/cbfs.c) : $(obj)/fmap_config.h
+$(call src-to-obj,smm,$(dir)/cbfs.c) : $(obj)/fmap_config.h
+$(call src-to-obj,verstage,$(dir)/cbfs.c) : $(obj)/fmap_config.h
+$(call src-to-obj,postcar,$(dir)/cbfs.c) : $(obj)/fmap_config.h
+
romstage-y += bootmode.c
ramstage-y += bootmode.c
verstage-y += bootmode.c
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index e1626d79fd..764a6f70d8 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -25,6 +25,8 @@
#include <symbols.h>
#include <timestamp.h>
+#include "fmap_config.h"
+
#define ERROR(x...) printk(BIOS_ERR, "CBFS: " x)
#define LOG(x...) printk(BIOS_INFO, "CBFS: " x)
#if IS_ENABLED(CONFIG_DEBUG_CBFS)
@@ -215,6 +217,7 @@ out:
return 0;
}
+/* This only supports the "COREBOOT" fmap region. */
static int cbfs_master_header_props(struct cbfs_props *props)
{
struct cbfs_header header;
@@ -227,13 +230,15 @@ static int cbfs_master_header_props(struct cbfs_props *props)
if (bdev == NULL)
return -1;
+ size_t fmap_top = ___FMAP__COREBOOT_BASE + ___FMAP__COREBOOT_SIZE;
+
/* Find location of header using signed 32-bit offset from
* end of CBFS region. */
- offset = CONFIG_CBFS_SIZE - sizeof(int32_t);
+ offset = fmap_top - sizeof(int32_t);
if (rdev_readat(bdev, &rel_offset, offset, sizeof(int32_t)) < 0)
return -1;
- offset = CONFIG_CBFS_SIZE + rel_offset;
+ offset = fmap_top + rel_offset;
if (rdev_readat(bdev, &header, offset, sizeof(header)) < 0)
return -1;