162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _ASM_IA64_TIMEX_H 362306a36Sopenharmony_ci#define _ASM_IA64_TIMEX_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci/* 662306a36Sopenharmony_ci * Copyright (C) 1998-2001, 2003 Hewlett-Packard Co 762306a36Sopenharmony_ci * David Mosberger-Tang <davidm@hpl.hp.com> 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci/* 1062306a36Sopenharmony_ci * 2001/01/18 davidm Removed CLOCK_TICK_RATE. It makes no sense on IA-64. 1162306a36Sopenharmony_ci * Also removed cacheflush_time as it's entirely unused. 1262306a36Sopenharmony_ci */ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <asm/intrinsics.h> 1562306a36Sopenharmony_ci#include <asm/processor.h> 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_citypedef unsigned long cycles_t; 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciextern void (*ia64_udelay)(unsigned long usecs); 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci/* 2262306a36Sopenharmony_ci * For performance reasons, we don't want to define CLOCK_TICK_TRATE as 2362306a36Sopenharmony_ci * local_cpu_data->itc_rate. Fortunately, we don't have to, either: according to George 2462306a36Sopenharmony_ci * Anzinger, 1/CLOCK_TICK_RATE is taken as the resolution of the timer clock. The time 2562306a36Sopenharmony_ci * calculation assumes that you will use enough of these so that your tick size <= 1/HZ. 2662306a36Sopenharmony_ci * If the calculation shows that your CLOCK_TICK_RATE can not supply exactly 1/HZ ticks, 2762306a36Sopenharmony_ci * the actual value is calculated and used to update the wall clock each jiffie. Setting 2862306a36Sopenharmony_ci * the CLOCK_TICK_RATE to x*HZ insures that the calculation will find no errors. Hence we 2962306a36Sopenharmony_ci * pick a multiple of HZ which gives us a (totally virtual) CLOCK_TICK_RATE of about 3062306a36Sopenharmony_ci * 100MHz. 3162306a36Sopenharmony_ci */ 3262306a36Sopenharmony_ci#define CLOCK_TICK_RATE (HZ * 100000UL) 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_cistatic inline cycles_t 3562306a36Sopenharmony_ciget_cycles (void) 3662306a36Sopenharmony_ci{ 3762306a36Sopenharmony_ci cycles_t ret; 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci ret = ia64_getreg(_IA64_REG_AR_ITC); 4062306a36Sopenharmony_ci return ret; 4162306a36Sopenharmony_ci} 4262306a36Sopenharmony_ci#define get_cycles get_cycles 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ciextern void ia64_cpu_local_tick (void); 4562306a36Sopenharmony_ciextern unsigned long long ia64_native_sched_clock (void); 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci#endif /* _ASM_IA64_TIMEX_H */ 48