]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/setup_64.c
x86: account overlapped mappings in max_pfn_mapped
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / setup_64.c
index 164200257b6849b15840a66496f22ebeb9ff6c69..3d76dbd9f2c09c2ecbf5f6307d28d083bad87165 100644 (file)
@@ -347,13 +347,11 @@ void __init setup_arch(char **cmdline_p)
 
        check_efer();
 
-       init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT));
+       max_pfn_mapped = init_memory_mapping(0, (max_pfn_mapped << PAGE_SHIFT));
        if (efi_enabled)
                efi_init();
 
-#ifdef CONFIG_PARAVIRT
        vsmp_init();
-#endif
 
        dmi_scan_machine();
 
@@ -562,9 +560,9 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
        bits = c->x86_coreid_bits;
 
        /* Low order bits define the core id (index of core in socket) */
-       c->cpu_core_id = c->phys_proc_id & ((1 << bits)-1);
-       /* Convert the APIC ID into the socket ID */
-       c->phys_proc_id = phys_pkg_id(bits);
+       c->cpu_core_id = c->initial_apicid & ((1 << bits)-1);
+       /* Convert the initial APIC ID into the socket ID */
+       c->phys_proc_id = c->initial_apicid >> bits;
 
 #ifdef CONFIG_NUMA
        node = c->phys_proc_id;
@@ -581,7 +579,7 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
                   If that doesn't result in a usable node fall back to the
                   path for the previous case.  */
 
-               int ht_nodeid = apicid - (cpu_data(0).phys_proc_id << bits);
+               int ht_nodeid = c->initial_apicid;
 
                if (ht_nodeid >= 0 &&
                    apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
@@ -687,7 +685,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 
        /* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
           3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */
-       clear_bit(0*32+31, (unsigned long *)&c->x86_capability);
+       clear_cpu_cap(c, 0*32+31);
 
        /* On C+ stepping K8 rep microcode works well for copy/memset */
        level = cpuid_eax(1);
@@ -823,7 +821,7 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
 {
        if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
            (c->x86 == 0x6 && c->x86_model >= 0x0e))
-               set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
+               set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 }
 
 static void __cpuinit init_intel(struct cpuinfo_x86 *c)
@@ -929,15 +927,16 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
                        c->x86 += (tfms >> 20) & 0xff;
                if (c->x86 >= 0x6)
                        c->x86_model += ((tfms >> 16) & 0xF) << 4;
-               if (c->x86_capability[0] & (1<<19))
+               if (test_cpu_cap(c, X86_FEATURE_CLFLSH))
                        c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
        } else {
                /* Have CPUID level 0 only - unheard of */
                c->x86 = 4;
        }
 
+       c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xff;
 #ifdef CONFIG_SMP
-       c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
+       c->phys_proc_id = c->initial_apicid;
 #endif
        /* AMD-defined flags: level 0x80000001 */
        xlvl = cpuid_eax(0x80000000);
@@ -963,12 +962,19 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
        if (c->extended_cpuid_level >= 0x80000007)
                c->x86_power = cpuid_edx(0x80000007);
 
+
+       clear_cpu_cap(c, X86_FEATURE_PAT);
+
        switch (c->x86_vendor) {
        case X86_VENDOR_AMD:
                early_init_amd(c);
+               if (c->x86 >= 0xf && c->x86 <= 0x11)
+                       set_cpu_cap(c, X86_FEATURE_PAT);
                break;
        case X86_VENDOR_INTEL:
                early_init_intel(c);
+               if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))
+                       set_cpu_cap(c, X86_FEATURE_PAT);
                break;
        }
 
@@ -1035,14 +1041,24 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
 #endif
        select_idle_routine(c);
 
-       if (c != &boot_cpu_data)
-               mtrr_ap_init();
 #ifdef CONFIG_NUMA
        numa_add_cpu(smp_processor_id());
 #endif
 
 }
 
+void __cpuinit identify_boot_cpu(void)
+{
+       identify_cpu(&boot_cpu_data);
+}
+
+void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c)
+{
+       BUG_ON(c == &boot_cpu_data);
+       identify_cpu(c);
+       mtrr_ap_init();
+}
+
 static __init int setup_noclflush(char *arg)
 {
        setup_clear_cpu_cap(X86_FEATURE_CLFLSH);