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 914c5d3d97b11491a7cfc47e8f8bfc8e9b1def76 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 be52454..1f064ea 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" @@ -322,3 +323,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..cca52a9 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 +void set_boot_successful(void) { } +#endif
+#endif /* __ASSEMBLER__ */ #endif /* FALLBACK_H */ diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h index 170a433..76935f5 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 diff --git a/src/lib/fallback_boot.c b/src/lib/fallback_boot.c index b956c94..0c49d5c 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