[coreboot-gerrit] New patch to review for coreboot: c70726f lib: Add Kconfig option to enable/disable auto fallback control

Timothy Pearson (tpearson@raptorengineeringinc.com) gerrit at coreboot.org
Mon Mar 16 17:51:33 CET 2015


Timothy Pearson (tpearson at raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8698

-gerrit

commit c70726f5696f81df23a88587955b90c96e538cfe
Author: Timothy Pearson <tpearson at raptorengineeringinc.com>
Date:   Mon Mar 16 11:47:45 2015 -0500

    lib: Add Kconfig option to enable/disable auto fallback control
    
    Under certain conditions, e.g. automated testing, it is useful
    to have the payload (e.g. Linux) reset the reboot_bits CMOS
    value.  This allows automated recovery in the case of coreboot
    starting properly but the payload failing to start due to bad
    configuration data provided by the coreboot image under test.
    
    Signed-off-by: Timothy Pearson <tpearson at raptorengineeringinc.com>
    Change-Id: Ifc8f565f8292941d90b2e520cc9c5993b41e9cdd
---
 src/Kconfig             | 10 +++++++++-
 src/lib/fallback_boot.c |  5 +++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/Kconfig b/src/Kconfig
index a0758bc..ecf0573 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -236,6 +236,14 @@ config BOOTBLOCK_SOURCE
 	default "bootblock_simple.c" if BOOTBLOCK_SIMPLE
 	default "bootblock_normal.c" if BOOTBLOCK_NORMAL
 
+config CLEAR_MAX_REBOOT_CNT
+	bool "Clear reboot count after successful boot"
+	default y
+	depends on EXPERT
+	help
+	  Clear the reboot count immediately after successful boot.
+	  Unset to allow the payload to control normal/fallback image recovery.
+
 config UPDATE_IMAGE
 	bool "Update existing coreboot.rom image"
 	default n
@@ -1169,4 +1177,4 @@ config REG_SCRIPT
 # TODO: Improve description.
 config MAX_REBOOT_CNT
 	int
-	default 3
+	default 3
\ No newline at end of file
diff --git a/src/lib/fallback_boot.c b/src/lib/fallback_boot.c
index b956c94..b191589 100644
--- a/src/lib/fallback_boot.c
+++ b/src/lib/fallback_boot.c
@@ -22,8 +22,9 @@ static void set_boot_successful(void)
 	byte |= (byte & (1 << 1)) >> 1;
 
 	/* If we are in normal mode set the boot count to 0 */
-	if(byte & 1)
-		byte &= 0x0f;
+	if (IS_ENABLED(CONFIG_CLEAR_MAX_REBOOT_CNT))
+		if(byte & 1)
+			byte &= 0x0f;
 	outb(byte, RTC_PORT(1));
 }
 #else



More information about the coreboot-gerrit mailing list