Home | History | Annotate | Download | only in vme

Lines Matching defs:iorq

96  * XDC_TWAIT: add iorq "N" to tail of SC's wait queue
105 * XDC_HWAIT: add iorq "N" to head of SC's wait queue
125 * XDC_FREE: add iorq "N" to SC's free list
135 * XDC_RQALLOC: allocate an iorq off the free list (assume nfree > 0).
168 * XDC_DONE: don't need IORQ, get error code and free (done after xdc_cmd)
182 * XDC_ADVANCE: advance iorq's pointers by a number of sectors
184 #define XDC_ADVANCE(IORQ, N) { \
186 (IORQ)->sectcnt -= (N); \
187 (IORQ)->blockno += (N); \
188 (IORQ)->dbuf += ((N)*XDFM_BPS); \
195 * [2] & of xdc_softc's "nfree" (waiting for a free iorq/iopb)
196 * [3] & of xdc_softc's "ndone" (waiting for number of done iorq/iopb's
198 * [4] & an iorq (waiting for an XD_SUB_WAIT iorq to finish)
533 * iorq's up front. thus, we avoid linked lists and the costs
556 /* Get DMA handle for mapping iorq descriptors */
574 /* Get DMA buffer for iorq descriptors */
590 /* init free list, iorq to iopb pointers, and non-zero fields in the
1294 /* if there are no free iorq
1341 /* start any iorq's already waiting */
1345 /* fill up any remaining iorq's with queue'd buffers */
1379 * xdc_rqtopb: load up an IOPB based on an iorq
1383 xdc_rqtopb(struct xd_iorq *iorq, struct xd_iopb *iopb, int cmd, int subfun)
1393 if (iorq->xd)
1394 iopb->unit = iorq->xd->xd_drive;
1406 iopb->intl = (XD_STATE(iorq->mode) == XD_SUB_POLL)
1408 : iorq->xdc->ipl;
1422 if (XD_STATE(iorq->mode) == XD_SUB_POLL)
1426 iorq->xdc->ipl;
1427 drv->maxsect = iorq->xd->nsect - 1;
1432 drv->maxcyl = iorq->xd->pcyl - 1;
1433 drv->maxhead = iorq->xd->nhead - 1;
1439 if (XD_STATE(iorq->mode) == XD_SUB_POLL)
1443 iorq->xdc->ipl;
1459 iopb->intl = (XD_STATE(iorq->mode) == XD_SUB_POLL)
1461 : iorq->xdc->ipl;
1462 iopb->sectcnt = iorq->sectcnt;
1463 block = iorq->blockno;
1464 if (iorq->xd == NULL || block == 0) {
1467 iopb->sectno = block % iorq->xd->nsect;
1468 block = block / iorq->xd->nsect;
1469 iopb->headno = block % iorq->xd->nhead;
1470 block = block / iorq->xd->nhead;
1473 dp = (u_long) iorq->dbuf;
1474 dp = iopb->daddr = (iorq->dbuf == NULL) ? 0 : dp;
1475 iopb->addrmod = ((dp + (XDFM_BPS * iorq->sectcnt)) > 0x1000000)
1483 * If you've already got an IORQ, you can call submit directly (currently
1491 struct xd_iorq *iorq;
1494 /* get iorq/iopb */
1523 iorq = &xdcsc->reqs[rqno];
1524 iopb = iorq->iopb;
1527 /* init iorq/iopb */
1529 xdc_rqinit(iorq, xdcsc,
1533 /* load IOPB from iorq */
1535 xdc_rqtopb(iorq, iopb, cmd, subfn);
1539 xdc_submit_iorq(xdcsc, rqno, fullmode); /* error code will be in iorq */
1552 struct xd_iorq *iorq;
1561 iorq = &xdcsc->reqs[rqno];
1562 iopb = iorq->iopb;
1584 * note that iorq points to the buffer as mapped into DVMA space,
1591 error = bus_dmamap_load(xdcsc->dmatag, iorq->dmamap,
1600 bus_dmamap_sync(xdcsc->dmatag, iorq->dmamap, 0,
1601 iorq->dmamap->dm_mapsize, (bp->b_flags & B_READ)
1605 /* init iorq and load iopb from it */
1606 xdc_rqinit(iorq, xdcsc, xdsc, XD_SUB_NORM | XD_MODE_VERBO, block,
1608 (void *)(u_long)iorq->dmamap->dm_segs[0].ds_addr,
1611 xdc_rqtopb(iorq, iopb, (bp->b_flags & B_READ) ? XDCMD_RD : XDCMD_WR, 0);
1624 * xdc_submit_iorq: submit an iorq for processing. returns XD_ERR_AOK
1627 * note: caller frees iorq in all cases except NORM
1641 * software state is stored in the iorq structure. each iorq has an
1650 * on the iorq free list until some iopbs are available.
1658 struct xd_iorq *iorq = &xdcsc->reqs[iorqno];
1677 while (iorq->iopb->done == 0) {
1678 (void) tsleep(iorq, PRIBIO, "xdciorq", 0);
1680 return (iorq->errnum);
1689 u_char *rio = (u_char *) iorq->iopb;
1692 device_xname(xdcsc->sc_dev), iorq - xdcsc->reqs);
1700 iopbaddr = (u_long) iorq->dmaiopb;
1709 while (iorq->iopb->done == 0) {
1710 (void) tsleep(iorq, PRIBIO, "xdciorq", 0);
1712 return (iorq->errnum);
1727 * and drains off all i/o requests. it returns the status of the iorq
1729 * when there is a free iorq.
1860 register struct xd_iorq *iorq = &xdcsc->reqs[lcv];
1862 if (XD_STATE(iorq->mode) != XD_SUB_POLL &&
1863 XD_STATE(iorq->mode) != XD_SUB_WAIT &&
1864 XD_STATE(iorq->mode) != XD_SUB_NORM)
1871 iorq->errnum = error;
1875 iorq->buf->b_error = EIO;
1876 iorq->buf->b_resid =
1877 iorq->sectcnt * XDFM_BPS;
1879 bus_dmamap_sync(xdcsc->dmatag, iorq->dmamap, 0,
1880 iorq->dmamap->dm_mapsize,
1881 (iorq->buf->b_flags & B_READ)
1885 bus_dmamap_unload(xdcsc->dmatag, iorq->dmamap);
1890 (iorq->buf->b_flags & B_READ));
1891 biodone(iorq->buf);
1895 wakeup(iorq);
1898 iorq->mode =
1899 XD_NEWSTATE(iorq->mode, XD_SUB_DONE);
1961 struct xd_iorq *iorq;
1998 iorq = &xdcsc->reqs[rqno];
1999 if (iorq->mode == 0 || XD_STATE(iorq->mode) == XD_SUB_DONE)
2022 iorq->errnum = iopb->errnum;
2024 iorq->errnum = 0;
2029 xdc_error(xdcsc, iorq, iopb, rqno, comm) == XD_ERR_AOK)
2033 /* this iorq is now done (hasn't been restarted or anything) */
2035 if ((iorq->mode & XD_MODE_VERBO) && iorq->lasterror)
2036 xdc_perror(iorq, iopb, 0);
2042 if ((iorq->mode & XD_MODE_B144) != 0 && errs == 0 &&
2052 XDC_ADVANCE(iorq, 1); /* advance 1 sector */
2055 iorq->mode = iorq->mode & (~XD_MODE_B144);
2057 if (iorq->sectcnt) { /* more to go! */
2058 iorq->lasterror = iorq->errnum = iopb->errnum = 0;
2060 iorq->tries = 0;
2061 iopb->sectcnt = iorq->sectcnt;
2062 iopb->cylno = iorq->blockno /
2063 iorq->xd->sectpercyl;
2065 (iorq->blockno / iorq->xd->nhead) %
2066 iorq->xd->nhead;
2067 iopb->sectno = iorq->blockno % XDFM_BPS;
2068 iopb->daddr = (u_long) iorq->dbuf;
2076 switch (XD_STATE(iorq->mode)) {
2078 bp = iorq->buf;
2081 bp->b_resid = iorq->sectcnt * XDFM_BPS;
2085 bus_dmamap_sync(xdcsc->dmatag, iorq->dmamap, 0,
2086 iorq->dmamap->dm_mapsize,
2090 bus_dmamap_unload(xdcsc->dmatag, iorq->dmamap);
2092 disk_unbusy(&iorq->xd->sc_dk,
2099 iorq->mode = XD_NEWSTATE(iorq->mode, XD_SUB_DONE);
2101 wakeup(iorq);
2104 iorq->mode = XD_NEWSTATE(iorq->mode, XD_SUB_DONE);
2119 * is in lasterror. also, if iorq->errnum == 0, then we recovered
2120 * from that error (otherwise iorq->errnum == iorq->lasterror).
2123 xdc_perror(struct xd_iorq *iorq, struct xd_iopb *iopb, int still_trying)
2127 int error = iorq->lasterror;
2129 printf("%s", (iorq->xd) ? device_xname(iorq->xd->sc_dev)
2130 : device_xname(iorq->xdc->sc_dev));
2131 if (iorq->buf)
2132 printf("%c: ", 'a' + (char)DISKPART(iorq->buf->b_dev));
2140 printf(" [still trying, new error=%s]", xdc_e2str(iorq->errnum));
2142 if (iorq->errnum == 0)
2143 printf(" [recovered in %d tries]", iorq->tries);
2153 xdc_error(struct xdc_softc *xdcsc, struct xd_iorq *iorq, struct xd_iopb *iopb,
2157 int errnum = iorq->errnum;
2165 oldmode = iorq->mode;
2166 iorq->mode = XD_SUB_DONE | (~XD_SUB_MASK & oldmode);
2169 xdc_reset(xdcsc, 1, XD_RSET_NONE, errnum, iorq->xd);
2170 iorq->mode = oldmode;
2177 (iorq->mode & XD_MODE_B144) == 0) {
2178 advance = iorq->sectcnt - iopb->sectcnt;
2179 XDC_ADVANCE(iorq, advance);
2181 if ((i = isbad(&iorq->xd->dkb, iorq->blockno / iorq->xd->sectpercyl,
2182 (iorq->blockno / iorq->xd->nsect) % iorq->xd->nhead,
2183 iorq->blockno % iorq->xd->nsect)) != -1) {
2184 iorq->mode |= XD_MODE_B144; /* enter bad144 mode &
2188 iopb->cylno = (iorq->xd->ncyl + iorq->xd->acyl) - 2;
2190 i = iorq->xd->sectpercyl - 1 - i; /* follow bad144
2192 iopb->headno = i / iorq->xd->nhead;
2193 iopb->sectno = i % iorq->xd->nhead;
2205 if ((iorq->mode & XD_MODE_VERBO) && iorq->lasterror)
2206 xdc_perror(iorq, iopb, 1); /* inform of error state
2208 iorq->lasterror = errnum;
2211 && iorq->tries < XDC_MAXTRIES) { /* retry? */
2212 iorq->tries++;
2213 iorq->errnum = iopb->errnum = iopb->done = iopb->errs = 0;