From 029d67278bd53ef9918045712880f3cc9c61a605 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Thu, 5 Dec 2019 22:08:09 -0800 Subject: [PATCH] intel/apollolake: Remove CBFS locator override This patch removes the CBFS locator override for the Apollolake SoC and instead integrates the extra sanity check it was used for straight in the boot device initializer. Change-Id: Iccdb885be233bb027a6a1f2cc79054582cbdf3fc Signed-off-by: Julius Werner Reviewed-on: https://review.coreboot.org/c/coreboot/+/38418 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Nico Huber --- src/soc/intel/apollolake/mmap_boot.c | 42 +++++++--------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/src/soc/intel/apollolake/mmap_boot.c b/src/soc/intel/apollolake/mmap_boot.c index 96ddc0560e..611b0a7d4f 100644 --- a/src/soc/intel/apollolake/mmap_boot.c +++ b/src/soc/intel/apollolake/mmap_boot.c @@ -90,6 +90,16 @@ static void bios_mmap_init(void) CONFIG_ROM_SIZE); bios_size = size; + + /* Check that the CBFS lies within the memory mapped area. It's too + easy to forget the SRAM mapping when crafting an FMAP file. */ + struct region cbfs_region; + if (!fmap_locate_area("COREBOOT", &cbfs_region) && + !region_is_subregion(&real_dev.sub_region, &cbfs_region)) + printk(BIOS_CRIT, + "ERROR: CBFS @ %zx size %zx exceeds mem-mapped area @ %zx size %zx\n", + region_offset(&cbfs_region), region_sz(&cbfs_region), + start, bios_mapped_size); } const struct region_device *boot_device_ro(void) @@ -98,35 +108,3 @@ const struct region_device *boot_device_ro(void) return &real_dev.rdev; } - -static int iafw_boot_region_device(struct region_device *rdev) -{ - struct region *real_dev_reg; - - if (cbfs_default_region_device(rdev)) - return -1; - - /* 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_reg = &real_dev.sub_region; - if (region_is_subregion(real_dev_reg, region_device_region(rdev))) { - printk(BIOS_DEBUG, "CBFS @ %zx size %zx\n", - region_device_offset(rdev), region_device_sz(rdev)); - } else { - printk(BIOS_CRIT, - "ERROR: CBFS @ %zx size %zx exceeds mem-mapped area @ %zx size %zx\n", - region_device_offset(rdev), region_device_sz(rdev), - region_offset(real_dev_reg), region_sz(real_dev_reg)); - } - - return 0; -} - -/* - * Named cbfs_default_locator so that it overrides the default, but incompatible - * locator in cbfs.c - */ -const struct cbfs_locator cbfs_default_locator = { - .name = "IAFW Locator", - .locate = iafw_boot_region_device, -};