diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2020-10-26 11:40:41 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-10-28 10:43:41 +0000 |
commit | 6ad856825a0c4b2c2d64b633e7cb83fcb4dd8ff2 (patch) | |
tree | db4568dbb1f3d191abb960699904b479dc5baf45 /src/drivers | |
parent | 71b546773daa57682c480196f4ed167dd060b54c (diff) | |
download | coreboot-6ad856825a0c4b2c2d64b633e7cb83fcb4dd8ff2.tar.xz |
drivers/mrc_cache: Fix size comparison in mrc_cache update
`mrc_cache_needs_update` is comparing the "new size" of the MRC data
(minus metadata size) to the size including the metadata, which causes
the driver to think the data has changed, and so it will rewrite the
MRC cache on every boot. This patch removes the metadata size from
the comparison.
BUG=b:171513942
BRANCH=volteer
TEST=1) Memory training data gets written the on a boot where the data
was wiped out.
2) Memory training data does not get written back on every subsequent
boot.
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: I7280276f71fdaa492c327b2b7ade8e53e7c59f51
Reviewed-on: https://review.coreboot.org/c/coreboot/+/46824
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shelley Chen <shchen@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/mrc_cache/mrc_cache.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/drivers/mrc_cache/mrc_cache.c b/src/drivers/mrc_cache/mrc_cache.c index 3b98dbaa63..eb43123c67 100644 --- a/src/drivers/mrc_cache/mrc_cache.c +++ b/src/drivers/mrc_cache/mrc_cache.c @@ -337,10 +337,10 @@ static bool mrc_cache_needs_update(const struct region_device *rdev, const void *new_data, size_t new_data_size) { void *mapping, *data_mapping; - size_t size = region_device_sz(rdev); + size_t old_data_size = region_device_sz(rdev) - sizeof(struct mrc_metadata); bool need_update = false; - if (new_data_size != size) + if (new_data_size != old_data_size) return true; mapping = rdev_mmap_full(rdev); |