Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[powerpc.git] / include / asm-powerpc / time.h
index 4463148..a782850 100644 (file)
@@ -18,8 +18,9 @@
 #include <linux/percpu.h>
 
 #include <asm/processor.h>
-#ifdef CONFIG_PPC64
+#ifdef CONFIG_PPC_ISERIES
 #include <asm/paca.h>
+#include <asm/firmware.h>
 #include <asm/iseries/hv_call.h>
 #endif
 
@@ -29,10 +30,6 @@ extern unsigned long tb_ticks_per_usec;
 extern unsigned long tb_ticks_per_sec;
 extern u64 tb_to_xs;
 extern unsigned      tb_to_us;
-extern unsigned long tb_last_stamp;
-extern u64 tb_last_jiffy;
-
-DECLARE_PER_CPU(unsigned long, last_jiffy);
 
 struct rtc_time;
 extern void to_tm(int tim, struct rtc_time * tm);
@@ -42,6 +39,10 @@ extern void generic_calibrate_decr(void);
 extern void wakeup_decrementer(void);
 extern void snapshot_timebase(void);
 
+#ifdef CONFIG_RTC_CLASS
+extern int __init rtc_class_hookup(void);
+#endif
+
 /* Some sane defaults: 125 MHz timebase, 1GHz processor */
 extern unsigned long ppc_proc_freq;
 #define DEFAULT_PROC_FREQ      (DEFAULT_TB_FREQ * 8)
@@ -81,30 +82,35 @@ struct div_result {
 #define __USE_RTC()    0
 #endif
 
-/* On ppc64 this gets us the whole timebase; on ppc32 just the lower half */
+#ifdef CONFIG_PPC64
+
+/* For compatibility, get_tbl() is defined as get_tb() on ppc64 */
+#define get_tbl                get_tb
+
+#else
+
 static inline unsigned long get_tbl(void)
 {
-       unsigned long tbl;
-
 #if defined(CONFIG_403GCX)
+       unsigned long tbl;
        asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
+       return tbl;
 #else
-       asm volatile("mftb %0" : "=r" (tbl));
+       return mftbl();
 #endif
-       return tbl;
 }
 
 static inline unsigned int get_tbu(void)
 {
+#ifdef CONFIG_403GCX
        unsigned int tbu;
-
-#if defined(CONFIG_403GCX)
        asm volatile("mfspr %0, 0x3dc" : "=r" (tbu));
+       return tbu;
 #else
-       asm volatile("mftbu %0" : "=r" (tbu));
+       return mftbu();
 #endif
-       return tbu;
 }
+#endif /* !CONFIG_PPC64 */
 
 static inline unsigned int get_rtcl(void)
 {
@@ -130,7 +136,7 @@ static inline u64 get_tb(void)
 {
        return mftb();
 }
-#else
+#else /* CONFIG_PPC64 */
 static inline u64 get_tb(void)
 {
        unsigned int tbhi, tblo, tbhi2;
@@ -143,7 +149,7 @@ static inline u64 get_tb(void)
 
        return ((u64)tbhi << 32) | tblo;
 }
-#endif
+#endif /* !CONFIG_PPC64 */
 
 static inline void set_tb(unsigned int upper, unsigned int lower)
 {
@@ -177,7 +183,8 @@ static inline void set_dec(int val)
 #ifdef CONFIG_PPC_ISERIES
        int cur_dec;
 
-       if (get_lppaca()->shared_proc) {
+       if (firmware_has_feature(FW_FEATURE_ISERIES) &&
+                       get_lppaca()->shared_proc) {
                get_lppaca()->virtual_decr = val;
                cur_dec = get_dec();
                if (cur_dec > val)
@@ -236,4 +243,4 @@ extern void snapshot_timebases(void);
 #endif
 
 #endif /* __KERNEL__ */
-#endif /* __PPC64_TIME_H */
+#endif /* __POWERPC_TIME_H */