xref: /OK3568_Linux_fs/kernel/arch/ia64/include/asm/timex.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef _ASM_IA64_TIMEX_H
3*4882a593Smuzhiyun #define _ASM_IA64_TIMEX_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun /*
6*4882a593Smuzhiyun  * Copyright (C) 1998-2001, 2003 Hewlett-Packard Co
7*4882a593Smuzhiyun  *	David Mosberger-Tang <davidm@hpl.hp.com>
8*4882a593Smuzhiyun  */
9*4882a593Smuzhiyun /*
10*4882a593Smuzhiyun  * 2001/01/18 davidm	Removed CLOCK_TICK_RATE.  It makes no sense on IA-64.
11*4882a593Smuzhiyun  *			Also removed cacheflush_time as it's entirely unused.
12*4882a593Smuzhiyun  */
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #include <asm/intrinsics.h>
15*4882a593Smuzhiyun #include <asm/processor.h>
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun typedef unsigned long cycles_t;
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun extern void (*ia64_udelay)(unsigned long usecs);
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun /*
22*4882a593Smuzhiyun  * For performance reasons, we don't want to define CLOCK_TICK_TRATE as
23*4882a593Smuzhiyun  * local_cpu_data->itc_rate.  Fortunately, we don't have to, either: according to George
24*4882a593Smuzhiyun  * Anzinger, 1/CLOCK_TICK_RATE is taken as the resolution of the timer clock.  The time
25*4882a593Smuzhiyun  * calculation assumes that you will use enough of these so that your tick size <= 1/HZ.
26*4882a593Smuzhiyun  * If the calculation shows that your CLOCK_TICK_RATE can not supply exactly 1/HZ ticks,
27*4882a593Smuzhiyun  * the actual value is calculated and used to update the wall clock each jiffie.  Setting
28*4882a593Smuzhiyun  * the CLOCK_TICK_RATE to x*HZ insures that the calculation will find no errors.  Hence we
29*4882a593Smuzhiyun  * pick a multiple of HZ which gives us a (totally virtual) CLOCK_TICK_RATE of about
30*4882a593Smuzhiyun  * 100MHz.
31*4882a593Smuzhiyun  */
32*4882a593Smuzhiyun #define CLOCK_TICK_RATE		(HZ * 100000UL)
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun static inline cycles_t
get_cycles(void)35*4882a593Smuzhiyun get_cycles (void)
36*4882a593Smuzhiyun {
37*4882a593Smuzhiyun 	cycles_t ret;
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun 	ret = ia64_getreg(_IA64_REG_AR_ITC);
40*4882a593Smuzhiyun 	return ret;
41*4882a593Smuzhiyun }
42*4882a593Smuzhiyun #define get_cycles get_cycles
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun extern void ia64_cpu_local_tick (void);
45*4882a593Smuzhiyun extern unsigned long long ia64_native_sched_clock (void);
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun #endif /* _ASM_IA64_TIMEX_H */
48