summaryrefslogtreecommitdiff
path: root/src/soc/intel/apollolake
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2018-12-05 18:06:17 +0100
committerPatrick Georgi <pgeorgi@google.com>2018-12-06 12:06:16 +0000
commit56dd2d6ff108105a9349d2644db9706e7d688eeb (patch)
tree0126306b9712ae8b0d3eacb06ff93ac1f705cda8 /src/soc/intel/apollolake
parent6a5b53bef8dfae795d3d6e297508cf559d5d2fd2 (diff)
soc/intel/apl: Warn if CBFS is outside the memory mapped area
As part of the memory mapped BIOS region is covered by SRAM, check that CBFS always fits the effectively mapped region of flash. This is usually taken care of by reserving the SRAM range in the FMAP (e.g. as BIOS_UNUSABLE), but can be missed. Change-Id: If5a5b553ad4853723bf13349c809c4f6154aa5f2 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/30055 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/soc/intel/apollolake')
-rw-r--r--src/soc/intel/apollolake/mmap_boot.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/soc/intel/apollolake/mmap_boot.c b/src/soc/intel/apollolake/mmap_boot.c
index db13cba62f..1c3077ed91 100644
--- a/src/soc/intel/apollolake/mmap_boot.c
+++ b/src/soc/intel/apollolake/mmap_boot.c
@@ -110,6 +110,8 @@ const struct region_device *boot_device_ro(void)
static int iafw_boot_region_properties(struct cbfs_props *props)
{
+ struct xlate_region_device *real_dev_ptr;
+ struct region *real_dev_reg;
struct region regn;
/* use fmap to locate CBFS area */
@@ -119,7 +121,19 @@ static int iafw_boot_region_properties(struct cbfs_props *props)
props->offset = region_offset(&regn);
props->size = region_sz(&regn);
- printk(BIOS_DEBUG, "CBFS @ %zx size %zx\n", props->offset, props->size);
+ /* Check that we are within the memory mapped area. It's too
+ easy to forget the SRAM mapping when crafting an FMAP file. */
+ real_dev_ptr = car_get_var_ptr(&real_dev);
+ real_dev_reg = &real_dev_ptr->sub_region;
+ if (region_is_subregion(real_dev_reg, &regn)) {
+ printk(BIOS_DEBUG, "CBFS @ %zx size %zx\n",
+ props->offset, props->size);
+ } else {
+ printk(BIOS_CRIT,
+ "ERROR: CBFS @ %zx size %zx exceeds mem-mapped area @ %zx size %zx\n",
+ props->offset, props->size,
+ region_offset(real_dev_reg), region_sz(real_dev_reg));
+ }
return 0;
}