]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/parisc/kernel/processor.c
Merge branch 'rusty-cpumask-parisc' into parisc
[linux-2.6-omap-h63xx.git] / arch / parisc / kernel / processor.c
index 549f5484342c7d6e812edd457bf2c2475ec93fa1..e09d0f7fb6b047ad2c2cf34d95046f89f2263874 100644 (file)
@@ -3,7 +3,7 @@
  *    Initial setup-routines for HP 9000 based hardware.
  *
  *    Copyright (C) 1991, 1992, 1995  Linus Torvalds
- *    Modifications for PA-RISC (C) 1999 Helge Deller <deller@gmx.de>
+ *    Modifications for PA-RISC (C) 1999-2008 Helge Deller <deller@gmx.de>
  *    Modifications copyright 1999 SuSE GmbH (Philipp Rumpf)
  *    Modifications copyright 2000 Martin K. Petersen <mkp@mkp.net>
  *    Modifications copyright 2000 Philipp Rumpf <prumpf@tux.org>
@@ -46,7 +46,7 @@
 struct system_cpuinfo_parisc boot_cpu_data __read_mostly;
 EXPORT_SYMBOL(boot_cpu_data);
 
-struct cpuinfo_parisc cpu_data[NR_CPUS] __read_mostly;
+DEFINE_PER_CPU(struct cpuinfo_parisc, cpu_data);
 
 extern int update_cr16_clocksource(void);      /* from time.c */
 
@@ -68,6 +68,23 @@ extern int update_cr16_clocksource(void);    /* from time.c */
 ** The initialization of OS data structures is the same (done below).
 */
 
+/**
+ * init_cpu_profiler - enable/setup per cpu profiling hooks.
+ * @cpunum: The processor instance.
+ *
+ * FIXME: doesn't do much yet...
+ */
+static void __cpuinit
+init_percpu_prof(unsigned long cpunum)
+{
+       struct cpuinfo_parisc *p;
+
+       p = &per_cpu(cpu_data, cpunum);
+       p->prof_counter = 1;
+       p->prof_multiplier = 1;
+}
+
+
 /**
  * processor_probe - Determine if processor driver should claim this device.
  * @dev: The device which has been found.
@@ -82,7 +99,12 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
        unsigned long cpuid;
        struct cpuinfo_parisc *p;
 
-#ifndef CONFIG_SMP
+#ifdef CONFIG_SMP
+       if (num_online_cpus() >= nr_cpu_ids) {
+               printk(KERN_INFO "num_online_cpus() >= nr_cpu_ids\n");
+               return 1;
+       }
+#else
        if (boot_cpu_data.cpu_count > 0) {
                printk(KERN_INFO "CONFIG_SMP=n  ignoring additional CPUs\n");
                return 1;
@@ -142,7 +164,7 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
        }
 #endif
 
-       p = &cpu_data[cpuid];
+       p = &per_cpu(cpu_data, cpuid);
        boot_cpu_data.cpu_count++;
 
        /* initialize counters - CPU 0 gets it_value set in time_init() */
@@ -157,12 +179,9 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
 #ifdef CONFIG_SMP
        /*
        ** FIXME: review if any other initialization is clobbered
-       **      for boot_cpu by the above memset().
+       **        for boot_cpu by the above memset().
        */
-
-       /* stolen from init_percpu_prof() */
-       cpu_data[cpuid].prof_counter = 1;
-       cpu_data[cpuid].prof_multiplier = 1;
+       init_percpu_prof(cpuid);
 #endif
 
        /*
@@ -195,7 +214,7 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
         */
 #ifdef CONFIG_SMP
        if (cpuid) {
-               cpu_set(cpuid, cpu_present_map);
+               set_cpu_present(cpuid, true);
                cpu_up(cpuid);
        }
 #endif
@@ -256,19 +275,6 @@ void __init collect_boot_cpu_data(void)
 }
 
 
