From: deraadt Date: Wed, 22 Mar 2000 00:02:12 +0000 (+0000) Subject: fix k6 mtrr; cokane@pohl.ececs.uc.edu X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1145ea57c676c6dccf15e4c4228cf8ed0eb80e02;p=openbsd fix k6 mtrr; cokane@pohl.ececs.uc.edu --- diff --git a/sys/arch/i386/i386/k6_mem.c b/sys/arch/i386/i386/k6_mem.c index a140e5ad81d..d16ee55eeaf 100644 --- a/sys/arch/i386/i386/k6_mem.c +++ b/sys/arch/i386/i386/k6_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: k6_mem.c,v 1.3 1999/11/24 01:43:32 deraadt Exp $ */ +/* $OpenBSD: k6_mem.c,v 1.4 2000/03/22 00:02:12 deraadt Exp $ */ /*- * Copyright (c) 1999 Brian Fundakowski Feldman * All rights reserved. @@ -93,7 +93,7 @@ k6_mrmake(desc, mtrr) return EOPNOTSUPP; for (bit = ffs(desc->mr_len >> 17) - 1; bit < 15; bit++) - len |= 1 << (14 - bit); + len |= 1 << bit; wc = (desc->mr_flags & MDF_WRITECOMBINE) ? 1 : 0; uc = (desc->mr_flags & MDF_UNCACHEABLE) ? 1 : 0; diff --git a/sys/arch/i386/i386/mtrr.c b/sys/arch/i386/i386/mtrr.c index 11a21514c9c..45111eace08 100644 --- a/sys/arch/i386/i386/mtrr.c +++ b/sys/arch/i386/i386/mtrr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mtrr.c,v 1.3 2000/03/13 06:56:56 matthieu Exp $ */ +/* $OpenBSD: mtrr.c,v 1.4 2000/03/22 00:02:12 deraadt Exp $ */ /*- * Copyright (c) 1999 Michael Smith * Copyright (c) 1999 Brian Fundakowski Feldman @@ -49,8 +49,6 @@ mtrrattach (num) if (num > 1) return; -#if 0 - /* XXX at least 2 people report problems with K6 MTRR */ if (strcmp(cpu_vendor, "AuthenticAMD") == 0 && (cpu_id & 0xf00) == 0x500 && ((cpu_id & 0xf0) > 0x80 || @@ -58,18 +56,14 @@ mtrrattach (num) (cpu_id & 0xf) > 0x7))) { mem_range_softc.mr_op = &k6_mrops; - - } else -#endif - /* Try for i686 MTRRs */ - if ((cpu_feature & CPUID_MTRR) && - ((cpu_id & 0xf00) == 0x600) && - ((strcmp(cpu_vendor, "GenuineIntel") == 0) || - (strcmp(cpu_vendor, "AuthenticAMD") == 0))) { + /* Try for i686 MTRRs */ + } else if ((cpu_feature & CPUID_MTRR) && + ((cpu_id & 0xf00) == 0x600) && + ((strcmp(cpu_vendor, "GenuineIntel") == 0) || + (strcmp(cpu_vendor, "AuthenticAMD") == 0))) { mem_range_softc.mr_op = &i686_mrops; - } else { - mem_range_softc.mr_op = NULL; - } + + } /* Initialise memory range handling */ if (mem_range_softc.mr_op != NULL) mem_range_softc.mr_op->init(&mem_range_softc);