blob: b9e5320b76252f06d86fac9f1ac36eeaaa41233b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Torvalds1da177e2005-04-16 15:20:36 -07009#include <asm/8253pit.h>
10#include <asm/msr.h>
11#include <asm/vsyscall.h>
12#include <asm/hpet.h>
Andi Kleenc818a182006-01-11 22:45:24 +010013#include <asm/system.h>
14#include <asm/processor.h>
15#include <linux/compiler.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
17#define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */
18
19typedef unsigned long long cycles_t;
20
21static inline cycles_t get_cycles (void)
22{
23 unsigned long long ret;
24
25 rdtscll(ret);
26 return ret;
27}
28
Andi Kleenc818a182006-01-11 22:45:24 +010029/* Like get_cycles, but make sure the CPU is synchronized. */
30static __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. */
Siddha, Suresh Be4cff6a2006-04-11 12:54:42 +020036 alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC,
Andi Kleenc818a182006-01-11 22:45:24 +010037 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
38 rdtscll(ret);
39 return ret;
40}
41
Linus Torvalds1da177e2005-04-16 15:20:36 -070042extern unsigned int cpu_khz;
43
Venkatesh Pallipadi8a9e1b02005-06-23 00:08:13 -070044extern int read_current_timer(unsigned long *timer_value);
45#define ARCH_HAS_READ_CURRENT_TIMER 1
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047extern struct vxtime_data vxtime;
48
49#endif