Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/asm-x86_64/timex.h |
| 3 | * |
| 4 | * x86-64 architecture timex specifications |
| 5 | */ |
| 6 | #ifndef _ASMx8664_TIMEX_H |
| 7 | #define _ASMx8664_TIMEX_H |
| 8 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <asm/8253pit.h> |
| 10 | #include <asm/msr.h> |
| 11 | #include <asm/vsyscall.h> |
| 12 | #include <asm/hpet.h> |
Andi Kleen | c818a18 | 2006-01-11 22:45:24 +0100 | [diff] [blame] | 13 | #include <asm/system.h> |
| 14 | #include <asm/processor.h> |
| 15 | #include <linux/compiler.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
| 17 | #define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */ |
| 18 | |
| 19 | typedef unsigned long long cycles_t; |
| 20 | |
| 21 | static inline cycles_t get_cycles (void) |
| 22 | { |
| 23 | unsigned long long ret; |
| 24 | |
| 25 | rdtscll(ret); |
| 26 | return ret; |
| 27 | } |
| 28 | |
Andi Kleen | c818a18 | 2006-01-11 22:45:24 +0100 | [diff] [blame] | 29 | /* Like get_cycles, but make sure the CPU is synchronized. */ |
| 30 | static __always_inline cycles_t get_cycles_sync(void) |
| 31 | { |
| 32 | unsigned long long ret; |
| 33 | unsigned eax; |
| 34 | /* Don't do an additional sync on CPUs where we know |
| 35 | RDTSC is already synchronous. */ |
| 36 | alternative_io(ASM_NOP2, "cpuid", X86_FEATURE_SYNC_RDTSC, |
| 37 | "=a" (eax), "0" (1) : "ebx","ecx","edx","memory"); |
| 38 | rdtscll(ret); |
| 39 | return ret; |
| 40 | } |
| 41 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | extern unsigned int cpu_khz; |
| 43 | |
Venkatesh Pallipadi | 8a9e1b0 | 2005-06-23 00:08:13 -0700 | [diff] [blame] | 44 | extern int read_current_timer(unsigned long *timer_value); |
| 45 | #define ARCH_HAS_READ_CURRENT_TIMER 1 |
| 46 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | extern struct vxtime_data vxtime; |
| 48 | |
| 49 | #endif |