cpupower: Show Intel turbo ratio support via ./cpupower frequency-info
[pandora-kernel.git] / tools / power / cpupower / utils / helpers / cpuid.c
index 71021f3..a97f091 100644 (file)
@@ -67,28 +67,26 @@ int get_cpu_info(unsigned int cpu, struct cpupower_cpu_info *cpu_info)
                        continue;
                value[63 - 1] = '\0';
 
-               if (!strncmp(value, "processor\t: ", 12)) {
+               if (!strncmp(value, "processor\t: ", 12))
                        sscanf(value, "processor\t: %u", &proc);
-               }
+
                if (proc != cpu)
                        continue;
 
                /* Get CPU vendor */
-               if (!strncmp(value, "vendor_id", 9))
+               if (!strncmp(value, "vendor_id", 9)) {
                        for (x = 1; x < X86_VENDOR_MAX; x++) {
                                if (strstr(value, cpu_vendor_table[x]))
                                        cpu_info->vendor = x;
                        }
                /* Get CPU family, etc. */
-               else if (!strncmp(value, "cpu family\t: ", 13)) {
+               else if (!strncmp(value, "cpu family\t: ", 13)) {
                        sscanf(value, "cpu family\t: %u",
                               &cpu_info->family);
-               }
-               else if (!strncmp(value, "model\t\t: ", 9)) {
+               } else if (!strncmp(value, "model\t\t: ", 9)) {
                        sscanf(value, "model\t\t: %u",
                               &cpu_info->model);
-               }
-               else if (!strncmp(value, "stepping\t: ", 10)) {
+               } else if (!strncmp(value, "stepping\t: ", 10)) {
                        sscanf(value, "stepping\t: %u",
                               &cpu_info->stepping);
 
@@ -132,10 +130,37 @@ out:
                        cpu_info->caps |= CPUPOWER_CAP_AMD_CBP;
        }
 
-       /* Intel's perf-bias MSR support */
        if (cpu_info->vendor == X86_VENDOR_INTEL) {
+               /* Intel's perf-bias MSR support */
                if (cpuid_level >= 6 && (cpuid_ecx(6) & (1 << 3)))
                        cpu_info->caps |= CPUPOWER_CAP_PERF_BIAS;
+
+               /* Intel's Turbo Ratio Limit support */
+               if (cpu_info->family == 6) {
+                       switch (cpu_info->model) {
+                       case 0x1A:      /* Core i7, Xeon 5500 series
+                                        * Bloomfield, Gainstown NHM-EP
+                                        */
+                       case 0x1E:      /* Core i7 and i5 Processor
+                                        * Clarksfield, Lynnfield, Jasper Forest
+                                        */
+                       case 0x1F:      /* Core i7 and i5 Processor - Nehalem */
+                       case 0x25:      /* Westmere Client
+                                        * Clarkdale, Arrandale
+                                        */
+                       case 0x2C:      /* Westmere EP - Gulftown */
+                               cpu_info->caps |= CPUPOWER_CAP_HAS_TURBO_RATIO;
+                       case 0x2A:      /* SNB */
+                       case 0x2D:      /* SNB Xeon */
+                               cpu_info->caps |= CPUPOWER_CAP_HAS_TURBO_RATIO;
+                               cpu_info->caps |= CPUPOWER_CAP_IS_SNB;
+                               break;
+                       case 0x2E:      /* Nehalem-EX Xeon - Beckton */
+                       case 0x2F:      /* Westmere-EX Xeon - Eagleton */
+                       default:
+                               break;
+                       }
+               }
        }
 
        /*      printf("ID: %u - Extid: 0x%x - Caps: 0x%llx\n",