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>
This commit is contained in:
parent
010225c777
commit
810caa9949
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue