Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild
[pandora-kernel.git] / include / asm-powerpc / time.h
index 4eecc38..912118d 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/processor.h>
 #ifdef CONFIG_PPC64
 #include <asm/paca.h>
-#include <asm/iSeries/HvCall.h>
+#include <asm/iseries/hv_call.h>
 #endif
 
 /* time.c */
@@ -30,7 +30,8 @@ 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 u64 tb_last_stamp;
+extern unsigned long tb_last_stamp;
+extern u64 tb_last_jiffy;
 
 DECLARE_PER_CPU(unsigned long, last_jiffy);
 
@@ -40,6 +41,7 @@ extern time_t last_rtc_update;
 
 extern void generic_calibrate_decr(void);
 extern void wakeup_decrementer(void);
+extern void snapshot_timebase(void);
 
 /* Some sane defaults: 125 MHz timebase, 1GHz processor */
 extern unsigned long ppc_proc_freq;
@@ -75,7 +77,7 @@ struct div_result {
 /* Accessor functions for the timebase (RTC on 601) registers. */
 /* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
 #ifdef CONFIG_6xx
-#define __USE_RTC()    cpu_has_feature(CPU_FTR_USE_TB)
+#define __USE_RTC()    (!cpu_has_feature(CPU_FTR_USE_TB))
 #else
 #define __USE_RTC()    0
 #endif
@@ -113,6 +115,17 @@ static inline unsigned int get_rtcl(void)
        return rtcl;
 }
 
+static inline u64 get_rtc(void)
+{
+       unsigned int hi, lo, hi2;
+
+       do {
+               asm volatile("mfrtcu %0; mfrtcl %1; mfrtcu %2"
+                            : "=r" (hi), "=r" (lo), "=r" (hi2));
+       } while (hi2 != hi);
+       return (u64)hi * 1000000000 + lo;
+}
+
 #ifdef CONFIG_PPC64
 static inline u64 get_tb(void)
 {
@@ -163,11 +176,10 @@ static inline void set_dec(int val)
        set_dec_cpu6(val);
 #else
 #ifdef CONFIG_PPC_ISERIES
-       struct paca_struct *lpaca = get_paca();
        int cur_dec;
 
-       if (lpaca->lppaca.shared_proc) {
-               lpaca->lppaca.virtual_decr = val;
+       if (get_lppaca()->shared_proc) {
+               get_lppaca()->virtual_decr = val;
                cur_dec = get_dec();
                if (cur_dec > val)
                        HvCall_setVirtualDecr();
@@ -196,9 +208,11 @@ static inline unsigned long tb_ticks_since(unsigned long tstamp)
 extern u64 mulhdu(u64, u64);
 #endif
 
-unsigned mulhwu_scale_factor(unsigned, unsigned);
-void div128_by_32(u64 dividend_high, u64 dividend_low,
-                 unsigned divisor, struct div_result *dr);
+extern void smp_space_timers(unsigned int);
+
+extern unsigned mulhwu_scale_factor(unsigned, unsigned);
+extern void div128_by_32(u64 dividend_high, u64 dividend_low,
+                        unsigned divisor, struct div_result *dr);
 
 /* Used to store Processor Utilization register (purr) values */
 
@@ -208,5 +222,19 @@ struct cpu_usage {
 
 DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
 
+#ifdef CONFIG_VIRT_CPU_ACCOUNTING
+extern void account_process_vtime(struct task_struct *tsk);
+#else
+#define account_process_vtime(tsk)             do { } while (0)
+#endif
+
+#if defined(CONFIG_VIRT_CPU_ACCOUNTING) && defined(CONFIG_PPC_SPLPAR)
+extern void calculate_steal_time(void);
+extern void snapshot_timebases(void);
+#else
+#define calculate_steal_time()                 do { } while (0)
+#define snapshot_timebases()                   do { } while (0)
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* __PPC64_TIME_H */