Lines Matching defs:xdcsc
135 xdcsc->nwait--; \
1150 struct xdc_softc *xdcsc = v;
1153 xdcsc->sc_intrcnt.ev_count++;
1156 xdc_remove_iorq(xdcsc);
1159 xdc_start(xdcsc, XDC_MAXIOPB);
1162 while (xdcsc->nfree > 0 && bufq_peek(xdcsc->sc_wq) != NULL)
1163 if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
1310 xdc_cmd(struct xdc_softc *xdcsc, int cmd, int subfn, int unit, int block,
1321 while (xdcsc->nfree == 0) {
1322 if (xdc_piodriver(xdcsc, 0, 1) != XD_ERR_AOK)
1329 while (xdcsc->nfree == 0) {
1330 if (tsleep(&xdcsc->nfree, PRIBIO, "xdnfree", 0))
1333 while (xdcsc->ndone > XDC_SUBWAITLIM) {
1334 if (tsleep(&xdcsc->ndone, PRIBIO, "xdsubwait", 0))
1337 if (xdcsc->nfree)
1344 if (xdcsc->nfree == 0)
1346 rqno = XDC_RQALLOC(xdcsc);
1347 iorq = &xdcsc->reqs[rqno];
1352 xdc_rqinit(iorq, xdcsc,
1353 (unit == XDC_NOUNIT) ? NULL : xdcsc->sc_drives[unit],
1360 xdc_submit_iorq(xdcsc, rqno, fullmode); /* error code will be in iorq */
1370 xdc_startbuf(struct xdc_softc *xdcsc, struct xd_softc *xdsc, struct buf *bp)
1378 if (xdcsc->nfree == 0)
1380 rqno = XDC_RQALLOC(xdcsc);
1381 iorq = &xdcsc->reqs[rqno];
1387 bp = bufq_get(xdcsc->sc_wq);
1390 xdsc = xdcsc->sc_drives[DISKUNIT(bp->b_dev)];
1428 device_xname(xdcsc->sc_dev));
1429 XDC_FREE(xdcsc, rqno);
1430 bufq_put(xdcsc->sc_wq, bp);
1437 xdc_rqinit(iorq, xdcsc, xdsc, XD_SUB_NORM | XD_MODE_VERBO, block,
1447 xdc_submit_iorq(xdcsc, rqno, XD_SUB_NORM);
1483 xdc_submit_iorq(struct xdc_softc *xdcsc, int iorqno, int type)
1486 struct xd_iorq *iorq = &xdcsc->reqs[iorqno];
1490 device_xname(xdcsc->sc_dev), iorqno, type);
1494 if (xdcsc->xdc->xdc_csr & XDC_ADDING) {
1500 XDC_TWAIT(xdcsc, iorqno); /* put at end of waitq */
1510 return xdc_piodriver(xdcsc, iorqno, 0);
1520 device_xname(xdcsc->sc_dev), iorq - xdcsc->reqs);
1528 iopbaddr = dvma_kvtopa(iorq->iopb, xdcsc->bustype);
1529 XDC_GO(xdcsc->xdc, iopbaddr); /* go! */
1530 xdcsc->nrun++;
1542 return xdc_piodriver(xdcsc, iorqno, 0);
1560 xdc_piodriver(struct xdc_softc *xdcsc, int iorqno, int freeone)
1565 struct xdc *xdc = xdcsc->xdc;
1568 device_xname(xdcsc->sc_dev), iorqno, freeone);
1571 while (xdcsc->nwait || xdcsc->nrun) {
1574 xdcsc->nwait, xdcsc->nrun);
1582 xdc_reset(xdcsc, 0, XD_RSET_ALL, XD_ERR_FAIL, 0);
1589 if (xdc_reset(xdcsc, 0,
1596 xdc_remove_iorq(xdcsc); /* could resubmit request */
1598 if (xdcsc->nrun < XDC_MAXIOPB) {
1606 xdc_start(xdcsc, XDC_MAXIOPB);
1611 retval = xdcsc->reqs[iorqno].errno;
1615 xdcsc->reqs[iorqno].errno, xdc_e2str(xdcsc->reqs[iorqno].errno));
1623 while (xdcsc->nfree > 0 && bufq_peek(xdcsc->sc_wq) != NULL)
1624 if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
1635 xdc_xdreset(struct xdc_softc *xdcsc, struct xd_softc *xdsc)
1641 memcpy(&tmpiopb, xdcsc->iopbase, sizeof(tmpiopb));
1642 memset(xdcsc->iopbase, 0, sizeof(tmpiopb));
1643 xdcsc->iopbase->comm = XDCMD_RST;
1644 xdcsc->iopbase->unit = xdsc->xd_drive;
1645 addr = (u_long)xdcsc->dvmaiopb;
1646 XDC_GO(xdcsc->xdc, addr); /* go! */
1647 XDC_WAIT(xdcsc->xdc, del, XDC_RESETUSEC, XDC_REMIOPB);
1648 if (del <= 0 || xdcsc->iopbase->errs) {
1649 printf("%s: off-line: %s\n", device_xname(xdcsc->sc_dev),
1650 xdc_e2str(xdcsc->iopbase->errno));
1651 xdcsc->xdc->xdc_csr = XDC_RESET;
1652 XDC_WAIT(xdcsc->xdc, del, XDC_RESETUSEC, XDC_RESET);
1656 xdcsc->xdc->xdc_csr = XDC_CLRRIO; /* clear RIO */
1658 memcpy(xdcsc->iopbase, &tmpiopb, sizeof(tmpiopb));
1667 xdc_reset(struct xdc_softc *xdcsc, int quiet, int blastmode, int error,
1671 int oldfree = xdcsc->nfree;
1677 printf("%s: soft reset\n", device_xname(xdcsc->sc_dev));
1678 xdcsc->xdc->xdc_csr = XDC_RESET;
1679 XDC_WAIT(xdcsc->xdc, del, XDC_RESETUSEC, XDC_RESET);
1685 xdc_xdreset(xdcsc, xdsc);
1690 iorq = &xdcsc->reqs[lcv];
1698 xdcsc->nrun--; /* it isn't running any more */
1702 xdcsc->iopbase[lcv].done = xdcsc->iopbase[lcv].errs = 1;
1714 XDC_FREE(xdcsc, lcv); /* add to free list */
1719 xdcsc->ndone++;
1728 XDC_HWAIT(xdcsc, lcv);
1736 xdc_start(xdcsc, XDC_MAXIOPB);
1739 if (oldfree == 0 && xdcsc->nfree)
1740 wakeup(&xdcsc->nfree);
1743 del = xdcsc->nwait + xdcsc->nrun + xdcsc->nfree + xdcsc->ndone;
1746 device_xname(xdcsc->sc_dev), del, XDC_MAXIOPB);
1748 if (xdcsc->ndone > XDC_MAXIOPB - XDC_SUBWAITLIM)
1750 device_xname(xdcsc->sc_dev), xdcsc->ndone);
1760 xdc_start(struct xdc_softc *xdcsc, int maxio)
1763 while (maxio && xdcsc->nwait &&
1764 (xdcsc->xdc->xdc_csr & XDC_ADDING) == 0) {
1765 XDC_GET_WAITER(xdcsc, rqno); /* note: rqno is an "out"
1767 if (xdc_submit_iorq(xdcsc, rqno, XD_SUB_NOQ) != XD_ERR_AOK)
1777 xdc_remove_iorq(struct xdc_softc *xdcsc)
1780 struct xdc *xdc = xdcsc->xdc;
1793 device_xname(xdcsc->sc_dev), errno, xdc_e2str(errno));
1794 if (xdc_reset(xdcsc, 0, XD_RSET_ALL, errno, 0) != XD_ERR_AOK) {
1796 device_xname(xdcsc->sc_dev));
1820 iorq = &xdcsc->reqs[rqno];
1823 iopb = &xdcsc->iopbase[rqno];
1833 device_xname(xdcsc->sc_dev), rqno);
1840 xdcsc->nrun--;
1853 xdc_error(xdcsc, iorq, iopb, rqno, comm) == XD_ERR_AOK)
1893 dvma_kvtopa(iorq->dbuf, xdcsc->bustype);
1894 XDC_HWAIT(xdcsc, rqno);
1895 xdc_start(xdcsc, 1); /* resubmit */
1915 XDC_FREE(xdcsc, rqno);
1920 xdcsc->ndone++;
1925 xdcsc->ndone++;
1972 xdc_error(struct xdc_softc *xdcsc, struct xd_iorq *iorq, struct xd_iopb *iopb,
1983 xdcsc->ndone++;
1985 xdc_reset(xdcsc, 1, XD_RSET_NONE, errno, iorq->xd);
1987 xdcsc->ndone--;
2010 XDC_HWAIT(xdcsc, rqno);
2011 xdc_start(xdcsc, 1); /* resubmit */
2029 XDC_HWAIT(xdcsc, rqno);
2030 xdc_start(xdcsc, 1); /* restart */
2044 struct xdc_softc *xdcsc = arg;
2050 nwait = xdcsc->nwait;
2051 nrun = xdcsc->nrun;
2052 nfree = xdcsc->nfree;
2053 ndone = xdcsc->ndone;
2054 memcpy(wqc, xdcsc->waitq, sizeof(wqc));
2055 memcpy(fqc, xdcsc->freereq, sizeof(fqc));
2060 device_xname(xdcsc->sc_dev), nwait, nfree, nrun, ndone,
2081 lcv, xdcsc->reqs[lcv].mode,
2082 xdcsc->iopbase[lcv].done,
2083 xdcsc->iopbase[lcv].errs,
2084 xdcsc->iopbase[lcv].errno,
2085 xdcsc->reqs[lcv].ttl,
2086 xdcsc->reqs[lcv].buf);
2092 device_xname(xdcsc->sc_dev), ndone);
2097 device_xname(xdcsc->sc_dev),
2098 xdcsc->xdc->xdc_csr, xdcsc->nwait, xdcsc->nfree, xdcsc->nrun,
2099 xdcsc->ndone);
2101 if (xdcsc->reqs[lcv].mode) {
2104 xdcsc->reqs[lcv].mode, xdcsc->iopbase[lcv].done,
2105 xdcsc->iopbase[lcv].errs,
2106 xdcsc->iopbase[lcv].errno);
2114 if (xdcsc->reqs[lcv].mode == 0 ||
2115 XD_STATE(xdcsc->reqs[lcv].mode) == XD_SUB_DONE)
2117 xdcsc->reqs[lcv].ttl--;
2118 if (xdcsc->reqs[lcv].ttl == 0)
2122 printf("%s: watchdog timeout\n", device_xname(xdcsc->sc_dev));
2123 xdc_reset(xdcsc, 0, XD_RSET_NONE, XD_ERR_FAIL, NULL);
2129 callout_reset(&xdcsc->sc_tick_ch, XDC_TICKCNT, xdc_tick, xdcsc);
2143 struct xdc_softc *xdcsc;
2238 xdcsc = xd->parent;
2240 rqno = xdc_cmd(xdcsc, xio->cmd, xio->subfn, xd->xd_drive, xio->block,
2246 xio->errno = xdcsc->reqs[rqno].errno;
2247 xio->tries = xdcsc->reqs[rqno].tries;
2248 XDC_DONE(xdcsc, rqno, err);