From owner-svn-src-projects@FreeBSD.ORG Mon Sep 23 18:50:48 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 808DE424; Mon, 23 Sep 2013 18:50:48 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 52B13215B; Mon, 23 Sep 2013 18:50:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8NIomV5093318; Mon, 23 Sep 2013 18:50:48 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8NIom4O093317; Mon, 23 Sep 2013 18:50:48 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201309231850.r8NIom4O093317@svn.freebsd.org> From: Justin Hibbits Date: Mon, 23 Sep 2013 18:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r255822 - projects/pmac_pmu/sys/powerpc/powerpc X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2013 18:50:48 -0000 Author: jhibbits Date: Mon Sep 23 18:50:47 2013 New Revision: 255822 URL: http://svnweb.freebsd.org/changeset/base/255822 Log: Reduce the diff on mp_machdep.c against the original. Modified: projects/pmac_pmu/sys/powerpc/powerpc/mp_machdep.c Modified: projects/pmac_pmu/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- projects/pmac_pmu/sys/powerpc/powerpc/mp_machdep.c Mon Sep 23 18:12:25 2013 (r255821) +++ projects/pmac_pmu/sys/powerpc/powerpc/mp_machdep.c Mon Sep 23 18:50:47 2013 (r255822) @@ -60,10 +60,9 @@ __FBSDID("$FreeBSD$"); extern struct pcpu __pcpu[MAXCPU]; -extern void *ap_pcpu; volatile static int ap_awake; volatile static u_int ap_letgo; -volatile u_quad_t ap_timebase; +volatile static u_quad_t ap_timebase; static u_int ipi_msg_cnt[32]; static struct mtx ap_boot_mtx; struct pcb stoppcbs[MAXCPU]; @@ -73,28 +72,40 @@ void machdep_ap_bootstrap(void) { jmp_buf *restore; + + /* The following is needed for restoring from sleep. */ #ifdef __powerpc64__ /* Writing to the time base register is hypervisor-privileged */ if (mfmsr() & PSL_HV) - mttb(ap_timebase); + mttb(0); #else - mttb(ap_timebase); + mttb(0); #endif /* Set up important bits on the CPU (HID registers, etc.) */ cpudep_ap_setup(); - restore = PCPU_GET(restore); - if (restore != NULL) { - longjmp(*restore, 1); - } - /* Set PIR */ PCPU_SET(pir, mfspr(SPR_PIR)); PCPU_SET(awake, 1); __asm __volatile("msync; isync"); - while (ap_letgo == 0) - ; + if (mp_ncpus > 1 && !pcpup->pc_bsp) { + while (ap_letgo == 0) + ; + } + + restore = PCPU_GET(restore); + if (restore != NULL) { + longjmp(*restore, 1); + } + +#ifdef __powerpc64__ + /* Writing to the time base register is hypervisor-privileged */ + if (mfmsr() & PSL_HV) + mttb(ap_timebase); +#else + mttb(ap_timebase); +#endif /* Initialize DEC, sync with the BSP values */ decr_ap_init(); @@ -210,12 +221,10 @@ cpu_mp_unleash(void *dummy) struct pcpu *pc; int cpus, timeout; - mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); - - if (mp_ncpus <= 1) { - ap_letgo = 1; + if (mp_ncpus <= 1) return; - } + + mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); cpus = 0; smp_cpus = 0;