Add definitions for Intel Digital Thermal Sensor and Power Management, at

CPUID Fn0000_0006, %eax, %ecx. Use these instead of magic numbers.
This commit is contained in:
jruoho 2010-08-25 05:07:43 +00:00
parent 38451663e8
commit cff1577a2c
3 changed files with 30 additions and 10 deletions

View File

@ -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>
@ -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 @@ acpicpu_md_quirks(void)
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;
}

View File

@ -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 */

View File

@ -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 @@ coretemp_register(struct cpu_info *ci)
* 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);