Lines Matching defs:acb
180 struct osiop_acb *acb;
253 acb = malloc(sizeof(struct osiop_acb) * OSIOP_NACB,
255 sc->sc_acb = acb;
271 OSIOP_MAX_XFER, 0, BUS_DMA_NOWAIT, &acb->datadma);
278 acb->sc = sc;
279 acb->ds = &sc->sc_ds[i];
280 acb->dsoffset = sizeof(struct osiop_ds) * i;
282 dsa = sc->sc_dsdma->dm_segs[0].ds_addr + acb->dsoffset;
283 acb->ds->id.addr = dsa + OSIOP_DSIDOFF;
284 acb->ds->cmd.addr = dsa + OSIOP_DSCMDOFF;
285 acb->ds->status.count = 1;
286 acb->ds->status.addr = dsa + OSIOP_DSSTATOFF;
287 acb->ds->msg.count = 1;
288 acb->ds->msg.addr = dsa + OSIOP_DSMSGOFF;
289 acb->ds->msgin.count = 1;
290 acb->ds->msgin.addr = dsa + OSIOP_DSMSGINOFF;
291 acb->ds->extmsg.count = 1;
292 acb->ds->extmsg.addr = dsa + OSIOP_DSEXTMSGOFF;
293 acb->ds->synmsg.count = 3;
294 acb->ds->synmsg.addr = dsa + OSIOP_DSSYNMSGOFF;
295 TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
297 acb++;
356 struct osiop_acb *acb;
380 acb = TAILQ_FIRST(&sc->free_list);
381 if (acb != NULL) {
382 TAILQ_REMOVE(&sc->free_list, acb, chain);
387 printf("unable to allocate acb\n");
392 acb->status = ACB_S_READY;
393 acb->xs = xs;
397 err = bus_dmamap_load(sc->sc_dmat, acb->datadma,
407 TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
413 acb->cmdlen = xs->cmdlen;
414 acb->datalen = xs->datalen;
416 acb->data = xs->data;
419 TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
427 osiop_poll(sc, acb);
457 osiop_poll(struct osiop_softc *sc, struct osiop_acb *acb)
459 struct scsipi_xfer *xs = acb->xs;
484 acb->ds, acb->xs->timeout);
501 if (acb != sc->sc_nexus)
527 struct osiop_acb *acb;
540 TAILQ_FOREACH(acb, &sc->ready_list, chain) {
541 periph = acb->xs->xs_periph;
546 TAILQ_REMOVE(&sc->ready_list, acb, chain);
547 sc->sc_nexus = acb;
554 if (acb == NULL) {
562 if (acb->xs->xs_control & XS_CTL_RESET)
570 osiop_scsidone(struct osiop_acb *acb, int status)
578 if (acb == NULL || acb->xs == NULL) {
579 printf("osiop_scsidone: NULL acb or scsipi_xfer\n");
586 xs = acb->xs;
587 sc = acb->sc;
591 if (acb->status != ACB_S_DONE)
592 printf("%s: acb not done (status %d)\n",
593 device_xname(sc->sc_dev), acb->status);
630 bus_dmamap_sync(sc->sc_dmat, acb->datadma, 0, acb->datalen,
633 bus_dmamap_unload(sc->sc_dmat, acb->datadma);
643 if (acb == sc->sc_nexus) {
651 } else if (sc->ready_list.tqh_last == &TAILQ_NEXT(acb, chain)) {
652 TAILQ_REMOVE(&sc->ready_list, acb, chain);
657 if (acb2 == acb) {
658 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
666 if (TAILQ_NEXT(acb, chain) != NULL) {
667 TAILQ_REMOVE(&sc->ready_list, acb, chain);
670 printf("%s: can't find matching acb\n",
682 acb->status = ACB_S_FREE;
683 TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
769 struct osiop_acb *acb;
843 while ((acb = TAILQ_FIRST(&sc->nexus_list)) != NULL) {
844 acb->xs->error = (acb->flags & ACB_F_TIMEOUT) ?
846 acb->status = ACB_S_DONE;
847 acb->flags = 0;
848 osiop_scsidone(acb, SCSI_OSIOP_NOCHECK);
880 struct osiop_acb *acb = sc->sc_nexus;
881 struct osiop_ds *ds = acb->ds;
882 struct scsipi_xfer *xs = acb->xs;
883 bus_dmamap_t dsdma = sc->sc_dsdma, datadma = acb->datadma;
893 sc->sc_script, acb->ds, sc->sc_active);
909 if (acb->status != ACB_S_READY)
910 panic("osiop_start: non-ready cmd in acb");
913 acb->intstat = 0;
916 memcpy(ds->scsipi_cmd, xs->cmd, acb->cmdlen);
917 ds->cmd.count = acb->cmdlen;
966 acb->curaddr = 0;
967 acb->curlen = 0;
978 bus_dmamap_sync(sc->sc_dmat, acb->datadma,
979 0, acb->datalen, (xs->xs_control & XS_CTL_DATA_IN) ?
985 acb->dsoffset, sizeof(struct osiop_ds),
988 acb->status = ACB_S_ACTIVE;
992 int timeout = mstohz(acb->xs->timeout);
997 osiop_timeout, acb);
1004 sc->sc_script, acb->ds, sc->sc_active);
1019 dsdma->dm_segs[0].ds_addr + acb->dsoffset);
1045 struct osiop_acb *acb = sc->sc_nexus;
1081 if (acb != NULL) { /* XXX */
1082 ds = acb->ds;
1084 acb->dsoffset, sizeof(struct osiop_ds),
1087 if (acb->status != ACB_S_ACTIVE)
1088 printf("osiop_checkintr: acb not active (status %d)\n",
1089 acb->status);
1098 if (acb == NULL) {
1105 dsdma->dm_segs[0].ds_addr + acb->dsoffset) {
1108 dsdma->dm_segs[0].ds_addr + acb->dsoffset);
1112 target = acb->xs->xs_periph->periph_target;
1144 acb->status = ACB_S_DONE;
1148 if (acb == NULL) {
1153 target = acb->xs->xs_periph->periph_target;
1175 acb->dsoffset, sizeof(struct osiop_ds),
1197 if (acb == NULL) {
1202 if (acb->datalen > 0) {
1208 acb->curaddr = osiop_read_4(sc, OSIOP_DNAD) - adjust;
1209 acb->curlen = dbc + adjust;
1214 "adjust %x sbcl %x starts %d acb %p\n",
1215 acb->curaddr, acb->curlen, dfifo,
1218 osiopstarts, acb);
1228 acb->dsoffset, sizeof(struct osiop_ds),
1270 if (acb == NULL) {
1279 dsdma->dm_segs[0].ds_addr + acb->dsoffset);
1305 acb->status = ACB_S_DONE;
1307 acb->xs->error = XS_SELTIMEOUT;
1313 if (acb != NULL)
1314 target = acb->xs->xs_periph->periph_target;
1320 if (acb == NULL)
1330 return (acb != NULL);
1335 if (acb == NULL) {
1344 "dbc %x sstat1 %x starts %d acb %p\n",
1349 acb->curaddr, acb->curlen,
1351 dfifo, dbc, sstat1, osiopstarts, acb);
1353 acb->dsoffset, sizeof(struct osiop_ds),
1365 if (acb->datalen > 0 &&
1369 if (acb->curlen != 0 &&
1370 acb->curlen != ds->data[0].count)
1374 acb->curaddr, acb->curlen,
1383 acb->curaddr = ds->data[n].addr;
1384 acb->curlen = ds->data[n].count;
1391 acb->curaddr, acb->curlen);
1402 if (acb->curlen > 0) {
1417 if (acb->curaddr >= ds->data[i].addr &&
1418 acb->curaddr <
1425 acb->curaddr, acb->curlen, i);
1434 acb->curaddr, acb->curlen);
1436 ds->data[0].addr = acb->curaddr;
1437 ds->data[0].count = acb->curlen;
1457 acb->dsoffset, sizeof(struct osiop_ds),
1466 acb->intstat = sc->sc_flags & OSIOP_INTSOFF;
1467 TAILQ_INSERT_TAIL(&sc->nexus_list, acb, chain);
1509 * locate acb of reselecting device
1510 * set sc->sc_nexus to acb
1512 TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
1513 struct scsipi_periph *periph = acb->xs->xs_periph;
1518 TAILQ_REMOVE(&sc->nexus_list, acb, chain);
1519 sc->sc_nexus = acb;
1520 sc->sc_flags |= acb->intstat;
1521 acb->intstat = 0;
1523 dsdma->dm_segs[0].ds_addr + acb->dsoffset);
1530 if (acb == NULL) {
1583 if (acb == NULL) {
1595 acb->dsoffset, sizeof(struct osiop_ds),
1636 acb ? sc->sc_dsdma->dm_segs[0].ds_addr + acb->dsoffset : 0,
1657 if (acb != NULL)
1658 acb->status = ACB_S_DONE;
1665 struct osiop_acb *acb = sc->sc_nexus;
1672 if (acb->xs->xs_control & XS_CTL_POLL || sc->sc_flags & OSIOP_NODMA) {
1691 acb->xs->xs_periph->periph_target,
1692 acb->xs->cmd->opcode, sc->sc_nexus->ds);
1841 struct osiop_acb *acb = arg;
1842 struct scsipi_xfer *xs = acb->xs;
1843 struct osiop_softc *sc = acb->sc;
1855 acb->flags |= ACB_F_TIMEOUT;
1881 osiop_dump_acb(struct osiop_acb *acb)
1886 printf("acb@%p ", acb);
1887 if (acb->xs == NULL) {
1892 b = (uint8_t *)&acb->xs->cmd;
1894 acb->xs->xs_periph->periph_target,
1895 acb->xs->xs_periph->periph_lun, acb->status, acb->cmdlen);
1896 for (i = acb->cmdlen; i > 0; i--)
1899 printf(" xs: %p data %p:%04x ", acb->xs, acb->xs->data,
1900 acb->xs->datalen);
1901 printf("va %p:%lx ", acb->data, acb->datalen);
1902 printf("cur %lx:%lx\n", acb->curaddr, acb->curlen);
1908 struct osiop_acb *acb;
1917 if ((acb = TAILQ_FIRST(&sc->free_list)) != NULL) {
1919 while (acb) {
1920 osiop_dump_acb(acb);
1921 acb = TAILQ_NEXT(acb, chain);
1924 if ((acb = TAILQ_FIRST(&sc->ready_list)) != NULL) {
1926 while (acb) {
1927 osiop_dump_acb(acb);
1928 acb = TAILQ_NEXT(acb, chain);
1931 if ((acb = TAILQ_FIRST(&sc->nexus_list)) != NULL) {
1933 while (acb) {
1934 osiop_dump_acb(acb);
1935 acb = TAILQ_NEXT(acb, chain);