sh: Populate initial secondary CPU info from boot_cpu_data.
[safe/jmp/linux-2.6] / arch / powerpc / kernel / setup-common.c
index 61a3f41..4271f7a 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/seq_file.h>
 #include <linux/ioport.h>
 #include <linux/console.h>
-#include <linux/utsname.h>
 #include <linux/screen_info.h>
 #include <linux/root_dev.h>
 #include <linux/notifier.h>
@@ -35,6 +34,7 @@
 #include <linux/debugfs.h>
 #include <linux/percpu.h>
 #include <linux/lmb.h>
+#include <linux/of_platform.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/processor.h>
@@ -59,6 +59,7 @@
 #include <asm/mmu.h>
 #include <asm/xmon.h>
 #include <asm/cputhreads.h>
+#include <mm/mmu_decl.h>
 
 #include "setup.h"
 
@@ -190,6 +191,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                if (ppc_md.show_cpuinfo != NULL)
                        ppc_md.show_cpuinfo(m);
 
+#ifdef CONFIG_PPC32
+               /* Display the amount of memory */
+               seq_printf(m, "Memory\t\t: %d MB\n",
+                          (unsigned int)(total_memory / (1024 * 1024)));
+#endif
+
                return 0;
        }
 
@@ -254,8 +261,21 @@ static int show_cpuinfo(struct seq_file *m, void *v)
        /* If we are a Freescale core do a simple check so
         * we dont have to keep adding cases in the future */
        if (PVR_VER(pvr) & 0x8000) {
-               maj = PVR_MAJ(pvr);
-               min = PVR_MIN(pvr);
+               switch (PVR_VER(pvr)) {
+               case 0x8000:    /* 7441/7450/7451, Voyager */
+               case 0x8001:    /* 7445/7455, Apollo 6 */
+               case 0x8002:    /* 7447/7457, Apollo 7 */
+               case 0x8003:    /* 7447A, Apollo 7 PM */
+               case 0x8004:    /* 7448, Apollo 8 */
+               case 0x800c:    /* 7410, Nitro */
+                       maj = ((pvr >> 8) & 0xF);
+                       min = PVR_MIN(pvr);
+                       break;
+               default:        /* e500/book-e */
+                       maj = PVR_MAJ(pvr);
+                       min = PVR_MIN(pvr);
+                       break;
+               }
        } else {
                switch (PVR_VER(pvr)) {
                        case 0x0020:    /* 403 family */
@@ -307,7 +327,7 @@ static void c_stop(struct seq_file *m, void *v)
 {
 }
 
-struct seq_operations cpuinfo_op = {
+const struct seq_operations cpuinfo_op = {
        .start =c_start,
        .next = c_next,
        .stop = c_stop,
@@ -367,7 +387,6 @@ static void __init cpu_init_thread_core_maps(int tpc)
  * setup_cpu_maps - initialize the following cpu maps:
  *                  cpu_possible_map
  *                  cpu_present_map
- *                  cpu_sibling_map
  *
  * Having the possible map set up early allows us to restrict allocations
  * of things like irqstacks to num_possible_cpus() rather than NR_CPUS.
@@ -412,9 +431,9 @@ void __init smp_setup_cpu_maps(void)
                for (j = 0; j < nthreads && cpu < NR_CPUS; j++) {
                        DBG("    thread %d -> cpu %d (hard id %d)\n",
                            j, cpu, intserv[j]);
-                       cpu_set(cpu, cpu_present_map);
+                       set_cpu_present(cpu, true);
                        set_hard_smp_processor_id(cpu, intserv[j]);
-                       cpu_set(cpu, cpu_possible_map);
+                       set_cpu_possible(cpu, true);
                        cpu++;
                }
        }
@@ -460,7 +479,7 @@ void __init smp_setup_cpu_maps(void)
                               maxcpus);
 
                for (cpu = 0; cpu < maxcpus; cpu++)
-                       cpu_set(cpu, cpu_possible_map);
+                       set_cpu_possible(cpu, true);
        out:
                of_node_put(dn);
        }
@@ -475,29 +494,6 @@ void __init smp_setup_cpu_maps(void)
         */
        cpu_init_thread_core_maps(nthreads);
 }
-
-/*
- * Being that cpu_sibling_map is now a per_cpu array, then it cannot
- * be initialized until the per_cpu areas have been created.  This
- * function is now called from setup_per_cpu_areas().
- */
-void __init smp_setup_cpu_sibling_map(void)
-{
-#ifdef CONFIG_PPC64
-       int i, cpu, base;
-
-       for_each_possible_cpu(cpu) {
-               DBG("Sibling map for CPU %d:", cpu);
-               base = cpu_first_thread_in_core(cpu);
-               for (i = 0; i < threads_per_core; i++) {
-                       cpu_set(base + i, per_cpu(cpu_sibling_map, cpu));
-                       DBG(" %d", base + i);
-               }
-               DBG("\n");
-       }
-
-#endif /* CONFIG_PPC64 */
-}
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_PCSPKR_PLATFORM
@@ -673,3 +669,37 @@ static int powerpc_debugfs_init(void)
 }
 arch_initcall(powerpc_debugfs_init);
 #endif
+
+static int ppc_dflt_bus_notify(struct notifier_block *nb,
+                               unsigned long action, void *data)
+{
+       struct device *dev = data;
+
+       /* We are only intereted in device addition */
+       if (action != BUS_NOTIFY_ADD_DEVICE)
+               return 0;
+
+       set_dma_ops(dev, &dma_direct_ops);
+
+       return NOTIFY_DONE;
+}
+
+static struct notifier_block ppc_dflt_plat_bus_notifier = {
+       .notifier_call = ppc_dflt_bus_notify,
+       .priority = INT_MAX,
+};
+
+static struct notifier_block ppc_dflt_of_bus_notifier = {
+       .notifier_call = ppc_dflt_bus_notify,
+       .priority = INT_MAX,
+};
+
+static int __init setup_bus_notifier(void)
+{
+       bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier);
+       bus_register_notifier(&of_platform_bus_type, &ppc_dflt_of_bus_notifier);
+
+       return 0;
+}
+
+arch_initcall(setup_bus_notifier);