util/ifdtool/ifdtool.c: Fix default FMAP generation

According to SPI programming guide, a region limit of 0 as well as
region base of 7FFFh indicates an unused/reserved region.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I790d7f5631ecef3043b2c17c41430dc4fd854f72
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74735
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
This commit is contained in:
Maximilian Brune 2023-04-24 19:28:21 +02:00 committed by Martin L Roth
parent 1f58b6a2a5
commit 2c895aaac3
1 changed files with 10 additions and 4 deletions

View File

@ -457,8 +457,11 @@ static void dump_flashrom_layout(char *image, int size, const char *layout_fname
for (unsigned int i = 0; i < max_regions; i++) {
struct region region = get_region(frba, i);
/* is region invalid? */
if (region.size < 1)
/* A region limit of 0 is an indicator of an unused region
* A region base of 7FFFh is an indicator of a reserved region
*/
if (region.limit == 0 || region.base == 0x07FFF000)
continue;
char buf[LAYOUT_LINELEN];
@ -1027,8 +1030,11 @@ static void create_fmap_template(char *image, int size, const char *layout_fname
struct region sorted_regions[MAX_REGIONS] = { 0 };
for (unsigned int i = 0; i < max_regions; i++) {
struct region region = get_region(frba, i);
/* is region invalid? */
if (region.size < 1)
/* A region limit of 0 is an indicator of an unused region
* A region base of 7FFFh is an indicator of a reserved region
*/
if (region.limit == 0 || region.base == 0x07FFF000)
continue;
/* Here we decide to use the coreboot generated FMAP BIOS region, instead of