summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-05-28 20:10:59 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-05-28 20:10:59 +0000
commit9720dcf9b0f447cb8683388f03629410cd4b255a (patch)
treec9a4d56527132ba0a2a541b86cba5cb56dee2931 /sys/arch/i386
parent86241f3476e7a76d21eda4b22cb2da3381bab123 (diff)
Save the cpuid(6) eax bits in the cpu_info and report the SENSOR and ARAT
bits from it. ok krw@ kettenis@
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/i386/machdep.c30
-rw-r--r--sys/arch/i386/include/cpu.h3
-rw-r--r--sys/arch/i386/include/specialreg.h8
3 files changed, 30 insertions, 11 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 40f0a9bfac0..1aa2ba82fbd 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.569 2015/04/18 22:16:21 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.570 2015/05/28 20:10:58 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -1077,6 +1077,11 @@ const struct cpu_cpuid_feature cpu_seff0_ebxfeatures[] = {
{ SEFF0EBX_SMAP, "SMAP" },
};
+const struct cpu_cpuid_feature cpu_tpm_eaxfeatures[] = {
+ { TPM_SENSOR, "SENSOR" },
+ { TPM_ARAT, "ARAT" },
+};
+
const struct cpu_cpuid_feature i386_cpuid_eaxperf[] = {
{ CPUIDEAX_VERID, "PERF" },
};
@@ -1481,14 +1486,7 @@ intelcore_update_sensor(void *args)
void
intel686_cpusensors_setup(struct cpu_info *ci)
{
- u_int regs[4];
-
- if (!CPU_IS_PRIMARY(ci) || cpuid_level < 0x06)
- return;
-
- /* CPUID.06H.EAX[0] = 1 tells us if we have on-die sensor */
- cpuid(0x06, regs);
- if ((regs[0] & 0x01) != 1)
+ if (!CPU_IS_PRIMARY(ci) || (ci->ci_feature_tpmflags & TPM_SENSOR) == 0)
return;
/* Setup the sensors structures */
@@ -1988,6 +1986,20 @@ identifycpu(struct cpu_info *ci)
(numbits == 0 ? "" : ","),
cpu_seff0_ebxfeatures[i].feature_name);
}
+
+ if (!strcmp(cpu_vendor, "GenuineIntel") &&
+ cpuid_level >= 0x06 ) {
+ u_int dummy;
+
+ CPUID(0x06, ci->ci_feature_tpmflags, dummy,
+ dummy, dummy);
+ max = nitems(cpu_tpm_eaxfeatures);
+ for (i = 0; i < max; i++)
+ if (ci->ci_feature_tpmflags &
+ cpu_tpm_eaxfeatures[i].feature_bit)
+ printf(",%s", cpu_tpm_eaxfeatures[i].feature_name);
+ }
+
printf("\n");
}
}
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index 14033d378d0..623154e993d 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.139 2015/04/18 22:16:21 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.140 2015/05/28 20:10:58 guenther Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -118,6 +118,7 @@ struct cpu_info {
u_int32_t ci_model; /* extended cpuid model */
u_int32_t ci_feature_flags; /* X86 CPUID feature bits */
u_int32_t ci_feature_sefflags; /* more CPUID feature bits */
+ u_int32_t ci_feature_tpmflags; /* thermal & power bits */
u_int32_t cpu_class; /* CPU class */
u_int32_t ci_cflushsz; /* clflush cache-line size */
diff --git a/sys/arch/i386/include/specialreg.h b/sys/arch/i386/include/specialreg.h
index 3bb33b3f4ce..7f1f341dfdf 100644
--- a/sys/arch/i386/include/specialreg.h
+++ b/sys/arch/i386/include/specialreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: specialreg.h,v 1.50 2015/03/25 20:59:30 kettenis Exp $ */
+/* $OpenBSD: specialreg.h,v 1.51 2015/05/28 20:10:58 guenther Exp $ */
/* $NetBSD: specialreg.h,v 1.7 1994/10/27 04:16:26 cgd Exp $ */
/*-
@@ -178,6 +178,12 @@
#define SEFF0EBX_SMAP 0x00100000 /* Supervisor mode access prevent */
/*
+ * Thermal and Power Management (CPUID function 0x6) EAX bits
+ */
+#define TPM_SENSOR 0x00000001 /* Digital temp sensor */
+#define TPM_ARAT 0x00000004 /* APIC Timer Always Running */
+
+/*
* "Architectural Performance Monitoring" bits (CPUID function 0x0a):
* EAX bits
*/