Date: Mon, 7 Jun 2004 16:35:42 GMT From: Scott Long <scottl@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 54323 for review Message-ID: <200406071635.i57GZg9g054986@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=54323 Change 54323 by scottl@scottl-esp-sparc64 on 2004/06/07 16:34:55 Start working on ncr53c9x_action() and the XPT_SCSI_IO and XPT_RESET_BUS ops. Affected files ... .. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#8 edit Differences ... ==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#8 (text+ko) ==== @@ -805,25 +805,21 @@ void ncr53c9x_action(struct cam_sim *sim, union ccb *ccb) { - struct scsipi_xfer *xs; - struct scsipi_periph *periph; - struct ncr53c9x_softc *sc = (void *)chan->chan_adapter->adapt_dev; + struct ncr53c9x_softc *sc; struct ncr53c9x_ecb *ecb; int flags; NCR_TRACE(("[ncr53c9x_action] ")); + sc = cam_sim_softc(sim); mtx_lock(&sc->sc_lock); - switch (req) { - case ADAPTER_REQ_RUN_XFER: - xs = arg; - periph = xs->xs_periph; - flags = xs->xs_control; + switch (ccb->ccb_h.func_code) { + case XPT_SCSI_IO: + case XPT_RESET_BUS: + { + struct ccb_scsiio *csio; - NCR_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd->opcode, xs->cmdlen, - periph->periph_target)); - /* Get an ECB to use. */ ecb = ncr53c9x_get_ecb(sc, xs->xs_control); /* @@ -831,27 +827,33 @@ * in the mid-layer. */ if (ecb == NULL) { - scsipi_printaddr(periph); + xpt_freeze_simq(sim, 1); + ccb->ccb_h.status = CAM_BUSY; printf("unable to allocate ecb\n"); - xs->error = XS_RESOURCE_SHORTAGE; mtx_unlock(&sc->sc_lock); - scsipi_done(xs); + xpt_done(ccb); return; } /* Initialize ecb */ - ecb->xs = xs; - ecb->timeout = xs->timeout; + ecb->ccb = ccb; + ecb->timeout = ccb->ccb_h.timeout; - if (flags & XS_CTL_RESET) { + if (ccb->ccb_h.func_code == XPT_RESET_BUS) { ecb->flags |= ECB_RESET; ecb->clen = 0; ecb->dleft = 0; } else { - memcpy(&ecb->cmd.cmd, xs->cmd, xs->cmdlen); - ecb->clen = xs->cmdlen; - ecb->daddr = xs->data; - ecb->dleft = xs->datalen; + csio = &ccb->csio; + if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) + bcopy(csio->cdb_io.cdb_ptr, &ecb->cmd.cmd, + csio->cdb_len); + else + bcopy(csio->cdb_io.cdb_bytes, &ecb->cmd.cmd, + csio->cdb_len); + ecb->clen = csio->cdb_len; + ecb->daddr = csio->data_ptr; + ecb->dleft = csio->dxfer_len; } ecb->stat = 0; @@ -860,10 +862,10 @@ if (sc->sc_state == NCR_IDLE) ncr53c9x_sched(sc); +#if 0 if ((flags & XS_CTL_POLL) == 0) break; -#if 0 /* Not allowed to use interrupts, use polling instead */ if (ncr53c9x_poll(sc, xs, ecb->timeout)) { ncr53c9x_timeout(ecb); @@ -872,13 +874,10 @@ } #endif break; + } - case ADAPTER_REQ_GROW_RESOURCES: - /* XXX Not supported. */ - break; - - case ADAPTER_REQ_SET_XFER_MODE: - { + case XPT_SET_TRAN_SETTINGS: + { struct ncr53c9x_tinfo *ti; struct scsipi_xfer_mode *xm = arg; @@ -919,6 +918,8 @@ ncr53c9x_update_xfer_mode(sc, xm->xm_target); } break; + default: + break; } mtx_unlock(&sc->sc_lock);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406071635.i57GZg9g054986>