Patch from Stephen Hemminger <shemminger@osdl.org>

For machines that don't want to cooperate and have bad TSC counter and/or
change CPU frequency without change support.

This fixes the problem on Jerry Cooperstein's PIII laptop.  Could be useful
for other people and tech support situations.




 25-akpm/Documentation/kernel-parameters.txt |    7 ++++++-
 25-akpm/arch/i386/kernel/timers/timer_tsc.c |   10 +++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff -puN arch/i386/kernel/timers/timer_tsc.c~notsclock-option arch/i386/kernel/timers/timer_tsc.c
--- 25/arch/i386/kernel/timers/timer_tsc.c~notsclock-option	Tue Mar 18 17:52:24 2003
+++ 25-akpm/arch/i386/kernel/timers/timer_tsc.c	Tue Mar 18 17:52:24 2003
@@ -15,6 +15,7 @@
 #include <asm/processor.h>
 
 int tsc_disable __initdata = 0;
+static int tsc_clock_disable __initdata = 0;
 
 extern spinlock_t i8253_lock;
 
@@ -243,6 +244,13 @@ static struct notifier_block time_cpufre
 };
 #endif
 
+/* Don't use TSC for time of day clock */
+static int __init tsc_noclock_setup(char *str)
+{
+	tsc_clock_disable = 1;
+	return 1;
+}
+__setup("notsclock", tsc_noclock_setup);
 
 static int init_tsc(void)
 {
@@ -275,7 +283,7 @@ static int init_tsc(void)
 	cpufreq_register_notifier(&time_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
 #endif
 
-	if (cpu_has_tsc) {
+	if (cpu_has_tsc && !tsc_clock_disable) {
 		unsigned long tsc_quotient = calibrate_tsc();
 		if (tsc_quotient) {
 			fast_gettimeoffset_quotient = tsc_quotient;
diff -puN Documentation/kernel-parameters.txt~notsclock-option Documentation/kernel-parameters.txt
--- 25/Documentation/kernel-parameters.txt~notsclock-option	Tue Mar 18 17:52:24 2003
+++ 25-akpm/Documentation/kernel-parameters.txt	Tue Mar 18 17:52:24 2003
@@ -627,7 +627,12 @@ running once the system is up.
 
 	nosync		[HW,M68K] Disables sync negotiation for all devices.
 
-	notsc		[BUGS=IA-32] Disable Time Stamp Counter
+	notsc		[BUGS=IA-32] Disable Time Stamp Counter.
+			Turns off TSC in processor. Kernel must
+			be compiled without TSC support.
+	
+	notsclock	[BUGS=IA-32] Tells kernel not to use 
+			Time Stamp Counter for gettimeofday. 
 
 	nousb		[USB] Disable the USB subsystem
 

_