Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jun 2004 18:14:51 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 54331 for review
Message-ID:  <200406071814.i57IEpQG083575@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406071814.i57IEpQG083575>