Lines Matching defs:xycsc
1245 struct xyc_softc *xycsc = v;
1249 xycsc->sc_intrcnt.ev_count++;
1253 xyc_remove_iorq(xycsc);
1257 xyc_start(xycsc, NULL);
1354 xyc_cmd(struct xyc_softc *xycsc, int cmd, int subfn, int unit, int block,
1358 struct xy_iorq *iorq = xycsc->ciorq;
1359 struct xy_iopb *iopb = xycsc->ciopb;
1374 printf("%s: stole control iopb\n", device_xname(xycsc->sc_dev));
1379 xyc_rqinit(iorq, xycsc,
1380 (unit == XYC_NOUNIT) ? NULL : xycsc->sc_drives[unit],
1389 xyc_submit_iorq(xycsc, iorq, fullmode); /* error code will be in iorq */
1400 xyc_startbuf(struct xyc_softc *xycsc, struct xy_softc *xysc, struct buf *bp)
1435 error = bus_dmamap_load(xycsc->dmatag, iorq->dmamap,
1438 aprint_error_dev(xycsc->sc_dev, "warning: cannot load DMA map\n");
1443 bus_dmamap_sync(xycsc->dmatag, iorq->dmamap, 0,
1449 xyc_rqinit(iorq, xycsc, xysc, XY_SUB_NORM | XY_MODE_VERBO, block,
1498 xyc_submit_iorq(struct xyc_softc *xycsc, struct xy_iorq *iorq, int type)
1504 device_xname(xycsc->sc_dev), iorq, type);
1508 if ((xycsc->xyc->xyc_csr & XYC_GBSY) != 0) {
1523 (void)xycsc->xyc->xyc_rsetup; /* RESET */
1524 if (xyc_unbusy(xycsc->xyc,XYC_RESETUSEC) == XY_ERR_FAIL)
1527 device_xname(xycsc->sc_dev));
1534 dmaiopb = xyc_chain(xycsc, iorq); /* build chain */
1541 XYC_GO(xycsc->xyc, dmaiopb);
1554 return (xyc_piodriver(xycsc, iorq));
1569 xyc_chain(struct xyc_softc *xycsc, struct xy_iorq *iorq)
1573 memset(xycsc->xy_chain, 0, sizeof(xycsc->xy_chain));
1579 if ((XY_STATE(xycsc->reqs[XYC_CTLIOPB].mode) == XY_SUB_POLL ||
1580 XY_STATE(xycsc->reqs[XYC_CTLIOPB].mode) == XY_SUB_WAIT) &&
1581 xycsc->iopbase[XYC_CTLIOPB].done == 0)
1582 iorq = &xycsc->reqs[XYC_CTLIOPB];
1590 xycsc->xy_chain[0] = iorq;
1599 hand = xycsc->xy_hand;
1600 xycsc->xy_hand = (xycsc->xy_hand + 1) % XYC_MAXIOPB;
1606 if (XY_STATE(xycsc->reqs[hand].mode) != XY_SUB_NORM ||
1607 xycsc->iopbase[hand].done)
1610 xycsc->xy_chain[chain] = &xycsc->reqs[hand];
1611 iopb = xycsc->xy_chain[chain]->iopb;
1615 prev_iopb = xycsc->xy_chain[chain-1]->iopb;
1617 dmaiopb = xycsc->xy_chain[chain]->dmaiopb;
1621 iorq = xycsc->xy_chain[chain];
1626 if (xycsc->no_ols)
1641 xyc_piodriver(struct xyc_softc *xycsc, struct xy_iorq *iorq)
1647 printf("xyc_piodriver(%s, 0x%x)\n", device_xname(xycsc->sc_dev), iorq);
1652 res = xyc_unbusy(xycsc->xyc, XYC_MAXTIME);
1656 xyc_reset(xycsc, 0, XY_RSET_ALL, XY_ERR_FAIL, 0);
1663 if (xyc_reset(xycsc, 0,
1672 xyc_remove_iorq(xycsc); /* may resubmit request */
1675 xyc_start(xycsc, iorq);
1689 xyc_start(xycsc, NULL);
1699 xyc_xyreset(struct xyc_softc *xycsc, struct xy_softc *xysc)
1705 iopb = xycsc->ciopb;
1715 XYC_GO(xycsc->xyc, xycsc->ciorq->dmaiopb);
1719 if ((xycsc->xyc->xyc_csr & XYC_GBSY) == 0)
1726 printf("%s: off-line: %s\n", device_xname(xycsc->sc_dev),
1728 del = xycsc->xyc->xyc_rsetup;
1729 if (xyc_unbusy(xycsc->xyc, XYC_RESETUSEC) == XY_ERR_FAIL)
1732 xycsc->xyc->xyc_csr = XYC_IPND; /* clear IPND */
1745 xyc_reset(struct xyc_softc *xycsc, int quiet, struct xy_iorq *blastmode,
1753 printf("%s: soft reset\n", device_xname(xycsc->sc_dev));
1754 del = xycsc->xyc->xyc_rsetup;
1755 del = xyc_unbusy(xycsc->xyc, XYC_RESETUSEC);
1761 xyc_xyreset(xycsc, xysc);
1766 register struct xy_iorq *iorq = &xycsc->reqs[lcv];
1778 xycsc->iopbase[lcv].done = xycsc->iopbase[lcv].errs = 1;
1784 bus_dmamap_sync(xycsc->dmatag, iorq->dmamap, 0,
1790 bus_dmamap_unload(xycsc->dmatag, iorq->dmamap);
1793 disk_unbusy(&xycsc->reqs[lcv].xy->sc_dk,
1794 (xycsc->reqs[lcv].buf->b_bcount -
1795 xycsc->reqs[lcv].buf->b_resid),
1796 (xycsc->reqs[lcv].buf->b_flags & B_READ));
1818 xyc_start(xycsc, NULL);
1828 xyc_start(struct xyc_softc *xycsc, struct xy_iorq *iorq)
1835 if ((xy = xycsc->sc_drives[lcv]) == NULL) continue;
1838 xyc_startbuf(xycsc, xy, bufq_peek(xy->xyq));
1841 xyc_submit_iorq(xycsc, iorq, XY_SUB_NOQ);
1849 xyc_remove_iorq(struct xyc_softc *xycsc)
1852 struct xyc *xyc = xycsc->xyc;
1865 aprint_error_dev(xycsc->sc_dev, "DOUBLE ERROR!\n");
1866 if (xyc_reset(xycsc, 0, XY_RSET_ALL, errnum, 0) != XY_ERR_AOK) {
1867 aprint_error_dev(xycsc->sc_dev, "soft reset failed!\n");
1885 iorq = xycsc->xy_chain[rq];
1904 xyc_error(xycsc, iorq, iopb, comm) == XY_ERR_AOK)
1961 bus_dmamap_sync(xycsc->dmatag, iorq->dmamap, 0,
1967 bus_dmamap_unload(xycsc->dmatag, iorq->dmamap);
2028 xyc_error(struct xyc_softc *xycsc, struct xy_iorq *iorq, struct xy_iopb *iopb,
2042 xyc_reset(xycsc, 1, XY_RSET_NONE, errnum, iorq->xy);
2099 struct xyc_softc *xycsc = arg;
2105 if (xycsc->reqs[lcv].mode == 0 ||
2106 XY_STATE(xycsc->reqs[lcv].mode) == XY_SUB_DONE)
2108 xycsc->reqs[lcv].ttl--;
2109 if (xycsc->reqs[lcv].ttl == 0)
2113 printf("%s: watchdog timeout\n", device_xname(xycsc->sc_dev));
2114 xyc_reset(xycsc, 0, XY_RSET_NONE, XY_ERR_FAIL, NULL);
2120 callout_reset(&xycsc->sc_tick_ch, XYC_TICKCNT, xyc_tick, xycsc);
2136 struct xyc_softc *xycsc;
2166 xycsc = xy->parent;
2172 if ((error = xy_dmamem_alloc(xycsc->dmatag, xycsc->auxmap,
2182 bus_dmamem_unmap(xycsc->dmatag, buf, xio->dlen);
2183 bus_dmamem_free(xycsc->dmatag, &seg, rseg);
2192 rqno = xyc_cmd(xycsc, xio->cmd, xio->subfn, xy->xy_drive, xio->block,
2198 xio->errnum = xycsc->ciorq->errnum;
2199 xio->tries = xycsc->ciorq->tries;
2200 XYC_DONE(xycsc, dummy);
2208 xy_dmamem_free(xycsc->dmatag, xycsc->auxmap, &seg, rseg,