summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2016-07-27 08:04:54 -0700
committerFurquan Shaikh <furquan@google.com>2016-07-27 23:53:03 +0200
commitc31973760f7dd3db2b149cb512b0a9dbb9ef45cc (patch)
tree5078cfaeefccf6339999ed536cb6451204ced8ee /src
parentbc24b85e6a1ce040e3d9f505e188c686496b7e29 (diff)
downloadcoreboot-c31973760f7dd3db2b149cb512b0a9dbb9ef45cc.tar.xz
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 <furquan@google.com> Reviewed-on: https://review.coreboot.org/15915 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/common/mrc_cache.c8
1 files changed, 7 insertions, 1 deletions
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;