From 919be612b8383d75a1ea55db6552aa7648af66d1 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 2 May 2016 17:02:53 +0800 Subject: 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 Reviewed-on: https://review.coreboot.org/14571 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- util/cbfstool/fmaptool.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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); -- cgit v1.2.3