Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3991
-gerrit
commit 15182d1e647680b4bba65c6cdf6bc870e18a19ff
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Sun Oct 20 23:37:35 2013 +0200
lenovo/x60: Require only one failed boot to switch to fallback in X86_BOOTBLOCK_NORMAL mode.
src/arch/x86/Kconfig defines MAX_REBOOT_CNT as 3.
If that value is not overrided, then the Lenovo X60 coreboot image gets it too.
At the end of a successfull boot, with CONFIG_KEEP_BOOT_COUNT,
the Lenovo X60 increments its reboot_bits cmos option by one.
In case of a failed boot, the user probably doesn't know that coreboot will
only switch to fallback after 3 failed boots, and will act as if the laptop
will not boot anymore with its current coreboot image.
Change-Id: I746df11c933dfe62e01e1591479ca96a84907dc0
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
src/mainboard/lenovo/x60/Kconfig | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/mainboard/lenovo/x60/Kconfig b/src/mainboard/lenovo/x60/Kconfig
index 72aeef8..90d472c 100644
--- a/src/mainboard/lenovo/x60/Kconfig
+++ b/src/mainboard/lenovo/x60/Kconfig
@@ -54,6 +54,10 @@ config MAX_CPUS
int
default 2
+config MAX_REBOOT_CNT
+ int
+ default 1
+
config MAINBOARD_SMBIOS_MANUFACTURER
string
default "LENOVO"
Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3990
-gerrit
commit fe7bc4e31577a3dbdd4cee8b8f3612704d378439
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Mon Oct 21 01:56:47 2013 +0200
Add a KEEP_BOOT_COUNT Kconfig option.
The use case of that option is to inform coreboot (trough the nvram) at the
next boot, that the computer could not fully boot to boot to an usable state.
In that case, the boot count is incremented by one.
Previously there was no way to tell coreboot that the computer really booted
successfully, because it was assumed that if set_boot_successful was called
in ramstage, then the computer would have booted successfully.
However many things can go wrong after that point, for instance the payload
could fail to boot, or the operating system's kernel could fail to boot too,
due to the wrong configurations passed to it by coreboot and the payload.
Change-Id: I01af053455eb6bd2f7a4f9d37e8c234ba8d55250
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
src/Kconfig | 8 ++++++++
src/lib/fallback_boot.c | 3 +++
2 files changed, 11 insertions(+)
diff --git a/src/Kconfig b/src/Kconfig
index 10f8c18..ac7b610 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -47,6 +47,14 @@ config CBFS_PREFIX
Select the prefix to all files put into the image. It's "fallback"
by default, "normal" is a common alternative.
+config KEEP_BOOT_COUNT
+ bool "Keep boot count"
+ default n
+ depends on PC80_SYSTEM
+ help
+ If enabled, the boot count is not reset anymore in the ramstage.
+ This delegates that task to the software running after the ramstage.
+
config ALT_CBFS_LOAD_PAYLOAD
bool "Use alternative cbfs_load_payload() implementation."
default n
diff --git a/src/lib/fallback_boot.c b/src/lib/fallback_boot.c
index a34090e..b1c24f4 100644
--- a/src/lib/fallback_boot.c
+++ b/src/lib/fallback_boot.c
@@ -17,8 +17,11 @@ void boot_successful(void)
vbe_textmode_console();
#endif
+
+#if !CONFIG_KEEP_BOOT_COUNT
/* Remember this was a successful boot */
set_boot_successful();
+#endif
/* turn off the boot watchdog */
watchdog_off();
Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3996
-gerrit
commit 0ba9071090a07df313d758e026f8c6a577fc2841
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Sun Oct 27 17:58:11 2013 +0100
Move set_boot_successful to drivers/pc80/mc146818rtc.c
set_boot_successful depends on CONFIG_PC80_SYSTEM, it also is specific to the
mc146818 rtc.
Change-Id: I57d28d7c81ea595ce06bd4ec9c4981fa71566db9
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
src/drivers/pc80/mc146818rtc.c | 22 ++++++++++++++++++++++
src/lib/fallback_boot.c | 25 +------------------------
2 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/src/drivers/pc80/mc146818rtc.c b/src/drivers/pc80/mc146818rtc.c
index be52454..55817b4 100644
--- a/src/drivers/pc80/mc146818rtc.c
+++ b/src/drivers/pc80/mc146818rtc.c
@@ -322,3 +322,25 @@ void rtc_check_update_cmos_date(u8 has_century)
rtc_update_cmos_date(has_century);
}
}
+
+/* Reset the boot count if the boot is considered successfull */
+void set_boot_successful(void)
+{
+ /* Remember I successfully booted by setting
+ * the initial boot direction
+ * to the direction that I booted.
+ */
+ unsigned char index, byte;
+ index = inb(RTC_PORT(0)) & 0x80;
+ index |= RTC_BOOT_BYTE;
+ outb(index, RTC_PORT(0));
+
+ byte = inb(RTC_PORT(1));
+ byte &= 0xfe;
+ byte |= (byte & (1 << 1)) >> 1;
+
+ /* If we are in normal mode set the boot count to 0 */
+ if(byte & 1)
+ byte &= 0x0f;
+ outb(byte, RTC_PORT(1));
+}
diff --git a/src/lib/fallback_boot.c b/src/lib/fallback_boot.c
index b956c94..a34090e 100644
--- a/src/lib/fallback_boot.c
+++ b/src/lib/fallback_boot.c
@@ -3,30 +3,7 @@
#include <watchdog.h>
#include <arch/io.h>
-#if CONFIG_PC80_SYSTEM
-#include <pc80/mc146818rtc.h>
-
-static void set_boot_successful(void)
-{
- /* Remember I successfully booted by setting
- * the initial boot direction
- * to the direction that I booted.
- */
- unsigned char index, byte;
- index = inb(RTC_PORT(0)) & 0x80;
- index |= RTC_BOOT_BYTE;
- outb(index, RTC_PORT(0));
-
- byte = inb(RTC_PORT(1));
- byte &= 0xfe;
- byte |= (byte & (1 << 1)) >> 1;
-
- /* If we are in normal mode set the boot count to 0 */
- if(byte & 1)
- byte &= 0x0f;
- outb(byte, RTC_PORT(1));
-}
-#else
+#if !CONFIG_PC80_SYSTEM
static void set_boot_successful(void)
{
/* To be implemented */
Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3991
-gerrit
commit 8beaaf00dfc75db2e19ea760b640bcad7fd9ab54
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Sun Oct 20 23:37:35 2013 +0200
lenovo/x60: Require only one failed boot to switch to fallback in X86_BOOTBLOCK_NORMAL mode.
src/arch/x86/Kconfig defines MAX_REBOOT_CNT as 3.
If that value is not overrided, then the Lenovo X60 coreboot image gets it too.
At the end of a successfull boot, with CONFIG_KEEP_BOOT_COUNT,
the Lenovo X60 increments its reboot_bits cmos option by one.
In case of a failed boot, the user probably doesn't know that coreboot will
only switch to fallback after 3 failed boots, and will act as if the laptop
will not boot anymore with its current coreboot image.
Change-Id: I746df11c933dfe62e01e1591479ca96a84907dc0
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
src/mainboard/lenovo/x60/Kconfig | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/mainboard/lenovo/x60/Kconfig b/src/mainboard/lenovo/x60/Kconfig
index 72aeef8..90d472c 100644
--- a/src/mainboard/lenovo/x60/Kconfig
+++ b/src/mainboard/lenovo/x60/Kconfig
@@ -54,6 +54,10 @@ config MAX_CPUS
int
default 2
+config MAX_REBOOT_CNT
+ int
+ default 1
+
config MAINBOARD_SMBIOS_MANUFACTURER
string
default "LENOVO"
Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3990
-gerrit
commit 3d4c213f022cca5b2dee309ae2af55c44c5ef893
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Mon Oct 21 01:56:47 2013 +0200
Add a KEEP_BOOT_COUNT Kconfig option.
The use case of that option is to inform coreboot (trough the nvram) at the
next boot, that the computer could not fully boot to boot to an usable state.
In that case, the boot count is incremented by one.
Previously there was no way to tell coreboot that the computer really booted
successfully, because it was assumed that if set_boot_successful was called
in ramstage, then the computer would have booted successfully.
However many things can go wrong after that point, for instance the payload
could fail to boot, or the operating system's kernel could fail to boot too,
due to the wrong configurations passed to it by coreboot and the payload.
Change-Id: I01af053455eb6bd2f7a4f9d37e8c234ba8d55250
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
src/Kconfig | 8 ++++++++
src/lib/fallback_boot.c | 3 +++
2 files changed, 11 insertions(+)
diff --git a/src/Kconfig b/src/Kconfig
index 10f8c18..ac7b610 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -47,6 +47,14 @@ config CBFS_PREFIX
Select the prefix to all files put into the image. It's "fallback"
by default, "normal" is a common alternative.
+config KEEP_BOOT_COUNT
+ bool "Keep boot count"
+ default n
+ depends on PC80_SYSTEM
+ help
+ If enabled, the boot count is not reset anymore in the ramstage.
+ This delegates that task to the software running after the ramstage.
+
config ALT_CBFS_LOAD_PAYLOAD
bool "Use alternative cbfs_load_payload() implementation."
default n
diff --git a/src/lib/fallback_boot.c b/src/lib/fallback_boot.c
index a34090e..b1c24f4 100644
--- a/src/lib/fallback_boot.c
+++ b/src/lib/fallback_boot.c
@@ -17,8 +17,11 @@ void boot_successful(void)
vbe_textmode_console();
#endif
+
+#if !CONFIG_KEEP_BOOT_COUNT
/* Remember this was a successful boot */
set_boot_successful();
+#endif
/* turn off the boot watchdog */
watchdog_off();
Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3991
-gerrit
commit ed2481770a0c4dac2e36b8e064a6279bc64fff49
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Sun Oct 20 23:37:35 2013 +0200
Require only one failed boot to switch to fallback in X86_BOOTBLOCK_NORMAL mode.
src/arch/x86/Kconfig defines MAX_REBOOT_CNT as 3.
If that value is not overrided, then the coreboot image gets it too.
At the end of a successfull boot, with CONFIG_KEEP_BOOT_COUNT,
the reboot_bits cmos option is increased by one.
In case of a failed boot, the user probably doesn't know that coreboot will
only switch to fallback after 3 failed boots, and will act as if the laptop
will not boot anymore with its current coreboot image.
This patch was tested on the Lenovo X60.
Change-Id: I746df11c933dfe62e01e1591479ca96a84907dc0
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
src/arch/x86/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index 0a21fcc..9610a5b 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -46,7 +46,7 @@ config STACK_SIZE
# TODO: Improve description.
config MAX_REBOOT_CNT
int
- default 3
+ default 1
# This is something you almost certainly don't want to mess with.
# How many SIPIs do we send when starting up APs and cores?