From owner-svn-src-all@FreeBSD.ORG Sat Jun 12 21:14:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82E2A1065677; Sat, 12 Jun 2010 21:14:23 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58CAE8FC0C; Sat, 12 Jun 2010 21:14:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5CLENmx015049; Sat, 12 Jun 2010 21:14:23 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5CLENg9015047; Sat, 12 Jun 2010 21:14:23 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006122114.o5CLENg9015047@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 12 Jun 2010 21:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209114 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jun 2010 21:14:23 -0000 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();