diff options
author | jkim <jkim@FreeBSD.org> | 2011-04-12 22:15:46 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2011-04-12 22:15:46 +0000 |
commit | 8eb15cd79a268862532c7374f250152933c6d7cc (patch) | |
tree | b8bb4cc8db8fe80781d73045e910fd150fae0a88 /sys/x86 | |
parent | df8e7b4e4c8923983f67d40dc817bca367b7df37 (diff) | |
download | FreeBSD-src-8eb15cd79a268862532c7374f250152933c6d7cc.zip FreeBSD-src-8eb15cd79a268862532c7374f250152933c6d7cc.tar.gz |
Probe capability to find effective frequency. When the TSC is P-state
invariant, APERF/MPERF ratio can be used to find effective frequency.
Diffstat (limited to 'sys/x86')
-rw-r--r-- | sys/x86/x86/tsc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index be691f9e..7aca10f 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$"); uint64_t tsc_freq; int tsc_is_invariant; +int tsc_perf_stat; + static eventhandler_tag tsc_levels_tag, tsc_pre_tag, tsc_post_tag; SYSCTL_INT(_kern_timecounter, OID_AUTO, invariant_tsc, CTLFLAG_RDTUN, @@ -151,6 +153,7 @@ tsc_freq_intel(void) static void probe_tsc_freq(void) { + u_int regs[4]; uint64_t tsc1, tsc2; switch (cpu_vendor_id) { @@ -178,6 +181,12 @@ probe_tsc_freq(void) break; } + if (cpu_high >= 6) { + do_cpuid(6, regs); + if ((regs[2] & CPUID_PERF_STAT) != 0) + tsc_perf_stat = 1; + } + if (tsc_skip_calibration) { if (cpu_vendor_id == CPU_VENDOR_INTEL) tsc_freq_intel(); |