acpi/cpu: Report that Turbo Boost is enabled on Intel CPUs
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 29 Dec 2011 10:36:41 +0000 (18:36 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 29 Dec 2011 10:36:41 +0000 (18:36 +0800)
If Turbo Boost is enabled, the current CPU frequencies reported by
hw.acpi.cpu are not correct, sigh.

sys/platform/pc32/acpica5/acpi_cpu_machdep.c
sys/platform/pc64/acpica5/acpi_cpu_machdep.c

index 4a87be5..ba7d376 100644 (file)
@@ -4,6 +4,7 @@
 #include <sys/systm.h>
 #include <sys/sysctl.h>
 
+#include <machine/cpufunc.h>
 #include <machine/cputypes.h>
 #include <machine/md_var.h>
 #include <machine/specialreg.h>
@@ -16,6 +17,16 @@ uint32_t
 acpi_cpu_md_features(void)
 {
        if (cpu_vendor_id == CPU_VENDOR_INTEL) {
+               uint32_t regs[4];
+               static int reported;
+
+               if (!reported) {
+                       do_cpuid(0x6, regs);
+                       if (regs[0] & 0x2)
+                               kprintf("Turbo mode enabled in BIOS\n");
+                       reported = 1;
+               }
+
                if (cpu_feature2 & CPUID2_EST) {
                        return (ACPI_PDC_PX_MSR |
                            ACPI_PDC_MP_PX_SWCORD |
index 4a87be5..ba7d376 100644 (file)
@@ -4,6 +4,7 @@
 #include <sys/systm.h>
 #include <sys/sysctl.h>
 
+#include <machine/cpufunc.h>
 #include <machine/cputypes.h>
 #include <machine/md_var.h>
 #include <machine/specialreg.h>
@@ -16,6 +17,16 @@ uint32_t
 acpi_cpu_md_features(void)
 {
        if (cpu_vendor_id == CPU_VENDOR_INTEL) {
+               uint32_t regs[4];
+               static int reported;
+
+               if (!reported) {
+                       do_cpuid(0x6, regs);
+                       if (regs[0] & 0x2)
+                               kprintf("Turbo mode enabled in BIOS\n");
+                       reported = 1;
+               }
+
                if (cpu_feature2 & CPUID2_EST) {
                        return (ACPI_PDC_PX_MSR |
                            ACPI_PDC_MP_PX_SWCORD |