Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86 Add definitions for Intel Digital Thermal Senso...



details:   https://anonhg.NetBSD.org/src/rev/04c552caf94e
branches:  trunk
changeset: 757314:04c552caf94e
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Wed Aug 25 05:07:43 2010 +0000

description:
Add definitions for Intel Digital Thermal Sensor and Power Management, at
CPUID Fn0000_0006, %eax, %ecx. Use these instead of magic numbers.

diffstat:

 sys/arch/x86/acpi/acpi_cpu_md.c   |  10 +++++-----
 sys/arch/x86/include/specialreg.h |  24 ++++++++++++++++++++++--
 sys/arch/x86/x86/coretemp.c       |   6 +++---
 3 files changed, 30 insertions(+), 10 deletions(-)

diffs (107 lines):

diff -r f7f0d79667e4 -r 04c552caf94e sys/arch/x86/acpi/acpi_cpu_md.c
--- a/sys/arch/x86/acpi/acpi_cpu_md.c   Wed Aug 25 04:58:59 2010 +0000
+++ b/sys/arch/x86/acpi/acpi_cpu_md.c   Wed Aug 25 05:07:43 2010 +0000
@@ -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 <jruohonen%iki.fi@localhost>
@@ -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;
                }
 
diff -r f7f0d79667e4 -r 04c552caf94e sys/arch/x86/include/specialreg.h
--- a/sys/arch/x86/include/specialreg.h Wed Aug 25 04:58:59 2010 +0000
+++ b/sys/arch/x86/include/specialreg.h Wed Aug 25 05:07:43 2010 +0000
@@ -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 */
diff -r f7f0d79667e4 -r 04c552caf94e sys/arch/x86/x86/coretemp.c
--- a/sys/arch/x86/x86/coretemp.c       Wed Aug 25 04:58:59 2010 +0000
+++ b/sys/arch/x86/x86/coretemp.c       Wed Aug 25 05:07:43 2010 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index