x86: pat cpu feature bit setting for known cpus
[safe/jmp/linux-2.6] / arch / x86 / kernel / cpu / common.c
index 57a46c3..d999d78 100644 (file)
@@ -309,6 +309,19 @@ static void __cpuinit early_get_cap(struct cpuinfo_x86 *c)
 
        }
 
+       clear_cpu_cap(c, X86_FEATURE_PAT);
+
+       switch (c->x86_vendor) {
+       case X86_VENDOR_AMD:
+               if (c->x86 >= 0xf && c->x86 <= 0x11)
+                       set_cpu_cap(c, X86_FEATURE_PAT);
+               break;
+       case X86_VENDOR_INTEL:
+               if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))
+                       set_cpu_cap(c, X86_FEATURE_PAT);
+               break;
+       }
+
 }
 
 /*
@@ -369,10 +382,12 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
                        if (c->x86 >= 0x6)
                                c->x86_model += ((tfms >> 16) & 0xF) << 4;
                        c->x86_mask = tfms & 15;
+                       c->initial_apicid = (ebx >> 24) & 0xFF;
 #ifdef CONFIG_X86_HT
-                       c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
+                       c->apicid = phys_pkg_id(c->initial_apicid, 0);
+                       c->phys_proc_id = c->initial_apicid;
 #else
-                       c->apicid = (ebx >> 24) & 0xFF;
+                       c->apicid = c->initial_apicid;
 #endif
                        if (test_cpu_cap(c, X86_FEATURE_CLFLSH))
                                c->x86_clflush_size = ((ebx >> 8) & 0xff) * 8;
@@ -395,9 +410,18 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
                init_scattered_cpuid_features(c);
        }
 
-#ifdef CONFIG_X86_HT
-       c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
-#endif
+       clear_cpu_cap(c, X86_FEATURE_PAT);
+
+       switch (c->x86_vendor) {
+       case X86_VENDOR_AMD:
+               if (c->x86 >= 0xf && c->x86 <= 0x11)
+                       set_cpu_cap(c, X86_FEATURE_PAT);
+               break;
+       case X86_VENDOR_INTEL:
+               if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))
+                       set_cpu_cap(c, X86_FEATURE_PAT);
+               break;
+       }
 }
 
 static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c)
@@ -554,7 +578,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
                }
 
                index_msb = get_count_order(smp_num_siblings);
-               c->phys_proc_id = phys_pkg_id((ebx >> 24) & 0xFF, index_msb);
+               c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb);
 
                printk(KERN_INFO  "CPU: Physical Processor ID: %d\n",
                       c->phys_proc_id);
@@ -565,7 +589,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 
                core_bits = get_count_order(c->x86_max_cores);
 
-               c->cpu_core_id = phys_pkg_id((ebx >> 24) & 0xFF, index_msb) &
+               c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) &
                                               ((1 << core_bits) - 1);
 
                if (c->x86_max_cores > 1)