xref: /openbmc/linux/arch/ia64/include/asm/timex.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
27f30491cSTony Luck #ifndef _ASM_IA64_TIMEX_H
37f30491cSTony Luck #define _ASM_IA64_TIMEX_H
47f30491cSTony Luck 
57f30491cSTony Luck /*
67f30491cSTony Luck  * Copyright (C) 1998-2001, 2003 Hewlett-Packard Co
77f30491cSTony Luck  *	David Mosberger-Tang <davidm@hpl.hp.com>
87f30491cSTony Luck  */
97f30491cSTony Luck /*
107f30491cSTony Luck  * 2001/01/18 davidm	Removed CLOCK_TICK_RATE.  It makes no sense on IA-64.
117f30491cSTony Luck  *			Also removed cacheflush_time as it's entirely unused.
127f30491cSTony Luck  */
137f30491cSTony Luck 
147f30491cSTony Luck #include <asm/intrinsics.h>
157f30491cSTony Luck #include <asm/processor.h>
167f30491cSTony Luck 
177f30491cSTony Luck typedef unsigned long cycles_t;
187f30491cSTony Luck 
197f30491cSTony Luck extern void (*ia64_udelay)(unsigned long usecs);
207f30491cSTony Luck 
217f30491cSTony Luck /*
227f30491cSTony Luck  * For performance reasons, we don't want to define CLOCK_TICK_TRATE as
237f30491cSTony Luck  * local_cpu_data->itc_rate.  Fortunately, we don't have to, either: according to George
247f30491cSTony Luck  * Anzinger, 1/CLOCK_TICK_RATE is taken as the resolution of the timer clock.  The time
257f30491cSTony Luck  * calculation assumes that you will use enough of these so that your tick size <= 1/HZ.
267f30491cSTony Luck  * If the calculation shows that your CLOCK_TICK_RATE can not supply exactly 1/HZ ticks,
277f30491cSTony Luck  * the actual value is calculated and used to update the wall clock each jiffie.  Setting
287f30491cSTony Luck  * the CLOCK_TICK_RATE to x*HZ insures that the calculation will find no errors.  Hence we
297f30491cSTony Luck  * pick a multiple of HZ which gives us a (totally virtual) CLOCK_TICK_RATE of about
307f30491cSTony Luck  * 100MHz.
317f30491cSTony Luck  */
327f30491cSTony Luck #define CLOCK_TICK_RATE		(HZ * 100000UL)
337f30491cSTony Luck 
347f30491cSTony Luck static inline cycles_t
get_cycles(void)357f30491cSTony Luck get_cycles (void)
367f30491cSTony Luck {
377f30491cSTony Luck 	cycles_t ret;
387f30491cSTony Luck 
397f30491cSTony Luck 	ret = ia64_getreg(_IA64_REG_AR_ITC);
407f30491cSTony Luck 	return ret;
417f30491cSTony Luck }
42*57c0900bSJason A. Donenfeld #define get_cycles get_cycles
437f30491cSTony Luck 
441b4a18fcSIsaku Yamahata extern void ia64_cpu_local_tick (void);
45f927da17SIsaku Yamahata extern unsigned long long ia64_native_sched_clock (void);
461b4a18fcSIsaku Yamahata 
477f30491cSTony Luck #endif /* _ASM_IA64_TIMEX_H */
48