[coreboot-gerrit] New patch to review for coreboot: 39835ef Add a KEEP_BOOT_COUNT Kconfig option.
Denis Carikli (GNUtoo@no-log.org)
gerrit at coreboot.org
Sun May 25 11:15:51 CEST 2014
Denis Carikli (GNUtoo at no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5855
-gerrit
commit 39835ef3bf83800d9a7cfb1f114a80cf58404ff0
Author: Denis 'GNUtoo' Carikli <GNUtoo at 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: Ibbfafd00799897b64fa268ca17448d746b0e681c
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>
---
src/arch/x86/Kconfig | 8 ++++++++
src/arch/x86/boot/acpi.c | 12 ++++++++++++
src/lib/fallback_boot.c | 4 ++++
3 files changed, 24 insertions(+)
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index 0a21fcc..b4e8eb0 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -72,6 +72,14 @@ config X86_BOOTBLOCK_NORMAL
endchoice
+config KEEP_BOOT_COUNT
+ bool "Keep boot count"
+ default n
+ depends on PC80_SYSTEM && X86_BOOTBLOCK_NORMAL
+ 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 BOOTBLOCK_SOURCE
string
default "bootblock_simple.c" if X86_BOOTBLOCK_SIMPLE
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c
index 96cb270..2b1e764 100644
--- a/src/arch/x86/boot/acpi.c
+++ b/src/arch/x86/boot/acpi.c
@@ -33,6 +33,9 @@
#include <cbmem.h>
#include <cpu/x86/lapic_def.h>
#include <cpu/cpu.h>
+#if CONFIG_KEEP_BOOT_COUNT
+#include <fallback.h>
+#endif
#if CONFIG_COLLECT_TIMESTAMPS
#include <timestamp.h>
#endif
@@ -638,6 +641,15 @@ void acpi_resume(void *wake_vec)
if (mainboard_suspend_resume)
mainboard_suspend_resume();
+#if CONFIG_KEEP_BOOT_COUNT
+ /* we don't want to resume with the wrong prefix next time.
+ * And doing it in the bootblock seems counterintuitive:
+ * the bootblock would then need to know it's resuming...
+ */
+ if (strncmp(CONFIG_CBFS_PREFIX, "fallback", sizeof("fallback")))
+ set_boot_successful();
+#endif
+
post_code(POST_OS_RESUME);
acpi_jump_to_wakeup(wake_vec);
}
diff --git a/src/lib/fallback_boot.c b/src/lib/fallback_boot.c
index 0c49d5c..3e274f4 100644
--- a/src/lib/fallback_boot.c
+++ b/src/lib/fallback_boot.c
@@ -10,8 +10,12 @@ void boot_successful(void)
vbe_textmode_console();
#endif
+
+/* We want to only do it at resume in the case of CONFIG_KEEP_BOOT_COUNT */
+#if !CONFIG_KEEP_BOOT_COUNT
/* Remember this was a successful boot */
set_boot_successful();
+#endif
/* turn off the boot watchdog */
watchdog_off();
More information about the coreboot-gerrit
mailing list