Merge ../linus
[pandora-kernel.git] / arch / x86_64 / kernel / setup.c
index 816203d..1129918 100644 (file)
@@ -63,7 +63,6 @@
 #include <asm/setup.h>
 #include <asm/mach_apic.h>
 #include <asm/numa.h>
-#include <asm/swiotlb.h>
 #include <asm/sections.h>
 #include <asm/dmi.h>
 
@@ -72,6 +71,7 @@
  */
 
 struct cpuinfo_x86 boot_cpu_data __read_mostly;
+EXPORT_SYMBOL(boot_cpu_data);
 
 unsigned long mmu_cr4_features;
 
@@ -100,12 +100,14 @@ char dmi_alloc_data[DMI_MAX_DATA];
  * Setup options
  */
 struct screen_info screen_info;
+EXPORT_SYMBOL(screen_info);
 struct sys_desc_table_struct {
        unsigned short length;
        unsigned char table[0];
 };
 
 struct edid_info edid_info;
+EXPORT_SYMBOL_GPL(edid_info);
 struct e820map e820;
 
 extern int root_mountflags;
@@ -702,10 +704,6 @@ void __init setup_arch(char **cmdline_p)
 
        e820_setup_gap();
 
-#ifdef CONFIG_IOMMU
-       iommu_hole_init();
-#endif
-
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
        conswitchp = &vga_con;
@@ -790,9 +788,9 @@ static int nearby_node(int apicid)
 static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
 {
 #ifdef CONFIG_SMP
-       int cpu = smp_processor_id();
        unsigned bits;
 #ifdef CONFIG_NUMA
+       int cpu = smp_processor_id();
        int node = 0;
        unsigned apicid = hard_smp_processor_id();
 #endif
@@ -810,12 +808,12 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
        }
 
        /* Low order bits define the core id (index of core in socket) */
-       cpu_core_id[cpu] = phys_proc_id[cpu] & ((1 << bits)-1);
+       c->cpu_core_id = c->phys_proc_id & ((1 << bits)-1);
        /* Convert the APIC ID into the socket ID */
-       phys_proc_id[cpu] = phys_pkg_id(bits);
+       c->phys_proc_id = phys_pkg_id(bits);
 
 #ifdef CONFIG_NUMA
-       node = phys_proc_id[cpu];
+       node = c->phys_proc_id;
        if (apicid_to_node[apicid] != NUMA_NO_NODE)
                node = apicid_to_node[apicid];
        if (!node_online(node)) {
@@ -828,7 +826,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
                   but in the same order as the HT nodeids.
                   If that doesn't result in a usable node fall back to the
                   path for the previous case.  */
-               int ht_nodeid = apicid - (phys_proc_id[0] << bits);
+               int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits);
                if (ht_nodeid >= 0 &&
                    apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
                        node = apicid_to_node[ht_nodeid];
@@ -838,15 +836,13 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
        }
        numa_set_node(cpu, node);
 
-       printk(KERN_INFO "CPU %d/%x(%d) -> Node %d -> Core %d\n",
-                       cpu, apicid, c->x86_max_cores, node, cpu_core_id[cpu]);
+       printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
 #endif
 #endif
 }
 
-static int __init init_amd(struct cpuinfo_x86 *c)
+static void __init init_amd(struct cpuinfo_x86 *c)
 {
-       int r;
        unsigned level;
 
 #ifdef CONFIG_SMP
@@ -879,8 +875,8 @@ static int __init init_amd(struct cpuinfo_x86 *c)
        if (c->x86 >= 6)
                set_bit(X86_FEATURE_FXSAVE_LEAK, &c->x86_capability);
 
-       r = get_model_name(c);
-       if (!r) { 
+       level = get_model_name(c);
+       if (!level) {
                switch (c->x86) { 
                case 15:
                        /* Should distinguish Models here, but this is only
@@ -901,8 +897,6 @@ static int __init init_amd(struct cpuinfo_x86 *c)
 
        /* Fix cpuid4 emulation for more */
        num_cache_leaves = 3;
-
-       return r;
 }
 
 static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
@@ -910,13 +904,14 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 #ifdef CONFIG_SMP
        u32     eax, ebx, ecx, edx;
        int     index_msb, core_bits;
-       int     cpu = smp_processor_id();
 
        cpuid(1, &eax, &ebx, &ecx, &edx);
 
 
-       if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY))
+       if (!cpu_has(c, X86_FEATURE_HT))
                return;
+       if (cpu_has(c, X86_FEATURE_CMP_LEGACY))
+               goto out;
 
        smp_num_siblings = (ebx & 0xff0000) >> 16;
 
@@ -931,10 +926,7 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
                }
 
                index_msb = get_count_order(smp_num_siblings);
