Lines Matching defs:acb
397 wd33c93_error(struct wd33c93_softc *sc, struct wd33c93_acb *acb)
399 struct scsipi_xfer *xs = acb->xs;
476 struct wd33c93_acb *acb = sc->sc_nexus;
479 sc->sc_daddr = acb->daddr;
480 sc->sc_dleft = acb->dleft;
555 struct wd33c93_acb *acb;
573 acb = pool_get(&wd33c93_pool, PR_NOWAIT);
576 if (acb == NULL) {
578 printf("cannot allocate acb\n");
584 acb->flags = ACB_ACTIVE;
585 acb->xs = xs;
586 acb->clen = xs->cmdlen;
587 acb->daddr = xs->data;
588 acb->dleft = xs->datalen;
589 acb->timeout = xs->timeout;
590 memcpy(&acb->cmd, xs->cmd, xs->cmdlen);
602 TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
603 acb->flags |= ACB_READY;
613 if (wd33c93_poll(sc, acb)) {
614 wd33c93_timeout(acb);
615 if (wd33c93_poll(sc, acb)) /* 2nd retry for ABORT */
616 wd33c93_timeout(acb);
666 struct wd33c93_acb *acb;
677 TAILQ_FOREACH(acb, &sc->ready_list, chain) {
678 periph = acb->xs->xs_periph;
683 KASSERT(acb->flags & ACB_READY);
690 else if ((acb->flags & ACB_SENSE) != 0)
692 else if (acb->xs->xs_control & XS_CTL_POLL)
695 tag = acb->xs->xs_tag_type;
714 li->untagged = acb; /* Issue untagged */
720 acb = li->untagged;
721 periph = acb->xs->xs_periph;
726 acb->tag_type = tag;
728 if (li->queued[acb->xs->xs_tag_id])
730 li->queued[acb->xs->xs_tag_id] = acb;
731 acb->tag_id = acb->xs->xs_tag_id;
746 if (acb == NULL) {
754 TAILQ_REMOVE(&sc->ready_list, acb, chain);
755 acb->flags &= ~ACB_READY;
757 flags = acb->xs->xs_control;
762 if (wd33c93_go(sc, acb) != 0 || acb->xs->error == XS_SELTIMEOUT) {
763 acb->dleft = sc->sc_dleft;
764 wd33c93_scsidone(sc, acb, sc->sc_status);
772 wd33c93_scsidone(struct wd33c93_softc *sc, struct wd33c93_acb *acb, int status)
774 struct scsipi_xfer *xs = acb->xs;
782 if (acb == NULL || xs == NULL) {
786 KASSERT(acb->flags != ACB_FREE);
795 xs->resid = acb->dleft;
822 wd33c93_dequeue(sc, acb);
823 if (sc->sc_nexus == acb) {
834 acb->flags = ACB_FREE;
835 pool_put(&wd33c93_pool, acb);
842 wd33c93_dequeue(struct wd33c93_softc *sc, struct wd33c93_acb *acb)
844 struct wd33c93_tinfo *ti = &sc->sc_tinfo[acb->xs->xs_periph->periph_target];
846 int lun = acb->xs->xs_periph->periph_lun;
852 lun, acb);
854 if (li->untagged == acb) {
858 if (acb->tag_type && li->queued[acb->tag_id] != NULL) {
860 if (li->queued[acb->tag_id] != NULL &&
861 (li->queued[acb->tag_id] != acb))
863 "instead of acb %p\n", acb->tag_id,
864 lun, li->queued[acb->tag_id], acb);
866 li->queued[acb->tag_id] = NULL;
899 wd33c93_abort(struct wd33c93_softc *sc, struct wd33c93_acb *acb,
907 scsipi_printaddr(acb->xs->xs_periph);
910 acb->timeout = SBIC_ABORT_TIMEOUT;
911 acb->flags |= ACB_ABORT;
916 if (sc->sc_nexus == acb) {
918 callout_reset(&acb->xs->xs_callout, mstohz(acb->timeout),
919 wd33c93_timeout, acb);
935 scsipi_printaddr(acb->xs->xs_periph);
944 scsipi_printaddr(acb->xs->xs_periph);
981 wd33c93_selectbus(struct wd33c93_softc *sc, struct wd33c93_acb *acb)
983 struct scsipi_xfer *xs = acb->xs;
1000 callout_reset(&xs->xs_callout, mstohz(acb->timeout),
1001 wd33c93_timeout, acb);
1040 wd33c93_nextstate(sc, acb, csr, asr);
1309 wd33c93_go(struct wd33c93_softc *sc, struct wd33c93_acb *acb)
1311 struct scsipi_xfer *xs = acb->xs;
1317 sc->sc_nexus = acb;
1323 sc->sc_daddr = acb->daddr;
1324 sc->sc_dleft = acb->dleft;
1338 if ((csr = wd33c93_selectbus(sc, acb)) == 0)
1349 i = wd33c93_nextstate(sc, acb, csr, asr);
1421 wd33c93_poll(struct wd33c93_softc *sc, struct wd33c93_acb *acb)
1425 struct scsipi_xfer *xs = acb->xs;
1428 for (count=acb->timeout; count;) {
1534 struct wd33c93_acb *acb = sc->sc_nexus;
1552 if (acb->tag_type &&
1553 li->queued[acb->tag_id] != NULL) {
1554 li->queued[acb->tag_id] = NULL;
1557 acb->tag_type = acb->tag_id = 0;
1558 li->untagged = acb;
1569 acb->xs->xs_periph->periph_target);
1599 acb->flags |= ACB_COMPLETE;
1601 if (acb->xs->xs_control & XS_CTL_POLL)
1608 if ((acb->xs->xs_periph->periph_quirks &
1615 acb->daddr = sc->sc_daddr;
1616 acb->dleft = sc->sc_dleft;
1621 sc->sc_daddr = acb->daddr;
1622 sc->sc_dleft = acb->dleft;
1700 acb->xs->xs_periph->periph_target);
1709 scsipi_printaddr(acb->xs->xs_periph);
1717 scsipi_printaddr(acb->xs->xs_periph);
1800 struct wd33c93_acb *acb = sc->sc_nexus;
1802 if (acb == NULL)
1813 ti = &sc->sc_tinfo[acb->xs->xs_periph->periph_target];
1839 MSG_IDENTIFY(acb->xs->xs_periph->periph_lun, 0);
1846 sc->sc_omsg[0] = acb->tag_type;
1847 sc->sc_omsg[1] = acb->tag_id;
1892 wd33c93_nextstate(struct wd33c93_softc *sc, struct wd33c93_acb *acb, u_char csr, u_char asr)
1903 if (wd33c93_xfout(sc, acb->clen, &acb->cmd))
1924 acb->dleft = (acb->flags & ACB_COMPLETE) ? 0 :
1930 wd33c93_scsidone(sc, acb, sc->sc_status);
1946 if (acb->dleft <= 0) {
1948 acb->dleft, asr, csr);
1955 if (acb->xs->xs_control & XS_CTL_POLL ||
1972 (acb->dleft - resid);
2046 if (acb->xs->xs_control & XS_CTL_POLL || wd33c93_nodisc)
2151 if (acb->xs)
2152 wd33c93_error(sc, acb);
2153 wd33c93_abort(sc, acb, "next");
2157 wd33c93_scsidone(sc, acb, STATUS_UNKNOWN);
2171 struct wd33c93_acb *acb;
2195 acb = NULL;
2204 acb = li->untagged;
2212 acb = li->queued[tag_id];
2215 if (acb == NULL) {
2224 sc->sc_nexus = acb;
2227 if (!wd33c93_dmaok(sc, acb->xs))
2231 sc->sc_daddr = acb->daddr;
2232 sc->sc_dleft = acb->dleft;
2237 if (acb->flags & ACB_RESET)
2239 else if (acb->flags & ACB_ABORT)
2279 struct wd33c93_acb *acb = arg;
2280 struct scsipi_xfer *xs = acb->xs;
2291 printf("%s: timed out; asr=0x%02x [acb %p (flags 0x%x, dleft %zx)], "
2293 device_xname(sc->sc_dev), asr, acb, acb->flags, acb->dleft,