Furquan Shaikh (furquan@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15828
-gerrit
commit d326bb1456a761409bcaf9a52bd17494013841f7 Author: Furquan Shaikh furquan@google.com Date: Sun Jul 24 08:48:34 2016 -0700
soc/intel/common: Do not update MRC cache in recovery mode
If the system is in recovery, there is no need to update the MRC cache. Instead clear the MRC cache. This ensures that on next boot, the normal/developer mode boot will save its own MRC data.
BUG=chrome-os-partner:55431
Change-Id: Ib13e8c978dc1b4fc8817fab16d0e606f210f2586 Signed-off-by: Furquan Shaikh furquan@google.com --- src/soc/intel/common/mrc_cache.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/soc/intel/common/mrc_cache.c b/src/soc/intel/common/mrc_cache.c index 4ad4158..b6f6654 100644 --- a/src/soc/intel/common/mrc_cache.c +++ b/src/soc/intel/common/mrc_cache.c @@ -14,6 +14,7 @@ */
#include <string.h> +#include <bootmode.h> #include <bootstate.h> #include <console/console.h> #include <cbmem.h> @@ -273,6 +274,18 @@ static int protect_mrc_cache(const struct mrc_data_region *region) return 0; }
+static void mrc_cache_erase(const struct mrc_data_region *region) +{ + /* If MRC_CACHE region does not exist, just ignore. */ + if (region->size == 0) + return; + + if (nvm_erase(region->base, region->size) < 0) { + printk(BIOS_DEBUG, "Failure erasing region.\n"); + return; + } +} + static void update_mrc_cache(void *unused) { const struct mrc_saved_data *current_boot; @@ -280,8 +293,6 @@ static void update_mrc_cache(void *unused) const struct mrc_saved_data *next_slot; struct mrc_data_region region;
- printk(BIOS_DEBUG, "Updating MRC cache data.\n"); - current_boot = cbmem_find(CBMEM_ID_MRCDATA); if (!current_boot) { printk(BIOS_ERR, "No MRC cache in cbmem.\n"); @@ -293,11 +304,19 @@ static void update_mrc_cache(void *unused) return; }
+ if (recovery_mode_enabled()) { + mrc_cache_erase(®ion); + printk(BIOS_DEBUG, "In recovery mode. Skipping MRC update.\n"); + return; + } + if (!mrc_cache_valid(®ion, current_boot)) { printk(BIOS_ERR, "MRC cache data in cbmem invalid.\n"); return; }
+ printk(BIOS_DEBUG, "Updating MRC cache data.\n"); + current_saved = NULL;
if (!__mrc_cache_get_current(®ion, ¤t_saved,