|
20 | 20 | #include <linux/seq_file.h> |
21 | 21 | #include <linux/cache.h> |
22 | 22 | #include <linux/delay.h> |
| 23 | +#include <linux/cpu.h> |
23 | 24 |
|
24 | 25 | #include <asm/ptrace.h> |
25 | 26 | #include <linux/atomic.h> |
|
32 | 33 | #include <asm/cacheflush.h> |
33 | 34 | #include <asm/tlbflush.h> |
34 | 35 | #include <asm/cpudata.h> |
| 36 | +#include <asm/timer.h> |
35 | 37 | #include <asm/leon.h> |
36 | 38 |
|
| 39 | +#include "kernel.h" |
37 | 40 | #include "irq.h" |
38 | 41 |
|
39 | 42 | volatile unsigned long cpu_callin_map[NR_CPUS] __cpuinitdata = {0,}; |
@@ -294,6 +297,89 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |
294 | 297 | return ret; |
295 | 298 | } |
296 | 299 |
|
| 300 | +void __cpuinit arch_cpu_pre_starting(void *arg) |
| 301 | +{ |
| 302 | + local_ops->cache_all(); |
| 303 | + local_ops->tlb_all(); |
| 304 | + |
| 305 | + switch(sparc_cpu_model) { |
| 306 | + case sun4m: |
| 307 | + sun4m_cpu_pre_starting(arg); |
| 308 | + break; |
| 309 | + case sun4d: |
| 310 | + sun4d_cpu_pre_starting(arg); |
| 311 | + break; |
| 312 | + case sparc_leon: |
| 313 | + leon_cpu_pre_starting(arg); |
| 314 | + break; |
| 315 | + default: |
| 316 | + BUG(); |
| 317 | + } |
| 318 | +} |
| 319 | + |
| 320 | +void __cpuinit arch_cpu_pre_online(void *arg) |
| 321 | +{ |
| 322 | + unsigned int cpuid = hard_smp_processor_id(); |
| 323 | + |
| 324 | + register_percpu_ce(cpuid); |
| 325 | + |
| 326 | + calibrate_delay(); |
| 327 | + smp_store_cpu_info(cpuid); |
| 328 | + |
| 329 | + local_ops->cache_all(); |
| 330 | + local_ops->tlb_all(); |
| 331 | + |
| 332 | + switch(sparc_cpu_model) { |
| 333 | + case sun4m: |
| 334 | + sun4m_cpu_pre_online(arg); |
| 335 | + break; |
| 336 | + case sun4d: |
| 337 | + sun4d_cpu_pre_online(arg); |
| 338 | + break; |
| 339 | + case sparc_leon: |
| 340 | + leon_cpu_pre_online(arg); |
| 341 | + break; |
| 342 | + default: |
| 343 | + BUG(); |
| 344 | + } |
| 345 | +} |
| 346 | + |
| 347 | +void __cpuinit sparc_start_secondary(void *arg) |
| 348 | +{ |
| 349 | + unsigned int cpu; |
| 350 | + |
| 351 | + /* |
| 352 | + * SMP booting is extremely fragile in some architectures. So run |
| 353 | + * the cpu initialization code first before anything else. |
| 354 | + */ |
| 355 | + arch_cpu_pre_starting(arg); |
| 356 | + |
| 357 | + preempt_disable(); |
| 358 | + cpu = smp_processor_id(); |
| 359 | + |
| 360 | + /* Invoke the CPU_STARTING notifier callbacks */ |
| 361 | + notify_cpu_starting(cpu); |
| 362 | + |
| 363 | + arch_cpu_pre_online(arg); |
| 364 | + |
| 365 | + /* Set the CPU in the cpu_online_mask */ |
| 366 | + set_cpu_online(cpu, true); |
| 367 | + |
| 368 | + /* Enable local interrupts now */ |
| 369 | + local_irq_enable(); |
| 370 | + |
| 371 | + wmb(); |
| 372 | + cpu_idle(); |
| 373 | + |
| 374 | + /* We should never reach here! */ |
| 375 | + BUG(); |
| 376 | +} |
| 377 | + |
| 378 | +void __cpuinit smp_callin(void) |
| 379 | +{ |
| 380 | + sparc_start_secondary(NULL); |
| 381 | +} |
| 382 | + |
297 | 383 | void smp_bogo(struct seq_file *m) |
298 | 384 | { |
299 | 385 | int i; |
|
0 commit comments