aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/smp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/smp.c')
-rw-r--r--arch/sparc/kernel/smp.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/arch/sparc/kernel/smp.c b/arch/sparc/kernel/smp.c
index 40b42c88e6a7..6135d4faeeeb 100644
--- a/arch/sparc/kernel/smp.c
+++ b/arch/sparc/kernel/smp.c
@@ -58,7 +58,7 @@ cpumask_t smp_commenced_mask = CPU_MASK_NONE;
58/* Used to make bitops atomic */ 58/* Used to make bitops atomic */
59unsigned char bitops_spinlock = 0; 59unsigned char bitops_spinlock = 0;
60 60
61void __init smp_store_cpu_info(int id) 61void __cpuinit smp_store_cpu_info(int id)
62{ 62{
63 int cpu_node; 63 int cpu_node;
64 64
@@ -267,22 +267,18 @@ int setup_profiling_timer(unsigned int multiplier)
267void __init smp_prepare_cpus(unsigned int max_cpus) 267void __init smp_prepare_cpus(unsigned int max_cpus)
268{ 268{
269 extern void smp4m_boot_cpus(void); 269 extern void smp4m_boot_cpus(void);
270 int i, cpuid, ncpus, extra; 270 int i, cpuid, extra;
271 271
272 BUG_ON(sparc_cpu_model != sun4m); 272 BUG_ON(sparc_cpu_model != sun4m);
273 printk("Entering SMP Mode...\n"); 273 printk("Entering SMP Mode...\n");
274 274
275 ncpus = 1;
276 extra = 0; 275 extra = 0;
277 for (i = 0; !cpu_find_by_instance(i, NULL, &cpuid); i++) { 276 for (i = 0; !cpu_find_by_instance(i, NULL, &cpuid); i++) {
278 if (cpuid == boot_cpu_id) 277 if (cpuid >= NR_CPUS)
279 continue;
280 if (cpuid < NR_CPUS && ncpus++ < max_cpus)
281 cpu_set(cpuid, phys_cpu_present_map);
282 else
283 extra++; 278 extra++;
284 } 279 }
285 if (max_cpus >= NR_CPUS && extra) 280 /* i = number of cpus */
281 if (extra && max_cpus > i - extra)
286 printk("Warning: NR_CPUS is too low to start all cpus\n"); 282 printk("Warning: NR_CPUS is too low to start all cpus\n");
287 283
288 smp_store_cpu_info(boot_cpu_id); 284 smp_store_cpu_info(boot_cpu_id);
@@ -290,7 +286,25 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
290 smp4m_boot_cpus(); 286 smp4m_boot_cpus();
291} 287}
292 288
293void __devinit smp_prepare_boot_cpu(void) 289/* Set this up early so that things like the scheduler can init
290 * properly. We use the same cpu mask for both the present and
291 * possible cpu map.
292 */
293void __init smp_setup_cpu_possible_map(void)
294{
295 int instance, mid;
296
297 instance = 0;
298 while (!cpu_find_by_instance(instance, NULL, &mid)) {
299 if (mid < NR_CPUS) {
300 cpu_set(mid, phys_cpu_present_map);
301 cpu_set(mid, cpu_present_map);
302 }
303 instance++;
304 }
305}
306
307void __init smp_prepare_boot_cpu(void)
294{ 308{
295 int cpuid = hard_smp_processor_id(); 309 int cpuid = hard_smp_processor_id();
296 310
@@ -306,7 +320,7 @@ void __devinit smp_prepare_boot_cpu(void)
306 cpu_set(cpuid, phys_cpu_present_map); 320 cpu_set(cpuid, phys_cpu_present_map);
307} 321}
308 322
309int __devinit __cpu_up(unsigned int cpu) 323int __cpuinit __cpu_up(unsigned int cpu)
310{ 324{
311 extern int smp4m_boot_one_cpu(int); 325 extern int smp4m_boot_one_cpu(int);
312 int ret; 326 int ret;