diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2007-05-02 18:52:18 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2007-05-02 18:52:18 +0000 |
commit | 003f566817b62e9ea5b9f335acc14955c9416a0d (patch) | |
tree | 2ae6ad76e090b2bfd45fde05f3c6f470e1f1a78e /sys/arch | |
parent | c94c9f89fb6879820cbc21cb0097bb99beb3f19f (diff) |
Support for mtrr on AMD opteron CPUs. Patch by Mickey and bluhm@, tweaks
by dim@, ok deraadt@ and myself. (miod@ also found it sane).
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/i386/mtrr.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/arch/i386/i386/mtrr.c b/sys/arch/i386/i386/mtrr.c index 8c9835494b0..04ee89e9f1e 100644 --- a/sys/arch/i386/i386/mtrr.c +++ b/sys/arch/i386/i386/mtrr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mtrr.c,v 1.9 2006/11/29 20:03:20 dim Exp $ */ +/* $OpenBSD: mtrr.c,v 1.10 2007/05/02 18:52:17 matthieu Exp $ */ /*- * Copyright (c) 1999 Michael Smith <msmith@freebsd.org> * Copyright (c) 1999 Brian Fundakowski Feldman @@ -41,19 +41,25 @@ void mtrrattach(int); void mtrrattach(int num) { + int family, model, step; + if (num > 1) return; + family = (cpu_id >> 8) & 0xf; + model = (cpu_id >> 4) & 0xf; + step = (cpu_id >> 0) & 0xf; + if (strcmp(cpu_vendor, "AuthenticAMD") == 0 && - (cpu_id & 0xf00) == 0x500 && - ((cpu_id & 0xf0) > 0x80 || - ((cpu_id & 0xf0) == 0x80 && - (cpu_id & 0xf) > 0x7))) { + family == 0x5 && + (model > 0x8 || + (model == 0x8 && + step > 0x7))) { mem_range_softc.mr_op = &k6_mrops; /* Try for i686 MTRRs */ } else if ((cpu_feature & CPUID_MTRR) && - ((cpu_id & 0xf00) == 0x600) && + (family == 0x6 || family == 0xf) && ((strcmp(cpu_vendor, "GenuineIntel") == 0) || (strcmp(cpu_vendor, "AuthenticAMD") == 0))) { mem_range_softc.mr_op = &i686_mrops; |