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 201522822e99b7073f2a0ba6c545b7cc3adb2d4c 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 | 29 +++++++++++++++++++++++++++++ src/include/fallback.h | 3 --- src/include/pc80/mc146818rtc.h | 2 ++ src/lib/fallback_boot.c | 25 +------------------------ 4 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/src/drivers/pc80/mc146818rtc.c b/src/drivers/pc80/mc146818rtc.c index be52454..c9cc8ab 100644 --- a/src/drivers/pc80/mc146818rtc.c +++ b/src/drivers/pc80/mc146818rtc.c @@ -322,3 +322,32 @@ void rtc_check_update_cmos_date(u8 has_century) rtc_update_cmos_date(has_century); } } + +#if CONFIG_USE_OPTION_TABLE +/* 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)); +} +#else +void set_boot_successful(void) +{ + /* Nothing to do. */ +} +#endif diff --git a/src/include/fallback.h b/src/include/fallback.h index 7f3c823..013308c 100644 --- a/src/include/fallback.h +++ b/src/include/fallback.h @@ -6,7 +6,4 @@ void boot_successful(void);
#endif /* __ASSEMBLER__ */ - -#define RTC_BOOT_BYTE 48 - #endif /* FALLBACK_H */ diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h index 170a433..24cc111 100644 --- a/src/include/pc80/mc146818rtc.h +++ b/src/include/pc80/mc146818rtc.h @@ -14,6 +14,7 @@ #define RTC_REG_C 12 #define RTC_REG_D 13
+#define RTC_BOOT_BYTE 48
/********************************************************************** * register details @@ -171,6 +172,7 @@ static inline void cmos_write32(u8 offset, u32 value) void rtc_init(int invalid); void rtc_check_update_cmos_date(u8 has_century); #if CONFIG_USE_OPTION_TABLE +void set_boot_successful(void); int set_option(const char *name, void *val); int get_option(void *dest, const char *name); unsigned read_option_lowlevel(unsigned start, unsigned size, unsigned def); 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 */