-/**
- * init_cpu_profiler - enable/setup per cpu profiling hooks.
- * @cpunum: The processor instance.
- *
- * FIXME: doesn't do much yet...
- */
-static inline void __init
-init_percpu_prof(int cpunum)
-{
-       cpu_data[cpunum].prof_counter = 1;
-       cpu_data[cpunum].prof_multiplier = 1;
-}
-
 
 /**
  * init_per_cpu - Handle individual processor initializations.
@@ -288,7 +294,7 @@ init_percpu_prof(int cpunum)
  *
  * o Enable CPU profiling hooks.
  */
-int __init init_per_cpu(int cpunum)
+int __cpuinit init_per_cpu(int cpunum)
 {
        int ret;
        struct pdc_coproc_cfg coproc_cfg;
@@ -302,8 +308,8 @@ int __init init_per_cpu(int cpunum)
                /* FWIW, FP rev/model is a more accurate way to determine
                ** CPU type. CPU rev/model has some ambiguous cases.
                */
-               cpu_data[cpunum].fp_rev = coproc_cfg.revision;
-               cpu_data[cpunum].fp_model = coproc_cfg.model;
+               per_cpu(cpu_data, cpunum).fp_rev = coproc_cfg.revision;
+               per_cpu(cpu_data, cpunum).fp_model = coproc_cfg.model;
 
                printk(KERN_INFO  "FP[%d] enabled: Rev %ld Model %ld\n",
                        cpunum, coproc_cfg.revision, coproc_cfg.model);
@@ -339,16 +345,17 @@ int __init init_per_cpu(int cpunum)
 int
 show_cpuinfo (struct seq_file *m, void *v)
 {
-       int     n;
+       unsigned long cpu;
 
-       for(n=0; n<boot_cpu_data.cpu_count; n++) {
+       for_each_online_cpu(cpu) {
+               const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu);
 #ifdef CONFIG_SMP
-               if (0 == cpu_data[n].hpa)
+               if (0 == cpuinfo->hpa)
                        continue;
 #endif
-               seq_printf(m, "processor\t: %d\n"
+               seq_printf(m, "processor\t: %lu\n"
                                "cpu family\t: PA-RISC %s\n",
-                                n, boot_cpu_data.family_name);
+                                cpu, boot_cpu_data.family_name);
 
                seq_printf(m, "cpu\t\t: %s\n",  boot_cpu_data.cpu_name );
 
@@ -357,11 +364,18 @@ show_cpuinfo (struct seq_file *m, void *v)
                                 boot_cpu_data.cpu_hz / 1000000,
                                 boot_cpu_data.cpu_hz % 1000000  );
 
+               seq_printf(m, "capabilities\t:");
+               if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS32)
+                       seq_printf(m, " os32");
+               if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS64)
+                       seq_printf(m, " os64");
+               seq_printf(m, "\n");
+
                seq_printf(m, "model\t\t: %s\n"
                                "model name\t: %s\n",
                                 boot_cpu_data.pdc.sys_model_name,
-                                cpu_data[n].dev ? 
-                                cpu_data[n].dev->name : "Unknown" );
+                                cpuinfo->dev ?
+                                cpuinfo->dev->name : "Unknown");
 
                seq_printf(m, "hversion\t: 0x%08x\n"
                                "sversion\t: 0x%08x\n",
@@ -372,8 +386,8 @@ show_cpuinfo (struct seq_file *m, void *v)
                show_cache_info(m);
 
                seq_printf(m, "bogomips\t: %lu.%02lu\n",
-                            cpu_data[n].loops_per_jiffy / (500000 / HZ),
-                            (cpu_data[n].loops_per_jiffy / (5000 / HZ)) % 100);
+                            cpuinfo->loops_per_jiffy / (500000 / HZ),
+                            (cpuinfo->loops_per_jiffy / (5000 / HZ)) % 100);
 
                seq_printf(m, "software id\t: %ld\n\n",
                                boot_cpu_data.pdc.model.sw_id);