Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jun 2004 07:02:12 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 54405 for review
Message-ID:  <200406080702.i5872CCX072381@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=54405

Change 54405 by scottl@scottl-esp-sparc64 on 2004/06/08 07:01:17

	Make XPT_SET_TRAN_SETTINGS work.  The only thing left unconverted is
	ncr53c9x_update_xfer_mode(), and that seems to only involve doing
	an async callback back into the scsi layer.  It's not clear to me
	if FreeBSD needs this.
	
	With this I can do sync transfers, but it's only at 6.25MHz, narrow,
	and untagged.  It's unclear to me if this is normal given my
	existing hardware.

Affected files ...

.. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#15 edit

Differences ...

==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#15 (text+ko) ====

@@ -102,7 +102,7 @@
 #include <dev/esp/ncr53c9xreg.h>
 #include <dev/esp/ncr53c9xvar.h>
 
-int ncr53c9x_debug = NCR_SHOWMISC|NCR_SHOWPHASE|NCR_SHOWMISC|NCR_SHOWTRAC|NCR_SHOWCMDS;
+int ncr53c9x_debug = NCR_SHOWMISC /* |NCR_SHOWPHASE|NCR_SHOWMISC|NCR_SHOWTRAC|NCR_SHOWCMDS */;
 #ifdef DEBUG
 int ncr53c9x_notag = 0;
 #endif
@@ -867,7 +867,7 @@
 		cts->sync_period = ti->period;
 		cts->sync_offset = ti->offset;
 		cts->bus_width = ti->width;
-		cts->flags &= ~(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB);
+		cts->flags |= CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB;
 		cts->valid = CCB_TRANS_BUS_WIDTH_VALID |
 			     CCB_TRANS_SYNC_RATE_VALID |
 			     CCB_TRANS_SYNC_OFFSET_VALID |
@@ -935,69 +935,70 @@
 		if (sc->sc_state == NCR_IDLE)
 			ncr53c9x_sched(sc);
 
-#if 0
-		if ((flags & XS_CTL_POLL) == 0)
-			break;
-
-		/* Not allowed to use interrupts, use polling instead */
-		if (ncr53c9x_poll(sc, xs, ecb->timeout)) {
-			ncr53c9x_timeout(ecb);
-			if (ncr53c9x_poll(sc, xs, ecb->timeout))
-				ncr53c9x_timeout(ecb);
-		}
-#endif
 		break;
 	}
 
 	case XPT_SET_TRAN_SETTINGS:
-		ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
-		mtx_unlock(&sc->sc_lock);
-		xpt_done(ccb);
-		return;
-#if 0
-	case XPT_SET_TRAN_SETTINGS:
 	{
 		struct ncr53c9x_tinfo *ti;
-		struct scsipi_xfer_mode *xm = arg;
+		struct ccb_trans_settings *cts = &ccb->cts;
+		int target = ccb->ccb_h.target_id;
 
-		ti = &sc->sc_tinfo[xm->xm_target];
+		ti = &sc->sc_tinfo[target];
 		ti->flags &= ~(T_NEGOTIATE|T_SYNCMODE);
 		ti->period = 0;
 		ti->offset = 0;
 
-		if ((sc->sc_cfflags & (1<<((xm->xm_target&7)+16))) == 0 &&
-		    (xm->xm_mode & PERIPH_CAP_TQING)) {
-			NCR_MISC(("%s: target %d: tagged queuing\n",
-			    sc->dv_name, xm->xm_target));
-			ti->flags |= T_TAG;
-		} else
-			ti->flags &= ~T_TAG;
+		if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
+			if ((sc->sc_cfflags & (1<<((target & 7) + 16))) == 0 &&
+			    (cts->flags & CCB_TRANS_TAG_ENB)) {
+				NCR_MISC(("%s: target %d: tagged queuing\n",
+				    sc->dv_name, target));
+				ti->flags |= T_TAG;
+			} else
+				ti->flags &= ~T_TAG;
+		}
 
-		if ((xm->xm_mode & PERIPH_CAP_WIDE16) != 0) {
-			NCR_MISC(("%s: target %d: wide scsi negotiation\n",
-			    sc->dv_name, xm->xm_target));
-			if (sc->sc_rev == NCR_VARIANT_FAS366) {
-				ti->flags |= T_WIDE;
-				ti->width = 1;
+		if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) {
+			if (cts->bus_width != 0) {
+				NCR_MISC(("%s: target %d: wide negotiation\n",
+				    sc->dv_name, target));
+				if (sc->sc_rev == NCR_VARIANT_FAS366) {
+					ti->flags |= T_WIDE;
+					ti->width = 1;
+				}
+			} else {
+				ti->flags &= ~T_WIDE;
+				ti->width = 0;
 			}
 		}
 
-		if ((xm->xm_mode & PERIPH_CAP_SYNC) != 0 &&
-		    (ti->flags & T_SYNCHOFF) == 0 && sc->sc_minsync != 0) {
-			NCR_MISC(("%s: target %d: sync negotiation\n",
-			    sc->dv_name, xm->xm_target));
+		if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) {
+			NCR_MISC(("%s: target %d: sync period negotiation\n",
+			    sc->dv_name, target));
+			ti->flags |= T_NEGOTIATE;
+			ti->period = cts->sync_period;
+		}
+
+		if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0) {
+			NCR_MISC(("%s: target %d: sync offset negotiation\n",
+			    sc->dv_name, target));
 			ti->flags |= T_NEGOTIATE;
-			ti->period = sc->sc_minsync;
+			ti->period = cts->sync_offset;
 		}
 		/*
 		 * If we're not going to negotiate, send the notification
 		 * now, since it won't happen later.
 		 */
 		if ((ti->flags & T_NEGOTIATE) == 0)
-			ncr53c9x_update_xfer_mode(sc, xm->xm_target);
-	    }
-		break;
-#endif
+			ncr53c9x_update_xfer_mode(sc, target);
+
+		mtx_unlock(&sc->sc_lock);
+		ccb->ccb_h.status = CAM_REQ_CMP;
+		xpt_done(ccb);
+		return;
+	}
+
 	default:
 		printf("%s: Unhandled function code %d\n", sc->dv_name,
 		       ccb->ccb_h.func_code);
@@ -1095,7 +1096,7 @@
 		else if ((ecb->flags & ECB_SENSE) != 0)
 			tag = 0;
 		else
-			tag = ecb->ccb->csio.tag_id;
+			tag = ecb->ccb->csio.tag_action;
 
 		li = TINFO_LUN(ti, lun);
 		if (li == NULL) {



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