static void mcd_start(struct mcd_softc *sc) { struct bio *bp; int s = splbio(); if (sc->data.flags & MCDMBXBSY) { splx(s); return; } bp = bioq_first(&sc->data.head); if (bp != 0) { /* block found to process, dequeue */ /*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/ bioq_remove(&sc->data.head, bp); sc->data.flags |= MCDMBXBSY; splx(s); } else { /* nothing to do */ splx(s); return; } sc->data.mbx.retry = MCD_RETRYS; sc->data.mbx.bp = bp; mcd_doread(sc, MCD_S_BEGIN,&(sc->data.mbx)); return; }
static void mcd_start(struct mcd_softc *sc) { struct bio *bp; MCD_ASSERT_LOCKED(sc); if (sc->data.flags & MCDMBXBSY) { return; } bp = bioq_takefirst(&sc->data.head); if (bp != 0) { /* block found to process, dequeue */ /*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/ sc->data.flags |= MCDMBXBSY; } else { /* nothing to do */ return; } sc->data.mbx.retry = MCD_RETRYS; sc->data.mbx.bp = bp; mcd_doread(sc, MCD_S_BEGIN,&(sc->data.mbx)); return; }
/* state machine to process read requests * initialize with MCD_S_BEGIN: calculate sizes, and read status * MCD_S_WAITSTAT: wait for status reply, set mode * MCD_S_WAITMODE: waits for status reply from set mode, set read command * MCD_S_WAITREAD: wait for read ready, read data */ static void mcd_timeout(void *arg) { struct mcd_softc *sc; sc = (struct mcd_softc *)arg; mcd_doread(sc, sc->ch_state, sc->ch_mbxsave); }
/* state machine to process read requests * initialize with MCD_S_BEGIN: calculate sizes, and read status * MCD_S_WAITSTAT: wait for status reply, set mode * MCD_S_WAITMODE: waits for status reply from set mode, set read command * MCD_S_WAITREAD: wait for read ready, read data */ static void mcd_timeout(void *arg) { struct mcd_softc *sc; sc = (struct mcd_softc *)arg; MCD_ASSERT_LOCKED(sc); mcd_doread(sc, sc->ch_state, sc->ch_mbxsave); }