From 810caa99491c66a46bbb275214e1d8183ae09bcf Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Tue, 12 Apr 2016 14:52:29 -0700 Subject: [PATCH] soc/intel/common/mrc_cache: Don't assume FMAP is tied to CHROMEOS The old code only checked for an RW_MRC_CACHE region when CONFIG_CHROMEOS was selected. This assumption is not necessarily true, as one can have FMAP without a CHROMEOS build. As a result, always search FMAP first before falling back on CBFS for locating the MRC cache region. The old logic where CHROMEOS builds would fail when RW_MRC_CACHE was not found is preserved, such that behavior does not change. Change-Id: I3596ef3235eff661af055968ea641f3e9671cdcd Signed-off-by: Alexandru Gagniuc Reviewed-on: https://review.coreboot.org/14757 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/soc/intel/common/mrc_cache.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/soc/intel/common/mrc_cache.c b/src/soc/intel/common/mrc_cache.c index e96f7a7b9a..4ad41582b0 100644 --- a/src/soc/intel/common/mrc_cache.c +++ b/src/soc/intel/common/mrc_cache.c @@ -35,23 +35,27 @@ struct mrc_data_region { /* common code */ static int mrc_cache_get_region(struct mrc_data_region *region) { - if (IS_ENABLED(CONFIG_CHROMEOS)) { - struct region_device rdev; + bool located_by_fmap = true; + struct region_device rdev; - if (fmap_locate_area_as_rdev("RW_MRC_CACHE", &rdev)) - return -1; + if (fmap_locate_area_as_rdev("RW_MRC_CACHE", &rdev)) + located_by_fmap = false; + /* CHROMEOS builds must get their MRC cache from FMAP. */ + if (IS_ENABLED(CONFIG_CHROMEOS) && !located_by_fmap) + return -1; + + if (located_by_fmap) { region->size = region_device_sz(&rdev); region->base = rdev_mmap_full(&rdev); if (region->base == NULL) return -1; - - return 0; } else { region->base = (void *)CONFIG_MRC_SETTINGS_CACHE_BASE; region->size = CONFIG_MRC_SETTINGS_CACHE_SIZE; } + return 0; }