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>
This commit is contained in:
Patrick Georgi 2016-05-02 17:02:53 +08:00 committed by Patrick Georgi
parent 849635d4ef
commit 919be612b8
1 changed files with 14 additions and 0 deletions

View File

@ -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);