Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jun 2010 21:14:23 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r209114 - head/sys/powerpc/aim
Message-ID:  <201006122114.o5CLENg9015047@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Sat Jun 12 21:14:22 2010
New Revision: 209114
URL: http://svn.freebsd.org/changeset/base/209114

Log:
  Make SMP work on MPC7400-based Apple desktops like the PowerMac3,3.

Modified:
  head/sys/powerpc/aim/mp_cpudep.c
  head/sys/powerpc/aim/platform_chrp.c

Modified: head/sys/powerpc/aim/mp_cpudep.c
==============================================================================
--- head/sys/powerpc/aim/mp_cpudep.c	Sat Jun 12 20:08:01 2010	(r209113)
+++ head/sys/powerpc/aim/mp_cpudep.c	Sat Jun 12 21:14:22 2010	(r209114)
@@ -75,9 +75,21 @@ cpudep_ap_bootstrap(void)
 }
 
 static register_t
-mpc745x_l2_enable(register_t l2cr_config)
+mpc74xx_l2_enable(register_t l2cr_config)
 {
-	register_t ccr;
+	register_t ccr, bit;
+	uint16_t	vers;
+
+	vers = mfpvr() >> 16;
+	switch (vers) {
+	case MPC7400:
+	case MPC7410:
+		bit = L2CR_L2IP;
+		break;
+	default:
+		bit = L2CR_L2I;
+		break;
+	}
 
 	ccr = mfspr(SPR_L2CR);
 	if (ccr & L2CR_L2E)
@@ -88,7 +100,7 @@ mpc745x_l2_enable(register_t l2cr_config
 	mtspr(SPR_L2CR, ccr | L2CR_L2I);
 	do {
 		ccr = mfspr(SPR_L2CR);
-	} while (ccr & L2CR_L2I);
+	} while (ccr & bit);
 	powerpc_sync();
 	mtspr(SPR_L2CR, l2cr_config);
 	powerpc_sync();
@@ -129,7 +141,7 @@ mpc745x_l3_enable(register_t l3cr_config
 }
 
 static register_t
-mpc745x_l1d_enable(void)
+mpc74xx_l1d_enable(void)
 {
 	register_t hid;
 
@@ -147,7 +159,7 @@ mpc745x_l1d_enable(void)
 }
 
 static register_t
-mpc745x_l1i_enable(void)
+mpc74xx_l1i_enable(void)
 {
 	register_t hid;
 
@@ -267,9 +279,9 @@ cpudep_ap_setup()
 		mtspr(SPR_HID0, bsp_state[0]); isync();
 		mtspr(SPR_HID1, bsp_state[1]); isync();
 
-		reg = mpc745x_l2_enable(bsp_state[2]);
-		reg = mpc745x_l1d_enable();
-		reg = mpc745x_l1i_enable();
+		reg = mpc74xx_l2_enable(bsp_state[2]);
+		reg = mpc74xx_l1d_enable();
+		reg = mpc74xx_l1i_enable();
 
 		break;
 	default:

Modified: head/sys/powerpc/aim/platform_chrp.c
==============================================================================
--- head/sys/powerpc/aim/platform_chrp.c	Sat Jun 12 20:08:01 2010	(r209113)
+++ head/sys/powerpc/aim/platform_chrp.c	Sat Jun 12 21:14:22 2010	(r209114)
@@ -228,8 +228,26 @@ chrp_smp_start_cpu(platform_t plat, stru
 
 	cpu = pc->pc_hwref;
 	res = OF_getprop(cpu, "soft-reset", &reset, sizeof(reset));
-	if (res < 0)
-		return (ENXIO);
+	if (res < 0) {
+		reset = 0x58;
+
+		switch (pc->pc_cpuid) {
+		case 0:
+			reset += 0x03;
+			break;
+		case 1:
+			reset += 0x04;
+			break;
+		case 2:
+			reset += 0x0f;
+			break;
+		case 4:
+			reset += 0x10;
+			break;
+		default:
+			return (ENXIO);
+		}
+	}
 
 	ap_pcpu = pc;
 
@@ -239,10 +257,12 @@ chrp_smp_start_cpu(platform_t plat, stru
 	rstvec = rstvec_virtbase + reset;
 
 	*rstvec = 4;
+	powerpc_sync();
 	(void)(*rstvec);
 	powerpc_sync();
 	DELAY(1);
 	*rstvec = 0;
+	powerpc_sync();
 	(void)(*rstvec);
 	powerpc_sync();
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006122114.o5CLENg9015047>