Makefile: Simplify calculation of region base with default fmd files
commit5e1326a7d60f9a525dfe037eef3d44c87fd8d0ac
authorFurquan Shaikh <furquan@google.com>
Tue, 14 Apr 2020 06:39:44 +0000 (13 23:39 -0700)
committerPatrick Georgi <pgeorgi@google.com>
Mon, 20 Apr 2020 06:06:46 +0000 (20 06:06 +0000)
treef2b937e8f9461cf2b79c4b2b5b5a9c05681bf41f
parent3814116b42fe7b4f65ea8657b05be7622ba65d9d
Makefile: Simplify calculation of region base with default fmd files

When using default fmd files, base of the fmap region is currently
calculated based on the size and base of previous fmap regions. Since
the existence of any fmap region is dependent on the selection of
certain CONFIG_* parameters, these calculations get complicated. Every
time base is calculated for a region, there need to be checks to see
which of the previous regions really exist. As the regions in default
fmd file are increased, these calculations and the conditional checks
get even more complicated.

This change introduces a Makefile variable FMAP_CURRENT_BASE which is
updated every time a new region is allocated space. This allows using
the same steps for determining the base of any fmap region
irrespective of the state of previous regions.

The way the code is organized it should be possible in the future to
also add a macro to perform the same steps (in case that is possible).

TEST=Verified that coreboot image generated remains unchanged for x86
and ARM boards using the default fmd files.

Signed-off-by: Furquan Shaikh <furquan@google.com>
Change-Id: I2a109462928b6e8b7930bbcc1a1ba45fa85de6ac
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40373
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Makefile.inc