Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jun 2004 20:49:27 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 54344 for review
Message-ID:  <200406072049.i57KnRw6022941@repoman.freebsd.org>

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

Change 54344 by scottl@scottl-esp-sparc64 on 2004/06/07 20:49:11

	Fix up a bunch more functions mostly by eliminating the scsipi_periph
	structure.

Affected files ...

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

Differences ...

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

@@ -813,7 +813,6 @@
 {
 	struct ncr53c9x_softc *sc;
 	struct ncr53c9x_ecb *ecb;
-	int flags;
 
 	NCR_TRACE(("[ncr53c9x_action] "));
 
@@ -988,7 +987,6 @@
 	struct ncr53c9x_softc *sc;
 {
 	struct ncr53c9x_ecb *ecb;
-	struct scsipi_periph *periph;
 	struct ncr53c9x_tinfo *ti;
 	struct ncr53c9x_linfo *li;
 	int lun;
@@ -1004,9 +1002,8 @@
 	 */
 	for (ecb = TAILQ_FIRST(&sc->ready_list); ecb != NULL;
 	    ecb = TAILQ_NEXT(ecb, chain)) {
-		periph = ecb->xs->xs_periph;
-		ti = &sc->sc_tinfo[periph->periph_target];
-		lun = periph->periph_lun;
+		ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id];
+		lun = ecb->ccb->ccb_h.target_lun;
 
 		/* Select type of tag for this command */
 		if ((ti->flags & (T_RSELECTOFF)) != 0)
@@ -1016,12 +1013,7 @@
 		else if ((ecb->flags & ECB_SENSE) != 0)
 			tag = 0;
 		else
-			tag = ecb->xs->xs_tag_type;
-#if 0
-		/* XXXX Use tags for polled commands? */
-		if (ecb->xs->xs_control & XS_CTL_POLL)
-			tag = 0;
-#endif
+			tag = ecb->ccb->csio.tag_id;
 
 		li = TINFO_LUN(ti, lun);
 		if (li == NULL) {
@@ -1047,7 +1039,6 @@
 			if ((li->busy != 1) && li->used == 0) {
 				/* We need to issue this untagged command now */
 				ecb = li->untagged;
-				periph = ecb->xs->xs_periph;
 			} else {
 				/* Not ready yet */
 				continue;
@@ -1055,8 +1046,8 @@
 		}
 		ecb->tag[0] = tag;
 		if (tag != 0) {
-			li->queued[ecb->xs->xs_tag_id] = ecb;
-			ecb->tag[1] = ecb->xs->xs_tag_id;
+			li->queued[ecb->ccb->csio.tag_id] = ecb;
+			ecb->tag[1] = ecb->ccb->csio.tag_id;
 			li->used++;
 		}
 		if (li->untagged != NULL && (li->busy != 1)) {
@@ -1075,8 +1066,8 @@
 			break;
 		} else
 			NCR_TRACE(("%d:%d busy\n",
-			    periph->periph_target,
-			    periph->periph_lun));
+			    ecb->ccb->ccb_h.target_id,
+			    ecb->ccb->ccb_h.target_lun));
 	}
 }
 
@@ -1085,22 +1076,25 @@
 	struct ncr53c9x_softc *sc;
 	struct ncr53c9x_ecb *ecb;
 {
-	struct scsipi_xfer *xs = ecb->xs;
-	struct scsipi_periph *periph = xs->xs_periph;
-	struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[periph->periph_target];
-	struct scsipi_sense *ss = (void *)&ecb->cmd.cmd;
+	union ccb *ccb = ecb->ccb;
+	struct ncr53c9x_tinfo *ti;
+	struct scsi_request_sense *ss = (void *)&ecb->cmd.cmd;
 	struct ncr53c9x_linfo *li;
-	int lun = periph->periph_lun;
+	int lun;
 
 	NCR_TRACE(("requesting sense "));
+
+	lun = ccb->ccb_h.target_lun;
+	ti = &sc->sc_tinfo[ccb->ccb_h.target_id];
+
 	/* Next, setup a request sense command block */
 	memset(ss, 0, sizeof(*ss));
 	ss->opcode = REQUEST_SENSE;
-	ss->byte2 = periph->periph_lun << SCSI_CMD_LUN_SHIFT;
-	ss->length = sizeof(struct scsipi_sense_data);
+	ss->byte2 = ccb->ccb_h.target_lun << SCSI_CMD_LUN_SHIFT;
+	ss->length = sizeof(struct scsi_request_sense);
 	ecb->clen = sizeof(*ss);
-	ecb->daddr = (char *)&xs->sense.scsi_sense;
-	ecb->dleft = sizeof(struct scsipi_sense_data);
+	ecb->daddr = (char *)&ecb->ccb->csio.sense_data;
+	ecb->dleft = sizeof(struct scsi_sense_data);
 	ecb->flags |= ECB_SENSE;
 	ecb->timeout = NCR_SENSE_TIMEOUT;
 	ti->senses++;
@@ -1129,7 +1123,7 @@
 	struct ncr53c9x_ecb *ecb;
 {
 	union ccb *ccb = ecb->ccb;
-	struct ncr53c9x_tinfo *ti
+	struct ncr53c9x_tinfo *ti;
 	struct ncr53c9x_linfo *li;
 	int lun;
 
@@ -1156,7 +1150,7 @@
 			ccb->ccb_h.status = CAM_AUTOSENSE_FAIL;
 		} else if ((ecb->stat & ST_MASK) == SCSI_CHECK) {
 			/* First, save the return values */
-			xs->resid = ecb->dleft;
+			ecb->ccb->csio.resid = ecb->dleft;
 			ncr53c9x_sense(sc, ecb);
 			return;
 		} else {
@@ -1212,11 +1206,12 @@
 	struct ncr53c9x_softc *sc;
 	struct ncr53c9x_ecb *ecb;
 {
-	struct ncr53c9x_tinfo *ti = 
-	    &sc->sc_tinfo[ecb->xs->xs_periph->periph_target];
+	struct ncr53c9x_tinfo *ti;
 	struct ncr53c9x_linfo *li;
-	int64_t lun = ecb->xs->xs_periph->periph_lun;
-	
+	int64_t lun;
+
+	ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id];
+	lun = ecb->ccb->ccb_h.target_lun;
 	li = TINFO_LUN(ti, lun);
 #ifdef DIAGNOSTIC
 	if (li == NULL || li->lun != lun)
@@ -1561,13 +1556,13 @@
 
 	case NCR_CONNECTED:
 		ecb = sc->sc_nexus;
-		ti = &sc->sc_tinfo[ecb->xs->xs_periph->periph_target];
+		ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id];
 
 		switch (sc->sc_imess[0]) {
 		case MSG_CMDCOMPLETE:
 			NCR_MSGS(("cmdcomplete "));
 			if (sc->sc_dleft < 0) {
-				scsipi_printaddr(ecb->xs->xs_periph);
+				xpt_print_path(ecb->ccb->ccb_h.path);
 				printf("got %ld extra bytes\n",
 				    -(long)sc->sc_dleft);
 				sc->sc_dleft = 0;
@@ -1575,7 +1570,7 @@
 			ecb->dleft = (ecb->flags & ECB_TENTATIVE_DONE) ?
 			    0 : sc->sc_dleft;
 			if ((ecb->flags & ECB_SENSE) == 0)
-				ecb->xs->resid = ecb->dleft;
+				ecb->ccb->csio.resid = ecb->dleft;
 			sc->sc_state = NCR_CMDCOMPLETE;
 			break;
 
@@ -1591,13 +1586,13 @@
 				 */
 				printf("%s: tagged queuing rejected: "
 				    "target %d\n", sc->dv_name, 
-				    ecb->xs->xs_periph->periph_target);
+				    ecb->ccb->ccb_h.target_id);
 
 				NCR_MSGS(("(rejected sent tag)"));
 				NCRCMD(sc, NCRCMD_FLUSH);
 				DELAY(1);
 				ti->flags &= ~T_TAG;
-				lun = ecb->xs->xs_periph->periph_lun;
+				lun = ecb->ccb->ccb_h.target_lun;
 				li = TINFO_LUN(ti, lun);
 				if (ecb->tag[0] &&
 				    li->queued[ecb->tag[1]] != NULL) {
@@ -1612,19 +1607,19 @@
 			case SEND_SDTR:
 				printf("%s: sync transfer rejected: "
 				    "target %d\n", sc->dv_name, 
-				    ecb->xs->xs_periph->periph_target);
+				    ecb->ccb->ccb_h.target_id);
 
 				sc->sc_flags &= ~NCR_SYNCHNEGO;
 				ti->flags &= ~(T_NEGOTIATE | T_SYNCMODE);
 				ncr53c9x_setsync(sc, ti);
 				ncr53c9x_update_xfer_mode(sc,
-				    ecb->xs->xs_periph->periph_target);
+				    ecb->ccb->ccb_h.target_id);
 				break;
 
 			case SEND_WDTR:
 				printf("%s: wide transfer rejected: "
-				    "target %d\n", sc->dv_xname, 
-				    ecb->xs->xs_periph->periph_target);
+				    "target %d\n", sc->dv_name, 
+				    ecb->ccb->ccb_h.target_id);
 				ti->flags &= ~(T_WIDE | T_WDTRSENT);
 				ti->width = 0;
 				break;
@@ -1689,7 +1684,7 @@
 				    ti->period > 124) {
 #if 0
 #ifdef NCR53C9X_DEBUG
-					scsipi_printaddr(ecb->xs->xs_periph);
+					xpt_print_path(ecb->ccb->ccb_h.path);
 					printf("async mode\n");
 #endif
 #endif
@@ -1726,7 +1721,7 @@
 					}
 				}
 				ncr53c9x_update_xfer_mode(sc,
-				    ecb->xs->xs_periph->periph_target);
+				    ecb->ccb->ccb_h.target_id);
 				sc->sc_flags &= ~NCR_SYNCHNEGO;
 				ncr53c9x_setsync(sc, ti);
 				break;
@@ -1749,7 +1744,7 @@
 				ti->flags &= ~(T_WIDE | T_WDTRSENT);
 				break;
 			default:
-				scsipi_printaddr(ecb->xs->xs_periph);
+				xpt_print_path(ecb->ccb->ccb_h.path);
 				printf("unrecognized MESSAGE EXTENDED;"
 				    " sending REJECT\n");
 				goto reject;
@@ -1758,7 +1753,7 @@
 
 		default:
 			NCR_MSGS(("ident "));
-			scsipi_printaddr(ecb->xs->xs_periph);
+			xpt_print_path(ecb->ccb->ccb_h.path);
 			printf("unrecognized MESSAGE; sending REJECT\n");
 		reject:
 			ncr53c9x_sched_msgout(SEND_REJECT);
@@ -1868,7 +1863,7 @@
 		switch (sc->sc_msgout) {
 		case SEND_SDTR:
 			ecb = sc->sc_nexus;
-			ti = &sc->sc_tinfo[ecb->xs->xs_periph->periph_target];
+			ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id];
 			sc->sc_omess[0] = MSG_EXTENDED;
 			sc->sc_omess[1] = MSG_EXT_SDTR_LEN;
 			sc->sc_omess[2] = MSG_EXT_SDTR;
@@ -1882,7 +1877,7 @@
 			break;
 		case SEND_WDTR:
 			ecb = sc->sc_nexus;
-			ti = &sc->sc_tinfo[ecb->xs->xs_periph->periph_target];
+			ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id];
 			sc->sc_omess[0] = MSG_EXTENDED;
 			sc->sc_omess[1] = MSG_EXT_WDTR_LEN;
 			sc->sc_omess[2] = MSG_EXT_WDTR;
@@ -1896,7 +1891,7 @@
                         }
                         ecb = sc->sc_nexus;
                         sc->sc_omess[0] =
-                            MSG_IDENTIFY(ecb->xs->xs_periph->periph_lun, 0);
+                            MSG_IDENTIFY(ecb->ccb->ccb_h.target_lun, 0);
                         break;
 		case SEND_TAG:
 			if (sc->sc_state != NCR_CONNECTED) {
@@ -1912,10 +1907,9 @@
 			sc->sc_flags |= NCR_ABORTING;
 			sc->sc_omess[0] = MSG_BUS_DEV_RESET;
 			ecb = sc->sc_nexus;
-			ti = &sc->sc_tinfo[ecb->xs->xs_periph->periph_target];
+			ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id];
 			ti->flags &= ~T_SYNCMODE;
-			ncr53c9x_update_xfer_mode(sc,
-			    ecb->xs->xs_periph->periph_target);
+			ncr53c9x_update_xfer_mode(sc,ecb->ccb->ccb_h.target_id);
 			if ((ti->flags & T_SYNCHOFF) == 0)
 				/* We can re-start sync negotiation */
 				ti->flags |= T_NEGOTIATE;
@@ -2000,7 +1994,6 @@
 {
 	struct ncr53c9x_softc *sc = arg;
 	struct ncr53c9x_ecb *ecb;
-	struct scsipi_periph *periph;
 	struct ncr53c9x_tinfo *ti;
 	size_t size;
 	int nfifo;
@@ -2205,7 +2198,7 @@
 		{
 			struct ncr53c9x_linfo *li;
 
-			ecb->ccb->ccb_h.statusr = CAM_SEL_TIMEOUT;
+			ecb->ccb->ccb_h.status = CAM_SEL_TIMEOUT;
 
 			/* Selection timeout -- discard all LUNs if empty */
 			ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id];
@@ -2418,8 +2411,7 @@
 			if (ecb == NULL)
 				panic("ncr53c9x: no nexus");
 
-			periph = ecb->xs->xs_periph;
-			ti = &sc->sc_tinfo[periph->periph_target];
+			ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id];
 
 			switch (sc->sc_espstep) {
 			case 0:
@@ -2489,8 +2481,8 @@
 				    " %d left in FIFO "
 				    "[intr %x, stat %x, step %d]\n",
 				    sc->dv_name,
-				    periph->periph_target,
-				    periph->periph_lun,
+				    ecb->ccb->ccb_h.target_id,
+				    ecb->ccb->ccb_h.target_lun,
 				    NCR_READ_REG(sc, NCR_FFLAG)
 				     & NCRFIFO_FF,
 				    sc->sc_espintr, sc->sc_espstat,
@@ -2509,8 +2501,8 @@
 					    "%lu left in DMA buffer "
 					    "[intr %x, stat %x, step %d]\n",
 					    sc->dv_name,
-					    periph->periph_target,
-					    periph->periph_lun,
+					    ecb->ccb->ccb_h.target_id,
+					    ecb->ccb->ccb_h.target_lun,
 					    (u_long)sc->sc_cmdlen,
 					    sc->sc_espintr,
 					    sc->sc_espstat,
@@ -2568,7 +2560,7 @@
 				ecb->dleft = (ecb->flags & ECB_TENTATIVE_DONE)
 					? 0 : sc->sc_dleft;
 				if ((ecb->flags & ECB_SENSE) == 0)
-					ecb->xs->resid = ecb->dleft;
+					ecb->ccb->csio.resid = ecb->dleft;
 				sc->sc_state = NCR_CMDCOMPLETE;
 			} else
 				printf("%s: STATUS_PHASE: msg %d\n",



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