Lines Matching defs:scb
77 /* scb flags */
322 struct mesh_scb *scb;
351 scb = sc->sc_nexus;
352 if (scb == NULL) {
362 scb->resid = MESH_GET_XFER(sc);
366 if (scb->flags & MESH_READ) {
369 cp = (char *)scb->daddr + scb->dlen
372 fifocnt, scb->resid);
392 mesh_error(sc, scb, error, 0);
399 mesh_error(sc, scb, 0, exception);
410 sc->sc_nextstate, scb->resid);
420 mesh_identify(sc, scb);
423 mesh_command(sc, scb);
427 mesh_dataio(sc, scb);
430 mesh_status(sc, scb);
433 mesh_msgin(sc, scb);
436 mesh_done(sc, scb);
442 scb->xs->error = XS_DRIVER_STUFFUP;
443 mesh_done(sc, scb);
450 mesh_error(struct mesh_softc *sc, struct mesh_scb *scb, int error, int exception)
463 scb->xs->error = XS_DRIVER_STUFFUP;
469 scb->xs->error = XS_DRIVER_STUFFUP;
474 scb->xs->error = XS_SELTIMEOUT;
477 mesh_done(sc, scb);
481 mesh_select(struct mesh_softc *sc, struct mesh_scb *scb)
483 struct mesh_tinfo *ti = &sc->sc_tinfo[scb->target];
507 mesh_set_reg(sc, MESH_DEST_ID, scb->target);
513 timeout = mstohz(scb->xs->timeout);
517 callout_reset(&scb->xs->xs_callout, timeout, mesh_timeout, scb);
521 mesh_identify(struct mesh_softc *sc, struct mesh_scb *scb)
523 struct mesh_tinfo *ti = &sc->sc_tinfo[scb->target];
540 mesh_command(struct mesh_softc *sc, struct mesh_scb *scb)
546 printf("mesh_command cdb = %02x", scb->cmd.opcode);
548 printf(" %02x", scb->cmd.bytes[i]);
554 MESH_SET_XFER(sc, scb->cmdlen);
557 cmdp = (char *)&scb->cmd;
558 for (i = 0; i < scb->cmdlen; i++)
561 if (scb->resid == 0)
568 mesh_dma_setup(struct mesh_softc *sc, struct mesh_scb *scb)
570 int datain = scb->flags & MESH_READ;
579 count = scb->dlen;
584 va = scb->daddr;
621 scb)
623 DPRINTF("mesh_dataio len = %ld (%s)\n", scb->dlen,
624 scb->flags & MESH_READ ? "read" : "write");
626 mesh_dma_setup(sc, scb);
628 if (scb->dlen == 65536)
631 MESH_SET_XFER(sc, scb->dlen);
633 if (scb->flags & MESH_READ)
643 mesh_status(struct mesh_softc *sc, struct mesh_scb *scb)
653 scb->status = mesh_read_reg(sc, MESH_FIFO);
654 DPRINTF("mesh_status(1): status = 0x%x\n", scb->status);
666 mesh_msgin(struct mesh_softc *sc, struct mesh_scb *scb)
712 sc->sc_tinfo[scb->target].period = 0;
713 sc->sc_tinfo[scb->target].offset = 0;
714 mesh_setsync(sc, &sc->sc_tinfo[scb->target]);
726 scsipi_printaddr(scb->xs->xs_periph);
741 struct mesh_tinfo *ti = &sc->sc_tinfo[scb->target];
753 scsipi_printaddr(scb->xs->xs_periph);
765 device_xname(sc->sc_dev), scb->target, sc->sc_imsg[0]);
779 struct mesh_scb *scb = sc->sc_nexus;
794 lun = scb->xs->xs_periph->periph_lun;
799 ti = &sc->sc_tinfo[scb->target];
933 struct mesh_scb *scb;
937 if ((scb = sc->free_scb.tqh_first) != NULL)
938 TAILQ_REMOVE(&sc->free_scb, scb, chain);
941 return scb;
945 mesh_free_scb(struct mesh_softc *sc, struct mesh_scb *scb)
950 TAILQ_INSERT_HEAD(&sc->free_scb, scb, chain);
960 struct mesh_scb *scb;
971 if ((scb = mesh_get_scb(sc)) == NULL) {
976 scb->xs = xs;
977 scb->flags = 0;
978 scb->status = 0;
979 scb->daddr = (vaddr_t)xs->data;
980 scb->dlen = xs->datalen;
981 scb->resid = xs->datalen;
982 memcpy(&scb->cmd, xs->cmd, xs->cmdlen);
983 scb->cmdlen = xs->cmdlen;
984 scb->target = periph->periph_target;
991 scb->target, scb->cmd.opcode);
993 printf(" %02x", scb->cmd.bytes[i]);
999 scb->flags |= MESH_POLL;
1002 scb->flags &= ~MESH_READ;
1005 scb->flags |= MESH_READ;
1009 TAILQ_INSERT_TAIL(&sc->ready_scb, scb, chain);
1041 struct mesh_scb *scb;
1043 scb = sc->ready_scb.tqh_first;
1045 if (scb == NULL)
1049 TAILQ_REMOVE(&sc->ready_scb, scb, chain);
1050 sc->sc_nexus = scb;
1051 mesh_select(sc, scb);
1055 scb = scb->chain.tqe_next;
1077 mesh_done(struct mesh_softc *sc, struct mesh_scb *scb)
1079 struct scsipi_xfer *xs = scb->xs;
1086 callout_stop(&scb->xs->xs_callout);
1088 if (scb->status == SCSI_BUSY) {
1093 xs->status = scb->status;
1094 xs->resid = scb->resid;
1095 if (scb->status == SCSI_CHECK) {
1105 mesh_free_scb(sc, scb);
1111 struct mesh_scb *scb = arg;
1113 device_private(scb->xs->xs_periph->periph_channel->chan_adapter->adapt_dev);
1137 scb->xs->error = XS_TIMEOUT;