Lines Matching defs:acb

64  * 4) Rewrite it to use malloc for the acb structs instead of static alloc.?
360 struct aic_acb *acb;
376 acb = sc->sc_acb;
377 bzero(acb, sizeof(sc->sc_acb));
378 for (r = 0; r < sizeof(sc->sc_acb) / sizeof(*acb); r++) {
379 TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
380 acb++;
386 if ((acb = sc->sc_nexus) != NULL) {
387 acb->xs->error = XS_DRIVER_STUFFUP;
388 timeout_del(&acb->xs->stimeout);
389 aic_done(sc, acb);
391 while ((acb = TAILQ_FIRST(&sc->nexus_list)) != NULL) {
392 acb->xs->error = XS_DRIVER_STUFFUP;
393 timeout_del(&acb->xs->stimeout);
394 aic_done(sc, acb);
426 struct aic_acb *acb = xacb;
429 acb->flags = 0;
430 TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
438 struct aic_acb *acb;
441 acb = TAILQ_FIRST(&sc->free_list);
442 if (acb) {
443 TAILQ_REMOVE(&sc->free_list, acb, chain);
444 acb->flags |= ACB_ALLOC;
448 return acb;
482 struct aic_acb *acb;
490 acb = xs->io;
492 /* Initialize acb */
493 acb->xs = xs;
494 acb->timeout = xs->timeout;
495 timeout_set(&xs->stimeout, aic_timeout, acb);
498 acb->flags |= ACB_RESET;
499 acb->scsi_cmd_length = 0;
500 acb->data_length = 0;
502 bcopy(&xs->cmd, &acb->scsi_cmd, xs->cmdlen);
503 acb->scsi_cmd_length = xs->cmdlen;
504 acb->data_addr = xs->data;
505 acb->data_length = xs->datalen;
507 acb->target_stat = 0;
511 TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
521 if (aic_poll(sc, xs, acb->timeout)) {
522 aic_timeout(acb);
523 if (aic_poll(sc, xs, acb->timeout))
524 aic_timeout(acb);
596 aic_select(struct aic_softc *sc, struct aic_acb *acb)
600 struct scsi_link *sc_link = acb->xs->sc_link;
621 struct aic_acb *acb;
646 TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
647 sc_link = acb->xs->sc_link;
651 if (acb == NULL) {
660 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
662 sc->sc_nexus = acb;
667 if (acb->flags & ACB_RESET)
669 else if (acb->flags & ACB_ABORT)
673 sc->sc_dp = acb->data_addr;
674 sc->sc_dleft = acb->data_length;
675 sc->sc_cp = (u_char *)&acb->scsi_cmd;
676 sc->sc_cleft = acb->scsi_cmd_length;
701 struct aic_acb *acb;
706 * Find first acb in ready queue that is for a target/lunit pair that
711 TAILQ_FOREACH(acb, &sc->ready_list, chain) {
712 sc_link = acb->xs->sc_link;
717 TAILQ_REMOVE(&sc->ready_list, acb, chain);
718 sc->sc_nexus = acb;
719 aic_select(sc, acb);
734 aic_sense(struct aic_softc *sc, struct aic_acb *acb)
736 struct scsi_xfer *xs = acb->xs;
739 struct scsi_sense *ss = (void *)&acb->scsi_cmd;
747 acb->scsi_cmd_length = sizeof(*ss);
748 acb->data_addr = (char *)&xs->sense;
749 acb->data_length = sizeof(struct scsi_sense_data);
750 acb->flags |= ACB_SENSE;
752 if (acb->flags & ACB_NEXUS)
754 if (acb == sc->sc_nexus) {
755 aic_select(sc, acb);
757 aic_dequeue(sc, acb);
758 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
768 aic_done(struct aic_softc *sc, struct aic_acb *acb)
770 struct scsi_xfer *xs = acb->xs;
785 if (acb->flags & ACB_ABORT) {
787 } else if (acb->flags & ACB_SENSE) {
789 } else if (acb->target_stat == SCSI_CHECK) {
791 xs->resid = acb->data_length;
792 xs->status = acb->target_stat;
793 aic_sense(sc, acb);
796 xs->resid = acb->data_length;
814 if (acb->flags & ACB_NEXUS)
816 if (acb == sc->sc_nexus) {
821 aic_dequeue(sc, acb);
828 aic_dequeue(struct aic_softc *sc, struct aic_acb *acb)
831 if (acb->flags & ACB_NEXUS) {
832 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
834 TAILQ_REMOVE(&sc->ready_list, acb, chain);
943 struct aic_acb *acb;
949 acb = sc->sc_nexus;
950 ti = &sc->sc_tinfo[acb->xs->sc_link->target];
955 sc_link = acb->xs->sc_link;
959 acb->data_length = 0;
961 acb->xs->resid = acb->data_length = sc->sc_dleft;
1009 acb->data_addr = sc->sc_dp;
1010 acb->data_length = sc->sc_dleft;
1014 sc->sc_dp = acb->data_addr;
1015 sc->sc_dleft = acb->data_length;
1016 sc->sc_cp = (u_char *)&acb->scsi_cmd;
1017 sc->sc_cleft = acb->scsi_cmd_length;
1036 sc_print_addr(acb->xs->sc_link);
1057 sc_print_addr(acb->xs->sc_link);
1592 struct aic_acb *acb;
1665 acb = sc->sc_nexus;
1667 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
1690 acb = sc->sc_nexus;
1691 sc_link = acb->xs->sc_link;
1695 if (acb->flags & ACB_RESET)
1697 else if (acb->flags & ACB_ABORT)
1710 acb->flags |= ACB_NEXUS;
1714 sc->sc_dp = acb->data_addr;
1715 sc->sc_dleft = acb->data_length;
1716 sc->sc_cp = (u_char *)&acb->scsi_cmd;
1717 sc->sc_cleft = acb->scsi_cmd_length;
1720 if ((acb->xs->flags & SCSI_POLL) == 0)
1721 timeout_add_msec(&acb->xs->stimeout, acb->timeout);
1735 acb = sc->sc_nexus;
1742 acb->xs->error = XS_SELTIMEOUT;
1787 acb = sc->sc_nexus;
1796 sc_link = acb->xs->sc_link;
1828 aic_sense(sc, acb);
1832 acb->xs->error = XS_DRIVER_STUFFUP;
1837 acb = sc->sc_nexus;
1839 acb->data_addr = sc->sc_dp;
1840 acb->data_length = sc->sc_dleft;
1842 TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
1848 acb = sc->sc_nexus;
1887 acb = sc->sc_nexus;
1889 acb->scsi_cmd.opcode, acb->scsi_cmd_length-1);
1922 acb = sc->sc_nexus;
1924 acb->target_stat = bus_space_read_1(iot, ioh, SCSIDAT);
1926 AIC_MISC(("target_stat=0x%02x ", acb->target_stat));
1938 timeout_del(&acb->xs->stimeout);
1939 aic_done(sc, acb);
1953 aic_abort(struct aic_softc *sc, struct aic_acb *acb)
1957 acb->timeout = AIC_ABORT_TIMEOUT;
1958 acb->flags |= ACB_ABORT;
1960 if (acb == sc->sc_nexus) {
1968 aic_dequeue(sc, acb);
1969 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
1978 struct aic_acb *acb = arg;
1979 struct scsi_xfer *xs = acb->xs;
1989 if (acb->flags & ACB_ABORT) {
1996 acb->xs->error = XS_TIMEOUT;
1997 aic_abort(sc, acb);
2011 aic_show_scsi_cmd(struct aic_acb *acb)
2013 u_char *b = (u_char *)&acb->scsi_cmd;
2014 struct scsi_link *sc_link = acb->xs->sc_link;
2018 if ((acb->xs->flags & SCSI_RESET) == 0) {
2019 for (i = 0; i < acb->scsi_cmd_length; i++) {
2030 aic_print_acb(struct aic_acb *acb)
2033 printf("acb@%p xs=%p flags=%x", acb, acb->xs, acb->flags);
2035 acb->data_addr, acb->data_length, acb->target_stat);
2036 aic_show_scsi_cmd(acb);
2042 struct aic_acb *acb;
2046 TAILQ_FOREACH(acb, &sc->ready_list, chain)
2047 aic_print_acb(acb);
2052 TAILQ_FOREACH(acb, &sc->nexus_list, chain)
2053 aic_print_acb(acb);