This patch makes the assumption that the code doing the cmos choice has
CONFIG_USE_OPTION_TABLE enabled.

Is this always the case?

Signed-off-by: Stefan Reinauer <ste...@coresystems.de>

Index: src/include/pc80/mc146818rtc.h
===================================================================
--- src/include/pc80/mc146818rtc.h      (revision 5314)
+++ src/include/pc80/mc146818rtc.h      (working copy)
@@ -82,7 +82,7 @@
 #define PC_CKS_LOC             46
 
 /* coreboot cmos checksum is usually only built over bytes 49..125 */
-#ifdef AUTOCONF_INCLUDED
+#if defined(AUTOCONF_INCLUDED) && (CONFIG_USE_OPTION_TABLE == 1)
 #include <option_table.h>
 #endif
 
Index: src/pc80/mc146818rtc_early.c
===================================================================
--- src/pc80/mc146818rtc_early.c        (revision 5314)
+++ src/pc80/mc146818rtc_early.c        (working copy)
@@ -8,6 +8,7 @@
 #error "CONFIG_MAX_REBOOT_CNT too high"
 #endif
 
+#if CONFIG_USE_OPTION_TABLE == 1
 static unsigned char cmos_read(unsigned char addr)
 {
        int offs = 0;
@@ -55,19 +56,23 @@
 
        return sum == old_sum;
 }
+#endif
 
-
 static inline int last_boot_normal(void)
 {
+#if CONFIG_USE_OPTION_TABLE == 1
        unsigned char byte;
        byte = cmos_read(RTC_BOOT_BYTE);
        return (byte & (1 << 1));
+#else
+       return 0;
+#endif
 }
 
 static inline int do_normal_boot(void)
 {
        unsigned char byte;
-
+#if CONFIG_USE_OPTION_TABLE == 1
        if (cmos_error() || !cmos_chksum_valid()) {
                /* There are no impossible values, no checksums so just
                 * trust whatever value we have in the the cmos,
@@ -105,6 +110,9 @@
        cmos_write(byte, RTC_BOOT_BYTE);
 
        return (byte & (1<<1));
+#else
+       return 0;
+#endif
 }
 
 static inline unsigned read_option(unsigned start, unsigned size, unsigned def)
-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to