Subject: WinChip C6's TSC problem
To: None <port-i386@netbsd.org>
From: Takahiro Kambe <taca@sky.yamashina.kyoto.jp>
List: port-i386
Date: 03/31/2000 08:58:12
Hi, this is just FYI.

> Module Name:	syssrc
> Committed By:	thorpej
> Date:		Tue Mar 28 01:38:23 UTC 2000
> 
> Modified Files:
> 	syssrc/sys/arch/i386/include: cpufunc.h
> 
> Log Message:
> Add functions to read the TSC and Performance Counters.
I heard WinChip C6's TSC problem from OpenBSD user and it reported and
fixed in OpenBSD.

--
Takahiro Kambe <taca@sky.yamashina.kyoto.jp>


Message-Id: <199911261435.XAA13079@gemini.ics.nara-wu.ac.jp>
Date: Fri, 26 Nov 1999 23:35:37 +0900 (JST)
From: Kamo Hiroyasu <wd@ics.nara-wu.ac.jp>
Reply-To: wd@ics.nara-wu.ac.jp
To: gnats@openbsd.org
Cc:
Subject: WinChip C6's TSC bug

>Number:         991
>Category:       i386
>Synopsis:       WinChip C6's TSC is broken
>Confidential:   yes
>Severity:       serious
>Priority:       low
>Responsible:    bugs
>State:          closed
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 26 07:40:01 MST 1999
>Last-Modified:  Fri Nov 26 20:33:06 MST 1999
>Originator:     Kamo Hiroyasu
>Organization:
Nara Women's University
>Release:        current
>Environment:

        System      : OpenBSD 2.5 + some patches
        Architecture: OpenBSD.i386
        Machine     : i386
>Description:
        IDT reports that WinChip C6's TSC is broken. (Errata ID I-12
in "IDT WinChip C6 Processor Data Sheet" available at
http://www.winchip.com/pdf/C6DS110.pdf)
The probability of mulfunction is very low but greater than
1 / (population on Earth).
>How-To-Repeat:
        Start a WinChip C6 machine more than 2 billion times. :-)
>Fix:
        Just stop using TSC.

--- sys/arch/i386/i386/machdep.c.orig   Fri Nov 26 21:17:35 1999
+++ sys/arch/i386/i386/machdep.c        Fri Nov 26 23:30:40 1999
@@ -268,6 +268,7 @@
 #endif
 #endif

+void    winchip_cpu_setup __P((const char *, int, int));
 void    cyrix6x86_cpu_setup __P((const char *, int, int));
 void    intel586_cpu_setup __P((const char *, int, int));
 void    intel686_cpu_setup __P((const char *, int, int));
@@ -817,7 +818,7 @@
                                 "WinChip 2", "WinChip 3", 0, 0, 0, 0, 0, 0,
                                 "WinChip"               /* Default */
                         },
-                        NULL
+                        winchip_cpu_setup
                 },
                 /* Family 6, not yet available from IDT */
                 {
@@ -892,6 +893,23 @@
         { CPUID_SIMD,   "SIMD" },
         { CPUID_3DNOW,  "3DNOW" },
 };
+
+void
+winchip_cpu_setup(cpu_device, model, step)
+        const char *cpu_device;
+        int model, step;
+{
+#if defined(I586_CPU)
+        extern int cpu_feature;
+
+        switch (model) {
+        case 4: /* WinChip C6 */
+                cpu_feature &= ~CPUID_TSC;
+                printf("%s: broken TSC disabled\n", cpu_device);
+                break;
+        }
+#endif
+}

 void
 cyrix6x86_cpu_setup(cpu_device, model, step)

>Audit-Trail:
State-Changed-From-To: open-closed
State-Changed-By: deraadt
State-Changed-When: Fri Nov 26 20:32:35 MST 1999
State-Changed-Why:
patch applied; thanks for continuing to send us patches for WinChip support;
noone else here has one of those chips.
>Unformatted: