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 Check if SpeedStep is enabled. If it is di...



details:   https://anonhg.NetBSD.org/src/rev/d95d7a2ba8be
branches:  trunk
changeset: 757222:d95d7a2ba8be
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Aug 20 07:00:17 2010 +0000

description:
Check if SpeedStep is enabled. If it is disabled, try to enable it.

diffstat:

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

diffs (46 lines):

diff -r ec4296cdc2ef -r d95d7a2ba8be sys/arch/x86/acpi/acpi_cpu_md.c
--- a/sys/arch/x86/acpi/acpi_cpu_md.c   Fri Aug 20 06:36:40 2010 +0000
+++ b/sys/arch/x86/acpi/acpi_cpu_md.c   Fri Aug 20 07:00:17 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.19 2010/08/20 06:34:32 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.20 2010/08/20 07:00:17 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.19 2010/08/20 06:34:32 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.20 2010/08/20 07:00:17 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -254,6 +254,27 @@
 int
 acpicpu_md_pstate_start(void)
 {
+       const uint64_t est = __BIT(16);
+       uint64_t val;
+
+       switch (cpu_vendor) {
+
+       case CPUVENDOR_IDT:
+       case CPUVENDOR_INTEL:
+
+               val = rdmsr(MSR_MISC_ENABLE);
+
+               if ((val & est) == 0) {
+
+                       val |= est;
+
+                       wrmsr(MSR_MISC_ENABLE, val);
+                       val = rdmsr(MSR_MISC_ENABLE);
+
+                       if ((val & est) == 0)
+                               return ENOTTY;
+               }
+       }
 
        return acpicpu_md_pstate_sysctl_init();
 }



Home | Main Index | Thread Index | Old Index