[coreboot-gerrit] New patch to review for coreboot: fmaptool: Make base offsets absolute in fmap_config.h

Julius Werner (jwerner@chromium.org) gerrit at coreboot.org
Mon Jun 20 22:31:54 CEST 2016


Julius Werner (jwerner at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15273

-gerrit

commit 2cdd5e5f6e3141102bfb21f88ac3a60ee83658f4
Author: Julius Werner <jwerner at chromium.org>
Date:   Mon Jun 20 13:21:36 2016 -0700

    fmaptool: Make base offsets absolute in fmap_config.h
    
    fmaptool generates a header file used to hardcode certain values from
    the FMAP in coreboot's binaries, to avoid having to find and parse the
    FMAP manually for every access. For the offset of the FMAP itself this
    has already been using the absolute offset from the base of the whole
    ROM, but for individual CBFS sections it only used the offset from the
    immediate parent FMAP region. Since the code using it intentionally has
    no knowledge of the whole section tree, this causes problems as soon as
    the CBFS is a child section of something not at absolute offset 0 (as is
    the case for most x86 Chromebooks).
    
    Change-Id: If0c516083949fe5ac8cdae85e00a4461dcbdf853
    Reported-by: Rolf Evers-Fischer <embedded24 at evers-fischer.de>
    Signed-off-by: Julius Werner <jwerner at chromium.org>
---
 util/cbfstool/fmaptool.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/cbfstool/fmaptool.c b/util/cbfstool/fmaptool.c
index 5aafffd..faf6508 100644
--- a/util/cbfstool/fmaptool.c
+++ b/util/cbfstool/fmaptool.c
@@ -108,8 +108,9 @@ static bool write_header(const char *out_fname,
 		const struct flashmap_descriptor *item =
 				cbfs_sections_iterator_deref(cbfs_it);
 		assert(item->offset_known && item->size_known);
+		unsigned abs_base = fmd_calc_absolute_offset(root, item->name);
 		fprintf(header, "#define ___FMAP__%s_BASE 0x%x\n",
-			item->name, item->offset);
+			item->name, abs_base);
 		fprintf(header, "#define ___FMAP__%s_SIZE 0x%x\n",
 			item->name, item->size);
 		cbfs_sections_iterator_advance(&cbfs_it);



More information about the coreboot-gerrit mailing list