2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
|
2007-09-05 14:58:26 +08:00
|
|
|
#include <asm/fw/cfe/cfe_api.h>
|
|
|
|
#include <asm/fw/cfe/cfe_error.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Use CFE to find out how many CPUs are available, setting up
|
|
|
|
* phys_cpu_present_map and the logical/physical mappings.
|
|
|
|
* XXXKW will the boot CPU ever not be physical 0?
|
|
|
|
*
|
|
|
|
* Common setup before any secondaries are started
|
|
|
|
*/
|
2006-02-23 20:23:27 +08:00
|
|
|
void __init plat_smp_setup(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
cpus_clear(phys_cpu_present_map);
|
|
|
|
cpu_set(0, phys_cpu_present_map);
|
|
|
|
__cpu_number_map[0] = 0;
|
|
|
|
__cpu_logical_map[0] = 0;
|
|
|
|
|
2006-02-23 20:23:27 +08:00
|
|
|
for (i = 1, num = 0; i < NR_CPUS; i++) {
|
2005-04-17 06:20:36 +08:00
|
|
|
if (cfe_cpu_stop(i) == 0) {
|
|
|
|
cpu_set(i, phys_cpu_present_map);
|
|
|
|
__cpu_number_map[i] = ++num;
|
|
|
|
__cpu_logical_map[num] = i;
|
|
|
|
}
|
|
|
|
}
|
2006-02-23 20:23:27 +08:00
|
|
|
printk(KERN_INFO "Detected %i available secondary CPU(s)\n", num);
|
|
|
|
}
|
|
|
|
|
|
|
|
void __init plat_prepare_cpus(unsigned int max_cpus)
|
|
|
|
{
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup the PC, SP, and GP of a secondary processor and start it
|
|
|
|
* running!
|
|
|
|
*/
|
2007-08-06 21:02:12 +08:00
|
|
|
void __cpuinit prom_boot_secondary(int cpu, struct task_struct *idle)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
int retval;
|
2005-09-04 06:56:17 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap,
|
|
|
|
__KSTK_TOS(idle),
|
2006-01-12 17:06:07 +08:00
|
|
|
(unsigned long)task_thread_info(idle), 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (retval != 0)
|
|
|
|
printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Code to run on secondary just after probing the CPU
|
|
|
|
*/
|
2007-08-06 21:02:12 +08:00
|
|
|
void __cpuinit prom_init_secondary(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-10-20 14:56:38 +08:00
|
|
|
#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
|
|
|
|
extern void bcm1480_smp_init(void);
|
|
|
|
bcm1480_smp_init();
|
|
|
|
#elif defined(CONFIG_SIBYTE_SB1250)
|
2005-04-17 06:20:36 +08:00
|
|
|
extern void sb1250_smp_init(void);
|
|
|
|
sb1250_smp_init();
|
2005-10-20 14:56:38 +08:00
|
|
|
#else
|
|
|
|
#error invalid SMP configuration
|
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do any tidying up before marking online and running the idle
|
|
|
|
* loop
|
|
|
|
*/
|
2007-08-06 21:02:12 +08:00
|
|
|
void __cpuinit prom_smp_finish(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-10-20 14:56:38 +08:00
|
|
|
#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
|
|
|
|
extern void bcm1480_smp_finish(void);
|
|
|
|
bcm1480_smp_finish();
|
|
|
|
#elif defined(CONFIG_SIBYTE_SB1250)
|
2005-04-17 06:20:36 +08:00
|
|
|
extern void sb1250_smp_finish(void);
|
|
|
|
sb1250_smp_finish();
|
2005-10-20 14:56:38 +08:00
|
|
|
#else
|
|
|
|
#error invalid SMP configuration
|
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Final cleanup after all secondaries booted
|
|
|
|
*/
|
|
|
|
void prom_cpus_done(void)
|
|
|
|
{
|
|
|
|
}
|