Timothy Pearson (tpearson@raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12289
-gerrit
commit c49d7f9bf46bee43f9fcf691762959dc82b1876a Author: Timothy Pearson tpearson@raptorengineeringinc.com Date: Sun Nov 1 02:13:17 2015 -0600
drivers/pc80: Ensure recovery mode always boots fallback image
The current fallback / failed boot count checks only look at the value of last_boot when determining whether to execute the normal or fallback image. Furthermore, the normal boot bit is unconditionally set if the failed boot count has not exceeded its threshold, thereby overriding a request from the user to boot into fallback mode if the user does not also set the failed boot count above the failure threshold.
Only check the failed boot count if the normal boot bit is set in nvram.
Change-Id: I753ae9f0710c524875a85354ac2547df0c305569 Signed-off-by: Timothy Pearson tpearson@raptorengineeringinc.com --- src/drivers/pc80/mc146818rtc_early.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/drivers/pc80/mc146818rtc_early.c b/src/drivers/pc80/mc146818rtc_early.c index 421af2f..9861c29 100644 --- a/src/drivers/pc80/mc146818rtc_early.c +++ b/src/drivers/pc80/mc146818rtc_early.c @@ -72,18 +72,20 @@ static inline __attribute__((unused)) int do_normal_boot(void) if (byte & 1) byte &= 0x0f; /* yes, clear the boot count */
- /* Properly set the last boot flag */ - byte &= 0xfc; - if ((byte >> 4) < CONFIG_MAX_REBOOT_CNT) { - byte |= (1<<1); - } - - /* Are we already at the max count? */ - if ((byte >> 4) < CONFIG_MAX_REBOOT_CNT) { - byte += 1 << 4; /* No, add 1 to the count */ - } - else { - byte &= 0xfc; /* Yes, put in fallback mode */ + if (byte & 1) { + /* Properly set the last boot flag */ + byte &= 0xfc; + if ((byte >> 4) < CONFIG_MAX_REBOOT_CNT) { + byte |= (1<<1); + } + + /* Are we already at the max count? */ + if ((byte >> 4) < CONFIG_MAX_REBOOT_CNT) { + byte += 1 << 4; /* No, add 1 to the count */ + } + else { + byte &= 0xfc; /* Yes, put in fallback mode */ + } }
/* Save the boot byte */