commented early_printk patch because of rejects.
[linux-flexiantxendom0-3.2.10.git] / arch / mips / sibyte / cfe / smp.c
1 /*
2  * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3  *
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.
8  *
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.
13  *
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.
17  */
18
19 #include <linux/sched.h>
20 #include <linux/smp.h>
21
22 #include <asm/mipsregs.h>
23
24 #include "cfe_api.h"
25 #include "cfe_error.h"
26
27 extern void asmlinkage smp_bootstrap(void);
28
29 /* Boot all other cpus in the system, initialize them, and
30    bring them into the boot fn */
31 int prom_boot_secondary(int cpu, unsigned long sp, unsigned long gp)
32 {
33         int retval;
34         
35         retval = cfe_cpu_start(cpu, &smp_bootstrap, sp, gp, 0);
36         if (retval != 0) {
37                 printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval);
38                 return 0;
39         } else {
40                 return 1;
41         }
42 }
43
44 void prom_init_secondary(void)
45 {
46         extern void load_mmu(void);
47         unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 |
48                 STATUSF_IP1 | STATUSF_IP0;
49
50         /* Enable basic interrupts */
51         change_c0_status(ST0_IM, imask);
52         set_c0_status(ST0_IE);
53
54         /* cache and TLB setup */
55         load_mmu();
56 }
57
58 /*
59  * Set up state, return the total number of cpus in the system, including
60  * the master
61  */
62 void prom_setup_smp(void)
63 {
64         int i;
65
66         /* Use CFE to find out how many CPUs are available */
67         for (i=1; i<NR_CPUS; i++) {
68                 if (cfe_cpu_stop(i) == 0) {
69                         CPUMASK_SETB(cpu_online_map, i);
70                 }
71         }
72         printk("Detected %i available CPU(s)\n", num_online_cpus());
73 }
74
75 void prom_smp_finish(void)
76 {
77         extern void sb1250_smp_finish(void);
78         sb1250_smp_finish();
79 }