162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _ASM_X86_TIMER_H 362306a36Sopenharmony_ci#define _ASM_X86_TIMER_H 462306a36Sopenharmony_ci#include <linux/pm.h> 562306a36Sopenharmony_ci#include <linux/percpu.h> 662306a36Sopenharmony_ci#include <linux/interrupt.h> 762306a36Sopenharmony_ci#include <linux/math64.h> 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#define TICK_SIZE (tick_nsec / 1000) 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ciunsigned long long native_sched_clock(void); 1262306a36Sopenharmony_ciextern void recalibrate_cpu_khz(void); 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ciextern int no_timer_check; 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciextern bool using_native_sched_clock(void); 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci/* 1962306a36Sopenharmony_ci * We use the full linear equation: f(x) = a + b*x, in order to allow 2062306a36Sopenharmony_ci * a continuous function in the face of dynamic freq changes. 2162306a36Sopenharmony_ci * 2262306a36Sopenharmony_ci * Continuity means that when our frequency changes our slope (b); we want to 2362306a36Sopenharmony_ci * ensure that: f(t) == f'(t), which gives: a + b*t == a' + b'*t. 2462306a36Sopenharmony_ci * 2562306a36Sopenharmony_ci * Without an offset (a) the above would not be possible. 2662306a36Sopenharmony_ci * 2762306a36Sopenharmony_ci * See the comment near cycles_2_ns() for details on how we compute (b). 2862306a36Sopenharmony_ci */ 2962306a36Sopenharmony_cistruct cyc2ns_data { 3062306a36Sopenharmony_ci u32 cyc2ns_mul; 3162306a36Sopenharmony_ci u32 cyc2ns_shift; 3262306a36Sopenharmony_ci u64 cyc2ns_offset; 3362306a36Sopenharmony_ci}; /* 16 bytes */ 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciextern void cyc2ns_read_begin(struct cyc2ns_data *); 3662306a36Sopenharmony_ciextern void cyc2ns_read_end(void); 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci#endif /* _ASM_X86_TIMER_H */ 39