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>
This commit is contained in:
parent
6a5b53bef8
commit
56dd2d6ff1
|
@ -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(®n);
|
||||
props->size = region_sz(®n);
|
||||
|
||||
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, ®n)) {
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue