From owner-p4-projects@FreeBSD.ORG Mon Jun 7 18:15:35 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 69BF216A4DA; Mon, 7 Jun 2004 18:15:35 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 200AF16A4CE for ; Mon, 7 Jun 2004 18:15:35 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1BAB943D48 for ; Mon, 7 Jun 2004 18:15:35 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i57IEqr9083578 for ; Mon, 7 Jun 2004 18:14:52 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i57IEpQG083575 for perforce@freebsd.org; Mon, 7 Jun 2004 18:14:51 GMT (envelope-from scottl@freebsd.org) Date: Mon, 7 Jun 2004 18:14:51 GMT Message-Id: <200406071814.i57IEpQG083575@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Subject: PERFORCE change 54331 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2004 18:15:36 -0000 http://perforce.freebsd.org/chv.cgi?CH=54331 Change 54331 by scottl@scottl-esp-sparc64 on 2004/06/07 18:14:37 CAM does not track timeouts itself, it just provides a timeout hint for drivers to use for doing their own tracking. Adjust the use of the callout API for this. Also fix up ncr53c9x_select(). Affected files ... .. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#9 edit .. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9xvar.h#7 edit Differences ... ==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#9 (text+ko) ==== @@ -150,6 +150,13 @@ } \ } while (0) +#ifndef mstohz +#define mstohz(ms) \ + (((ms) < 0x20000) ? \ + ((ms +0u) / 1000u) * hz : \ + ((ms +0u) * hz) /1000u) +#endif + static int ecb_zone_initialized = 0; static uma_zone_t ecb_zone; @@ -447,7 +454,7 @@ sc->sc_state = NCR_CLEANING; sc->sc_msgify = 0; if ((ecb = sc->sc_nexus) != NULL) { - ecb->xs->error = XS_TIMEOUT; + ecb->ccb->ccb_h.status = CAM_CMD_TIMEOUT; ncr53c9x_done(sc, ecb); } /* Cancel outstanding disconnected commands on each LUN */ @@ -462,13 +469,15 @@ * that never reached the disk? */ li->busy = 0; - ecb->xs->error = XS_TIMEOUT; + ecb->ccb->ccb_h.status = + CAM_CMD_TIMEOUT; ncr53c9x_done(sc, ecb); } for (i = 0; i < 256; i++) if ((ecb = li->queued[i])) { li->queued[i] = NULL; - ecb->xs->error = XS_TIMEOUT; + ecb->ccb->ccb_h.status = + CAM_CMD_TIMEOUT; ncr53c9x_done(sc, ecb); } li->used = 0; @@ -621,9 +630,8 @@ struct ncr53c9x_softc *sc; struct ncr53c9x_ecb *ecb; { - struct scsipi_periph *periph = ecb->xs->xs_periph; - int target = periph->periph_target; - int lun = periph->periph_lun; + int target = ecb->ccb->ccb_h.target_id; + int lun = ecb->ccb->ccb_h.target_lun; struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[target]; int tiflags = ti->flags; u_char *cmd; @@ -640,10 +648,8 @@ * expecting to come back due to an interrupt, because it is * always possible that the interrupt may never happen. */ - if ((ecb->xs->xs_control & XS_CTL_POLL) == 0) { - callout_reset(&ecb->xs->xs_callout, mstohz(ecb->timeout), - ncr53c9x_timeout, ecb); - } + callout_reset(&ecb->ecb_callout, mstohz(ecb->timeout), + ncr53c9x_timeout, ecb); /* * The docs say the target register is never reset, and I @@ -1128,7 +1134,7 @@ NCR_TRACE(("[ncr53c9x_done(error:%x)] ", xs->error)); - callout_stop(&ecb->xs->xs_callout); + callout_stop(&ecb->ecb_callout); /* * Now, if we've come here with no error code, i.e. we've kept the @@ -2251,7 +2257,7 @@ goto reset; } printf("sending REQUEST SENSE\n"); - callout_stop(&ecb->xs->xs_callout); + callout_stop(&ecb->ecb_callout); ncr53c9x_sense(sc, ecb); goto out; } @@ -2320,7 +2326,7 @@ */ if (sc->sc_state == NCR_SELECTING) { NCR_INTS(("backoff selector ")); - callout_stop(&ecb->xs->xs_callout); + callout_stop(&ecb->ecb_callout); ncr53c9x_dequeue(sc, ecb); TAILQ_INSERT_HEAD(&sc->ready_list, ecb, chain); ecb->flags |= ECB_READY; @@ -2784,7 +2790,7 @@ /* * Reschedule timeout. */ - callout_reset(&ecb->xs->xs_callout, mstohz(ecb->timeout), + callout_reset(&ecb->ecb_callout, mstohz(ecb->timeout), ncr53c9x_timeout, ecb); } else { /* ==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9xvar.h#7 (text+ko) ==== @@ -118,6 +118,7 @@ #define ECB_RESET 0x80 #define ECB_TENTATIVE_DONE 0x100 int timeout; + struct callout ecb_callout; struct { u_char msg[3]; /* Selection Id msg and tags */