-               phys_proc_id[cpu] = phys_pkg_id(index_msb);
-
-               printk(KERN_INFO  "CPU: Physical Processor ID: %d\n",
-                      phys_proc_id[cpu]);
+               c->phys_proc_id = phys_pkg_id(index_msb);
 
                smp_num_siblings = smp_num_siblings / c->x86_max_cores;
 
@@ -942,13 +934,15 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 
                core_bits = get_count_order(c->x86_max_cores);
 
-               cpu_core_id[cpu] = phys_pkg_id(index_msb) &
+               c->cpu_core_id = phys_pkg_id(index_msb) &
                                               ((1 << core_bits) - 1);
-
-               if (c->x86_max_cores > 1)
-                       printk(KERN_INFO  "CPU: Processor Core ID: %d\n",
-                              cpu_core_id[cpu]);
        }
+out:
+       if ((c->x86_max_cores * smp_num_siblings) > 1) {
+               printk(KERN_INFO  "CPU: Physical Processor ID: %d\n", c->phys_proc_id);
+               printk(KERN_INFO  "CPU: Processor Core ID: %d\n", c->cpu_core_id);
+       }
+
 #endif
 }
 
@@ -957,15 +951,12 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
  */
 static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
 {
-       unsigned int eax;
+       unsigned int eax, t;
 
        if (c->cpuid_level < 4)
                return 1;
 
-       __asm__("cpuid"
-               : "=a" (eax)
-               : "0" (4), "c" (0)
-               : "bx", "dx");
+       cpuid_count(4, 0, &eax, &t, &t, &t);
 
        if (eax & 0x1f)
                return ((eax >> 26) + 1);
@@ -978,16 +969,17 @@ static void srat_detect_node(void)
 #ifdef CONFIG_NUMA
        unsigned node;
        int cpu = smp_processor_id();
+       int apicid = hard_smp_processor_id();
 
        /* Don't do the funky fallback heuristics the AMD version employs
           for now. */
-       node = apicid_to_node[hard_smp_processor_id()];
+       node = apicid_to_node[apicid];
        if (node == NUMA_NO_NODE)
                node = first_node(node_online_map);
        numa_set_node(cpu, node);
 
        if (acpi_numa > 0)
-               printk(KERN_INFO "CPU %d -> Node %d\n", cpu, node);
+               printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
 #endif
 }
 
@@ -997,6 +989,13 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
        unsigned n;
 
        init_intel_cacheinfo(c);
+       if (c->cpuid_level > 9 ) {
+               unsigned eax = cpuid_eax(10);
+               /* Check for version and the number of counters */
+               if ((eax & 0xff) && (((eax>>8) & 0xff) > 1))
+                       set_bit(X86_FEATURE_ARCH_PERFMON, &c->x86_capability);
+       }
+
        n = c->extended_cpuid_level;
        if (n >= 0x80000008) {
                unsigned eax = cpuid_eax(0x80000008);
@@ -1088,7 +1087,7 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
        }
 
 #ifdef CONFIG_SMP
-       phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff;
+       c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
 #endif
 }
 
@@ -1215,7 +1214,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL,
-               NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow",
+               NULL, "fxsr_opt", NULL, "rdtscp", NULL, "lm", "3dnowext", "3dnow",
 
                /* Transmeta-defined */
                "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
@@ -1296,9 +1295,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 #ifdef CONFIG_SMP
        if (smp_num_siblings * c->x86_max_cores > 1) {
                int cpu = c - cpu_data;
-               seq_printf(m, "physical id\t: %d\n", phys_proc_id[cpu]);
+               seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
                seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu]));
-               seq_printf(m, "core id\t\t: %d\n", cpu_core_id[cpu]);
+               seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
                seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
        }
 #endif 
@@ -1372,7 +1371,7 @@ struct seq_operations cpuinfo_op = {
        .show = show_cpuinfo,
 };
 
-#ifdef CONFIG_INPUT_PCSPKR
+#if defined(CONFIG_INPUT_PCSPKR) || defined(CONFIG_INPUT_PCSPKR_MODULE)
 #include <linux/platform_device.h>
 static __init int add_pcspkr(void)
 {