[coreboot-gerrit] New patch to review for coreboot: soc/intel/common/mrc_cache: Don't assume FMAP is tied to CHROMEOS

Alexandru Gagniuc (alexandrux.gagniuc@intel.com) gerrit at coreboot.org
Tue May 10 18:24:40 CEST 2016


Alexandru Gagniuc (alexandrux.gagniuc at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14757

-gerrit

commit 414fea4c829ef98bb3aadac30705ff38952d4406
Author: Alexandru Gagniuc <alexandrux.gagniuc at intel.com>
Date:   Tue Apr 12 14:52:29 2016 -0700

    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 at intel.com>
---
 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 e96f7a7..4ad4158 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;
 }
 



More information about the coreboot-gerrit mailing list