Lines Matching defs:acb
231 struct siop_acb *acb;
253 acb = sc->free_list.tqh_first;
254 if (acb) {
255 TAILQ_REMOVE(&sc->free_list, acb, chain);
264 if (acb == NULL) {
266 printf("unable to allocate acb\n");
271 acb->flags = ACB_ACTIVE;
272 acb->xs = xs;
273 memcpy(&acb->cmd, xs->cmd, xs->cmdlen);
274 acb->clen = xs->cmdlen;
275 acb->daddr = xs->data;
276 acb->dleft = xs->datalen;
279 TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
287 siop_poll(sc, acb);
299 siop_poll(struct siop_softc *sc, struct siop_acb *acb)
302 struct scsipi_xfer *xs = acb->xs;
325 xs->xs_periph->periph_target, acb->cmd.opcode,
328 *((volatile long *)&rp->siop_dcmd), &acb->ds, acb->xs->timeout);
342 if (acb != sc->sc_nexus)
366 struct siop_acb *acb;
379 for (acb = sc->ready_list.tqh_first; acb; acb = acb->chain.tqe_next) {
380 periph = acb->xs->xs_periph;
385 TAILQ_REMOVE(&sc->ready_list, acb, chain);
386 sc->sc_nexus = acb;
387 periph = acb->xs->xs_periph;
394 if (acb == NULL) {
402 if (acb->xs->xs_control & XS_CTL_RESET)
406 acb->cmd.bytes[0] |= slp->scsipi_scsi.lun << 5; /* XXXX */
413 siop_scsidone(struct siop_acb *acb, int stat)
420 if (acb == NULL || (xs = acb->xs) == NULL) {
422 printf("siop_scsidone: NULL acb or scsipi_xfer\n");
450 if (acb == sc->sc_nexus) {
458 } else if (sc->ready_list.tqh_last == &acb->chain.tqe_next) {
459 TAILQ_REMOVE(&sc->ready_list, acb, chain);
465 if (acb2 == acb) {
466 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
474 else if (acb->chain.tqe_next) {
475 TAILQ_REMOVE(&sc->ready_list, acb, chain);
478 printf("%s: can't find matching acb\n",
487 acb->flags = ACB_FREE;
488 TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
611 struct siop_acb *acb;
616 acb = arg;
617 periph = acb->xs->xs_periph;
624 acb->xs->error = XS_TIMEOUT;
636 struct siop_acb *acb;
697 acb = sc->sc_acb;
698 memset(acb, 0, sizeof(struct siop_acb) * SIOP_NACB);
700 TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
701 acb++;
709 while ((acb = sc->nexus_list.tqh_first) > 0) {
710 acb->xs->error = XS_RESET;
711 siop_scsidone(acb, acb->stat[0]);
738 struct siop_acb *acb = sc->sc_nexus;
746 rp, &scripts, &acb->ds, sc->sc_active);
755 acb->msgout[0] = MSG_IDENTIFY | lun;
758 acb->msgout[0] = MSG_IDENTIFY_DR | lun;
759 acb->status = 0;
760 acb->stat[0] = -1;
761 acb->msg[0] = -1;
762 acb->ds.scsi_addr = (0x10000 << target) | (sc->sc_sync[target].sxfer << 8);
763 acb->ds.idlen = 1;
764 acb->ds.idbuf = (char *) kvtop(&acb->msgout[0]);
765 acb->ds.cmdlen = clen;
766 acb->ds.cmdbuf = (char *) kvtop(cbuf);
767 acb->ds.stslen = 1;
768 acb->ds.stsbuf = (char *) kvtop(&acb->stat[0]);
769 acb->ds.msglen = 1;
770 acb->ds.msgbuf = (char *) kvtop(&acb->msg[0]);
771 acb->msg[1] = -1;
772 acb->ds.msginlen = 1;
773 acb->ds.extmsglen = 1;
774 acb->ds.synmsglen = 3;
775 acb->ds.msginbuf = (char *) kvtop(&acb->msg[1]);
776 acb->ds.extmsgbuf = (char *) kvtop(&acb->msg[2]);
777 acb->ds.synmsgbuf = (char *) kvtop(&acb->msg[3]);
778 memset(&acb->ds.chain, 0, sizeof (acb->ds.chain));
796 acb->msg[2] = -1;
797 acb->msgout[1] = MSG_EXT_MESSAGE;
798 acb->msgout[2] = 3;
799 acb->msgout[3] = MSG_SYNC_REQ;
801 acb->msgout[4] = 50 / 4; /* ask for ridiculous period */
803 acb->msgout[4] = sc->sc_minsync;
805 acb->msgout[5] = SIOP_MAX_OFFSET;
806 acb->ds.idlen = 6;
818 acb->iob_buf = buf;
819 acb->iob_len = len;
820 acb->iob_curbuf = acb->iob_curlen = 0;
826 acb->ds.chain[nchain].databuf = (char *) kvtop (addr);
829 acb->ds.chain[nchain].datalen = tcount;
832 if (acb->ds.chain[nchain].databuf == dmaend) {
833 dmaend += acb->ds.chain[nchain].datalen;
834 acb->ds.chain[nchain].datalen = 0;
835 acb->ds.chain[--nchain].datalen += tcount;
841 dmaend = acb->ds.chain[nchain].databuf +
842 acb->ds.chain[nchain].datalen;
843 acb->ds.chain[nchain].datalen = tcount;
855 printf (" [%d] %8p %lx\n", i, acb->ds.chain[i].databuf,
856 acb->ds.chain[i].datalen);
862 dma_cachectl ((void *)acb, sizeof (struct siop_acb));
869 rp, &scripts, &acb->ds, sc->sc_active);
876 callout_reset(&acb->xs->xs_callout,
877 mstohz(acb->xs->timeout) + 1, siop_timeout, acb);
883 rp->siop_dsa = kvtop((void *)&acb->ds);
909 struct siop_acb *acb = sc->sc_nexus;
924 DCIAS(&acb->stat[0]); /* XXX */
926 istat, dstat, sstat0, rp->siop_dsps, rp->siop_sbcl, acb->stat[0], acb->msg[0]);
928 acb->msg[0], acb->msg[1], acb->msg[2],
929 acb->msg[3], acb->msg[4], acb->msg[5]);
948 if (rp->siop_dsa != kvtop((void *)&acb->ds)) {
950 (unsigned)kvtop((void *)&acb->ds));
954 target = acb->xs->xs_periph->periph_target;
956 if (acb->msg[1] == 0xff)
959 else if (acb->msg[1] == MSG_REJECT)
965 device_xname(sc->sc_dev), target, acb->msg[1],
966 acb->msg[2], acb->msg[3]);
969 dma_cachectl(&acb->stat[0], 1);
970 *status = acb->stat[0];
974 rp, &scripts, &acb->ds);*/
979 if (acb->msg[0] != 0x00)
981 device_xname(sc->sc_dev), acb->msg[0]);
988 target = acb->xs->xs_periph->periph_target;
989 if (acb->msg[1] == MSG_EXT_MESSAGE && acb->msg[2] == 3 &&
990 acb->msg[3] == MSG_SYNC_REQ) {
994 acb->msg[0], acb->msg[1], acb->msg[2],
995 acb->msg[3], acb->msg[4], acb->msg[5]);
999 if (acb->msg[2] == 3 &&
1000 acb->msg[3] == MSG_SYNC_REQ &&
1001 acb->msg[5] != 0) {
1012 if (acb->msg[4] && acb->msg[4] < 100 / 4) {
1016 acb->msg[4] * 4);
1018 if (acb->msg[4] == 50 / 4)
1019 acb->msg[4] = 208 / 4;
1021 acb->msg[4] = 100 / 4;
1026 acb->msg[4] * 4, acb->msg[5]);
1045 if (acb == NULL)
1049 if (acb->iob_len) {
1056 acb->iob_curlen =
1058 acb->iob_curlen += adjust;
1059 acb->iob_curbuf =
1064 printf ("Phase mismatch: curbuf %lx curlen %lx dfifo %x dbc %x sstat1 %x adjust %x sbcl %x starts %d acb %p\n",
1065 acb->iob_curbuf, acb->iob_curlen, dfifo,
1067 siopstarts, acb);
1068 if (acb->ds.chain[1].datalen) {
1069 for (i = 0; acb->ds.chain[i].datalen; ++i)
1071 i, acb->ds.chain[i].databuf,
1072 acb->ds.chain[i].datalen);
1076 dma_cachectl ((void *)acb, sizeof(*acb));
1109 if (acb == NULL)
1114 rp, &scripts, &acb->ds);
1131 acb->xs->error = XS_SELTIMEOUT;
1136 if (acb)
1137 target = acb->xs->xs_periph->periph_target;
1142 if (acb == NULL)
1154 return (acb != NULL);
1160 printf ("%s: ID %02x disconnected TEMP %lx (+%lx) curbuf %lx curlen %lx buf %p len %lx dfifo %x dbc %x sstat1 %x starts %d acb %p\n",
1163 acb->iob_curbuf, acb->iob_curlen,
1164 acb->ds.chain[0].databuf, acb->ds.chain[0].datalen, dfifo, dbc, sstat1, siopstarts, acb);
1166 if (acb == NULL) {
1179 if (acb->iob_len && rp->siop_temp) {
1182 if (acb->iob_curlen && acb->iob_curlen != acb->ds.chain[0].datalen)
1184 device_xname(sc->sc_dev), n, acb->iob_curbuf, acb->iob_curlen,
1185 acb->ds.chain[0].databuf, acb->ds.chain[0].datalen);
1193 acb->iob_curbuf = (u_long)acb->ds.chain[n].databuf;
1194 acb->iob_curlen = acb->ds.chain[n].datalen;
1199 printf(" curbuf %lx curlen %lx\n", acb->iob_curbuf,
1200 acb->iob_curlen);
1211 if (acb->iob_curlen) {
1225 if (acb->ds.chain[i].datalen == 0)
1227 if (acb->iob_curbuf >= (long)acb->ds.chain[i].databuf &&
1228 acb->iob_curbuf < (long)(acb->ds.chain[i].databuf +
1229 acb->ds.chain[i].datalen))
1232 if (i >= DMAMAXIO || acb->ds.chain[i].datalen == 0) {
1235 acb->iob_curbuf, acb->iob_curlen, i);
1244 acb->ds.chain[0].databuf,
1245 acb->ds.chain[0].datalen,
1246 acb->iob_curbuf,
1247 acb->iob_curlen);
1249 acb->ds.chain[0].databuf = (char *)acb->iob_curbuf;
1250 acb->ds.chain[0].datalen = acb->iob_curlen;
1251 for (j = 1, ++i; i < DMAMAXIO && acb->ds.chain[i].datalen; ++i, ++j) {
1255 acb->ds.chain[j].databuf,
1256 acb->ds.chain[j].datalen,
1257 acb->ds.chain[i].databuf,
1258 acb->ds.chain[i].datalen);
1260 acb->ds.chain[j].databuf = acb->ds.chain[i].databuf;
1261 acb->ds.chain[j].datalen = acb->ds.chain[i].datalen;
1264 acb->ds.chain[j].datalen = 0;
1265 DCIAS(kvtop((void *)&acb->ds.chain));
1273 acb->status = sc->sc_flags & SIOP_INTSOFF;
1274 TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
1310 * locate acb of reselecting device
1311 * set sc->sc_nexus to acb
1313 for (acb = sc->nexus_list.tqh_first; acb;
1314 acb = acb->chain.tqe_next) {
1315 if (reselid != (acb->ds.scsi_addr >> 16) ||
1316 reselun != (acb->msgout[0] & 0x07))
1318 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
1319 sc->sc_nexus = acb;
1320 sc->sc_flags |= acb->status;
1321 acb->status = 0;
1322 DCIAS(kvtop(&acb->stat[0]));
1323 rp->siop_dsa = kvtop((void *)&acb->ds);
1325 sc->sc_sync[acb->xs->xs_periph->periph_target].sxfer;
1327 sc->sc_sync[acb->xs->xs_periph->periph_target].sbcl;
1330 if (acb == NULL) {
1336 dma_cachectl ((void *)acb, sizeof(*acb));
1376 if (acb == NULL)
1380 dma_cachectl (&acb->msg[1],1);
1382 device_xname(sc->sc_dev), rp->siop_sfbr, acb->msg[1], rp->siop_sbcl);
1384 DCIAS(kvtop(&acb->msg[1]));
1399 dma_cachectl (&acb->stat[0], 1);
1400 dma_cachectl (&acb->msg[0], 1);
1402 rp->siop_dsps, acb->stat[0], acb->msg[0], acb->msg[1],
1421 printf ("siopchkintr: target %x ds %p\n", target, &acb->ds);
1423 sc->sc_scriptspa, (unsigned)kvtop((void *)&acb->ds),
1428 rp->siop_sbcl, acb->stat[0], acb->msg[0], acb->msg[1], rp->siop_sfbr);
1445 struct siop_acb *acb = sc->sc_nexus;
1453 if (acb->xs->xs_control & XS_CTL_POLL || siop_no_dma) {
1472 acb->xs->xs_periph->periph_target, acb->cmd.opcode,
1476 siop_start(sc, acb->xs->xs_periph->periph_target,
1477 acb->xs->xs_periph->periph_lun,
1478 (u_char *)&acb->cmd, acb->clen, acb->daddr, acb->dleft);
1632 siop_dump_acb(struct siop_acb *acb)
1634 u_char *b = (u_char *) &acb->cmd;
1637 printf("acb@%p ", acb);
1638 if (acb->xs == NULL) {
1643 acb->xs->xs_periph->periph_target,
1644 acb->xs->xs_periph->periph_lun, acb->flags, acb->clen);
1645 for (i = acb->clen; i; --i)
1648 printf(" xs: %p data %p:%04x ", acb->xs, acb->xs->data,
1649 acb->xs->datalen);
1650 printf("va %p:%lx ", acb->iob_buf, acb->iob_len);
1651 printf("cur %lx:%lx\n", acb->iob_curbuf, acb->iob_curlen);
1657 struct siop_acb *acb;
1668 if ((acb = sc->free_list.tqh_first) > 0) {
1670 while (acb) {
1671 siop_dump_acb(acb);
1672 acb = acb->chain.tqe_next;
1675 if ((acb = sc->ready_list.tqh_first) > 0) {
1677 while (acb) {
1678 siop_dump_acb(acb);
1679 acb = acb->chain.tqe_next;
1682 if ((acb = sc->nexus_list.tqh_first) > 0) {
1684 while (acb) {
1685 siop_dump_acb(acb);
1686 acb = acb->chain.tqe_next;