PERFORCE change 54339 for review
Scott Long
scottl at FreeBSD.org
Mon Jun 7 19:48:07 GMT 2004
http://perforce.freebsd.org/chv.cgi?CH=54339
Change 54339 by scottl at scottl-esp-sparc64 on 2004/06/07 19:47:36
More conversions to a lot of functions. Add an sc pointer to the
ecb so it can be retrieved in ncr53c9x_timeout().
Affected files ...
.. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#10 edit
.. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9xvar.h#8 edit
Differences ...
==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#10 (text+ko) ====
@@ -126,7 +126,7 @@
static int ncr53c9x_rdfifo(struct ncr53c9x_softc *, int);
static void ncr53c9x_update_xfer_mode(struct ncr53c9x_softc *, int);
-static struct ncr53c9x_ecb *ncr53c9x_get_ecb(struct ncr53c9x_softc *, int);
+static struct ncr53c9x_ecb *ncr53c9x_get_ecb(struct ncr53c9x_softc *);
static struct ncr53c9x_linfo *ncr53c9x_lunsearch(struct ncr53c9x_tinfo *,
int64_t lun);
@@ -784,9 +784,8 @@
}
static struct ncr53c9x_ecb *
-ncr53c9x_get_ecb(sc, flags)
+ncr53c9x_get_ecb(sc)
struct ncr53c9x_softc *sc;
- int flags;
{
struct ncr53c9x_ecb *ecb;
@@ -794,6 +793,7 @@
if (ecb) {
memset(ecb, 0, sizeof(*ecb));
ecb->flags |= ECB_ALLOC;
+ ecb->sc = sc;
}
return (ecb);
}
@@ -827,14 +827,14 @@
struct ccb_scsiio *csio;
/* Get an ECB to use. */
- ecb = ncr53c9x_get_ecb(sc, xs->xs_control);
+ ecb = ncr53c9x_get_ecb(sc);
/*
* This should never happen as we track resources
* in the mid-layer.
*/
if (ecb == NULL) {
xpt_freeze_simq(sim, 1);
- ccb->ccb_h.status = CAM_BUSY;
+ ccb->ccb_h.status = CAM_REQUEUE_REQ;
printf("unable to allocate ecb\n");
mtx_unlock(&sc->sc_lock);
xpt_done(ccb);
@@ -964,10 +964,12 @@
static void
ncr53c9x_poll(struct cam_sim *sim)
{
+ struct ncr53c9x_softc *sc;
NCR_TRACE(("[ncr53c9x_poll] "));
+ sc = cam_sim_softc(sim);
if (NCRDMA_ISINTR(sc)) {
- ncr53c9x_intr(cam_sim_softc(sim));
+ ncr53c9x_intr(sc);
}
}
@@ -1126,13 +1128,16 @@
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];
- int lun = periph->periph_lun;
- struct ncr53c9x_linfo *li = TINFO_LUN(ti, lun);
+ union ccb *ccb = ecb->ccb;
+ struct ncr53c9x_tinfo *ti
+ struct ncr53c9x_linfo *li;
+ int lun;
+
+ NCR_TRACE(("[ncr53c9x_done(status:%x)] ", ccb->ccb_h.status));
- NCR_TRACE(("[ncr53c9x_done(error:%x)] ", xs->error));
+ ti = &sc->sc_tinfo[ccb->ccb_h.target_id];
+ lun = ccb->ccb_h.target_lun;
+ li = TINFO_LUN(ti, lun);
callout_stop(&ecb->ecb_callout);
@@ -1144,12 +1149,11 @@
* commands for this target/lunit, else we lose the sense info.
* We don't support chk sense conditions for the request sense cmd.
*/
- if (xs->error == XS_NOERROR) {
- xs->status = ecb->stat;
+ if (ccb->ccb_h.status == CAM_REQ_CMP) {
if ((ecb->flags & ECB_ABORT) != 0) {
- xs->error = XS_TIMEOUT;
+ ccb->ccb_h.status = CAM_CMD_TIMEOUT;
} else if ((ecb->flags & ECB_SENSE) != 0) {
- xs->error = XS_SENSE;
+ ccb->ccb_h.status = CAM_AUTOSENSE_FAIL;
} else if ((ecb->stat & ST_MASK) == SCSI_CHECK) {
/* First, save the return values */
xs->resid = ecb->dleft;
@@ -1186,7 +1190,7 @@
}
}
- if (xs->error == XS_SELTIMEOUT) {
+ if (ccb->ccb_h.status == CAM_SEL_TIMEOUT) {
/* Selection timeout -- discard this LUN if empty */
if (li->untagged == NULL && li->used == 0) {
if (lun < NCR_NLUN)
@@ -1199,7 +1203,7 @@
ncr53c9x_free_ecb(sc, ecb);
ti->cmds++;
mtx_unlock(&sc->sc_lock);
- scsipi_done(xs);
+ xpt_done(ccb);
mtx_lock(&sc->sc_lock);
}
@@ -2004,7 +2008,7 @@
NCR_INTS(("[ncr53c9x_intr: state %d]", sc->sc_state));
if (!NCRDMA_ISINTR(sc))
- return (0);
+ return;
mtx_lock(&sc->sc_lock);
again:
@@ -2064,7 +2068,7 @@
}
if (sc->sc_state == NCR_CONNECTED ||
sc->sc_state == NCR_SELECTING) {
- ecb->xs->error = XS_TIMEOUT;
+ ecb->ccb->ccb_h.status = CAM_SEL_TIMEOUT;
ncr53c9x_done(sc, ecb);
}
goto out;
@@ -2201,11 +2205,10 @@
{
struct ncr53c9x_linfo *li;
- ecb->xs->error = XS_SELTIMEOUT;
+ ecb->ccb->ccb_h.statusr = CAM_SEL_TIMEOUT;
/* Selection timeout -- discard all LUNs if empty */
- periph = ecb->xs->xs_periph;
- ti = &sc->sc_tinfo[periph->periph_target];
+ ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id];
li = LIST_FIRST(&ti->luns);
while (li != NULL) {
if (li->untagged == NULL && li->used == 0) {
@@ -2227,10 +2230,10 @@
if ((sc->sc_flags & NCR_SYNCHNEGO) != 0) {
#ifdef NCR53C9X_DEBUG
if (ecb != NULL)
- scsipi_printaddr(ecb->xs->xs_periph);
+ xpt_print_path(ecb->ccb->ccb_h.path);
printf("sync nego not completed!\n");
#endif
- ti = &sc->sc_tinfo[ecb->xs->xs_periph->periph_target];
+ ti = &sc->sc_tinfo[ecb->ccb->ccb_h.target_id];
sc->sc_flags &= ~NCR_SYNCHNEGO;
ti->flags &= ~(T_NEGOTIATE | T_SYNCMODE);
}
@@ -2262,7 +2265,7 @@
goto out;
}
- ecb->xs->error = XS_TIMEOUT;
+ ecb->ccb->ccb_h.status = CAM_CMD_TIMEOUT;
goto finish;
case NCR_DISCONNECT:
@@ -2536,7 +2539,7 @@
if (sc->sc_state == NCR_IDLE) {
printf("%s: stray interrupt\n", sc->dv_name);
mtx_unlock(&sc->sc_lock);
- return (0);
+ return;
}
break;
@@ -2725,7 +2728,7 @@
out:
mtx_unlock(&sc->sc_lock);
- return (1);
+ return;
reset:
ncr53c9x_init(sc, 1);
@@ -2808,13 +2811,11 @@
void *arg;
{
struct ncr53c9x_ecb *ecb = arg;
- struct scsipi_xfer *xs = ecb->xs;
- struct scsipi_periph *periph = xs->xs_periph;
- struct ncr53c9x_softc *sc =
- (void *)periph->periph_channel->chan_adapter->adapt_dev;
- struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[periph->periph_target];
+ union ccb *ccb = ecb->ccb;
+ struct ncr53c9x_softc *sc = ecb->sc;
+ struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[ccb->ccb_h.target_id];
- scsipi_printaddr(periph);
+ xpt_print_path(ccb->ccb_h.path);
printf("%s: timed out [ecb %p (flags 0x%x, dleft %x, stat %x)], "
"<state %d, nexus %p, phase(l %x, c %x, p %x), resid %lx, "
"msg(q %x,o %x) %s>",
@@ -2839,7 +2840,7 @@
} else {
/* abort the operation that has timed out */
printf("\n");
- xs->error = XS_TIMEOUT;
+ ccb->ccb_h.status = CAM_CMD_TIMEOUT;
ncr53c9x_abort(sc, ecb);
/* Disable sync mode if stuck in a data phase */
@@ -2847,11 +2848,11 @@
(ti->flags & T_SYNCMODE) != 0 &&
(sc->sc_phase & (MSGI|CDI)) == 0) {
/* XXX ASYNC CALLBACK! */
- scsipi_printaddr(periph);
+ xpt_print_path(ccb->ccb_h.path);
printf("sync negotiation disabled\n");
sc->sc_cfflags |=
- (1 << ((periph->periph_target & 7) + 8));
- ncr53c9x_update_xfer_mode(sc, periph->periph_target);
+ (1 << ((ccb->ccb_h.target_id & 7) + 8));
+ ncr53c9x_update_xfer_mode(sc, ccb->ccb_h.target_id);
}
}
==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9xvar.h#8 (text+ko) ====
@@ -110,6 +110,7 @@
struct ncr53c9x_ecb {
TAILQ_ENTRY(ncr53c9x_ecb) chain;
union ccb *ccb; /* SCSI xfer ctrl block from above */
+ struct ncr53c9x_softc *sc;
int flags;
#define ECB_ALLOC 0x01
#define ECB_READY 0x02
More information about the p4-projects
mailing list