diff options
author | Alexandru Gagniuc <alexandrux.gagniuc@intel.com> | 2016-04-12 14:52:29 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2016-05-12 04:53:38 +0200 |
commit | 810caa99491c66a46bbb275214e1d8183ae09bcf (patch) | |
tree | 4bb54831c2ca7e41b710f93b35fde9d3afe89223 /src | |
parent | 010225c7770f033b7e804aad9cf16840c842674c (diff) | |
download | coreboot-810caa99491c66a46bbb275214e1d8183ae09bcf.tar.xz |
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 <alexandrux.gagniuc@intel.com>
Reviewed-on: https://review.coreboot.org/14757
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/intel/common/mrc_cache.c | 16 |
1 files 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; } |