]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/asm-x86/tsc.h
071e0ce5b664dd9ae428b056860b020f1b39eb15
[linux-2.6-omap-h63xx.git] / include / asm-x86 / tsc.h
1 /*
2  * x86 TSC related functions
3  */
4 #ifndef _ASM_X86_TSC_H
5 #define _ASM_X86_TSC_H
6
7 #include <asm/processor.h>
8
9 #define NS_SCALE        10 /* 2^10, carefully chosen */
10 #define US_SCALE        32 /* 2^32, arbitralrily chosen */
11
12 /*
13  * Standard way to access the cycle counter.
14  */
15 typedef unsigned long long cycles_t;
16
17 extern unsigned int cpu_khz;
18 extern unsigned int tsc_khz;
19 /* flag for disabling the tsc */
20 extern int tsc_disable;
21
22 extern void disable_TSC(void);
23
24 static inline cycles_t get_cycles(void)
25 {
26         unsigned long long ret = 0;
27
28 #ifndef CONFIG_X86_TSC
29         if (!cpu_has_tsc)
30                 return 0;
31 #endif
32
33 #if defined(CONFIG_X86_GENERIC) || defined(CONFIG_X86_TSC)
34         rdtscll(ret);
35 #endif
36         return ret;
37 }
38
39 static inline cycles_t vget_cycles(void)
40 {
41         /*
42          * We only do VDSOs on TSC capable CPUs, so this shouldnt
43          * access boot_cpu_data (which is not VDSO-safe):
44          */
45 #ifndef CONFIG_X86_TSC
46         if (!cpu_has_tsc)
47                 return 0;
48 #endif
49         return (cycles_t) __native_read_tsc();
50 }
51
52 extern void tsc_init(void);
53 extern void mark_tsc_unstable(char *reason);
54 extern int unsynchronized_tsc(void);
55 extern void init_tsc_clocksource(void);
56 int check_tsc_unstable(void);
57
58 /*
59  * Boot-time check whether the TSCs are synchronized across
60  * all CPUs/cores:
61  */
62 extern void check_tsc_sync_source(int cpu);
63 extern void check_tsc_sync_target(void);
64
65 extern void tsc_calibrate(void);
66 extern int notsc_setup(char *);
67
68 #endif