x86_64: Extract "Thermal and Power management Feature"
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 10 Jan 2014 13:13:26 +0000 (21:13 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 10 Jan 2014 13:40:02 +0000 (21:40 +0800)
This feature will be used to detect whether LAPIC timer could be enabled
for deep C-states.

sys/cpu/x86_64/include/specialreg.h
sys/platform/pc64/include/md_var.h
sys/platform/pc64/x86_64/identcpu.c
sys/platform/pc64/x86_64/initcpu.c

index ec4df7c..11d435a 100644 (file)
 #define        CPUID_STDEXT_ADX        0x00080000
 #define        CPUID_STDEXT_SMAP       0x00100000
 
+/*
+ * Thermal and PM Features
+ */
+#define CPUID_THERMAL_ARAT     0x00000004
+#define CPUID_THERMAL_PLN      0x00000010
+#define CPUID_THERMAL_ECMD     0x00000020
+#define CPUID_THERMAL_PTM      0x00000040
+
 /*
  * CPUID manufacturers identifiers
  */
index 5741538..31bfeec 100644 (file)
@@ -50,6 +50,7 @@ extern        u_int   amd_feature;
 extern u_int   amd_feature2;
 extern u_int   cpu_clflush_line_size;
 extern u_int   cpu_stdext_feature;
+extern u_int   cpu_thermal_feature;
 extern u_int   cpu_fxsr;
 extern u_int   cpu_xsave;
 extern u_int   cpu_high;
index 968305c..6bc7692 100644 (file)
@@ -389,6 +389,21 @@ printcpuinfo(void)
                                       );
                        }
 
+                       if (cpu_thermal_feature != 0) {
+                               kprintf("\n  Thermal and PM Features=0x%b",
+                                   cpu_thermal_feature,
+                                   "\020"
+                                   /* APIC-Timer-always-running */
+                                   "\003ARAT"
+                                   /* Power limit notification controls */
+                                   "\005PLN"
+                                   /* Clock modulation duty cycle extension */
+                                   "\006ECMD"
+                                   /* Package thermal management */
+                                   "\007PTM"
+                                   );
+                       }
+
                        if (cpu_vendor_id == CPU_VENDOR_CENTAUR)
                                print_via_padlock_info();
                        /*
@@ -513,6 +528,10 @@ identify_cpu(void)
        cpu_feature = regs[3];
        cpu_feature2 = regs[2];
 
+       if (cpu_high >= 6) {
+               do_cpuid(6, regs);
+               cpu_thermal_feature = regs[0];
+       }
        if (cpu_high >= 7) {
                cpuid_count(7, 0, regs);
                cpu_stdext_feature = regs[1];
index d499247..a093702 100644 (file)
@@ -66,6 +66,7 @@ u_int cpu_xsave;              /* AVX enabled by OS*/
 u_int  cpu_mxcsr_mask;         /* Valid bits in mxcsr */
 u_int  cpu_clflush_line_size = 32;     /* Default CLFLUSH line size */
 u_int  cpu_stdext_feature;
+u_int  cpu_thermal_feature;
 
 /*
  * -1: automatic (enable on h/w, disable on VMs)