Messages in this thread Patch in this message |  | | Date | Tue, 13 Nov 2001 08:27:00 +1100 (EST) | From | Neale Banks <> | Subject | Re: [PATCH] VIA timer fix was removed? |
| |
On Mon, 12 Nov 2001, Jeronimo Pellegrini wrote:
> > I have seen IBM machines (Netfinity 6000R) where this code got triggered > > even though they didn't have VIA chipsets/timers. Seems to have caused > > some problems there and I removed the code (in the custom kernel running > > on those machines). > > #ifdefs and a question in config, maybe?
Or a boot-time option to disable this fix?
Attached (untested) patch against 21.2.20 (which still has the $SUBJECT code) should implement timer=no-via686a option to disable this. Hopefully I'll get it tested in the next day or two.
Regards, Neale. --- linux-2.2.20-orig/arch/i386/kernel/time.c Mon Mar 26 02:37:30 2001 +++ linux-2.2.20-ntb/arch/i386/kernel/time.c Sun Nov 11 19:33:02 2001 @@ -81,6 +81,8 @@ spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED; +static int via686a_hacks = 1; /* default to enabled */ + static inline unsigned long do_fast_gettimeoffset(void) { register unsigned long eax asm("ax"); @@ -177,7 +179,7 @@ count |= inb_p(0x40) << 8; /* VIA686a test code... reset the latch if count > max */ - if (count > LATCH-1) { + if ((via686a_hacks) && (count > LATCH-1)) { outb_p(0x34, 0x43); outb_p(LATCH & 0xff, 0x40); outb(LATCH >> 8, 0x40); @@ -480,16 +482,21 @@ /* VIA686a test code... reset the latch if count > max */ if (count > LATCH-1) { static int last_whine; - outb_p(0x34, 0x43); - outb_p(LATCH & 0xff, 0x40); - outb(LATCH >> 8, 0x40); - count = LATCH - 1; - if(time_after(jiffies, last_whine)) - { + if(time_after(jiffies, last_whine)) { printk(KERN_WARNING "probable hardware bug: clock timer configuration lost - probably a VIA686a.\n"); - printk(KERN_WARNING "probable hardware bug: restoring chip configuration.\n"); + if (via686a_hacks) { + printk(KERN_WARNING "probable hardware bug: restoring chip configuration.\n"); + } else { + printk(KERN_WARNING "probable hardware bug: but VIA686a workaround disabled at boot.\n"); + } last_whine = jiffies + HZ; - } + } + if (via686a_hacks) { + outb_p(0x34, 0x43); + outb_p(LATCH & 0xff, 0x40); + outb(LATCH >> 8, 0x40); + count = LATCH - 1; + } } #if 0 @@ -737,3 +744,25 @@ setup_x86_irq(0, &irq0); #endif } + +static int __init timer_setup(char *str) +{ + int invert; + + while ((str != NULL) && (*str != '\0')) { + invert = (strncmp(str, "no-", 3) == 0); + if (invert) + str += 3; + if (strncmp(str, "via686a", 7) == 0) { + via686a_hacks = !invert; + if (invert) + printk(KERN_INFO "timer: VIA686a workaround disabled.\n"); + } + str = strchr(str, ','); + if (str != NULL) + str += strspn(str, ", \t"); + } + return 1; +} + +__setup("timer=", timer_setup); |  |