set_cputicker: use a bool
The third argument to this function indicates whether the supplied ticker is fixed or variable, i.e. requiring calibration. Give this argument a type and name that better conveys this purpose. Reviewed by: kib, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35459
This commit is contained in:
parent
36a8572ee8
commit
8701571df9
@ -291,7 +291,7 @@ geode_probe(device_t self)
|
|||||||
tc_init(&geode_timecounter);
|
tc_init(&geode_timecounter);
|
||||||
EVENTHANDLER_REGISTER(watchdog_list, geode_watchdog,
|
EVENTHANDLER_REGISTER(watchdog_list, geode_watchdog,
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
set_cputicker(geode_cputicks, 27000000, 0);
|
set_cputicker(geode_cputicks, 27000000, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x0510100b:
|
case 0x0510100b:
|
||||||
|
@ -2035,7 +2035,7 @@ SYSINIT(timecounter, SI_SUB_CLOCKS, SI_ORDER_SECOND, inittimecounter, NULL);
|
|||||||
|
|
||||||
/* Cpu tick handling -------------------------------------------------*/
|
/* Cpu tick handling -------------------------------------------------*/
|
||||||
|
|
||||||
static int cpu_tick_variable;
|
static bool cpu_tick_variable;
|
||||||
static uint64_t cpu_tick_frequency;
|
static uint64_t cpu_tick_frequency;
|
||||||
|
|
||||||
DPCPU_DEFINE_STATIC(uint64_t, tc_cpu_ticks_base);
|
DPCPU_DEFINE_STATIC(uint64_t, tc_cpu_ticks_base);
|
||||||
@ -2128,14 +2128,14 @@ cpu_tick_calibrate(int reset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
set_cputicker(cpu_tick_f *func, uint64_t freq, unsigned var)
|
set_cputicker(cpu_tick_f *func, uint64_t freq, bool isvariable)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (func == NULL) {
|
if (func == NULL) {
|
||||||
cpu_ticks = tc_cpu_ticks;
|
cpu_ticks = tc_cpu_ticks;
|
||||||
} else {
|
} else {
|
||||||
cpu_tick_frequency = freq;
|
cpu_tick_frequency = freq;
|
||||||
cpu_tick_variable = var;
|
cpu_tick_variable = isvariable;
|
||||||
cpu_ticks = func;
|
cpu_ticks = func;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ decr_init(void)
|
|||||||
ticks_per_sec = platform_timebase_freq(&cpu);
|
ticks_per_sec = platform_timebase_freq(&cpu);
|
||||||
ps_per_tick = 1000000000000 / ticks_per_sec;
|
ps_per_tick = 1000000000000 / ticks_per_sec;
|
||||||
|
|
||||||
set_cputicker(mftb, ticks_per_sec, 0);
|
set_cputicker(mftb, ticks_per_sec, false);
|
||||||
snprintf(buf, sizeof(buf), "cpu%d:decrementer", curcpu);
|
snprintf(buf, sizeof(buf), "cpu%d:decrementer", curcpu);
|
||||||
intrcnt_add(buf, &decr_counts[curcpu]);
|
intrcnt_add(buf, &decr_counts[curcpu]);
|
||||||
decr_et_stop(NULL);
|
decr_et_stop(NULL);
|
||||||
|
@ -407,7 +407,7 @@ int getenv_array(const char *name, void *data, int size, int *psize,
|
|||||||
#define GETENV_SIGNED true /* negative numbers allowed */
|
#define GETENV_SIGNED true /* negative numbers allowed */
|
||||||
|
|
||||||
typedef uint64_t (cpu_tick_f)(void);
|
typedef uint64_t (cpu_tick_f)(void);
|
||||||
void set_cputicker(cpu_tick_f *func, uint64_t freq, unsigned var);
|
void set_cputicker(cpu_tick_f *func, uint64_t freq, bool isvariable);
|
||||||
extern cpu_tick_f *cpu_ticks;
|
extern cpu_tick_f *cpu_ticks;
|
||||||
uint64_t cpu_tickrate(void);
|
uint64_t cpu_tickrate(void);
|
||||||
uint64_t cputick2usec(uint64_t tick);
|
uint64_t cputick2usec(uint64_t tick);
|
||||||
|
@ -846,7 +846,7 @@ tsc_levels_changed(void *arg, int unit)
|
|||||||
error = CPUFREQ_LEVELS(cf_dev, levels, &count);
|
error = CPUFREQ_LEVELS(cf_dev, levels, &count);
|
||||||
if (error == 0 && count != 0) {
|
if (error == 0 && count != 0) {
|
||||||
max_freq = (uint64_t)levels[0].total_set.freq * 1000000;
|
max_freq = (uint64_t)levels[0].total_set.freq * 1000000;
|
||||||
set_cputicker(rdtsc, max_freq, 1);
|
set_cputicker(rdtsc, max_freq, true);
|
||||||
} else
|
} else
|
||||||
printf("tsc_levels_changed: no max freq found\n");
|
printf("tsc_levels_changed: no max freq found\n");
|
||||||
free(levels, M_TEMP);
|
free(levels, M_TEMP);
|
||||||
|
Loading…
Reference in New Issue
Block a user