Denis Carikli (GNUtoo@no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3996
-gerrit
commit d6c5b637c33f3b84b8a459acfbe20ff83a5765c4 Author: Denis 'GNUtoo' Carikli GNUtoo@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@no-log.org --- src/drivers/pc80/mc146818rtc.c | 23 +++++++++++++++++++++++ src/include/fallback.h | 8 +++++--- src/include/pc80/mc146818rtc.h | 1 + src/lib/fallback_boot.c | 30 ------------------------------ 4 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/src/drivers/pc80/mc146818rtc.c b/src/drivers/pc80/mc146818rtc.c index 51cd6c3..73e446e 100644 --- a/src/drivers/pc80/mc146818rtc.c +++ b/src/drivers/pc80/mc146818rtc.c @@ -3,6 +3,7 @@ #include <console/console.h> #include <pc80/mc146818rtc.h> #include <boot/coreboot_tables.h> +#include <fallback.h> #include <string.h> #if CONFIG_USE_OPTION_TABLE #include "option_table.h" @@ -325,3 +326,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/include/fallback.h b/src/include/fallback.h index 7f3c823..f101a56 100644 --- a/src/include/fallback.h +++ b/src/include/fallback.h @@ -4,9 +4,11 @@ #if !defined(__ASSEMBLER__) && !defined(__PRE_RAM__)
void boot_successful(void); +void set_boot_successful(void);
-#endif /* __ASSEMBLER__ */ - -#define RTC_BOOT_BYTE 48 +#if !CONFIG_PC80_SYSTEM +#define set_boot_successful(void) do{} while(0) +#endif
+#endif /* __ASSEMBLER__ */ #endif /* FALLBACK_H */ diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h index fd40308..8b0dc39 100644 --- a/src/include/pc80/mc146818rtc.h +++ b/src/include/pc80/mc146818rtc.h @@ -16,6 +16,7 @@ #define RTC_REG_C 12 #define RTC_REG_D 13
+#define RTC_BOOT_BYTE 48
/********************************************************************** * register details diff --git a/src/lib/fallback_boot.c b/src/lib/fallback_boot.c index 042db08..3e274f4 100644 --- a/src/lib/fallback_boot.c +++ b/src/lib/fallback_boot.c @@ -3,36 +3,6 @@ #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 -static void set_boot_successful(void) -{ - /* To be implemented */ -} -#endif - void boot_successful(void) { #if CONFIG_FRAMEBUFFER_SET_VESA_MODE && !CONFIG_FRAMEBUFFER_KEEP_VESA_MODE