]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix via686a/KX133 TSC failure
authorAndrew Morton <akpm@osdl.org>
Tue, 30 Dec 2003 07:44:09 +0000 (23:44 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 30 Dec 2003 07:44:09 +0000 (23:44 -0800)
From: Chris Bajumpaa <cbajumpa@or8.net>

This patch fixes a problem with the TSC failing on via686a/KX133
motherboards either reverting to using the pit or deadlocking the machine
alltogether under heavy load.  (Specifically Abit KA7/KA7-100).

Message from the log:
Dec 18 18:20:37 grinder kernel: Losing too many ticks!
Dec 18 18:20:37 grinder kernel: TSC cannot be used as a timesource. (Are
you running with SpeedStep?)
Dec 18 18:20:37 grinder kernel: Falling back to a sane timesource.

The snippet of code that was missing from timer_tsc.c comes from
timer_pit.c.

arch/i386/kernel/timers/timer_tsc.c

index 95b915cc14b8f03728d477d4faea3d96e78527fb..67db5f6ebe2f5c94248b2cba0ad1441e2daf937f 100644 (file)
@@ -183,6 +183,18 @@ static void mark_offset_tsc(void)
 
        count = inb_p(PIT_CH0);    /* read the latched count */
        count |= inb(PIT_CH0) << 8;
+
+       /*
+        * VIA686a test code... reset the latch if count > max + 1
+        * from timer_pit.c - cjb
+        */
+       if (count > LATCH) {
+               outb_p(0x34, PIT_MODE);
+               outb_p(LATCH & 0xff, PIT_CH0);
+               outb(LATCH >> 8, PIT_CH0);
+               count = LATCH - 1;
+       }
+
        spin_unlock(&i8253_lock);
 
        if (pit_latch_buggy) {