From c31973760f7dd3db2b149cb512b0a9dbb9ef45cc Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Wed, 27 Jul 2016 08:04:54 -0700 Subject: soc/intel/common: Store MRC data in next available slot in the cache Currently, coreboot performs an erase of the entire MRC cache region on flash if there is a version mismatch for the MRC data. Instead of doing that, store the new MRC data in the next available slot, if there is enough space available in the cache region. BUG=chrome-os-partner:55699 Change-Id: Ib24a94f0a47c79941ed9f60095360ae3aad5540b Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/15915 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Aaron Durbin --- src/soc/intel/common/mrc_cache.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/soc/intel/common/mrc_cache.c b/src/soc/intel/common/mrc_cache.c index 4ad41582b0..cf819cfdcf 100644 --- a/src/soc/intel/common/mrc_cache.c +++ b/src/soc/intel/common/mrc_cache.c @@ -135,6 +135,13 @@ static int __mrc_cache_get_current(const struct mrc_data_region *region, slot++; } + /* + * Update pointer to the most recently saved MRC data before returning + * any error. This ensures that the caller can use next available slot + * if required. + */ + *cache = verified_cache; + if (verified_cache == NULL) return -1; @@ -144,7 +151,6 @@ static int __mrc_cache_get_current(const struct mrc_data_region *region, return -1; } - *cache = verified_cache; printk(BIOS_DEBUG, "MRC cache slot %d @ %p\n", slot-1, verified_cache); return 0; -- cgit v1.2.3