[coreboot-gerrit] New patch to review for coreboot: 96a2e9d Move set_boot_successful to drivers/pc80/mc146818rtc.c

Denis Carikli (GNUtoo@no-log.org) gerrit at coreboot.org
Sun May 25 11:15:50 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/5854

-gerrit

commit 96a2e9d8d3772a32ecfcff898d1906cfee57d920
Author: Denis 'GNUtoo' Carikli <GNUtoo at 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: I38aff153320f802141f944299777e58f5b029c05
    Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at 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..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 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



More information about the coreboot-gerrit mailing list