Loading...
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/kernel.h>
16#include <linux/sched.h>
17#include <linux/compiler.h>
18
19#include <asm/intrinsics.h>
20#include <asm/processor.h>
21
22static __inline__ void
23ia64_set_itm (unsigned long val)
24{
25 ia64_setreg(_IA64_REG_CR_ITM, val);
26 ia64_srlz_d();
27}
28
29static __inline__ unsigned long
30ia64_get_itm (void)
31{
32 unsigned long result;
33
34 result = ia64_getreg(_IA64_REG_CR_ITM);
35 ia64_srlz_d();
36 return result;
37}
38
39static __inline__ void
40ia64_set_itv (unsigned long val)
41{
42 ia64_setreg(_IA64_REG_CR_ITV, val);
43 ia64_srlz_d();
44}
45
46static __inline__ unsigned long
47ia64_get_itv (void)
48{
49 return ia64_getreg(_IA64_REG_CR_ITV);
50}
51
52static __inline__ void
53ia64_set_itc (unsigned long val)
54{
55 ia64_setreg(_IA64_REG_AR_ITC, val);
56 ia64_srlz_d();
57}
58
59static __inline__ unsigned long
60ia64_get_itc (void)
61{
62 unsigned long result;
63
64 result = ia64_getreg(_IA64_REG_AR_ITC);
65 ia64_barrier();
66#ifdef CONFIG_ITANIUM
67 while (unlikely((__s32) result == -1)) {
68 result = ia64_getreg(_IA64_REG_AR_ITC);
69 ia64_barrier();
70 }
71#endif
72 return result;
73}
74
75extern void ia64_delay_loop (unsigned long loops);
76
77static __inline__ void
78__delay (unsigned long loops)
79{
80 if (unlikely(loops < 1))
81 return;
82
83 ia64_delay_loop (loops - 1);
84}
85
86extern void udelay (unsigned long usecs);
87
88#endif /* _ASM_IA64_DELAY_H */
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_IA64_DELAY_H
3#define _ASM_IA64_DELAY_H
4
5/*
6 * Delay routines using a pre-computed "cycles/usec" value.
7 *
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>
14 */
15
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
87extern void udelay (unsigned long usecs);
88
89#endif /* _ASM_IA64_DELAY_H */