Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/i386 Fix MTRR code which had been broken since...



details:   https://anonhg.NetBSD.org/src/rev/e81b7eaef26e
branches:  trunk
changeset: 538675:e81b7eaef26e
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Fri Oct 25 12:01:56 2002 +0000

description:
Fix MTRR code which had been broken since the MP merge (but silently
failed due to a missing include of opt_mtrr.h in cpu.c)

diffstat:

 sys/arch/i386/i386/cpu.c       |  11 ++++++-----
 sys/arch/i386/i386/machdep.c   |  31 ++-----------------------------
 sys/arch/i386/i386/mtrr_i686.c |   8 ++++++--
 sys/arch/i386/i386/mtrr_k6.c   |   5 +++--
 4 files changed, 17 insertions(+), 38 deletions(-)

diffs (152 lines):

diff -r 6c5c14169783 -r e81b7eaef26e sys/arch/i386/i386/cpu.c
--- a/sys/arch/i386/i386/cpu.c  Fri Oct 25 12:00:11 2002 +0000
+++ b/sys/arch/i386/i386/cpu.c  Fri Oct 25 12:01:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.4 2002/10/05 21:18:44 fvdl Exp $ */
+/* $NetBSD: cpu.c,v 1.5 2002/10/25 12:01:56 fvdl Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -73,6 +73,7 @@
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
 #include "opt_mpbios.h"                /* for MPDEBUG */
+#include "opt_mtrr.h"
 
 #include "lapic.h"
 #include "ioapic.h"
@@ -419,10 +420,10 @@
                /*
                 * Must be a K6-2 Step >= 7 or a K6-III.
                 */
-               if (CPUID2FAMILY(cpu_id) == 5) {
-                       if (CPUID2MODEL(cpu_id) > 8 ||
-                           (CPUID2MODEL(cpu_id) == 8 &&
-                            CPUID2STEPPING(cpu_id) >= 7)) {
+               if (CPUID2FAMILY(ci->ci_signature) == 5) {
+                       if (CPUID2MODEL(ci->ci_signature) > 8 ||
+                           (CPUID2MODEL(ci->ci_signature) == 8 &&
+                            CPUID2STEPPING(ci->ci_signature) >= 7)) {
                                mtrr_funcs = &k6_mtrr_funcs;
                                k6_mtrr_init_first();
                                mtrr_init_cpu(ci);
diff -r 6c5c14169783 -r e81b7eaef26e sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Fri Oct 25 12:00:11 2002 +0000
+++ b/sys/arch/i386/i386/machdep.c      Fri Oct 25 12:01:56 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.494 2002/10/24 07:43:21 fvdl Exp $       */
+/*     $NetBSD: machdep.c,v 1.495 2002/10/25 12:01:56 fvdl Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.494 2002/10/24 07:43:21 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.495 2002/10/25 12:01:56 fvdl Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -227,10 +227,6 @@
 
 int    tmx86_has_longrun;
 
-#define        CPUID2FAMILY(cpuid)     (((cpuid) >> 8) & 15)
-#define        CPUID2MODEL(cpuid)      (((cpuid) >> 4) & 15)
-#define        CPUID2STEPPING(cpuid)   ((cpuid) & 15)
-
 vaddr_t        msgbuf_vaddr;
 paddr_t msgbuf_paddr;
 
@@ -478,29 +474,6 @@
 
        printf("%s", version);
 
-#if 0
-#ifdef MTRR
-       if (cpu_feature & CPUID_MTRR) {
-               mtrr_funcs = &i686_mtrr_funcs;
-               i686_mtrr_init_first();
-               mtrr_init_cpu(ci);
-       } else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
-               /*
-                * Must be a K6-2 Step >= 7 or a K6-III.
-                */
-               if (CPUID2FAMILY(cpu_id) == 5) {
-                       if (CPUID2MODEL(cpu_id) > 8 ||
-                           (CPUID2MODEL(cpu_id) == 8 &&
-                            CPUID2STEPPING(cpu_id) >= 7)) {
-                               mtrr_funcs = &k6_mtrr_funcs;
-                               k6_mtrr_init_first();
-                               mtrr_init_cpu(ci);
-                       }
-               }
-       }
-#endif
-#endif
-
 #ifdef TRAPLOG
        /*
         * Enable recording of branch from/to in MSR's
diff -r 6c5c14169783 -r e81b7eaef26e sys/arch/i386/i386/mtrr_i686.c
--- a/sys/arch/i386/i386/mtrr_i686.c    Fri Oct 25 12:00:11 2002 +0000
+++ b/sys/arch/i386/i386/mtrr_i686.c    Fri Oct 25 12:01:56 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mtrr_i686.c,v 1.5 2002/10/01 12:56:58 fvdl Exp $ */
+/*     $NetBSD: mtrr_i686.c,v 1.6 2002/10/25 12:01:57 fvdl Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.5 2002/10/01 12:56:58 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.6 2002/10/25 12:01:57 fvdl Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -314,6 +314,7 @@
 
        mtrr_var_raw = &mtrr_raw[0];
        mtrr_fixed_raw = &mtrr_raw[MTRR_I686_NVAR * 2];
+       mtrr_funcs = &i686_mtrr_funcs;
 
        i686_raw2soft();
 }
@@ -707,5 +708,8 @@
 i686_mtrr_commit(void)
 {
        i686_soft2raw();
+#ifdef MULTIPROCESSOR
+       i386_broadcast_ipi(I386_IPI_MTRR);
+#endif
        i686_mtrr_reload(1);
 }
diff -r 6c5c14169783 -r e81b7eaef26e sys/arch/i386/i386/mtrr_k6.c
--- a/sys/arch/i386/i386/mtrr_k6.c      Fri Oct 25 12:00:11 2002 +0000
+++ b/sys/arch/i386/i386/mtrr_k6.c      Fri Oct 25 12:01:56 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mtrr_k6.c,v 1.4 2002/10/01 12:56:58 fvdl Exp $ */
+/*     $NetBSD: mtrr_k6.c,v 1.5 2002/10/25 12:01:57 fvdl Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mtrr_k6.c,v 1.4 2002/10/01 12:56:58 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mtrr_k6.c,v 1.5 2002/10/25 12:01:57 fvdl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -152,6 +152,7 @@
            malloc(MTRR_K6_NVAR * sizeof(struct mtrr), M_TEMP, M_NOWAIT);
        if (mtrr_var == NULL)
                panic("can't allocate variable MTRR array");
+       mtrr_funcs = &k6_mtrr_funcs;
 
        k6_raw2soft();
 }



Home | Main Index | Thread Index | Old Index