]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/rtc.c
x86: enable ACPI extended century handling for 32bit
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / rtc.c
index 276cb7073ab164100af6e3c8e828490d4cd41c3f..91492190ac7298c1a83a5f59b1a30dfcf43624d3 100644 (file)
@@ -9,7 +9,6 @@
 #include <asm/vsyscall.h>
 
 #ifdef CONFIG_X86_32
-# define CMOS_YEARS_OFFS 1900
 /*
  * This is a special lock that is owned by the CPU and holds the index
  * register we are working with.  It is required for NMI access to the
  */
 volatile unsigned long cmos_lock = 0;
 EXPORT_SYMBOL(cmos_lock);
-#else
-/*
- * x86-64 systems only exists since 2002.
- * This will work up to Dec 31, 2100
- */
-# define CMOS_YEARS_OFFS 2000
 #endif
 
+/* For two digit years assume time is always after that */
+#define CMOS_YEARS_OFFS 2000
+
 DEFINE_SPINLOCK(rtc_lock);
 EXPORT_SYMBOL(rtc_lock);
 
@@ -98,7 +94,7 @@ int mach_set_rtc_mmss(unsigned long nowtime)
 
 unsigned long mach_get_cmos_time(void)
 {
-       unsigned int year, mon, day, hour, min, sec, century = 0;
+       unsigned int status, year, mon, day, hour, min, sec, century = 0;
 
        /*
         * If UIP is clear, then we have >= 244 microseconds before
@@ -116,14 +112,16 @@ unsigned long mach_get_cmos_time(void)
        mon = CMOS_READ(RTC_MONTH);
        year = CMOS_READ(RTC_YEAR);
 
-#if defined(CONFIG_ACPI) && defined(CONFIG_X86_64)
-       /* CHECKME: Is this really 64bit only ??? */
+#ifdef CONFIG_ACPI
        if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
            acpi_gbl_FADT.century)
                century = CMOS_READ(acpi_gbl_FADT.century);
 #endif
 
-       if (RTC_ALWAYS_BCD || !(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY)) {
+       status = CMOS_READ(RTC_CONTROL);
+       WARN_ON_ONCE(RTC_ALWAYS_BCD && (status & RTC_DM_BINARY));
+
+       if (RTC_ALWAYS_BCD || !(status & RTC_DM_BINARY)) {
                BCD_TO_BIN(sec);
                BCD_TO_BIN(min);
                BCD_TO_BIN(hour);
@@ -136,11 +134,8 @@ unsigned long mach_get_cmos_time(void)
                BCD_TO_BIN(century);
                year += century * 100;
                printk(KERN_INFO "Extended CMOS year: %d\n", century * 100);
-       } else {
+       } else
                year += CMOS_YEARS_OFFS;
-               if (year < 1970)
-                       year += 100;
-       }
 
        return mktime(year, mon, day, hour, min, sec);
 }
@@ -196,14 +191,9 @@ int update_persistent_clock(struct timespec now)
        return set_rtc_mmss(now.tv_sec);
 }
 
-unsigned long long __vsyscall_fn native_read_tsc(void)
+unsigned long long native_read_tsc(void)
 {
-       DECLARE_ARGS(val, low, high);
-
-       rdtsc_barrier();
-       asm volatile("rdtsc" : EAX_EDX_RET(val, low, high));
-       rdtsc_barrier();
-
-       return EAX_EDX_VAL(val, low, high);
+       return __native_read_tsc();
 }
-EXPORT_SYMBOL_GPL(native_read_tsc);
+EXPORT_SYMBOL(native_read_tsc);
+