Lines Matching defs:acb

76  * 4) Rewrite it to use malloc for the acb structs instead of static alloc.?
285 struct spc_acb *acb;
301 acb = sc->sc_acb;
302 bzero(acb, sizeof(sc->sc_acb));
303 for (r = 0; r < sizeof(sc->sc_acb) / sizeof(*acb); r++) {
304 TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
305 acb++;
311 if ((acb = sc->sc_nexus) != NULL) {
312 acb->xs->error = XS_DRIVER_STUFFUP;
313 timeout_del(&acb->xs->stimeout);
314 spc_done(sc, acb);
316 while ((acb = TAILQ_FIRST(&sc->nexus_list)) != NULL) {
317 acb->xs->error = XS_DRIVER_STUFFUP;
318 timeout_del(&acb->xs->stimeout);
319 spc_done(sc, acb);
352 struct spc_acb *acb = xacb;
356 acb->flags = 0;
358 TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
366 struct spc_acb *acb;
371 acb = TAILQ_FIRST(&sc->free_list);
372 if (acb)
373 TAILQ_REMOVE(&sc->free_list, acb, chain);
376 return acb;
410 struct spc_acb *acb;
418 acb = xs->io;
420 /* Initialize acb */
421 acb->xs = xs;
422 timeout_set(&xs->stimeout, spc_timeout, acb);
425 acb->flags |= ACB_RESET;
426 acb->scsi_cmd_length = 0;
427 acb->data_length = 0;
429 bcopy(&xs->cmd, &acb->scsi_cmd, xs->cmdlen);
430 acb->scsi_cmd_length = xs->cmdlen;
431 acb->data_addr = xs->data;
432 acb->data_length = xs->datalen;
434 acb->target_stat = 0;
438 TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
456 spc_timeout(acb);
458 spc_timeout(acb);
528 spc_select(struct spc_softc *sc, struct spc_acb *acb)
530 struct scsi_link *sc_link = acb->xs->sc_link;
571 struct spc_acb *acb;
597 TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
598 sc_link = acb->xs->sc_link;
603 if (acb == NULL) {
611 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
613 sc->sc_nexus = acb;
618 if (acb->flags & ACB_RESET)
620 else if (acb->flags & ACB_ABORT)
624 sc->sc_dp = acb->data_addr;
625 sc->sc_dleft = acb->data_length;
626 sc->sc_cp = (u_char *)&acb->scsi_cmd;
627 sc->sc_cleft = acb->scsi_cmd_length;
649 struct spc_acb *acb;
658 * Find first acb in ready queue that is for a target/lunit pair that
661 TAILQ_FOREACH(acb, &sc->ready_list, chain) {
662 sc_link = acb->xs->sc_link;
667 TAILQ_REMOVE(&sc->ready_list, acb, chain);
668 sc->sc_nexus = acb;
669 spc_select(sc, acb);
680 spc_sense(struct spc_softc *sc, struct spc_acb *acb)
682 struct scsi_xfer *xs = acb->xs;
685 struct scsi_sense *ss = (void *)&acb->scsi_cmd;
693 acb->scsi_cmd_length = sizeof(*ss);
694 acb->data_addr = (char *)&xs->sense;
695 acb->data_length = sizeof(struct scsi_sense_data);
696 acb->flags |= ACB_SENSE;
698 if (acb->flags & ACB_NEXUS)
700 if (acb == sc->sc_nexus) {
701 spc_select(sc, acb);
703 spc_dequeue(sc, acb);
704 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
714 spc_done(struct spc_softc *sc, struct spc_acb *acb)
716 struct scsi_xfer *xs = acb->xs;
731 if (acb->flags & ACB_ABORT) {
733 } else if (acb->flags & ACB_SENSE) {
736 switch (acb->target_stat) {
739 xs->resid = acb->data_length;
740 xs->status = acb->target_stat;
741 spc_sense(sc, acb);
747 xs->resid = acb->data_length;
753 sc->sc_dev.dv_xname, acb->target_stat);
774 if (acb->flags & ACB_NEXUS)
776 if (acb == sc->sc_nexus) {
781 spc_dequeue(sc, acb);
788 spc_dequeue(struct spc_softc *sc, struct spc_acb *acb)
792 if (acb->flags & ACB_NEXUS)
793 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
795 TAILQ_REMOVE(&sc->ready_list, acb, chain);
929 struct spc_acb *acb;
935 acb = sc->sc_nexus;
936 ti = &sc->sc_tinfo[acb->xs->sc_link->target];
941 sc_link = acb->xs->sc_link;
945 acb->data_length = 0;
947 acb->xs->resid = acb->data_length = sc->sc_dleft;
995 acb->data_addr = sc->sc_dp;
996 acb->data_length = sc->sc_dleft;
1000 sc->sc_dp = acb->data_addr;
1001 sc->sc_dleft = acb->data_length;
1002 sc->sc_cp = (u_char *)&acb->scsi_cmd;
1003 sc->sc_cleft = acb->scsi_cmd_length;
1022 sc_print_addr(acb->xs->sc_link);
1042 sc_print_addr(acb->xs->sc_link);
1581 struct spc_acb *acb;
1669 acb = sc->sc_nexus;
1671 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
1694 acb = sc->sc_nexus;
1695 sc_link = acb->xs->sc_link;
1699 if (acb->flags & ACB_RESET)
1701 else if (acb->flags & ACB_ABORT)
1714 acb->flags |= ACB_NEXUS;
1718 sc->sc_dp = acb->data_addr;
1719 sc->sc_dleft = acb->data_length;
1720 sc->sc_cp = (u_char *)&acb->scsi_cmd;
1721 sc->sc_cleft = acb->scsi_cmd_length;
1724 if ((acb->xs->flags & SCSI_POLL) == 0)
1725 timeout_add_msec(&acb->xs->stimeout,
1726 acb->xs->timeout);
1738 acb = sc->sc_nexus;
1742 acb->xs->error = XS_SELTIMEOUT;
1779 acb = sc->sc_nexus;
1788 sc_link = acb->xs->sc_link;
1820 spc_sense(sc, acb);
1824 acb->xs->error = XS_DRIVER_STUFFUP;
1829 acb = sc->sc_nexus;
1830 TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
1836 acb = sc->sc_nexus;
1889 acb = sc->sc_nexus;
1891 acb->scsi_cmd.opcode, acb->scsi_cmd_length - 1);
1924 acb = sc->sc_nexus;
1925 /*acb->target_stat = bus_space_read_1(iot, ioh, DREG);*/
1926 spc_datain_pio(sc, &acb->target_stat, 1);
1927 SPC_MISC(("target_stat=0x%02x ", acb->target_stat));
1939 timeout_del(&acb->xs->stimeout);
1942 spc_done(sc, acb);
1959 spc_abort(struct spc_softc *sc, struct spc_acb *acb)
1963 acb->xs->timeout = SPC_ABORT_TIMEOUT;
1964 acb->flags |= ACB_ABORT;
1966 if (acb == sc->sc_nexus) {
1974 spc_dequeue(sc, acb);
1975 TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
1984 struct spc_acb *acb = arg;
1985 struct scsi_xfer *xs = acb->xs;
1995 if (acb->flags & ACB_ABORT) {
2002 acb->xs->error = XS_TIMEOUT;
2003 spc_abort(sc, acb);
2016 spc_show_scsi_cmd(spc_acb *acb)
2018 u_char *b = (u_char *)&acb->scsi_cmd;
2019 struct scsi_link *sc_link = acb->xs->sc_link;
2023 if ((acb->xs->flags & SCSI_RESET) == 0) {
2024 for (i = 0; i < acb->scsi_cmd_length; i++) {
2035 spc_print_acb(spc_acb *acb)
2038 printf("acb@%p xs=%p flags=%x", acb, acb->xs, acb->flags);
2040 acb->data_addr, acb->data_length, acb->target_stat);
2041 spc_show_scsi_cmd(acb);
2047 struct spc_acb *acb;
2051 TAILQ_FOREACH(acb, &sc->ready_list, chain)
2052 spc_print_acb(acb);
2057 TAILQ_FOREACH(acb, &sc->nexus_list, chain)
2058 spc_print_acb(acb);