Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Jul 1999 01:31:05 +0900 (JST)
From:      sanpei@sanpei.org (MIHIRA Yoshiro)
To:        unfurl@FreeBSD.ORG
Cc:        freebsd-bugs@FreeBSD.ORG, julian@FreeBSD.ORG
Subject:   Re: kern/6630: [PATCH] Fix for Cyrix I8254 bug
Message-ID:  <199907021631.BAA05432@lavender.yy.cs.keio.ac.jp>
In-Reply-To: Your message of "Fri, 2 Jul 1999 10:35:12 JST". <199907020135.SAA19316@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

unfurl@FreeBSD.ORG Wrote 

>> Whistle is currently using the Cyrix 5510 chipsets. Please test this patch if necessary or close the PR altogether if this is fixed.

  Some people reported me that 2-times re-check is not eough for some
MediaGX machine.
  I have 4-times recheck patch.

--- clock.c.org	Mon Aug 31 13:08:11 1998
+++ clock.c.cyrix-4	Thu Jan 14 22:01:17 1999
@@ -345,6 +345,11 @@
 {
 	u_long ef;
 	int high, low;
+#define CPU_CYRIX_NO_I8254_LATCH
+
+#ifdef CPU_CYRIX_NO_I8254_LATCH
+       int ret1, ret2, ret3, ret4;
+#endif
 
 	ef = read_eflags();
 	disable_intr();
@@ -354,9 +359,33 @@
 
 	low = inb(TIMER_CNTR0);
 	high = inb(TIMER_CNTR0);
+#ifdef CPU_CYRIX_NO_I8254_LATCH
+	ret1 = (high << 8) | low;
+
+	outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
+	low = inb(TIMER_CNTR0);
+	high= inb(TIMER_CNTR0);
+	ret2 = (high << 8) | low;
+
+	outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
+	low = inb(TIMER_CNTR0);
+	high= inb(TIMER_CNTR0);
+	ret3 = (high << 8) | low;
+
+	outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
+	low = inb(TIMER_CNTR0);
+	high= inb(TIMER_CNTR0);
+	ret4 = (high << 8) | low;
+#endif
 
 	write_eflags(ef);
+#ifdef CPU_CYRIX_NO_I8254_LATCH
+	ret1 = (ret1 > ret2 ? ret1 : ret2);
+	ret3 = (ret3 > ret4 ? ret3 : ret4);
+	return (ret1 > ret3 ? ret1 : ret3);
+#else
 	return ((high << 8) | low);
+#endif
 }
 
 /*
@@ -598,12 +627,16 @@
 	}
 #endif
 
+#if 0
 	if (bootverbose)
+#endif
 	        printf("i8254 clock: %u Hz\n", tot_count);
 	return (tot_count);
 
 fail:
+#if 0
 	if (bootverbose)
+#endif
 	        printf("failed, using default i8254 clock of %u Hz\n",
 		       timer_freq);
 	return (timer_freq);


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907021631.BAA05432>