Module Name: src
Committed By: sborrill
Date: Thu Dec 3 14:44:12 UTC 2009
Modified Files:
src/sys/arch/x86/x86: coretemp.c
Log Message:
CPU model and CPU extended model cannot simply be summed; the extended model
differentiates different CPUs within a given model type (i.e. model 0xe with
extended model 0x1 is NOT the same as a model 0xf).
Modern Xeons do not support MSR_IA32_EXT_CONFIG, so use model and extended
model correctly to avoid it
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/x86/coretemp.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/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.12 src/sys/arch/x86/x86/coretemp.c:1.13
--- src/sys/arch/x86/x86/coretemp.c:1.12 Wed Mar 25 22:53:51 2009
+++ src/sys/arch/x86/x86/coretemp.c Thu Dec 3 14:44:12 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.12 2009/03/25 22:53:51 dyoung Exp $ */
+/* $NetBSD: coretemp.c,v 1.13 2009/12/03 14:44:12 sborrill Exp $ */
/*-
* Copyright (c) 2007 Juan Romero Pardines.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.12 2009/03/25 22:53:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.13 2009/12/03 14:44:12 sborrill Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -67,7 +67,7 @@
struct coretemp_softc *sc;
uint32_t regs[4];
uint64_t msr;
- int cpumodel, cpumask;
+ int cpumodel, cpuextmodel, cpumask;
/*
* CPUID 0x06 returns 1 if the processor has on-die thermal
@@ -85,7 +85,7 @@
(int)device_unit(ci->ci_dev));
cpumodel = CPUID2MODEL(ci->ci_signature);
/* extended model */
- cpumodel += CPUID2EXTMODEL(ci->ci_signature);
+ cpuextmodel = CPUID2EXTMODEL(ci->ci_signature);
cpumask = ci->ci_signature & 15;
/*
@@ -111,9 +111,12 @@
*
* The if-clause for CPUs having the MSR_IA32_EXT_CONFIG was adapted
* from the Linux coretemp driver.
+ *
+ * MSR_IA32_EXT_CONFIG is NOT safe on all CPUs
*/
sc->sc_tjmax = 100;
- if ((cpumodel == 0xf && cpumask >= 2) || cpumodel == 0xe) {
+ if ((cpumodel == 0xf && cpumask >= 2) ||
+ (cpumodel == 0xe && cpuextmodel != 1)) {
msr = rdmsr(MSR_IA32_EXT_CONFIG);
if (msr & (1 << 30))
sc->sc_tjmax = 85;