diff options
author | jkim <jkim@FreeBSD.org> | 2011-03-11 00:44:32 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2011-03-11 00:44:32 +0000 |
commit | 7df55dcdeb4359716cc7b6a3381d2772e1187d62 (patch) | |
tree | c5a4a6ac9d73738d09f204667eb641e541525a80 /sys/x86 | |
parent | 8c8d7206ece7a4dc88c61d5910c6724b0137b26a (diff) | |
download | FreeBSD-src-7df55dcdeb4359716cc7b6a3381d2772e1187d62.zip FreeBSD-src-7df55dcdeb4359716cc7b6a3381d2772e1187d62.tar.gz |
Add a tunable "machdep.disable_tsc" to turn off TSC. Specifically, it turns
off boot-time CPU frequency calibration, DELAY(9) with TSC, and using TSC as
a CPU ticker. Note tsc_present does not change by this tunable.
Diffstat (limited to 'sys/x86')
-rw-r--r-- | sys/x86/x86/tsc.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index 3e0300b..40d5f3c 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -63,6 +63,11 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, smp_tsc, CTLFLAG_RDTUN, &smp_tsc, 0, TUNABLE_INT("kern.timecounter.smp_tsc", &smp_tsc); #endif +static int tsc_disabled; +SYSCTL_INT(_machdep, OID_AUTO, disable_tsc, CTLFLAG_RDTUN, &tsc_disabled, 0, + "Disable x86 Time Stamp Counter"); +TUNABLE_INT("machdep.disable_tsc", &tsc_disabled); + static void tsc_freq_changed(void *arg, const struct cf_level *level, int status); static void tsc_freq_changing(void *arg, const struct cf_level *level, @@ -84,12 +89,11 @@ init_TSC(void) { u_int64_t tscval[2]; - if (cpu_feature & CPUID_TSC) - tsc_present = 1; - else - tsc_present = 0; + if ((cpu_feature & CPUID_TSC) == 0) + return; + tsc_present = 1; - if (!tsc_present) + if (tsc_disabled) return; if (bootverbose) @@ -151,7 +155,7 @@ void init_TSC_tc(void) { - if (!tsc_present) + if (!tsc_present || tsc_disabled) return; /* @@ -248,7 +252,7 @@ tsc_freq_changed(void *arg, const struct cf_level *level, int status) { /* If there was an error during the transition, don't do anything. */ - if (status != 0) + if (tsc_disabled || status != 0) return; /* Total setting for this level gives the new frequency in MHz. */ |