arch/intel64: cosmetic changes for TSC
cosmetic changes for TSC: - remove unused variables - add g_ prefix to global variables Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
parent
0a24f60e1b
commit
636b2309e4
|
@ -74,7 +74,7 @@
|
|||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
unsigned long x86_64_timer_freq;
|
||||
unsigned long g_x86_64_timer_freq;
|
||||
|
||||
static struct timespec g_goal_time_ts;
|
||||
static uint64_t g_last_stop_time;
|
||||
|
@ -138,16 +138,16 @@ void up_timer_initialize(void)
|
|||
|
||||
static inline uint64_t up_ts2tick(const struct timespec *ts)
|
||||
{
|
||||
return ROUND_INT_DIV((uint64_t)ts->tv_nsec * x86_64_timer_freq,
|
||||
return ROUND_INT_DIV((uint64_t)ts->tv_nsec * g_x86_64_timer_freq,
|
||||
NS_PER_SEC) +
|
||||
(uint64_t)ts->tv_sec * x86_64_timer_freq;
|
||||
(uint64_t)ts->tv_sec * g_x86_64_timer_freq;
|
||||
}
|
||||
|
||||
static inline void up_tick2ts(uint64_t tick, struct timespec *ts)
|
||||
{
|
||||
ts->tv_sec = (tick / x86_64_timer_freq);
|
||||
ts->tv_nsec = (uint64_t)(ROUND_INT_DIV((tick % x86_64_timer_freq) *
|
||||
NSEC_PER_SEC, x86_64_timer_freq));
|
||||
ts->tv_sec = (tick / g_x86_64_timer_freq);
|
||||
ts->tv_nsec = (uint64_t)(ROUND_INT_DIV((tick % g_x86_64_timer_freq) *
|
||||
NSEC_PER_SEC, g_x86_64_timer_freq));
|
||||
}
|
||||
|
||||
static inline void up_tmr_sync_up(void)
|
||||
|
|
|
@ -53,11 +53,7 @@
|
|||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
unsigned long x86_64_timer_freq;
|
||||
|
||||
static unsigned long tsc_overflow;
|
||||
static unsigned long tsc_last;
|
||||
static unsigned long tsc_overflows;
|
||||
unsigned long g_x86_64_timer_freq;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
|
@ -74,7 +70,8 @@ static unsigned long tsc_overflows;
|
|||
void apic_timer_set(unsigned long timeout_ns)
|
||||
{
|
||||
unsigned long long ticks =
|
||||
(unsigned long long)timeout_ns * x86_64_timer_freq / NS_PER_SEC;
|
||||
(unsigned long long)timeout_ns * g_x86_64_timer_freq / NS_PER_SEC;
|
||||
|
||||
#ifdef CONFIG_ARCH_INTEL64_TSC_DEADLINE
|
||||
write_msr(MSR_IA32_TSC_DEADLINE, rdtsc() + ticks);
|
||||
#else
|
||||
|
@ -115,7 +112,6 @@ static int intel64_timerisr(int irq, uint32_t *regs, void *arg)
|
|||
|
||||
void up_timer_initialize(void)
|
||||
{
|
||||
unsigned long ecx;
|
||||
uint32_t vector = IRQ0;
|
||||
|
||||
irq_attach(IRQ0, (xcpt_t)intel64_timerisr, NULL);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
extern unsigned long x86_64_timer_freq;
|
||||
extern unsigned long g_x86_64_timer_freq;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
|
@ -84,14 +84,14 @@ void x86_64_timer_calibrate_freq(void)
|
|||
|
||||
if (numerator == 0 || denominator == 0 || crystal_freq == 0)
|
||||
{
|
||||
x86_64_timer_freq = CONFIG_ARCH_INTEL64_CORE_FREQ_KHZ * 1000L;
|
||||
g_x86_64_timer_freq = CONFIG_ARCH_INTEL64_CORE_FREQ_KHZ * 1000L;
|
||||
}
|
||||
else
|
||||
{
|
||||
x86_64_timer_freq = crystal_freq / denominator * numerator;
|
||||
g_x86_64_timer_freq = crystal_freq / denominator * numerator;
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_ARCH_INTEL64_TSC)
|
||||
x86_64_timer_freq = CONFIG_ARCH_INTEL64_APIC_FREQ_KHZ * 1000L;
|
||||
g_x86_64_timer_freq = CONFIG_ARCH_INTEL64_APIC_FREQ_KHZ * 1000L;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue