Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2001 19:05:50 -0700 (PDT)
From:      Matthew Jacob <mjacob@feral.com>
To:        "Justin T. Gibbs" <gibbs@scsiguy.com>
Cc:        scsi@freebsd.org
Subject:   BusLogic patches for NEW_TRAN_CODE
Message-ID:  <Pine.BSF.4.21.0106241905290.82710-100000@beppo.feral.com>

next in thread | raw e-mail | index | archive | help

Index: bt.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/buslogic/bt.c,v
retrieving revision 1.30
diff -u -r1.30 bt.c
--- bt.c	2001/03/01 17:09:00	1.30
+++ bt.c	2001/06/25 02:02:01
@@ -1268,6 +1268,53 @@
 
 		cts = &ccb->cts;
 		target_mask = 0x01 << ccb->ccb_h.target_id;
+#ifdef	CAM_NEW_TRAN_CODE
+		if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
+			struct ccb_trans_settings_scsi *scsi =
+			    &cts->proto_specific.scsi;
+			struct ccb_trans_settings_spi *spi =
+			    &cts->xport_specific.spi;
+			cts->protocol = PROTO_SCSI;
+			cts->protocol_version = SCSI_REV_2;
+			cts->transport = XPORT_SPI;
+			cts->transport_version = 2;
+
+			scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB;
+			spi->flags &= ~CTS_SPI_FLAGS_DISC_ENB;
+
+			if ((bt->disc_permitted & target_mask) != 0)
+				spi->flags |= CTS_SPI_FLAGS_DISC_ENB;
+			if ((bt->tags_permitted & target_mask) != 0)
+				scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB;
+
+			if ((bt->ultra_permitted & target_mask) != 0)
+				spi->sync_period = 12;
+			else if ((bt->fast_permitted & target_mask) != 0)
+				spi->sync_period = 25;
+			else if ((bt->sync_permitted & target_mask) != 0)
+				spi->sync_period = 50;
+			else
+				spi->sync_period = 0;
+
+			if (spi->sync_period != 0)
+				spi->sync_offset = 15;
+
+			spi->valid |= CTS_SPI_VALID_SYNC_RATE;
+			spi->valid |= CTS_SPI_VALID_SYNC_OFFSET;
+
+			spi->valid |= CTS_SPI_VALID_BUS_WIDTH;
+			if ((bt->wide_permitted & target_mask) != 0)
+				spi->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
+			else
+				spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
+
+			if (cts->ccb_h.target_lun != CAM_LUN_WILDCARD) {
+				scsi->valid = CTS_SCSI_VALID_TQ;
+				spi->valid |= CTS_SPI_VALID_DISC;
+			} else
+				scsi->valid = 0;
+		} else {
+#else
 		if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
 			cts->flags = 0;
 			if ((bt->disc_permitted & target_mask) != 0)
@@ -1296,6 +1343,7 @@
 				   | CCB_TRANS_DISC_VALID
 				   | CCB_TRANS_TQ_VALID;
 		} else {
+#endif
 			btfetchtransinfo(bt, cts);
 		}
 
@@ -1366,6 +1414,12 @@
 		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
 		cpi->ccb_h.status = CAM_REQ_CMP;
+#ifdef	CAM_NEW_TRAN_CODE
+		cpi->transport = XPORT_SPI;
+		cpi->transport_version = 2;
+		cpi->protocol = PROTO_SCSI;
+		cpi->protocol_version = SCSI_REV_2;
+#endif
 		xpt_done(ccb);
 		break;
 	}
@@ -1681,12 +1735,24 @@
 		case BTSTAT_TAGGED_MSG_REJECTED:
 		{
 			struct ccb_trans_settings neg; 
- 
+#ifdef	CAM_NEW_TRAN_CODE
+			struct ccb_trans_settings_scsi *scsi =
+			    &neg.proto_specific.scsi;
+
+			neg.protocol = PROTO_SCSI;
+			neg.protocol_version = SCSI_REV_2;
+			neg.transport = XPORT_SPI;
+			neg.transport_version = 2;
+			scsi->valid = CTS_SCSI_VALID_TQ;
+			scsi->flags = 0;
+#else
+
+			neg.flags = 0;
+			neg.valid = CCB_TRANS_TQ_VALID;
+#endif
 			xpt_print_path(csio->ccb_h.path);
 			printf("refuses tagged commands.  Performing "
 			       "non-tagged I/O\n");
-			neg.flags = 0;
-			neg.valid = CCB_TRANS_TQ_VALID;
 			xpt_setup_ccb(&neg.ccb_h, csio->ccb_h.path,
 				      /*priority*/1); 
 			xpt_async(AC_TRANSFER_NEG, csio->ccb_h.path, &neg);
@@ -2114,17 +2180,31 @@
  * parameters for a particular target.
  */
 static void
-btfetchtransinfo(struct bt_softc *bt, struct ccb_trans_settings* cts)
+btfetchtransinfo(struct bt_softc *bt, struct ccb_trans_settings *cts)
 {
 	setup_data_t	setup_info;
 	u_int		target;
 	u_int		targ_offset;
 	u_int		targ_mask;
 	u_int		sync_period;
+	u_int		sync_offset;
+	u_int		bus_width;
 	int		error;
 	u_int8_t	param;
 	targ_syncinfo_t	sync_info;
+#ifdef	CAM_NEW_TRAN_CODE
+	struct ccb_trans_settings_scsi *scsi =
+	    &cts->proto_specific.scsi;
+	struct ccb_trans_settings_spi *spi =
+	    &cts->xport_specific.spi;
+
+	spi->valid = 0;
+	scsi->valid = 0;
+#else
 
+	cts->valid = 0;
+#endif
+
 	target = cts->ccb_h.target_id;
 	targ_offset = (target & 0x7);
 	targ_mask = (0x01 << targ_offset);
@@ -2142,7 +2222,6 @@
 	if (error != 0) {
 		printf("%s: btfetchtransinfo - Inquire Setup Info Failed %x\n",
 		       bt_name(bt), error);
-		cts->valid = 0;
 		return;
 	}
 
@@ -2150,11 +2229,12 @@
 				 : setup_info.high_syncinfo[targ_offset];
 
 	if (sync_info.sync == 0)
-		cts->sync_offset = 0;
+		sync_offset = 0;
 	else
-		cts->sync_offset = sync_info.offset;
+		sync_offset = sync_info.offset;
 
-	cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
+
+	bus_width = MSG_EXT_WDTR_BUS_8_BIT;
 	if (strcmp(bt->firmware_ver, "5.06L") >= 0) {
 		u_int wide_active;
 
@@ -2163,7 +2243,7 @@
 		    		 : (setup_info.high_wide_active & targ_mask);
 
 		if (wide_active)
-			cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
+			bus_width = MSG_EXT_WDTR_BUS_16_BIT;
 	} else if ((bt->wide_permitted & targ_mask) != 0) {
 		struct ccb_getdev cgd;
 
@@ -2179,7 +2259,7 @@
 		xpt_action((union ccb *)&cgd);
 		if ((cgd.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP
 		 && (cgd.inq_data.flags & SID_WBus16) != 0)
-			cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
+			bus_width = MSG_EXT_WDTR_BUS_16_BIT;
 	}
 
 	if (bt->firmware_ver[0] >= '3') {
@@ -2197,7 +2277,6 @@
 		if (error != 0) {
 			printf("%s: btfetchtransinfo - Inquire Sync "
 			       "Info Failed 0x%x\n", bt_name(bt), error);
-			cts->valid = 0;
 			return;
 		}
 		sync_period = sync_info.sync_rate[target] * 100;
@@ -2205,15 +2284,40 @@
 		sync_period = 2000 + (500 * sync_info.period);
 	}
 
+#ifdef	CAM_NEW_TRAN_CODE
+	cts->protocol = PROTO_SCSI;
+	cts->protocol_version = SCSI_REV_2;
+	cts->transport = XPORT_SPI;
+	cts->transport_version = 2;
+
+	spi->sync_period = sync_period;
+	spi->valid |= CTS_SPI_VALID_SYNC_RATE;
+	spi->sync_offset = sync_offset;
+	spi->valid |= CTS_SPI_VALID_SYNC_OFFSET;
+
+	spi->valid |= CTS_SPI_VALID_BUS_WIDTH;
+	spi->bus_width = bus_width;
+
+	if (cts->ccb_h.target_lun != CAM_LUN_WILDCARD) {
+		scsi->valid = CTS_SCSI_VALID_TQ;
+		spi->valid |= CTS_SPI_VALID_DISC;
+	} else
+		scsi->valid = 0;
+	
+#else
 	/* Convert ns value to standard SCSI sync rate */
 	if (cts->sync_offset != 0)
 		cts->sync_period = scsi_calc_syncparam(sync_period);
 	else
 		cts->sync_period = 0;
+	cts->sync_offset = sync_offset;
+	cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
 	
 	cts->valid = CCB_TRANS_SYNC_RATE_VALID
 		   | CCB_TRANS_SYNC_OFFSET_VALID
 		   | CCB_TRANS_BUS_WIDTH_VALID;
+
+#endif
         xpt_async(AC_TRANSFER_NEG, cts->ccb_h.path, cts);
 }
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0106241905290.82710-100000>