|
From: James S. <jsi...@us...> - 2002-05-30 20:42:43
|
Update of /cvsroot/linux-mips/linux/arch/mips/sibyte/swarm
In directory usw-pr-cvs1:/tmp/cvs-serv29100/arch/mips/sibyte/swarm
Modified Files:
cfe_api.c cfe_api.h setup.c smp.c
Log Message:
Updated Mips 64 to OSS tree.
Index: cfe_api.c
===================================================================
RCS file: /cvsroot/linux-mips/linux/arch/mips/sibyte/swarm/cfe_api.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cfe_api.c 19 Feb 2002 17:32:53 -0000 1.3
+++ cfe_api.c 30 May 2002 20:42:08 -0000 1.4
@@ -55,11 +55,10 @@
return 0;
}
+int cfe_iocb_dispatch(cfe_xiocb_t *xiocb);
int cfe_iocb_dispatch(cfe_xiocb_t *xiocb)
{
- if (!cfe_dispfunc)
- return -1;
-
+ if (!cfe_dispfunc) return -1;
return (*cfe_dispfunc)(cfe_handle,xiocb);
}
@@ -344,7 +343,7 @@
int cfe_start_cpu(int cpu, void (*fn)(void), long sp, long gp, long a1)
{
cfe_xiocb_t xiocb;
-
+
xiocb.xiocb_fcode = CFE_CMD_FW_CPUCTL;
xiocb.xiocb_status = 0;
xiocb.xiocb_handle = 0;
@@ -356,13 +355,30 @@
xiocb.plist.xiocb_cpuctl.sp_val = sp;
xiocb.plist.xiocb_cpuctl.a1_val = a1;
xiocb.plist.xiocb_cpuctl.start_addr = (long)fn;
-
+
cfe_iocb_dispatch(&xiocb);
-
+
return xiocb.xiocb_status;
}
+int cfe_stop_cpu(int cpu)
+{
+ cfe_xiocb_t xiocb;
+
+ xiocb.xiocb_fcode = CFE_CMD_FW_CPUCTL;
+ xiocb.xiocb_status = 0;
+ xiocb.xiocb_handle = 0;
+ xiocb.xiocb_flags = 0;
+ xiocb.xiocb_psize = sizeof(xiocb_cpuctl_t);
+ xiocb.plist.xiocb_cpuctl.cpu_number = cpu;
+ xiocb.plist.xiocb_cpuctl.cpu_command = CFE_CPU_CMD_STOP;
+
+ cfe_iocb_dispatch(&xiocb);
+
+ return xiocb.xiocb_status;
+}
+
void cfe_open_console()
{
cfe_console_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE);
@@ -374,7 +390,6 @@
int res;
if (cfe_console_handle != -1) {
- cfe_write(cfe_console_handle, str, strlen(str));
do {
res = cfe_writeblk(cfe_console_handle, 0, str, len);
if (res < 0)
@@ -384,3 +399,4 @@
} while (len);
}
}
+
Index: cfe_api.h
===================================================================
RCS file: /cvsroot/linux-mips/linux/arch/mips/sibyte/swarm/cfe_api.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cfe_api.h 28 Jan 2002 20:31:57 -0000 1.2
+++ cfe_api.h 30 May 2002 20:42:08 -0000 1.3
@@ -54,6 +54,7 @@
int cfe_flushcache(int flg);
int cfe_getstdhandle(int flg);
int cfe_start_cpu(int cpu, void (*fn)(void), long sp, long gp, long a1);
+int cfe_stop_cpu(int cpu);
void cfe_open_console(void);
void cfe_console_print(char *);
Index: setup.c
===================================================================
RCS file: /cvsroot/linux-mips/linux/arch/mips/sibyte/swarm/setup.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- setup.c 21 Apr 2002 20:01:13 -0000 1.11
+++ setup.c 30 May 2002 20:42:08 -0000 1.12
@@ -19,7 +19,7 @@
/*
* Setup code for the SWARM board
*/
-
+#include <linux/config.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/bootmem.h>
Index: smp.c
===================================================================
RCS file: /cvsroot/linux-mips/linux/arch/mips/sibyte/swarm/smp.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- smp.c 26 Feb 2002 17:34:15 -0000 1.7
+++ smp.c 30 May 2002 20:42:08 -0000 1.8
@@ -15,8 +15,6 @@
* 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/config.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/init.h>
@@ -38,13 +36,14 @@
int prom_boot_secondary(int cpu, unsigned long sp, unsigned long gp)
{
int retval;
-
- if ((retval = cfe_start_cpu(1, &smp_bootstrap, sp, gp, 0)) != 0) {
- printk("cfe_start_cpu returned %i\n" , retval);
- panic("secondary bootstrap failed");
+
+ retval = cfe_start_cpu(cpu, &smp_bootstrap, sp, gp, 0);
+ if (retval != 0) {
+ printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval);
+ return 0;
+ } else {
+ return 1;
}
-
- return 1;
}
@@ -66,23 +65,35 @@
*/
int prom_setup_smp(void)
{
- /* Nothing to do here */
- return 2;
+ int i;
+ int num_cpus = 1;
+
+ /* Use CFE to find out how many CPUs are available */
+ for (i=1; i<NR_CPUS; i++) {
+ if (cfe_stop_cpu(i) == 0) {
+ num_cpus++;
+ }
+ }
+ printk("Detected %i available CPU(s)\n", num_cpus);
+ return num_cpus;
}
void prom_smp_finish(void)
{
+ extern void sb1250_smp_finish(void);
sb1250_smp_finish();
}
/*
* XXX This is really halfway portable code and halfway system specific code.
+ * XXX Seems like some of this is CPU-specific, too - rather than board/system.
*/
extern atomic_t cpus_booted;
void __init smp_boot_cpus(void)
{
int i;
+ int cur_cpu = 0;
smp_num_cpus = prom_setup_smp();
init_new_context(current, &init_mm);
@@ -92,10 +103,18 @@
CPUMASK_CLRALL(cpu_online_map);
CPUMASK_SETB(cpu_online_map, 0);
atomic_set(&cpus_booted, 1); /* Master CPU is already booted... */
+ __cpu_number_map[0] = 0;
+ __cpu_logical_map[0] = 0;
init_idle();
- for (i = 1; i < smp_num_cpus; i++) {
+
+ /*
+ * This loop attempts to compensate for "holes" in the CPU
+ * numbering. It's overkill, but general.
+ */
+ for (i = 1; i < smp_num_cpus; ) {
struct task_struct *p;
struct pt_regs regs;
+ int retval;
printk("Starting CPU %d... ", i);
/* Spawn a new process normally. Grab a pointer to
@@ -115,9 +134,20 @@
del_from_runqueue(p);
unhash_process(p);
- prom_boot_secondary(i,
- (unsigned long)p + KERNEL_STACK_SIZE - 32,
- (unsigned long)p);
+ do {
+ /* Iterate until we find a CPU that comes up */
+ cur_cpu++;
+ retval = prom_boot_secondary(cur_cpu,
+ (unsigned long)p + KERNEL_STACK_SIZE - 32,
+ (unsigned long)p);
+ __cpu_number_map[i] = i;
+ __cpu_logical_map[i] = i;
+ } while (!retval && (cur_cpu < NR_CPUS));
+ if (retval) {
+ i++;
+ } else {
+ panic("CPU discovery disaster");
+ }
#if 0
/* This is copied from the ip-27 code in the mips64 tree */
|