Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/acpi Detect Intel's Turbo Boost and presence of...



details:   https://anonhg.NetBSD.org/src/rev/25c0cabccedf
branches:  trunk
changeset: 757235:25c0cabccedf
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Aug 21 04:36:29 2010 +0000

description:
Detect Intel's Turbo Boost and presence of IA32_APERF/IA32_MPERF. The former
is required for a quirk, and the latter is needed for hardware P-state
coordination (once acpicpu(4) will support fine-grained coordination).

diffstat:

 sys/arch/x86/acpi/acpi_cpu_md.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 404d918a80c9 -r 25c0cabccedf sys/arch/x86/acpi/acpi_cpu_md.c
--- a/sys/arch/x86/acpi/acpi_cpu_md.c   Sat Aug 21 03:55:24 2010 +0000
+++ b/sys/arch/x86/acpi/acpi_cpu_md.c   Sat Aug 21 04:36:29 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.22 2010/08/21 03:55:24 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.23 2010/08/21 04:36:29 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.22 2010/08/21 03:55:24 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.23 2010/08/21 04:36:29 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -146,6 +146,21 @@
                        val |= ACPICPU_FLAG_T_FFH;
 
                /*
+                * See if MSR_APERF, MSR_MPERF,
+                * and Turbo Boost are available.
+                */
+               if (cpuid_level >= 0x06) {
+
+                       x86_cpuid(0x06, regs);
+
+                       if ((regs[2] & __BIT(0)) != 0)        /* ECX.06[0] */
+                               val |= ACPICPU_FLAG_P_HW;
+
+                       if ((regs[0] & __BIT(1)) != 0)
+                               val |= ACPICPU_FLAG_P_TURBO;  /* EAX.06[1] */
+               }
+
+               /*
                 * Detect whether TSC is invariant. If it is not,
                 * we keep the flag to note that TSC will not run
                 * at constant rate. Depending on the CPU, this may



Home | Main Index | Thread Index | Old Index