Lines Matching defs:acb
241 void mha_free_acb(struct mha_softc *, struct acb *, int);
242 void mha_sense(struct mha_softc *, struct acb *);
249 void mha_abort(struct mha_softc *, struct acb *);
252 void mha_poll(struct mha_softc *, struct acb *);
254 void mha_done(struct mha_softc *, struct acb *);
258 void mha_dequeue(struct mha_softc *, struct acb *);
261 void mha_print_acb(struct acb *);
262 void mha_show_scsi_cmd(struct acb *);
434 struct acb *acb;
443 acb = sc->sc_acb;
444 memset(acb, 0, sizeof(sc->sc_acb));
445 for (r = 0; r < sizeof(sc->sc_acb) / sizeof(*acb); r++) {
446 TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
447 acb++;
477 if ((acb = sc->sc_nexus) != NULL) {
478 acb->xs->error = XS_DRIVER_STUFFUP;
479 mha_done(sc, acb);
481 while ((acb = TAILQ_FIRST(&sc->nexus_list)) != NULL) {
482 acb->xs->error = XS_DRIVER_STUFFUP;
483 mha_done(sc, acb);
506 mha_free_acb(struct mha_softc *sc, struct acb *acb, int flags)
512 acb->flags = 0;
513 TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
519 if (TAILQ_NEXT(acb, chain) == NULL)
598 struct acb *acb;
623 TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
624 periph = acb->xs->xs_periph;
629 if (acb == NULL) {
637 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
639 sc->sc_nexus = acb;
644 if (acb->flags & ACB_RESET)
646 else if (acb->flags & ACB_ABORTED)
650 sc->sc_dp = acb->daddr;
651 sc->sc_dleft = acb->dleft;
652 sc->sc_cp = (u_char *)&acb->cmd;
653 sc->sc_cleft = acb->clen;
677 struct acb *acb;
692 acb = TAILQ_FIRST(&sc->free_list);
693 if (acb) {
694 TAILQ_REMOVE(&sc->free_list, acb, chain);
695 ACB_SETQ(acb, ACB_QNONE);
698 if (acb == NULL) {
706 /* Initialize acb */
707 acb->xs = xs;
708 memcpy(&acb->cmd, xs->cmd, xs->cmdlen);
709 acb->clen = xs->cmdlen;
710 acb->daddr = xs->data;
711 acb->dleft = xs->datalen;
712 acb->stat = 0;
715 ACB_SETQ(acb, ACB_QREADY);
716 TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
718 callout_reset(&acb->xs->xs_callout,
719 mstohz(xs->timeout), mha_timeout, acb);
732 mha_poll(sc, acb);
763 mha_poll(struct mha_softc *sc, struct acb *acb)
765 struct scsipi_xfer *xs = acb->xs;
794 mha_timeout((void *)acb);
822 struct acb *acb;
833 * Find first acb in ready queue that is for a target/lunit
836 TAILQ_FOREACH(acb, &sc->ready_list, chain) {
838 periph = acb->xs->xs_periph;
842 if ((acb->flags & ACB_QBITS) != ACB_QREADY)
844 TAILQ_REMOVE(&sc->ready_list, acb, chain);
845 ACB_SETQ(acb, ACB_QNONE);
846 sc->sc_nexus = acb;
849 sc->sc_dp = acb->daddr;
850 sc->sc_dleft = acb->dleft;
853 (u_char *)&acb->cmd, acb->clen);
867 mha_done(struct mha_softc *sc, struct acb *acb)
869 struct scsipi_xfer *xs = acb->xs;
876 callout_stop(&acb->xs->xs_callout);
888 if ((acb->flags & ACB_ABORTED) != 0) {
890 } else if (acb->flags & ACB_CHKSENSE) {
893 xs->status = acb->stat & ST_MASK;
896 xs->resid = acb->dleft;
902 xs->resid = acb->dleft;
908 device_xname(sc->sc_dev), acb->stat);
929 switch (acb->flags & ACB_QBITS) {
931 if (acb != sc->sc_nexus) {
932 panic("%s: floating acb", device_xname(sc->sc_dev));
940 TAILQ_REMOVE(&sc->ready_list, acb, chain);
943 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
947 panic("%s: dequeue: busy acb on free list",
952 device_xname(sc->sc_dev), acb->flags & ACB_QBITS);
957 TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
958 acb->flags = ACB_QFREE;
960 mha_free_acb(sc, acb, xs->xs_control);
968 mha_dequeue(struct mha_softc *sc, struct acb *acb)
971 if (acb->flags & ACB_QNEXUS) {
972 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
974 TAILQ_REMOVE(&sc->ready_list, acb, chain);
1071 struct acb *acb = sc->sc_nexus;
1073 &sc->sc_tinfo[acb->xs->xs_periph->periph_target];
1079 struct scsipi_periph *periph = acb->xs->xs_periph;
1086 acb->xs->resid = acb->dleft = sc->sc_dleft;
1097 scsipi_printaddr(acb->xs->xs_periph);
1117 if ((acb->xs->xs_periph->periph_quirks & PQUIRK_AUTOSAVE) == 0)
1122 acb->dleft = sc->sc_dleft;
1123 acb->daddr = sc->sc_dp;
1127 if (!acb) {
1133 sc->sc_dp = acb->daddr;
1134 sc->sc_dleft = acb->dleft;
1139 acb->xs->xs_periph->periph_target);
1155 acb->xs->xs_periph->periph_target);
1160 acb->xs->xs_periph->periph_target);
1171 scsipi_printaddr(acb->xs->xs_periph);
1214 struct acb *acb;
1227 TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
1228 periph = acb->xs->xs_periph;
1231 TAILQ_REMOVE(&sc->nexus_list, acb,
1233 ACB_SETQ(acb, ACB_QNONE);
1238 if (!acb) { /* Invalid reselection! */
1248 sc->sc_nexus = acb;
1249 sc->sc_dp = acb->daddr;
1250 sc->sc_dleft = acb->dleft;
1258 SPC_MISC(("... found acb"));
1618 struct acb *acb = sc->sc_nexus;
1622 if (acb->cmd.opcode == SCSI_REQUEST_SENSE || (n & 1))
1642 struct acb *acb;
1683 acb = sc->sc_nexus;
1694 acb->xs->cmd->opcode,
1701 acb = sc->sc_nexus;
1703 acb->xs->error = XS_SELTIMEOUT;
1704 mha_done(sc, acb);
1726 acb = sc->sc_nexus;
1731 acb->stat = sc->sc_pcx[0]; /* XXX */
1732 SPC_MISC(("stat=0x%02x ", acb->stat));
1762 /*mha_done(sc, acb); XXX */
1815 if (acb->dleft) {
1817 if (acb->xs->xs_control & XS_CTL_DATA_IN) {
1823 else if (acb->xs->xs_control & XS_CTL_DATA_OUT) {
1849 acb = sc->sc_nexus;
1851 acb->xs->error = XS_NOERROR;
1852 mha_done(sc, acb);
1854 TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
1925 mha_abort(struct mha_softc *sc, struct acb *acb)
1927 acb->flags |= ACB_ABORTED;
1929 if (acb == sc->sc_nexus) {
1947 struct acb *acb = (struct acb *)arg;
1948 struct scsipi_xfer *xs = acb->xs;
1957 printf("%s: timed out [acb %p (flags 0x%x, dleft %x, stat %x)], "
1960 acb, acb->flags, acb->dleft, acb->stat,
1967 if (acb->flags & ACB_ABORTED) {
1977 mha_abort(sc, acb);
1990 mha_show_scsi_cmd(struct acb *acb)
1992 u_char *b = (u_char *)&acb->cmd;
1993 struct scsipi_periph *periph = acb->xs->xs_periph;
1997 if ((acb->xs->xs_control & XS_CTL_RESET) == 0) {
1998 for (i = 0; i < acb->clen; i++) {
2009 mha_print_acb(struct acb *acb)
2012 printf("acb@%p xs=%p flags=%x", acb, acb->xs, acb->flags);
2014 acb->daddr, acb->dleft, acb->stat);
2015 mha_show_scsi_cmd(acb);
2021 struct acb *acb;
2025 TAILQ_FOREACH(acb, &sc->ready_list, chain)
2026 mha_print_acb(acb);
2031 TAILQ_FOREACH(acb, &sc->nexus_list, chain)
2032 mha_print_acb(acb);