summaryrefslogtreecommitdiff
path: root/util/cbfstool
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2016-05-02 17:02:53 +0800
committerPatrick Georgi <pgeorgi@google.com>2016-05-03 11:42:45 +0200
commit919be612b8383d75a1ea55db6552aa7648af66d1 (patch)
treee67cacb64a1e498e031cbab1f532476c81562493 /util/cbfstool
parent849635d4ef835862b2fc4ecc4c4c1ee28186ad15 (diff)
downloadcoreboot-919be612b8383d75a1ea55db6552aa7648af66d1.tar.xz
fmaptool: Export some fmap knowledge to the build environment
By exporting base and offset of CBFS-formatted fmap regions, the code can use these when it's not prudent to do a runtime lookup. Change-Id: I20523b5cea68880af4cb1fcea4b37bb8ac2a23db Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: https://review.coreboot.org/14571 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util/cbfstool')
-rw-r--r--util/cbfstool/fmaptool.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/util/cbfstool/fmaptool.c b/util/cbfstool/fmaptool.c
index 1eda82262e..5aafffdd7b 100644
--- a/util/cbfstool/fmaptool.c
+++ b/util/cbfstool/fmaptool.c
@@ -101,6 +101,20 @@ static bool write_header(const char *out_fname,
fputs("#ifndef FMAPTOOL_GENERATED_HEADER_H_\n", header);
fputs("#define FMAPTOOL_GENERATED_HEADER_H_\n\n", header);
fprintf(header, "#define %s %#x\n\n", HEADER_FMAP_OFFSET, fmap_offset);
+
+ /* also add defines for each CBFS-carrying fmap region: base and size */
+ cbfs_section_iterator_t cbfs_it = cbfs_sections_iterator();
+ while (cbfs_it) {
+ const struct flashmap_descriptor *item =
+ cbfs_sections_iterator_deref(cbfs_it);
+ assert(item->offset_known && item->size_known);
+ fprintf(header, "#define ___FMAP__%s_BASE 0x%x\n",
+ item->name, item->offset);
+ fprintf(header, "#define ___FMAP__%s_SIZE 0x%x\n",
+ item->name, item->size);
+ cbfs_sections_iterator_advance(&cbfs_it);
+ }
+
fputs("#endif\n", header);
fclose(header);