From owner-svn-src-all@FreeBSD.ORG Thu Feb 27 21:48:35 2014 Return-Path: Delivered-To: svn-src-all@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 ESMTPS id 0C244833; Thu, 27 Feb 2014 21:48:35 +0000 (UTC) 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 E1C06195C; Thu, 27 Feb 2014 21:48:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1RLmYh2094639; Thu, 27 Feb 2014 21:48:34 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1RLmYVS094638; Thu, 27 Feb 2014 21:48:34 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201402272148.s1RLmYVS094638@svn.freebsd.org> From: Alexander Motin Date: Thu, 27 Feb 2014 21:48:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262575 - head/sys/dev/mps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 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: Thu, 27 Feb 2014 21:48:35 -0000 Author: mav Date: Thu Feb 27 21:48:34 2014 New Revision: 262575 URL: http://svnweb.freebsd.org/changeset/base/262575 Log: Restore SIM freeze/release match, broken at r253549. This fixes problem with SIM left in frozen state after reinit, for example, after firmware update. MFC after: 1 week Modified: head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Thu Feb 27 21:47:20 2014 (r262574) +++ head/sys/dev/mps/mps_sas.c Thu Feb 27 21:48:34 2014 (r262575) @@ -180,6 +180,9 @@ mpssas_startup_increment(struct mpssas_s /* just starting, freeze the simq */ mps_dprint(sassc->sc, MPS_INIT, "%s freezing simq\n", __func__); +#if __FreeBSD_version >= 1000039 + xpt_hold_boot(); +#endif xpt_freeze_simq(sassc->sim, 1); } mps_dprint(sassc->sc, MPS_INIT, "%s refcount %u\n", __func__, @@ -200,10 +203,10 @@ mpssas_startup_decrement(struct mpssas_s mps_dprint(sassc->sc, MPS_INIT, "%s releasing simq\n", __func__); sassc->flags &= ~MPSSAS_IN_STARTUP; + xpt_release_simq(sassc->sim, 1); #if __FreeBSD_version >= 1000039 xpt_release_boot(); #else - xpt_release_simq(sassc->sim, 1); mpssas_rescan_target(sassc->sc, NULL); #endif } @@ -763,12 +766,8 @@ mps_attach_sas(struct mps_softc *sc) * Hold off boot until discovery is complete. */ sassc->flags |= MPSSAS_IN_STARTUP | MPSSAS_IN_DISCOVERY; -#if __FreeBSD_version >= 1000039 - xpt_hold_boot(); -#else - xpt_freeze_simq(sassc->sim, 1); -#endif sc->sassc->startup_refcount = 0; + mpssas_startup_increment(sassc); callout_init(&sassc->discovery_callout, 1 /*mpsafe*/); sassc->discovery_timeouts = 0; @@ -1139,7 +1138,7 @@ mpssas_handle_reinit(struct mps_softc *s mps_dprint(sc, MPS_INIT, "%s startup\n", __func__); sc->sassc->flags |= MPSSAS_IN_STARTUP; sc->sassc->flags |= MPSSAS_IN_DISCOVERY; - xpt_freeze_simq(sc->sassc->sim, 1); + mpssas_startup_increment(sc->sassc); /* notify CAM of a bus reset */ mpssas_announce_reset(sc, AC_BUS_RESET, CAM_TARGET_WILDCARD, @@ -1152,12 +1151,6 @@ mpssas_handle_reinit(struct mps_softc *s "%s startup %u tm %u after command completion\n", __func__, sc->sassc->startup_refcount, sc->sassc->tm_count); - /* - * The simq was explicitly frozen above, so set the refcount to 0. - * The simq will be explicitly released after port enable completes. - */ - sc->sassc->startup_refcount = 0; - /* zero all the target handles, since they may change after the * reset, and we have to rediscover all the targets and use the new * handles. @@ -3461,15 +3454,12 @@ mpssas_read_cap_done(struct cam_periph * int mpssas_startup(struct mps_softc *sc) { - struct mpssas_softc *sassc; /* * Send the port enable message and set the wait_for_port_enable flag. * This flag helps to keep the simq frozen until all discovery events * are processed. */ - sassc = sc->sassc; - mpssas_startup_increment(sassc); sc->wait_for_port_enable = 1; mpssas_send_portenable(sc); return (0); @@ -3554,7 +3544,6 @@ mpssas_portenable_complete(struct mps_so sc->port_enable_complete = 1; wakeup(&sc->port_enable_complete); mpssas_startup_decrement(sassc); - xpt_release_simq(sassc->sim, 1); } int