Lines Matching defs:acb
76 * 4) Rewrite it to use malloc for the acb structs instead of static alloc.?
391 struct spc_acb *acb;
407 acb = sc->sc_acb;
408 memset(acb, 0, sizeof(sc->sc_acb));
409 for (r = 0; r < sizeof(sc->sc_acb) / sizeof(*acb); r++) {
410 TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
411 acb++;
417 if ((acb = sc->sc_nexus) != NULL) {
418 acb->xs->error = XS_DRIVER_STUFFUP;
419 callout_stop(&acb->xs->xs_callout);
420 spc_done(sc, acb);
422 while ((acb = TAILQ_FIRST(&sc->nexus_list)) != NULL) {
423 acb->xs->error = XS_DRIVER_STUFFUP;
424 callout_stop(&acb->xs->xs_callout);
425 spc_done(sc, acb);
455 spc_free_acb(struct spc_softc *sc, struct spc_acb *acb, int flags)
462 acb->flags = 0;
463 TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
470 struct spc_acb *acb;
475 acb = TAILQ_FIRST(&sc->free_list);
476 if (acb != NULL) {
477 TAILQ_REMOVE(&sc->free_list, acb, chain);
478 acb->flags |= ACB_ALLOC;
481 return acb;
515 struct spc_acb *acb;
527 acb = spc_get_acb(sc);
533 if (acb == NULL) {
535 printf("unable to allocate acb\n");
540 /* Initialize acb */
541 acb->xs = xs;
542 acb->timeout = xs->timeout;
545 acb->flags |= ACB_RESET;
546 acb->scsipi_cmd_length = 0;
547 acb->data_length = 0;
549 memcpy(&acb->scsipi_cmd, xs->cmd, xs->cmdlen);
550 acb->scsipi_cmd_length = xs->cmdlen;
551 acb->data_addr = xs->data;
552 acb->data_length = xs->datalen;
554 acb->target_stat = 0;
558 TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
576 if (spc_poll(sc, xs, acb->timeout)) {
577 spc_timeout(acb);
578 if (spc_poll(sc, xs, acb->timeout))
579 spc_timeout(acb);
667 spc_select(struct spc_softc *sc, struct spc_acb *acb)
669 struct scsipi_periph *periph = acb->xs->xs_periph;
710 struct spc_acb *acb;
736 TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
737 periph = acb->xs->xs_periph;
742 if (acb == NULL) {
750 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
752 sc->sc_nexus = acb;
757 if (acb->flags & ACB_RESET)
759 else if (acb->flags & ACB_ABORT)
763 sc->sc_dp = acb->data_addr;
764 sc->sc_dleft = acb->data_length;
765 sc->sc_cp = (uint8_t *)&acb->scsipi_cmd;
766 sc->sc_cleft = acb->scsipi_cmd_length;
788 struct spc_acb *acb;
797 * Find first acb in ready queue that is for a target/lunit pair that
800 TAILQ_FOREACH(acb, &sc->ready_list, chain) {
801 periph = acb->xs->xs_periph;
806 TAILQ_REMOVE(&sc->ready_list, acb, chain);
807 sc->sc_nexus = acb;
808 spc_select(sc, acb);
823 spc_done(struct spc_softc *sc, struct spc_acb *acb)
825 struct scsipi_xfer *xs = acb->xs;
832 if (acb->flags & ACB_ABORT) {
835 switch (acb->target_stat) {
838 xs->resid = acb->data_length;
841 xs->status = acb->target_stat;
845 xs->resid = acb->data_length;
851 device_xname(sc->sc_dev), acb->target_stat);
870 if (acb->flags & ACB_NEXUS)
872 if (acb == sc->sc_nexus) {
877 spc_dequeue(sc, acb);
879 spc_free_acb(sc, acb, xs->xs_control);
885 spc_dequeue(struct spc_softc *sc, struct spc_acb *acb)
889 if (acb->flags & ACB_NEXUS)
890 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
892 TAILQ_REMOVE(&sc->ready_list, acb, chain);
1041 struct spc_acb *acb;
1046 acb = sc->sc_nexus;
1047 ti = &sc->sc_tinfo[acb->xs->xs_periph->periph_target];
1053 periph = acb->xs->xs_periph;
1061 acb->xs->resid = acb->data_length = sc->sc_dleft;
1109 acb->data_addr = sc->sc_dp;
1110 acb->data_length = sc->sc_dleft;
1114 sc->sc_dp = acb->data_addr;
1115 sc->sc_dleft = acb->data_length;
1116 sc->sc_cp = (uint8_t *)&acb->scsipi_cmd;
1117 sc->sc_cleft = acb->scsipi_cmd_length;
1136 scsipi_printaddr(acb->xs->xs_periph);
1156 scsipi_printaddr(acb->xs->xs_periph);
1644 struct spc_acb *acb;
1729 acb = sc->sc_nexus;
1731 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
1754 acb = sc->sc_nexus;
1755 periph = acb->xs->xs_periph;
1759 if (acb->flags & ACB_RESET)
1761 else if (acb->flags & ACB_ABORT)
1774 acb->flags |= ACB_NEXUS;
1778 sc->sc_dp = acb->data_addr;
1779 sc->sc_dleft = acb->data_length;
1780 sc->sc_cp = (uint8_t *)&acb->scsipi_cmd;
1781 sc->sc_cleft = acb->scsipi_cmd_length;
1784 if ((acb->xs->xs_control & XS_CTL_POLL) == 0)
1785 callout_reset(&acb->xs->xs_callout,
1786 mstohz(acb->timeout), spc_timeout, acb);
1799 acb = sc->sc_nexus;
1803 acb->xs->error = XS_SELTIMEOUT;
1841 acb = sc->sc_nexus;
1850 periph = acb->xs->xs_periph;
1882 acb->target_stat = SCSI_CHECK;
1883 acb->xs->error = XS_NOERROR;
1887 acb->xs->error = XS_DRIVER_STUFFUP;
1892 acb = sc->sc_nexus;
1893 TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
1899 acb = sc->sc_nexus;
1953 acb = sc->sc_nexus;
1955 acb->scsipi_cmd.opcode, acb->scsipi_cmd_length - 1);
2000 acb = sc->sc_nexus;
2007 acb->target_stat = bus_space_read_1(iot, ioh, TEMP);
2013 SPC_MISC(("target_stat=0x%02x ", acb->target_stat));
2026 callout_stop(&acb->xs->xs_callout);
2029 spc_done(sc, acb);
2046 spc_abort(struct spc_softc *sc, struct spc_acb *acb)
2050 acb->timeout = SPC_ABORT_TIMEOUT;
2051 acb->flags |= ACB_ABORT;
2053 if (acb == sc->sc_nexus) {
2061 spc_dequeue(sc, acb);
2062 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
2071 struct spc_acb *acb = arg;
2072 struct scsipi_xfer *xs = acb->xs;
2083 if (acb->flags & ACB_ABORT) {
2090 acb->xs->error = XS_TIMEOUT;
2091 spc_abort(sc, acb);
2104 spc_show_scsi_cmd(struct spc_acb *acb)
2106 uint8_t *b = (uint8_t *)&acb->scsipi_cmd;
2109 scsipi_printaddr(acb->xs->xs_periph);
2110 if ((acb->xs->xs_control & XS_CTL_RESET) == 0) {
2111 for (i = 0; i < acb->scsipi_cmd_length; i++) {
2122 spc_print_acb(struct spc_acb *acb)
2125 printf("acb@%p xs=%p flags=%x", acb, acb->xs, acb->flags);
2127 acb->data_addr, acb->data_length, acb->target_stat);
2128 spc_show_scsi_cmd(acb);
2134 struct spc_acb *acb;
2138 TAILQ_FOREACH(acb, &sc->ready_list, chain)
2139 spc_print_acb(acb);
2144 TAILQ_FOREACH(acb, &sc->nexus_list, chain)
2145 spc_print_acb(acb);