Lines Matching defs:acb
259 struct sbic_acb* acb;
267 acb = dev->sc_nexus;
281 acb->sc_dmacmd = dev->sc_dmacmd;
294 acb->sc_dmacmd, asr);
298 acb->sc_kv.dc_addr += (dev->sc_tcnt - count);
299 acb->sc_kv.dc_count -= (dev->sc_tcnt - count);
300 acb->sc_pa.dc_addr += (dev->sc_tcnt - count);
301 acb->sc_pa.dc_count -= ((dev->sc_tcnt - count)>>1);
303 acb->sc_tcnt = dev->sc_tcnt = count;
323 struct sbic_acb *acb;
326 acb = dev->sc_nexus;
327 if (!acb->sc_kv.dc_count) {
335 dev->sc_last = dev->sc_cur = &acb->sc_pa;
336 dev->sc_tcnt = acb->sc_tcnt;
337 dev->sc_dmacmd = acb->sc_dmacmd;
346 paddr = acb->sc_pa.dc_addr =
347 (char *) kvtop(acb->sc_kv.dc_addr);
349 vaddr = acb->sc_kv.dc_addr;
350 count = acb->sc_kv.dc_count;
352 count < acb->sc_kv.dc_count
356 if (count > acb->sc_kv.dc_count) {
357 count = acb->sc_kv.dc_count;
366 acb->sc_tcnt = count;
367 acb->sc_pa.dc_count = count >> 1;
372 acb->sc_kv.dc_addr,
373 acb->sc_kv.dc_count,
374 acb->sc_pa.dc_addr,
375 acb->sc_tcnt);
401 struct sbic_acb *acb;
420 acb = dev->free_list.tqh_first;
421 if (acb)
422 TAILQ_REMOVE(&dev->free_list, acb, chain);
426 if (acb == NULL) {
428 printf("unable to allocate acb\n");
432 acb->flags = ACB_ACTIVE;
434 acb->flags |= ACB_DATAIN;
435 acb->xs = xs;
436 memcpy(&acb->cmd, xs->cmd, xs->cmdlen);
437 acb->clen = xs->cmdlen;
438 acb->sc_kv.dc_addr = xs->data;
439 acb->sc_kv.dc_count = xs->datalen;
440 acb->pa_addr = xs->data ? (char *)kvtop(xs->data) : 0; /* XXXX check */
452 dev->sc_nexus = acb;
458 &acb->cmd, acb->clen,
459 acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
460 } while (dev->sc_nexus != acb);
461 sbic_scsidone(acb, stat);
469 TAILQ_INSERT_TAIL(&dev->ready_list, acb, chain);
507 struct sbic_acb *acb;
515 for (acb = dev->ready_list.tqh_first; acb; acb = acb->chain.tqe_next) {
516 periph = acb->xs->xs_periph;
521 TAILQ_REMOVE(&dev->ready_list, acb, chain);
522 dev->sc_nexus = acb;
525 acb->sc_pa.dc_addr = acb->pa_addr; /* XXXX check */
531 if (acb == NULL)
534 dev->sc_xs = xs = acb->xs;
552 periph->periph_lun, &acb->cmd,
553 acb->clen, acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
560 sbic_scsidone(acb, stat);
565 sbic_scsidone(struct sbic_acb *acb, int stat)
572 xs = acb->xs;
577 if (acb == NULL || xs == NULL) {
611 if (acb == dev->sc_nexus) {
618 } else if (dev->ready_list.tqh_last == &acb->chain.tqe_next) {
619 TAILQ_REMOVE(&dev->ready_list, acb, chain);
624 if (acb2 == acb) {
625 TAILQ_REMOVE(&dev->nexus_list, acb, chain);
633 else if (acb->chain.tqe_next) {
634 TAILQ_REMOVE(&dev->ready_list, acb, chain);
636 printf("%s: can't find matching acb\n",
644 acb->flags = ACB_FREE;
645 TAILQ_INSERT_HEAD(&dev->free_list, acb, chain);
744 while (acb = dev->nexus_list.tqh_first) {
745 acb->xs->error = XS_DRIVER_STUFFUP;
746 sbic_scsidone(acb, -1 /*acb->stat[0]*/);
802 struct sbic_acb *acb;
815 acb = dev->sc_acb;
816 memset(acb, 0, sizeof(dev->sc_acb));
817 for (i = 0; i < sizeof(dev->sc_acb) / sizeof(*acb); i++) {
818 TAILQ_INSERT_TAIL(&dev->free_list, acb, chain);
819 acb++;
858 struct sbic_acb *acb;
920 acb = dev->sc_acb;
921 memset(acb, 0, sizeof(dev->sc_acb));
922 for (i = 0; i < sizeof(dev->sc_acb) / sizeof(*acb); i++) {
923 TAILQ_INSERT_TAIL(&dev->free_list, acb, chain);
924 acb++;
932 while (acb = dev->nexus_list.tqh_first) {
933 acb->xs->error = XS_DRIVER_STUFFUP;
934 sbic_scsidone(acb, -1 /*acb->stat[0]*/);
1320 struct sbic_acb *acb;
1331 acb = dev->sc_nexus;
1334 dev->sc_last = dev->sc_cur = &acb->sc_pa;
1335 dev->sc_tcnt = acb->sc_tcnt = 0;
1336 acb->sc_pa.dc_count = 0; /* No DMA */
1337 acb->sc_kv.dc_addr = buf;
1338 acb->sc_kv.dc_count = len;
1345 acb->sc_kv.dc_count);
1435 if (acb->sc_kv.dc_count <= 0)
1440 acb->sc_kv.dc_count,
1445 acb->sc_kv.dc_count,
1446 acb->sc_kv.dc_addr);
1449 acb->sc_kv.dc_count,
1450 acb->sc_kv.dc_addr,
1452 acb->sc_kv.dc_addr +=
1453 (acb->sc_kv.dc_count - i);
1454 acb->sc_kv.dc_count = i;
1541 acb->sc_kv.dc_count,
1608 struct sbic_acb *acb;
1613 acb = dev->sc_nexus;
1650 if (acb->flags & ACB_DATAIN)
1658 addr = acb->sc_kv.dc_addr;
1659 count = acb->sc_kv.dc_count;
1660 if (count && (char *)kvtop(addr) != acb->sc_pa.dc_addr) { /* XXXX check */
1662 acb->sc_pa.dc_addr, (unsigned)kvtop(addr));
1677 acb->flags |= ACB_BBUF;
1678 acb->sc_dmausrbuf = addr;
1679 acb->sc_dmausrlen = count;
1680 acb->sc_usrbufpa = (u_char *)kvtop(addr);
1684 printf("xfer: (%p->%p,%lx)\n", acb->sc_dmausrbuf,
1685 acb->sc_usrbufpa, acb->sc_dmausrlen);
1711 acb->sc_kv.dc_addr = addr;
1723 acb->sc_kv.dc_addr = addr;
1724 acb->sc_kv.dc_count = count;
1728 acb->sc_tcnt = dev->sc_tcnt = 0;
1729 acb->sc_pa.dc_count = 0;
1736 dev->sc_tcnt = dev->sc_dmago(dev, acb->sc_pa.dc_addr,
1737 acb->sc_pa.dc_count,
2200 struct sbic_acb *acb;
2209 acb = dev->sc_nexus;
2219 if (sbicxfstart(regs, acb->clen, CMD_PHASE, sbic_cmd_wait))
2220 if (sbicxfout(regs, acb->clen,
2221 &acb->cmd, CMD_PHASE))
2254 if (acb->flags & ACB_BBUF) {
2255 if ((u_char *)kvtop(acb->sc_dmausrbuf) != acb->sc_usrbufpa)
2257 device_xname(dev->sc_dev), acb->sc_usrbufpa,
2258 (unsigned)kvtop(acb->sc_dmausrbuf));
2262 acb->sc_dmausrlen,
2267 acb->sc_dmausrbuf,
2268 acb->sc_dmausrlen);
2271 sbic_scsidone(acb, dev->sc_stat[0]);
2284 (dev->sc_flags & SBICF_ICMD) || acb->sc_dmacmd == 0) {
2287 if (acb->sc_kv.dc_count <= 0) {
2289 acb->sc_kv.dc_count, asr, csr);
2294 acb->sc_kv.dc_count,
2299 acb->sc_kv.dc_count,
2300 acb->sc_kv.dc_addr);
2303 acb->sc_kv.dc_count,
2304 acb->sc_kv.dc_addr,
2307 acb->sc_kv.dc_addr +=
2308 (acb->sc_kv.dc_count - i);
2309 acb->sc_kv.dc_count = i;
2311 if (acb->sc_kv.dc_count <= 0) {
2313 acb->sc_kv.dc_count, asr, csr);
2329 dev->sc_tcnt = acb->sc_tcnt = tcnt;
2391 TAILQ_INSERT_HEAD(&dev->nexus_list, acb, chain);
2396 if ((acb->xs->xs_control & XS_CTL_POLL)
2472 for (acb = dev->nexus_list.tqh_first; acb;
2473 acb = acb->chain.tqe_next) {
2474 if (acb->xs->xs_periph->periph_target != newtarget ||
2475 acb->xs->xs_periph->periph_lun != newlun)
2477 TAILQ_REMOVE(&dev->nexus_list, acb, chain);
2478 dev->sc_nexus = acb;
2479 dev->sc_xs = acb->xs;
2485 if (acb == NULL) {
2537 sbic_scsidone(acb, -1);
2661 sbic_dump_acb(struct sbic_acb *acb)
2663 u_char *b = (u_char *) &acb->cmd;
2666 printf("acb@%p ", acb);
2667 if (acb->xs == NULL) {
2672 acb->xs->xs_periph->periph_target,
2673 acb->xs->xs_periph->periph_lun, acb->flags, acb->clen);
2674 for (i = acb->clen; i; --i)
2677 printf(" xs: %8p data %8p:%04x ", acb->xs, acb->xs->data,
2678 acb->xs->datalen);
2679 printf("va %8p:%04x ", acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
2680 printf("pa %8p:%04x tcnt %lx\n", acb->sc_pa.dc_addr, acb->sc_pa.dc_count,
2681 acb->sc_tcnt);
2689 struct sbic_acb *acb;
2804 if ((acb = dev->free_list.tqh_first)) {
2806 while (acb) {
2807 sbic_dump_acb(acb);
2808 acb = acb->chain.tqe_next;
2811 if ((acb = dev->ready_list.tqh_first)) {
2813 while (acb) {
2814 sbic_dump_acb(acb);
2815 acb = acb->chain.tqe_next;
2818 if ((acb = dev->nexus_list.tqh_first)) {
2820 while (acb) {
2821 sbic_dump_acb(acb);
2822 acb = acb->chain.tqe_next;