diff options
author | Maximilian Brune <maximilian.brune@9elements.com> | 2023-12-03 20:47:30 +0100 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2024-10-14 15:27:44 +0000 |
commit | 85541960df2c34d0e7c621cc1cfb3c169439d9d0 (patch) | |
tree | a5fd47319581f0db37e008277697e11bcf8f5bb1 /util/ifdtool | |
parent | aa13aeadc05142bd71eb7a6c6742b5a0c8cc9ee9 (diff) |
util/ifdtool/ifdtool.c: Add validation exception
When validating the FMAP against the IFD, the BIOS region is a somewhat
specical case, since the FMAP BIOS region usually does not match the IFD
BIOS region. Instead the FMAP region usually resides somewhere inside
the IFD BIOS region and the where depends on CONFIG_CBFS_SIZE.
Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I920a0ee246cfd2b4ae0870256357d4f285e1730d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79368
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Diffstat (limited to 'util/ifdtool')
-rw-r--r-- | util/ifdtool/ifdtool.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c index 5993bfc99b..36477eef66 100644 --- a/util/ifdtool/ifdtool.c +++ b/util/ifdtool/ifdtool.c @@ -1227,6 +1227,19 @@ static void validate_layout(char *image, int size) matches++; // found a match between FMAP and IFD region if ((uint)region.base != area->offset || (uint)region.size != area->size) { + if (i == REGION_BIOS) { + /* + * BIOS FMAP region is a special case + * coreboots FMAP BIOS region depends on the CONFIG_CBFS_SIZE + * while the IFD BIOS region is always of static size. + * Therefore we just make sure that the BIOS region of the FMAP + * is inside the region specified by the IFD + */ + if ((uint)region.base <= area->offset && + ((uint)region.base + region.size) >= (area->offset + area->size)) { + continue; + } + } printf("Region mismatch between %s and %s\n", region_names[i].terse, area->name); printf(" Descriptor region %s:\n", region_names[i].terse); printf(" offset: 0x%08x\n", region.base); |