Lines Matching defs:acb

57  * 4) Rewrite it to use malloc for the acb structs instead of static alloc.?
382 struct aic_acb *acb;
397 acb = sc->sc_acb;
398 memset(acb, 0, sizeof(sc->sc_acb));
399 for (r = 0; r < sizeof(sc->sc_acb) / sizeof(*acb); r++) {
400 TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
401 acb++;
407 if ((acb = sc->sc_nexus) != NULL) {
408 acb->xs->error = XS_DRIVER_STUFFUP;
409 callout_stop(&acb->xs->xs_callout);
410 aic_done(sc, acb);
412 while ((acb = sc->nexus_list.tqh_first) != NULL) {
413 acb->xs->error = XS_DRIVER_STUFFUP;
414 callout_stop(&acb->xs->xs_callout);
415 aic_done(sc, acb);
433 aic_free_acb(struct aic_softc *sc, struct aic_acb *acb)
438 acb->flags = 0;
439 TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
446 struct aic_acb *acb;
450 acb = TAILQ_FIRST(&sc->free_list);
451 if (acb != NULL) {
452 TAILQ_REMOVE(&sc->free_list, acb, chain);
453 acb->flags |= ACB_ALLOC;
456 return (acb);
490 struct aic_acb *acb;
510 acb = aic_get_acb(sc);
516 if (acb == NULL) {
518 printf("unable to allocate acb\n");
523 /* Initialize acb */
524 acb->xs = xs;
525 acb->timeout = xs->timeout;
528 acb->flags |= ACB_RESET;
529 acb->scsipi_cmd_length = 0;
530 acb->data_length = 0;
532 memcpy(&acb->scsipi_cmd, xs->cmd, xs->cmdlen);
533 acb->scsipi_cmd_length = xs->cmdlen;
534 acb->data_addr = xs->data;
535 acb->data_length = xs->datalen;
537 acb->target_stat = 0;
541 TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
551 if (aic_poll(sc, xs, acb->timeout)) {
552 aic_timeout(acb);
553 if (aic_poll(sc, xs, acb->timeout))
554 aic_timeout(acb);
703 aic_select(struct aic_softc *sc, struct aic_acb *acb)
705 struct scsipi_periph *periph = acb->xs->xs_periph;
728 struct aic_acb *acb;
753 for (acb = sc->nexus_list.tqh_first; acb != NULL;
754 acb = acb->chain.tqe_next) {
755 periph = acb->xs->xs_periph;
760 if (acb == NULL) {
768 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
770 sc->sc_nexus = acb;
775 if (acb->flags & ACB_RESET)
777 else if (acb->flags & ACB_ABORT)
781 sc->sc_dp = acb->data_addr;
782 sc->sc_dleft = acb->data_length;
783 sc->sc_cp = (u_char *)&acb->scsipi_cmd;
784 sc->sc_cleft = acb->scsipi_cmd_length;
806 struct aic_acb *acb;
816 * Find first acb in ready queue that is for a target/lunit pair that
821 for (acb = sc->ready_list.tqh_first; acb != NULL;
822 acb = acb->chain.tqe_next) {
823 periph = acb->xs->xs_periph;
828 TAILQ_REMOVE(&sc->ready_list, acb, chain);
829 sc->sc_nexus = acb;
830 aic_select(sc, acb);
844 aic_sense(struct aic_softc *sc, struct aic_acb *acb)
846 struct scsipi_xfer *xs = acb->xs;
849 struct scsi_request_sense *ss = (void *)&acb->scsipi_cmd;
857 acb->scsipi_cmd_length = sizeof(*ss);
858 acb->data_addr = (char *)&xs->sense.scsi_sense;
859 acb->data_length = sizeof(struct scsi_sense_data);
860 acb->flags |= ACB_SENSE;
862 if (acb->flags & ACB_NEXUS)
864 if (acb == sc->sc_nexus) {
865 aic_select(sc, acb);
867 aic_dequeue(sc, acb);
868 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
878 aic_done(struct aic_softc *sc, struct aic_acb *acb)
880 struct scsipi_xfer *xs = acb->xs;
895 if (acb->flags & ACB_ABORT) {
897 } else if (acb->flags & ACB_SENSE) {
899 } else if (acb->target_stat == SCSI_CHECK) {
901 xs->resid = acb->data_length;
902 xs->status = acb->target_stat;
903 aic_sense(sc, acb);
906 xs->resid = acb->data_length;
924 if (acb->flags & ACB_NEXUS)
926 if (acb == sc->sc_nexus) {
931 aic_dequeue(sc, acb);
933 aic_free_acb(sc, acb);
939 aic_dequeue(struct aic_softc *sc, struct aic_acb *acb)
942 if (acb->flags & ACB_NEXUS) {
943 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
945 TAILQ_REMOVE(&sc->ready_list, acb, chain);
1053 struct aic_acb *acb;
1058 acb = sc->sc_nexus;
1059 ti = &sc->sc_tinfo[acb->xs->xs_periph->periph_target];
1066 periph = acb->xs->xs_periph;
1074 acb->xs->resid = acb->data_length = sc->sc_dleft;
1100 acb->xs->xs_periph->periph_target);
1108 acb->xs->xs_periph->periph_target);
1126 acb->data_addr = sc->sc_dp;
1127 acb->data_length = sc->sc_dleft;
1131 sc->sc_dp = acb->data_addr;
1132 sc->sc_dleft = acb->data_length;
1133 sc->sc_cp = (u_char *)&acb->scsipi_cmd;
1134 sc->sc_cleft = acb->scsipi_cmd_length;
1154 acb->xs->xs_periph->periph_target);
1172 acb->xs->xs_periph->periph_target);
1703 struct aic_acb *acb;
1779 acb = sc->sc_nexus;
1781 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
1803 acb = sc->sc_nexus;
1804 periph = acb->xs->xs_periph;
1808 if (acb->flags & ACB_RESET)
1810 else if (acb->flags & ACB_ABORT)
1823 acb->flags |= ACB_NEXUS;
1827 sc->sc_dp = acb->data_addr;
1828 sc->sc_dleft = acb->data_length;
1829 sc->sc_cp = (u_char *)&acb->scsipi_cmd;
1830 sc->sc_cleft = acb->scsipi_cmd_length;
1833 if ((acb->xs->xs_control & XS_CTL_POLL) == 0)
1834 callout_reset(&acb->xs->xs_callout,
1835 mstohz(acb->timeout), aic_timeout, acb);
1848 acb = sc->sc_nexus;
1855 acb->xs->error = XS_SELTIMEOUT;
1900 acb = sc->sc_nexus;
1909 periph = acb->xs->xs_periph;
1941 aic_sense(sc, acb);
1945 acb->xs->error = XS_DRIVER_STUFFUP;
1950 acb = sc->sc_nexus;
1952 acb->data_addr = sc->sc_dp;
1953 acb->data_length = sc->sc_dleft;
1955 TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
1961 acb = sc->sc_nexus;
2000 acb = sc->sc_nexus;
2002 acb->scsipi_cmd.opcode, acb->scsipi_cmd_length-1);
2035 acb = sc->sc_nexus;
2037 acb->target_stat = bus_space_read_1(iot, ioh, SCSIDAT);
2039 AIC_MISC(("target_stat=0x%02x ", acb->target_stat));
2051 callout_stop(&acb->xs->xs_callout);
2052 aic_done(sc, acb);
2066 aic_abort(struct aic_softc *sc, struct aic_acb *acb)
2070 acb->timeout = AIC_ABORT_TIMEOUT;
2071 acb->flags |= ACB_ABORT;
2073 if (acb == sc->sc_nexus) {
2081 aic_dequeue(sc, acb);
2082 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
2091 struct aic_acb *acb = arg;
2092 struct scsipi_xfer *xs = acb->xs;
2103 if (acb->flags & ACB_ABORT) {
2110 acb->xs->error = XS_TIMEOUT;
2111 aic_abort(sc, acb);
2124 aic_show_scsi_cmd(struct aic_acb *acb)
2126 u_char *b = (u_char *)&acb->scsipi_cmd;
2127 struct scsipi_periph *periph = acb->xs->xs_periph;
2131 if ((acb->xs->xs_control & XS_CTL_RESET) == 0) {
2132 for (i = 0; i < acb->scsipi_cmd_length; i++) {
2143 aic_print_acb(struct aic_acb *acb)
2146 printf("acb@%p xs=%p flags=%x", acb, acb->xs, acb->flags);
2148 acb->data_addr, acb->data_length, acb->target_stat);
2149 aic_show_scsi_cmd(acb);
2155 struct aic_acb *acb;
2159 for (acb = sc->ready_list.tqh_first; acb != NULL;
2160 acb = acb->chain.tqe_next)
2161 aic_print_acb(acb);
2166 for (acb = sc->nexus_list.tqh_first; acb != NULL;
2167 acb = acb->chain.tqe_next)
2168 aic_print_acb(acb);