2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #include <linux/init.h>
20 #include <linux/sched.h>
21 #include <linux/smp.h>
22 #include <asm/processor.h>
25 #include "cfe_error.h"
28 * Use CFE to find out how many CPUs are available, setting up
29 * phys_cpu_present_map and the logical/physical mappings.
30 * XXXKW will the boot CPU ever not be physical 0?
32 void __init prom_build_cpu_map(void)
36 cpus_clear(phys_cpu_present_map);
37 cpu_set(0, phys_cpu_present_map);
38 __cpu_number_map[0] = 0;
39 __cpu_logical_map[0] = 0;
41 for (i=1, num=0; i<NR_CPUS; i++) {
42 if (cfe_cpu_stop(i) == 0) {
43 cpu_set(i, phys_cpu_present_map);
44 __cpu_number_map[i] = ++num;
45 __cpu_logical_map[num] = i;
48 printk("Detected %i available secondary CPU(s)\n", num);
52 * Common setup before any secondaries are started
54 void prom_prepare_cpus(unsigned int max_cpus)
59 * Setup the PC, SP, and GP of a secondary processor and start it
62 void prom_boot_secondary(int cpu, struct task_struct *idle)
66 retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap,
68 (unsigned long)idle->thread_info, 0);
70 printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval);
74 * Code to run on secondary just after probing the CPU
76 void prom_init_secondary(void)
78 extern void sb1250_smp_init(void);
83 * Do any tidying up before marking online and running the idle
86 void prom_smp_finish(void)
88 extern void sb1250_smp_finish(void);
93 * Final cleanup after all secondaries booted
95 void prom_cpus_done(void)