diff options
Diffstat (limited to 'sys/dev/ic/adw.c')
-rw-r--r-- | sys/dev/ic/adw.c | 122 |
1 files changed, 3 insertions, 119 deletions
diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c index bbfe1fedb9d..9146a660d38 100644 --- a/sys/dev/ic/adw.c +++ b/sys/dev/ic/adw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adw.c,v 1.35 2008/11/24 00:31:35 krw Exp $ */ +/* $OpenBSD: adw.c,v 1.36 2008/11/26 16:38:00 krw Exp $ */ /* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $ */ /* @@ -61,9 +61,6 @@ /******************************************************************************/ -void adw_enqueue(ADW_SOFTC *, struct scsi_xfer *, int); -struct scsi_xfer *adw_dequeue(ADW_SOFTC *); - int adw_alloc_controls(ADW_SOFTC *); int adw_alloc_carriers(ADW_SOFTC *); int adw_create_ccbs(ADW_SOFTC *, ADW_CCB *, int); @@ -105,51 +102,6 @@ struct scsi_device adw_dev = /******************************************************************************/ -/* scsi_xfer queue routines */ -/******************************************************************************/ - -/* - * Insert a scsi_xfer into the software queue. We overload xs->free_list - * to avoid having to allocate additional resources (since we're used - * only during resource shortages anyhow. - */ -void -adw_enqueue(sc, xs, infront) - ADW_SOFTC *sc; - struct scsi_xfer *xs; - int infront; -{ - - if (infront || LIST_EMPTY(&sc->sc_queue)) { - if (LIST_EMPTY(&sc->sc_queue)) - sc->sc_queuelast = xs; - LIST_INSERT_HEAD(&sc->sc_queue, xs, free_list); - return; - } - LIST_INSERT_AFTER(sc->sc_queuelast, xs, free_list); - sc->sc_queuelast = xs; -} - - -/* - * Pull a scsi_xfer off the front of the software queue. - */ -struct scsi_xfer * -adw_dequeue(sc) - ADW_SOFTC *sc; -{ - struct scsi_xfer *xs; - - xs = LIST_FIRST(&sc->sc_queue); - LIST_REMOVE(xs, free_list); - - if (LIST_EMPTY(&sc->sc_queue)) - sc->sc_queuelast = NULL; - - return (xs); -} - -/******************************************************************************/ /* DMA Mapping for Control Blocks */ /******************************************************************************/ @@ -517,7 +469,6 @@ adw_attach(sc) TAILQ_INIT(&sc->sc_free_ccb); TAILQ_INIT(&sc->sc_waiting_ccb); TAILQ_INIT(&sc->sc_pending_ccb); - LIST_INIT(&sc->sc_queue); /* @@ -651,55 +602,12 @@ adw_scsi_cmd(xs) struct scsi_link *sc_link = xs->sc_link; ADW_SOFTC *sc = sc_link->adapter_softc; ADW_CCB *ccb; - int s, fromqueue = 1, dontqueue = 0, nowait = 0, retry = 0; + int s, nowait = 0, retry = 0; int flags; s = splbio(); /* protect the queue */ /* - * If we're running the queue from adw_done(), we've been - * called with the first queue entry as our argument. - */ - if (xs == LIST_FIRST(&sc->sc_queue)) { - if(sc->sc_freeze_dev[xs->sc_link->target]) { - splx(s); - return (TRY_AGAIN_LATER); - } - xs = adw_dequeue(sc); - fromqueue = 1; - nowait = 1; - } else { - if(sc->sc_freeze_dev[xs->sc_link->target]) { - splx(s); - return (TRY_AGAIN_LATER); - } - - /* Polled requests can't be queued for later. */ - dontqueue = xs->flags & SCSI_POLL; - - /* - * If there are jobs in the queue, run them first. - */ - if (!LIST_EMPTY(&sc->sc_queue)) { - /* - * If we can't queue, we have to abort, since - * we have to preserve order. - */ - if (dontqueue) { - splx(s); - return (TRY_AGAIN_LATER); - } - /* - * Swap with the first queue entry. - */ - adw_enqueue(sc, xs, 0); - xs = adw_dequeue(sc); - fromqueue = 1; - } - } - - - /* * get a ccb to use. If the transfer * is from a buf (possibly from interrupt time) * then we can't allow it to sleep @@ -709,20 +617,8 @@ adw_scsi_cmd(xs) if (nowait) flags |= SCSI_NOSLEEP; if ((ccb = adw_get_ccb(sc, flags)) == NULL) { - /* - * If we can't queue, we lose. - */ - if (dontqueue) { - splx(s); - return (NO_CCB); - } - /* - * Stuff ourselves into the queue, in front - * if we came off in the first place. - */ - adw_enqueue(sc, xs, fromqueue); splx(s); - return (SUCCESSFULLY_QUEUED); + return (NO_CCB); } splx(s); /* done playing with the queue */ @@ -921,21 +817,9 @@ adw_intr(arg) void *arg; { ADW_SOFTC *sc = arg; - struct scsi_xfer *xs; if(AdwISR(sc) != ADW_FALSE) { - /* - * If there are queue entries in the software queue, try to - * run the first one. We should be more or less guaranteed - * to succeed, since we just freed a CCB. - * - * NOTE: adw_scsi_cmd() relies on our calling it with - * the first entry in the queue. - */ - if ((xs = LIST_FIRST(&sc->sc_queue)) != NULL) - (void) adw_scsi_cmd(xs); - return (1); } |