summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hessler <phessler@cvs.openbsd.org>2009-06-01 20:46:51 +0000
committerPeter Hessler <phessler@cvs.openbsd.org>2009-06-01 20:46:51 +0000
commit8648b27664592bcafda72648c990f943c0674ee5 (patch)
tree2e7327e2f5c1c24d5dac482ae34303ba5de85890
parent2509e171fef14435ee7b27ae92ed9ca56c5ff1b7 (diff)
Fix the order of checking if a machine has MTRR. We need to check
against the vendor string, then cpu family, then if the cpu claims to have it. requested by toby@ Also match against Via's cpu string to enable MTRR on matthieu@'s VIA Nano compile tested on i386 by wcmaier@
-rw-r--r--sys/arch/amd64/amd64/mtrr.c13
-rw-r--r--sys/arch/i386/i386/mtrr.c11
2 files changed, 13 insertions, 11 deletions
diff --git a/sys/arch/amd64/amd64/mtrr.c b/sys/arch/amd64/amd64/mtrr.c
index 32048871538..ed6907843d1 100644
--- a/sys/arch/amd64/amd64/mtrr.c
+++ b/sys/arch/amd64/amd64/mtrr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mtrr.c,v 1.1 2008/06/11 09:22:38 phessler Exp $ */
+/* $OpenBSD: mtrr.c,v 1.2 2009/06/01 20:46:50 phessler Exp $ */
/*-
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
* Copyright (c) 1999 Brian Fundakowski Feldman
@@ -50,13 +50,14 @@ mtrrattach(int num)
step = (cpu_id >> 0) & 0xf;
/* Try for i686 MTRRs */
- if ((cpu_feature & CPUID_MTRR) &&
- (family == 0x6 || family == 0xf) &&
- ((strcmp(cpu_vendor, "GenuineIntel") == 0) ||
- (strcmp(cpu_vendor, "AuthenticAMD") == 0))) {
+ if (((strcmp(cpu_vendor, "GenuineIntel") == 0) ||
+ (strcmp(cpu_vendor, "CentaurHauls") == 0) ||
+ (strcmp(cpu_vendor, "AuthenticAMD") == 0)) &&
+ (family == 0x6 || family == 0xf) &&
+ cpu_feature & CPUID_MTRR) {
mem_range_softc.mr_op = &amd64_mrops;
-
}
+
/* Initialise memory range handling */
if (mem_range_softc.mr_op != NULL)
mem_range_softc.mr_op->init(&mem_range_softc);
diff --git a/sys/arch/i386/i386/mtrr.c b/sys/arch/i386/i386/mtrr.c
index 04ee89e9f1e..c5358a0970b 100644
--- a/sys/arch/i386/i386/mtrr.c
+++ b/sys/arch/i386/i386/mtrr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mtrr.c,v 1.10 2007/05/02 18:52:17 matthieu Exp $ */
+/* $OpenBSD: mtrr.c,v 1.11 2009/06/01 20:46:50 phessler Exp $ */
/*-
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
* Copyright (c) 1999 Brian Fundakowski Feldman
@@ -58,10 +58,11 @@ mtrrattach(int num)
mem_range_softc.mr_op = &k6_mrops;
/* Try for i686 MTRRs */
- } else if ((cpu_feature & CPUID_MTRR) &&
- (family == 0x6 || family == 0xf) &&
- ((strcmp(cpu_vendor, "GenuineIntel") == 0) ||
- (strcmp(cpu_vendor, "AuthenticAMD") == 0))) {
+ } else if (((strcmp(cpu_vendor, "GenuineIntel") == 0) ||
+ (strcmp(cpu_vendor, "CentaurHauls") == 0) ||
+ (strcmp(cpu_vendor, "AuthenticAMD") == 0)) &&
+ (family == 0x6 || family == 0xf) &&
+ (cpu_feature & CPUID_MTRR)) {
mem_range_softc.mr_op = &i686_mrops;
}