From owner-svn-src-projects@FreeBSD.ORG Thu Oct 1 16:17:45 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B06B10656C4; Thu, 1 Oct 2009 16:17:45 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 109ED8FC1D; Thu, 1 Oct 2009 16:17:45 +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 n91GHiM0057100; Thu, 1 Oct 2009 16:17:44 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n91GHiB6057098; Thu, 1 Oct 2009 16:17:44 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <200910011617.n91GHiB6057098@svn.freebsd.org> From: Sean Bruno Date: Thu, 1 Oct 2009 16:17:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197677 - projects/sbruno_firewire/sys/dev/firewire X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 01 Oct 2009 16:17:45 -0000 Author: sbruno Date: Thu Oct 1 16:17:44 2009 New Revision: 197677 URL: http://svn.freebsd.org/changeset/base/197677 Log: Quick and dirty callout implementation for debugging purposes to allow non-booting systems to bypass an initialization failure at startup. Modified: projects/sbruno_firewire/sys/dev/firewire/sbp.c Modified: projects/sbruno_firewire/sys/dev/firewire/sbp.c ============================================================================== --- projects/sbruno_firewire/sys/dev/firewire/sbp.c Thu Oct 1 15:51:29 2009 (r197676) +++ projects/sbruno_firewire/sys/dev/firewire/sbp.c Thu Oct 1 16:17:44 2009 (r197677) @@ -252,10 +252,12 @@ struct sbp_softc { #define SIMQ_FREEZED 1 int flags; struct mtx mtx; + struct callout busreset_timeout; }; #define SBP_LOCK(sbp) mtx_lock(&(sbp)->mtx) #define SBP_UNLOCK(sbp) mtx_unlock(&(sbp)->mtx) +static void sbp_busreset_timeout(void *); static void sbp_post_explore (void *); static void sbp_recv (struct fw_xfer *); static void sbp_mgm_callback (struct fw_xfer *); @@ -815,10 +817,29 @@ END_DEBUG if ((sbp->sim->flags & SIMQ_FREEZED) == 0) { sbp->sim->flags |= SIMQ_FREEZED; xpt_freeze_simq(sbp->sim, /*count*/1); + callout_reset(&sbp->busreset_timeout, + scan_delay * hz / 1000, + sbp_busreset_timeout, + (void *)sbp); } SBP_UNLOCK(sbp); microtime(&sbp->last_busreset); } +static void +sbp_busreset_timeout(void *arg) +{ + struct sbp_softc *sbp; + + sbp = (struct sbp_softc *)arg; + + callout_stop(&sbp->busreset_timeout); + printf("%s: Failed to recieved SID from fwohci\n", __func__); + SBP_LOCK(sbp); + xpt_release_simq(sbp->sim, /*run queue*/TRUE); + sbp->sim->flags &= ~SIMQ_FREEZED; + SBP_UNLOCK(sbp); +} + static void sbp_post_explore(void *arg) @@ -828,6 +849,7 @@ sbp_post_explore(void *arg) struct fw_device *fwdev; int i, alive; + callout_stop(&sbp->busreset_timeout); SBP_DEBUG(0) printf("sbp_post_explore (sbp_cold=%d)\n", sbp_cold); END_DEBUG @@ -2063,6 +2085,7 @@ END_DEBUG sbp->fd.post_busreset = sbp_post_busreset; sbp->fd.post_explore = sbp_post_explore; + CALLOUT_INIT(&sbp->busreset_timeout); if (fc->status != -1) { s = splfw(); sbp_post_busreset((void *)sbp); @@ -2359,6 +2382,8 @@ SBP_DEBUG(1) ccb->ccb_h.target_id, ccb->ccb_h.target_lun); END_DEBUG + printf("%s: ccb func_code = %x\n", __func__, ccb->ccb_h.func_code); + switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: case XPT_RESET_DEV: