[coreboot-gerrit] New patch to review for coreboot: 60a3cdc baytrail: mrc_cache: check region erased before erasing

Aaron Durbin (adurbin@google.com) gerrit at coreboot.org
Tue Jan 28 03:57:46 CET 2014


Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5043

-gerrit

commit 60a3cdc69519eda0216b905f5764876081de888c
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Mon Jan 13 11:34:51 2014 -0600

    baytrail: mrc_cache: check region erased before erasing
    
    On a firmware update the MRC cache is destroyed. On the
    subsequent boot the MRC region was attempted to be erased
    even if it was already erased. This led to spi part taking
    longer than it should have for an unnecessary erase
    operation. Therefore, check that the region is erased
    before issuing the erease command.
    
    BUG=chrome-os-partner:24916
    BRANCH=baytrail
    TEST=Booted after chromeos-firmeareupdate. Noted no
         error messages in this path.
    
    Change-Id: I6fadeb6bc5fc178abb0a7e3f0898855e481add2e
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
    Reviewed-on: https://chromium-review.googlesource.com/182153
    Reviewed-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/soc/intel/baytrail/mrc_cache.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/soc/intel/baytrail/mrc_cache.c b/src/soc/intel/baytrail/mrc_cache.c
index 0ba1408..9f7676b 100644
--- a/src/soc/intel/baytrail/mrc_cache.c
+++ b/src/soc/intel/baytrail/mrc_cache.c
@@ -279,9 +279,12 @@ static void update_mrc_cache(void *unused)
 	next_slot = mrc_cache_next_slot(&region, current_saved);
 
 	if (!mrc_slot_valid(&region, next_slot, current_boot)) {
-		if (nvm_erase(region.base, region.size) < 0) {
-			printk(BIOS_DEBUG, "Could not erase MRC region.\n");
-			return;
+		printk(BIOS_DEBUG, "Slot @ %p is invalid.\n", next_slot);
+		if (!nvm_is_erased(region.base, region.size)) {
+			if (nvm_erase(region.base, region.size) < 0) {
+				printk(BIOS_DEBUG, "Failure erasing region.\n");
+				return;
+			}
 		}
 		next_slot = region.base;
 	}



More information about the coreboot-gerrit mailing list