aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ia64/delay.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-ia64/delay.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-ia64/delay.h')
-rw-r--r--include/asm-ia64/delay.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/include/asm-ia64/delay.h b/include/asm-ia64/delay.h
new file mode 100644
index 000000000000..57182d6f2b9a
--- /dev/null
+++ b/include/asm-ia64/delay.h
@@ -0,0 +1,97 @@
1#ifndef _ASM_IA64_DELAY_H
2#define _ASM_IA64_DELAY_H
3
4/*
5 * Delay routines using a pre-computed "cycles/usec" value.
6 *
7 * Copyright (C) 1998, 1999 Hewlett-Packard Co
8 * David Mosberger-Tang <davidm@hpl.hp.com>
9 * Copyright (C) 1999 VA Linux Systems
10 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
11 * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
12 * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
13 */
14
15#include <linux/config.h>
16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/compiler.h>
19
20#include <asm/intrinsics.h>
21#include <asm/processor.h>
22
23static __inline__ void
24ia64_set_itm (unsigned long val)
25{
26 ia64_setreg(_IA64_REG_CR_ITM, val);
27 ia64_srlz_d();
28}
29
30static __inline__ unsigned long
31ia64_get_itm (void)
32{
33 unsigned long result;
34
35 result = ia64_getreg(_IA64_REG_CR_ITM);
36 ia64_srlz_d();
37 return result;
38}
39
40static __inline__ void
41ia64_set_itv (unsigned long val)
42{
43 ia64_setreg(_IA64_REG_CR_ITV, val);
44 ia64_srlz_d();
45}
46
47static __inline__ unsigned long
48ia64_get_itv (void)
49{
50 return ia64_getreg(_IA64_REG_CR_ITV);
51}
52
53static __inline__ void
54ia64_set_itc (unsigned long val)
55{
56 ia64_setreg(_IA64_REG_AR_ITC, val);
57 ia64_srlz_d();
58}
59
60static __inline__ unsigned long
61ia64_get_itc (void)
62{
63 unsigned long result;
64
65 result = ia64_getreg(_IA64_REG_AR_ITC);
66 ia64_barrier();
67#ifdef CONFIG_ITANIUM
68 while (unlikely((__s32) result == -1)) {
69 result = ia64_getreg(_IA64_REG_AR_ITC);
70 ia64_barrier();
71 }
72#endif
73 return result;
74}
75
76extern void ia64_delay_loop (unsigned long loops);
77
78static __inline__ void
79__delay (unsigned long loops)
80{
81 if (unlikely(loops < 1))
82 return;
83
84 ia64_delay_loop (loops - 1);
85}
86
87static __inline__ void
88udelay (unsigned long usecs)
89{
90 unsigned long start = ia64_get_itc();
91 unsigned long cycles = usecs*local_cpu_data->cyc_per_usec;
92
93 while (ia64_get_itc() - start < cycles)
94 cpu_relax();
95}
96
97#endif /* _ASM_IA64_DELAY_H */