special usb hub handling, IDE disks, and retries all over the place
[linux-2.4.git] / include / asm-x86_64 / vsyscall.h
1 #ifndef _ASM_X86_64_VSYSCALL_H_
2 #define _ASM_X86_64_VSYSCALL_H_
3
4 #include <linux/time.h>
5
6 enum vsyscall_num {
7         __NR_vgettimeofday,
8         __NR_vtime,
9 };
10
11 #define VSYSCALL_START (-10UL << 20)
12 #define VSYSCALL_SIZE 1024
13 #define VSYSCALL_END (-2UL << 20)
14 #define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr))
15
16 #ifdef __KERNEL__
17
18 #define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16)))
19 #define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16)))
20 #define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16)))
21 #define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16)))
22 #define __section_xtime __attribute__ ((unused, __section__ (".xtime"), aligned(16)))
23 #define __section_vxtime_sequence __attribute__ ((unused, __section__ (".vxtime_sequence"), aligned(16)))
24
25 struct vxtime_data {
26         long last_tsc;
27         long tsc_quot;
28         long quot;
29         int last;
30         int mode;
31 };
32
33 #define VXTIME_STUPID   0
34 #define VXTIME_TSC      1
35 #define VXTIME_HPET     2
36
37 #define hpet_readl(a)           readl(fix_to_virt(FIX_HPET_BASE) + a)
38 #define hpet_writel(d,a)        writel(d, fix_to_virt(FIX_HPET_BASE) + a)
39
40 /* vsyscall space (readonly) */
41 extern long __vxtime_sequence[2];
42 extern struct vxtime_data __vxtime;
43 extern struct timeval __xtime;
44 extern volatile unsigned long __jiffies;
45 extern unsigned long __wall_jiffies;
46 extern struct timezone __sys_tz;
47
48 /* kernel space (writeable) */
49 extern long vxtime_sequence[2];
50 extern struct vxtime_data vxtime;
51 extern unsigned long wall_jiffies;
52 extern struct timezone sys_tz;
53
54 #define vxtime_lock() do { vxtime_sequence[0]++; wmb(); } while(0)
55 #define vxtime_unlock() do { wmb(); vxtime_sequence[1]++; } while (0)
56
57 #endif /* __KERNEL__ */
58
59 #endif /* _ASM_X86_64_VSYSCALL_H_ */