1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_IA64_DELAY_H
3 #define _ASM_IA64_DELAY_H
6 * Delay routines using a pre-computed "cycles/usec" value.
8 * Copyright (C) 1998, 1999 Hewlett-Packard Co
9 * David Mosberger-Tang <davidm@hpl.hp.com>
10 * Copyright (C) 1999 VA Linux Systems
11 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
12 * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
13 * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
16 #include <linux/kernel.h>
17 #include <linux/sched.h>
18 #include <linux/compiler.h>
20 #include <asm/intrinsics.h>
21 #include <asm/processor.h>
23 static __inline__
void
24 ia64_set_itm (unsigned long val
)
26 ia64_setreg(_IA64_REG_CR_ITM
, val
);
30 static __inline__
unsigned long
35 result
= ia64_getreg(_IA64_REG_CR_ITM
);
40 static __inline__
void
41 ia64_set_itv (unsigned long val
)
43 ia64_setreg(_IA64_REG_CR_ITV
, val
);
47 static __inline__
unsigned long
50 return ia64_getreg(_IA64_REG_CR_ITV
);
53 static __inline__
void
54 ia64_set_itc (unsigned long val
)
56 ia64_setreg(_IA64_REG_AR_ITC
, val
);
60 static __inline__
unsigned long
65 result
= ia64_getreg(_IA64_REG_AR_ITC
);
68 while (unlikely((__s32
) result
== -1)) {
69 result
= ia64_getreg(_IA64_REG_AR_ITC
);
76 extern void ia64_delay_loop (unsigned long loops
);
78 static __inline__
void
79 __delay (unsigned long loops
)
81 if (unlikely(loops
< 1))
84 ia64_delay_loop (loops
- 1);
87 extern void udelay (unsigned long usecs
);
89 #endif /* _ASM_IA64_DELAY_H */