Timothy Pearson (tpearson(a)raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12289
-gerrit
commit b143349179ace8fd9eb286c1959ffb78dc8b1f4d
Author: Timothy Pearson <tpearson(a)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(a)raptorengineeringinc.com>
---
src/drivers/pc80/mc146818rtc_early.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/drivers/pc80/mc146818rtc_early.c b/src/drivers/pc80/mc146818rtc_early.c
index 421af2f..2533058 100644
--- a/src/drivers/pc80/mc146818rtc_early.c
+++ b/src/drivers/pc80/mc146818rtc_early.c
@@ -67,23 +67,31 @@ static inline __attribute__((unused)) int do_normal_boot(void)
/* The RTC_BOOT_BYTE is now o.k. see where to go. */
byte = cmos_read(RTC_BOOT_BYTE);
+ /* If booting past the bootblock is all that is required
+ * to reset the failed boot checks, then clear the boot
+ * count. This code must execute before any of the boot
+ * count checks below to function correctly.
+ */
if (!IS_ENABLED(CONFIG_SKIP_MAX_REBOOT_CNT_CLEAR))
/* Are we in normal mode? */
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 */
+ /* Are we in normal 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 */
Timothy Pearson (tpearson(a)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(a)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(a)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 */