Module Name:    src
Committed By:   abs
Date:           Thu Dec 15 09:38:21 UTC 2011

Modified Files:
        src/sys/arch/x86/include: mtrr.h specialreg.h
        src/sys/arch/x86/x86: mtrr_i686.c

Log Message:
Increase MTRR_I686_NVAR_MAX from 8 to 16. Avoids
"FIXME: more than 8 MTRRs (10)" message on booting Thinkpad W520 and
similar. While here replace a magic number with MTRR_I686_NVAR_MAX * 2


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/include/mtrr.h
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/x86/mtrr_i686.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/include/mtrr.h
diff -u src/sys/arch/x86/include/mtrr.h:1.4 src/sys/arch/x86/include/mtrr.h:1.5
--- src/sys/arch/x86/include/mtrr.h:1.4	Tue Jul  1 15:27:34 2008
+++ src/sys/arch/x86/include/mtrr.h	Thu Dec 15 09:38:21 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mtrr.h,v 1.4 2008/07/01 15:27:34 mrg Exp $ */
+/* $NetBSD: mtrr.h,v 1.5 2011/12/15 09:38:21 abs Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define MTRR_I686_FIXED_IDX16K	1
 #define MTRR_I686_FIXED_IDX4K	3
 
-#define MTRR_I686_NVAR_MAX	8	/* could be upto 255? */
+#define MTRR_I686_NVAR_MAX	16	/* could be upto 255? */
 
 #define MTRR_I686_64K_START		0x00000
 #define MTRR_I686_16K_START		0x80000

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.54 src/sys/arch/x86/include/specialreg.h:1.55
--- src/sys/arch/x86/include/specialreg.h:1.54	Fri Dec  9 10:08:47 2011
+++ src/sys/arch/x86/include/specialreg.h	Thu Dec 15 09:38:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.54 2011/12/09 10:08:47 cegger Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.55 2011/12/15 09:38:21 abs Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -381,6 +381,22 @@
 #define	MSR_MTRRphysMask6	0x20d
 #define	MSR_MTRRphysBase7	0x20e
 #define	MSR_MTRRphysMask7	0x20f
+#define	MSR_MTRRphysBase8	0x210
+#define	MSR_MTRRphysMask8	0x211
+#define	MSR_MTRRphysBase9	0x212
+#define	MSR_MTRRphysMask9	0x213
+#define	MSR_MTRRphysBase10	0x214
+#define	MSR_MTRRphysMask10	0x215
+#define	MSR_MTRRphysBase11	0x216
+#define	MSR_MTRRphysMask11	0x217
+#define	MSR_MTRRphysBase12	0x218
+#define	MSR_MTRRphysMask12	0x219
+#define	MSR_MTRRphysBase13	0x21a
+#define	MSR_MTRRphysMask13	0x21b
+#define	MSR_MTRRphysBase14	0x21c
+#define	MSR_MTRRphysMask14	0x21d
+#define	MSR_MTRRphysBase15	0x21e
+#define	MSR_MTRRphysMask15	0x21f
 #define	MSR_MTRRfix64K_00000	0x250
 #define	MSR_MTRRfix16K_80000	0x258
 #define	MSR_MTRRfix16K_A0000	0x259

Index: src/sys/arch/x86/x86/mtrr_i686.c
diff -u src/sys/arch/x86/x86/mtrr_i686.c:1.24 src/sys/arch/x86/x86/mtrr_i686.c:1.25
--- src/sys/arch/x86/x86/mtrr_i686.c:1.24	Tue Jan 18 17:44:15 2011
+++ src/sys/arch/x86/x86/mtrr_i686.c	Thu Dec 15 09:38:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mtrr_i686.c,v 1.24 2011/01/18 17:44:15 jmcneill Exp $ */
+/*	$NetBSD: mtrr_i686.c,v 1.25 2011/12/15 09:38:21 abs Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.24 2011/01/18 17:44:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.25 2011/12/15 09:38:21 abs Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -83,6 +83,22 @@ mtrr_raw[] = {
 	{ MSR_MTRRphysMask6, 0 },
 	{ MSR_MTRRphysBase7, 0 },
 	{ MSR_MTRRphysMask7, 0 },
+	{ MSR_MTRRphysBase8, 0 },
+	{ MSR_MTRRphysMask8, 0 },
+	{ MSR_MTRRphysBase9, 0 },
+	{ MSR_MTRRphysMask9, 0 },
+	{ MSR_MTRRphysBase10, 0 },
+	{ MSR_MTRRphysMask10, 0 },
+	{ MSR_MTRRphysBase11, 0 },
+	{ MSR_MTRRphysMask11, 0 },
+	{ MSR_MTRRphysBase12, 0 },
+	{ MSR_MTRRphysMask12, 0 },
+	{ MSR_MTRRphysBase13, 0 },
+	{ MSR_MTRRphysMask13, 0 },
+	{ MSR_MTRRphysBase14, 0 },
+	{ MSR_MTRRphysMask14, 0 },
+	{ MSR_MTRRphysBase15, 0 },
+	{ MSR_MTRRphysMask15, 0 },
 	{ MSR_MTRRfix64K_00000, 0 },
 	{ MSR_MTRRfix16K_80000, 0 },
 	{ MSR_MTRRfix16K_A0000, 0 },
@@ -305,8 +321,8 @@ i686_mtrr_init_first(void)
 		    MTRR_I686_NVAR_MAX, i686_mtrr_vcnt);
 	else if (i686_mtrr_vcnt < MTRR_I686_NVAR_MAX) {
 		for (i = MTRR_I686_NVAR_MAX - i686_mtrr_vcnt; i; i--) {
-			mtrr_raw[16 - (i*2)].msraddr = 0;
-			mtrr_raw[17 - (i*2)].msraddr = 0;
+			mtrr_raw[(MTRR_I686_NVAR_MAX - i) * 2].msraddr = 0;
+			mtrr_raw[(MTRR_I686_NVAR_MAX - i) * 2 + 1].msraddr = 0;
 		}
 	}
 

Reply via email to