18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_TIMER_H 38c2ecf20Sopenharmony_ci#define _ASM_X86_TIMER_H 48c2ecf20Sopenharmony_ci#include <linux/pm.h> 58c2ecf20Sopenharmony_ci#include <linux/percpu.h> 68c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 78c2ecf20Sopenharmony_ci#include <linux/math64.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define TICK_SIZE (tick_nsec / 1000) 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ciunsigned long long native_sched_clock(void); 128c2ecf20Sopenharmony_ciextern void recalibrate_cpu_khz(void); 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciextern int no_timer_check; 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciextern bool using_native_sched_clock(void); 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* 198c2ecf20Sopenharmony_ci * We use the full linear equation: f(x) = a + b*x, in order to allow 208c2ecf20Sopenharmony_ci * a continuous function in the face of dynamic freq changes. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * Continuity means that when our frequency changes our slope (b); we want to 238c2ecf20Sopenharmony_ci * ensure that: f(t) == f'(t), which gives: a + b*t == a' + b'*t. 248c2ecf20Sopenharmony_ci * 258c2ecf20Sopenharmony_ci * Without an offset (a) the above would not be possible. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * See the comment near cycles_2_ns() for details on how we compute (b). 288c2ecf20Sopenharmony_ci */ 298c2ecf20Sopenharmony_cistruct cyc2ns_data { 308c2ecf20Sopenharmony_ci u32 cyc2ns_mul; 318c2ecf20Sopenharmony_ci u32 cyc2ns_shift; 328c2ecf20Sopenharmony_ci u64 cyc2ns_offset; 338c2ecf20Sopenharmony_ci}; /* 16 bytes */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciextern void cyc2ns_read_begin(struct cyc2ns_data *); 368c2ecf20Sopenharmony_ciextern void cyc2ns_read_end(void); 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#endif /* _ASM_X86_TIMER_H */ 39