mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* VIA timer bugfix, patch for 2.4.5
@ 2001-06-02 14:35 Jonas Diemer
  0 siblings, 0 replies; only message in thread
From: Jonas Diemer @ 2001-06-02 14:35 UTC (permalink / raw)
  To: linux-kernel

Hi!

I have compiled a little patch that contains the VIA timer bugfix (from the ac kernel). the patch is against linus' 2.4.5 kernel. I have compiled and ran the patched kernel sucessfully.

the only changes made by this patch are done to linux/arch/i386/kernel/timer.c

I would like to have this patch applied to linus' kernel tree (so that it comes in 2.4.6), because alan's kernel has USB problems on my machine.


Here's the patch:

--- arch/i386/kernel/time.c.orig	Sat Jun  2 16:06:59 2001
+++ arch/i386/kernel/time.c	Sat Jun  2 16:07:20 2001
@@ -178,6 +178,15 @@
  	jiffies_t = jiffies;
 
 	count |= inb_p(0x40) << 8;
+	
+        /* VIA686a test code... reset the latch if count > max + 1 */
+        if (count > LATCH) {
+                outb_p(0x34, 0x43);
+                outb_p(LATCH & 0xff, 0x40);
+                outb(LATCH >> 8, 0x40);
+                count = LATCH - 1;
+        }
+	
 	spin_unlock(&i8253_lock);
 
 	/*
@@ -413,7 +422,7 @@
 	if (!user_mode(regs))
 		x86_do_profile(regs->eip);
 #else
-	if (!smp_found_config)
+	if (!using_apic_timer)
 		smp_local_timer_interrupt(regs);
 #endif
 
@@ -492,6 +501,24 @@
 
 		count = inb_p(0x40);    /* read the latched count */
 		count |= inb(0x40) << 8;
+		
+
+                /* 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))
+                        {
+                                printk(KERN_WARNING "probable hardware bug: clock timer configuration lost - probably a VIA686a motherboard.\n");
+                                printk(KERN_WARNING "probable hardware bug: restoring chip configuration.\n");
+                                last_whine = jiffies + HZ;
+                        }                       
+                }                               
+
+		
 		spin_unlock(&i8253_lock);
 
 		count = ((LATCH-1) - count) * TICK_SIZE;

--end of patch---

This is my first patch, i hope it is ok. i followed the instructions in Documentation/SubmittingPatches to create it.

- Jonas

PS: please CC me any reply, i haven't registered to the mailinglist.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-02 14:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-02 14:35 VIA timer bugfix, patch for 2.4.5 Jonas Diemer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®