patch-2.2.12 linux/arch/ppc/kernel/smp.c

Next file: linux/arch/ppc/kernel/syscalls.c
Previous file: linux/arch/ppc/kernel/sleep.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.11/linux/arch/ppc/kernel/smp.c linux/arch/ppc/kernel/smp.c
@@ -1,5 +1,5 @@
 /*
- * $Id: smp.c,v 1.49.2.3 1999/06/24 17:12:55 cort Exp $
+ * $Id: smp.c,v 1.49.2.5 1999/07/22 01:49:45 cort Exp $
  *
  * Smp support for ppc.
  *
@@ -57,6 +57,10 @@
 extern int cpu_idle(void *unused);
 u_int openpic_read(volatile u_int *addr);
 
+extern int mot_multi;
+extern unsigned long *MotSave_SmpIar;
+extern unsigned char *MotSave_CpusState[2];
+
 /* register for interrupting the secondary processor on the powersurge */
 #define PSURGE_INTR	((volatile unsigned *)0xf80000c0)
 
@@ -171,7 +175,7 @@
 void smp_message_pass(int target, int msg, unsigned long data, int wait)
 {
 	int i;
-	if ( !(_machine & (_MACH_Pmac|_MACH_chrp)) )
+	if ( !(_machine & (_MACH_Pmac|_MACH_chrp|_MACH_prep)) )
 		return;
 
 	spin_lock(&mesg_pass_lock);
@@ -197,8 +201,8 @@
 		break;
 	}
 	
-	if ( _machine == _MACH_Pmac )
-	{
+	switch (_machine) {
+	case _MACH_Pmac:
 		/* interrupt secondary processor */
 		out_be32(PSURGE_INTR, ~0);
 		out_be32(PSURGE_INTR, 0);
@@ -208,10 +212,10 @@
 		 */
 		/* interrupt primary */
 		/**(volatile unsigned long *)(0xf3019000);*/
-	}
+		break;
 	
-	if ( _machine == _MACH_chrp )
-	{
+	case _MACH_chrp:
+	case _MACH_prep:
 		/*
 		 * There has to be some way of doing this better -
 		 * perhaps a sent-to-all or send-to-all-but-self
@@ -234,6 +238,7 @@
 			openpic_cause_IPI(target, 0, 1U << target);
 			break;
 		}
+		break;
 	}
 	
 	spin_unlock(&mesg_pass_lock);
@@ -273,23 +278,27 @@
 	 */
 	cacheflush_time = 5 * 1024;
 
-	if ( !(_machine & (_MACH_Pmac|_MACH_chrp)) )
-	{
-		printk("SMP not supported on this machine.\n");
-		return;
-	}
-	
 	switch ( _machine )
 	{
 	case _MACH_Pmac:
 		/* assume powersurge board - 2 processors -- Cort */
-		cpu_nr = 2; 
+		cpu_nr = 2;
 		break;
 	case _MACH_chrp:
 		cpu_nr = ((openpic_read(&OpenPIC->Global.Feature_Reporting0)
 				 & OPENPIC_FEATURE_LAST_PROCESSOR_MASK) >>
 				OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT)+1;
 		break;
+ 	case _MACH_prep:
+ 		/* assume 2 for now == fix later -- Johnnie */
+		if ( mot_multi )
+		{
+			cpu_nr = 2;
+			break;
+		}
+	default:
+		printk("SMP not supported on this machine.\n");
+		return;
 	}
 
 	/*
@@ -343,6 +352,11 @@
 				   __pa(__secondary_start_chrp), i);
 #endif			
 			break;
+		case _MACH_prep:
+			*MotSave_SmpIar = (unsigned long)__secondary_start_psurge - KERNELBASE;
+			*MotSave_CpusState[1] = CPU_GOOD;
+			printk("CPU1 reset, waiting\n");
+			break;
 		}
 		
 		/*
@@ -399,12 +413,12 @@
 {
         smp_store_cpu_info(current->processor);
 	set_dec(decrementer_count);
-	
 #if 0
 	current->mm->mmap->vm_page_prot = PAGE_SHARED;
 	current->mm->mmap->vm_start = PAGE_OFFSET;
 	current->mm->mmap->vm_end = init_task.mm->mmap->vm_end;
 #endif
+	init_idle();
 	cpu_callin_map[current->processor] = 1;
 	while(!smp_commenced)
 		barrier();

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)