Module Name: src
Committed By: jruoho
Date: Wed Aug 25 05:07:44 UTC 2010
Modified Files:
src/sys/arch/x86/acpi: acpi_cpu_md.c
src/sys/arch/x86/include: specialreg.h
src/sys/arch/x86/x86: coretemp.c
Log Message:
Add definitions for Intel Digital Thermal Sensor and Power Management, at
CPUID Fn0000_0006, %eax, %ecx. Use these instead of magic numbers.
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x86/acpi/acpi_cpu_md.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.15 -r1.16 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/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.33 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.34
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.33 Tue Aug 24 10:29:53 2010
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c Wed Aug 25 05:07:43 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.33 2010/08/24 10:29:53 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.34 2010/08/25 05:07:43 jruoho Exp $ */
/*-
* Copyright (c) 2010 Jukka Ruohonen <[email protected]>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.33 2010/08/24 10:29:53 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.34 2010/08/25 05:07:43 jruoho Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -188,13 +188,13 @@
x86_cpuid(0x06, regs);
- if ((regs[2] & __BIT(0)) != 0) /* ECX.06[0] */
+ if ((regs[2] & CPUID_DSPM_HWF) != 0)
val |= ACPICPU_FLAG_P_HW;
- if ((regs[0] & __BIT(1)) != 0) /* EAX.06[1] */
+ if ((regs[0] & CPUID_DSPM_IDA) != 0)
val |= ACPICPU_FLAG_P_TURBO;
- if ((regs[0] & __BIT(2)) != 0) /* EAX.06[2] */
+ if ((regs[0] & CPUID_DSPM_ARAT) != 0)
val &= ~ACPICPU_FLAG_C_APIC;
}
Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.46 src/sys/arch/x86/include/specialreg.h:1.47
--- src/sys/arch/x86/include/specialreg.h:1.46 Sat Aug 21 02:59:18 2010
+++ src/sys/arch/x86/include/specialreg.h Wed Aug 25 05:07:43 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: specialreg.h,v 1.46 2010/08/21 02:59:18 jruoho Exp $ */
+/* $NetBSD: specialreg.h,v 1.47 2010/08/25 05:07:43 jruoho Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -127,6 +127,27 @@
"\30MMX\31FXSR\32SSE\33SSE2\34SS\35HTT\36TM" \
"\37IA64\40SBF"
+/*
+ * Intel Digital Thermal Sensor and
+ * Power Management, Fn0000_0006 - %eax.
+ */
+#define CPUID_DSPM_DTS 0x00000001 /* Digital Thermal Sensor */
+#define CPUID_DSPM_IDA 0x00000002 /* Intel Dynamic Acceleration */
+#define CPUID_DSPM_ARAT 0x00000004 /* Always Running APIC Timer */
+#define CPUID_DSPM_PLN 0x00000010 /* Power Limit Notification */
+#define CPUID_DSPM_CME 0x00000020 /* Clock Modulation Extension */
+#define CPUID_DSPM_PLTM 0x00000040 /* Package Level Thermal Management */
+
+#define CPUID_DSPM_FLAGS "\20\1DTS\2IDA\3ARAT\5PLN\6CME\7PLTM"
+
+/*
+ * Intel Digital Thermal Sensor and
+ * Power Management, Fn0000_0006 - %ecx.
+ */
+#define CPUID_DSPM_HWF 0x00000001 /* MSR_APERF/MSR_MPERF available */
+
+#define CPUID_DSPM_FLAGS1 "\20\1HWF"
+
/* Intel Fn80000001 extended features - %edx */
#define CPUID_SYSCALL 0x00000800 /* SYSCALL/SYSRET */
#define CPUID_XD 0x00100000 /* Execute Disable (like CPUID_NOX) */
@@ -190,7 +211,6 @@
* AMD Advanced Power Management
* CPUID Fn8000_0007 %edx
*/
-
#define CPUID_APM_TS 0x00000001 /* Temperature Sensor */
#define CPUID_APM_FID 0x00000002 /* Frequency ID control */
#define CPUID_APM_VID 0x00000004 /* Voltage ID control */
Index: src/sys/arch/x86/x86/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.15 src/sys/arch/x86/x86/coretemp.c:1.16
--- src/sys/arch/x86/x86/coretemp.c:1.15 Sun Aug 15 08:45:20 2010
+++ src/sys/arch/x86/x86/coretemp.c Wed Aug 25 05:07:43 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.15 2010/08/15 08:45:20 mrg Exp $ */
+/* $NetBSD: coretemp.c,v 1.16 2010/08/25 05:07:43 jruoho Exp $ */
/*-
* Copyright (c) 2007 Juan Romero Pardines.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.15 2010/08/15 08:45:20 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.16 2010/08/25 05:07:43 jruoho Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -80,7 +80,7 @@
* sensors. EBX[0:3] contains the number of sensors.
*/
x86_cpuid(0x06, regs);
- if ((regs[0] & 0x1) != 1)
+ if ((regs[0] & CPUID_DSPM_DTS) == 0)
return;
sc = kmem_zalloc(sizeof(struct coretemp_softc), KM_NOSLEEP);