From fe338e2319f40a22f1c64aef3df95e015ab8b90b Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Mon, 18 Nov 2019 12:35:21 -0700 Subject: cbfs: switch to region_device for location APIs Drop struct cbfs_props and replace with struct region_device object. The goal of the cbfs locator APIs are to determine the correct region device to find the cbfs files. Therefore, start directly using struct region_device in the cbfs location paths. Update the users of the API and leverage the default boot region device implementation for apollolake. Change-Id: I0158a095cc64c9900d8738f8ffd45ae4040575ea Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/c/coreboot/+/36939 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- src/soc/intel/apollolake/mmap_boot.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/soc/intel/apollolake/mmap_boot.c') diff --git a/src/soc/intel/apollolake/mmap_boot.c b/src/soc/intel/apollolake/mmap_boot.c index 631a834160..96ddc0560e 100644 --- a/src/soc/intel/apollolake/mmap_boot.c +++ b/src/soc/intel/apollolake/mmap_boot.c @@ -99,28 +99,23 @@ const struct region_device *boot_device_ro(void) return &real_dev.rdev; } -static int iafw_boot_region_properties(struct cbfs_props *props) +static int iafw_boot_region_device(struct region_device *rdev) { struct region *real_dev_reg; - struct region regn; - /* use fmap to locate CBFS area */ - if (fmap_locate_area("COREBOOT", ®n)) + if (cbfs_default_region_device(rdev)) return -1; - props->offset = region_offset(®n); - props->size = region_sz(®n); - /* 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, ®n)) { + if (region_is_subregion(real_dev_reg, region_device_region(rdev))) { printk(BIOS_DEBUG, "CBFS @ %zx size %zx\n", - props->offset, props->size); + 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", - props->offset, props->size, + region_device_offset(rdev), region_device_sz(rdev), region_offset(real_dev_reg), region_sz(real_dev_reg)); } @@ -133,5 +128,5 @@ static int iafw_boot_region_properties(struct cbfs_props *props) */ const struct cbfs_locator cbfs_default_locator = { .name = "IAFW Locator", - .locate = iafw_boot_region_properties, + .locate = iafw_boot_region_device, }; -- cgit v1.2.3