diff options
author | jkim <jkim@FreeBSD.org> | 2011-04-12 23:04:01 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2011-04-12 23:04:01 +0000 |
commit | 218c7113eda7be885de958c079152f70afe24ad9 (patch) | |
tree | 32c006d3850d3958b17e9567cbf9d124b9917034 /sys/pc98/pc98 | |
parent | c14cd58282c1241f10c3b38c4ca228eff76f0249 (diff) | |
download | FreeBSD-src-218c7113eda7be885de958c079152f70afe24ad9.zip FreeBSD-src-218c7113eda7be885de958c079152f70afe24ad9.tar.gz |
Reinstate cpu_est_clockrate() support for P-state invariant TSC if APERF and
MPERF MSRs are available. It was disabled in r216443. Remove the earlier
hack to subtract 0.5% from the calibrated frequency as DELAY(9) is little
bit more reliable now.
Diffstat (limited to 'sys/pc98/pc98')
-rw-r--r-- | sys/pc98/pc98/machdep.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 4727351..853ac69 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -1071,20 +1071,13 @@ cpu_flush_dcache(void *ptr, size_t len) int cpu_est_clockrate(int cpu_id, uint64_t *rate) { + uint64_t tsc1, tsc2; register_t reg; - uint64_t freq, tsc1, tsc2; if (pcpu_find(cpu_id) == NULL || rate == NULL) return (EINVAL); if ((cpu_feature & CPUID_TSC) == 0) return (EOPNOTSUPP); - freq = atomic_load_acq_64(&tsc_freq); - - /* If we're booting, trust the rate calibrated moments ago. */ - if (cold && freq != 0) { - *rate = freq; - return (0); - } #ifdef SMP if (smp_cpus > 1) { @@ -1101,6 +1094,7 @@ cpu_est_clockrate(int cpu_id, uint64_t *rate) DELAY(1000); tsc2 = rdtsc(); intr_restore(reg); + *rate = (tsc2 - tsc1) * 1000; #ifdef SMP if (smp_cpus > 1) { @@ -1110,17 +1104,6 @@ cpu_est_clockrate(int cpu_id, uint64_t *rate) } #endif - tsc2 -= tsc1; - if (freq != 0) { - *rate = tsc2 * 1000; - return (0); - } - - /* - * Subtract 0.5% of the total. Empirical testing has shown that - * overhead in DELAY() works out to approximately this value. - */ - *rate = tsc2 * 1000 - tsc2 * 5; return (0); } |