aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMaximilian Brune <maximilian.brune@9elements.com>2023-04-24 19:28:21 +0200
committerMartin L Roth <gaumless@gmail.com>2023-04-27 20:45:14 +0000
commit2c895aaac366017bea3641b43cc5f71e5cc86609 (patch)
treea653fcfbb69b2d8d278a2b6891ebd937f0dd52eb /util
parent1f58b6a2a58a119c7073bb92c40d4ef98dc0efa9 (diff)
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>
Diffstat (limited to 'util')
-rw-r--r--util/ifdtool/ifdtool.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c
index 625b4cf5ac..ada120b001 100644
--- a/util/ifdtool/ifdtool.c
+++ b/util/ifdtool/ifdtool.c
@@ -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