Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Fix calculation of the cpu model (display m...



details:   https://anonhg.NetBSD.org/src/rev/530404fc8a46
branches:  trunk
changeset: 791300:530404fc8a46
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Nov 12 16:11:39 2013 +0000

description:
Fix calculation of the cpu model (display model) in cpu_probe_amd_cache().
The CPUID2MODEL() must be used only when the CPUID2FAMILY() macro returns
0xf or 0x6. Also fix a bug that CPUID2EXTMODEL() is _ADDED_. The correct way
is shifting the return value of CPUID2EXTMODEL() 4bit left and _OR_ it.

diffstat:

 sys/arch/x86/x86/identcpu.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r cd2d7c992c68 -r 530404fc8a46 sys/arch/x86/x86/identcpu.c
--- a/sys/arch/x86/x86/identcpu.c       Tue Nov 12 15:58:38 2013 +0000
+++ b/sys/arch/x86/x86/identcpu.c       Tue Nov 12 16:11:39 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: identcpu.c,v 1.35 2013/10/21 06:33:11 msaitoh Exp $    */
+/*     $NetBSD: identcpu.c,v 1.36 2013/11/12 16:11:39 msaitoh Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.35 2013/10/21 06:33:11 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.36 2013/11/12 16:11:39 msaitoh Exp $");
 
 #include "opt_xen.h"
 
@@ -119,10 +119,11 @@
        /*
         * Get extended values for K8 and up.
         */
-       if (family == 0xf) {
+       if (family == 0xf)
                family += CPUID2EXTFAMILY(ci->ci_signature);
-               model += CPUID2EXTMODEL(ci->ci_signature);
-       }
+
+       if ((family == 0xf) || (model == 0x6))
+               model |= CPUID2EXTMODEL(ci->ci_signature) << 4;
 
        /*
         * Determine the largest extended function value.



Home | Main Index | Thread Index | Old Index