Module Name:    src
Committed By:   msaitoh
Date:           Tue Nov 12 16:11:39 UTC 2013

Modified Files:
        src/sys/arch/x86/x86: identcpu.c

Log Message:
 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.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x86/x86/identcpu.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/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.35 src/sys/arch/x86/x86/identcpu.c:1.36
--- src/sys/arch/x86/x86/identcpu.c:1.35	Mon Oct 21 06:33:11 2013
+++ src/sys/arch/x86/x86/identcpu.c	Tue Nov 12 16:11:39 2013
@@ -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 @@ cpu_probe_amd_cache(struct cpu_info *ci)
 	/*
 	 * 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.

Reply via email to