diff options
-rw-r--r-- | sys/dev/ic/adv.c | 119 | ||||
-rw-r--r-- | sys/dev/ic/adw.c | 122 | ||||
-rw-r--r-- | sys/dev/ic/bha.c | 108 | ||||
-rw-r--r-- | sys/dev/ic/bhavar.h | 9 |
4 files changed, 10 insertions, 348 deletions
diff --git a/sys/dev/ic/adv.c b/sys/dev/ic/adv.c index 0b8a4f6374e..808f946707f 100644 --- a/sys/dev/ic/adv.c +++ b/sys/dev/ic/adv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adv.c,v 1.21 2008/11/24 00:31:35 krw Exp $ */ +/* $OpenBSD: adv.c,v 1.22 2008/11/26 16:38:00 krw Exp $ */ /* $NetBSD: adv.c,v 1.6 1998/10/28 20:39:45 dante Exp $ */ /* @@ -62,9 +62,6 @@ /******************************************************************************/ -static void adv_enqueue(ASC_SOFTC *, struct scsi_xfer *, int); -static struct scsi_xfer *adv_dequeue(ASC_SOFTC *); - static int adv_alloc_ccbs(ASC_SOFTC *); static int adv_create_ccbs(ASC_SOFTC *, ADV_CCB *, int); static void adv_free_ccb(ASC_SOFTC *, ADV_CCB *); @@ -117,53 +114,6 @@ struct scsi_device adv_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. - */ -static void -adv_enqueue(sc, xs, infront) - ASC_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. - */ -static struct scsi_xfer * -adv_dequeue(sc) - ASC_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); -} - - -/******************************************************************************/ /* Control Blocks routines */ /******************************************************************************/ @@ -586,7 +536,6 @@ adv_attach(sc) TAILQ_INIT(&sc->sc_free_ccb); TAILQ_INIT(&sc->sc_waiting_ccb); - LIST_INIT(&sc->sc_queue); /* @@ -639,46 +588,10 @@ adv_scsi_cmd(xs) bus_dma_tag_t dmat = sc->sc_dmat; ADV_CCB *ccb; int s, flags, error, nsegs; - int fromqueue = 1, dontqueue = 0; - s = splbio(); /* protect the queue */ /* - * If we're running the queue from adv_done(), we've been - * called with the first queue entry as our argument. - */ - if (xs == LIST_FIRST(&sc->sc_queue)) { - xs = adv_dequeue(sc); - fromqueue = 1; - } else { - - /* 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. - */ - adv_enqueue(sc, xs, 0); - xs = adv_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 @@ -686,20 +599,8 @@ adv_scsi_cmd(xs) flags = xs->flags; if ((ccb = adv_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. - */ - adv_enqueue(sc, xs, fromqueue); splx(s); - return (SUCCESSFULLY_QUEUED); + return (NO_CCB); } splx(s); /* done playing with the queue */ @@ -799,10 +700,6 @@ adv_scsi_cmd(xs) sc_link->scsipi_scsi.lun, xs->cmd->opcode, (unsigned long)ccb); #endif - s = splbio(); - adv_queue_ccb(sc, ccb); - splx(s); - /* * Usually return SUCCESSFULLY QUEUED */ @@ -826,7 +723,6 @@ adv_intr(arg) void *arg; { ASC_SOFTC *sc = arg; - struct scsi_xfer *xs; #ifdef ASC_DEBUG int int_pend = FALSE; @@ -843,17 +739,6 @@ adv_intr(arg) printf("\n"); #endif - /* - * 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: adv_scsi_cmd() relies on our calling it with - * the first entry in the queue. - */ - if ((xs = LIST_FIRST(&sc->sc_queue)) != NULL) - (void) adv_scsi_cmd(xs); - return (1); } 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); } diff --git a/sys/dev/ic/bha.c b/sys/dev/ic/bha.c index 5124573ddf6..00f36323c28 100644 --- a/sys/dev/ic/bha.c +++ b/sys/dev/ic/bha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bha.c,v 1.14 2008/11/24 00:31:35 krw Exp $ */ +/* $OpenBSD: bha.c,v 1.15 2008/11/26 16:38:00 krw Exp $ */ /* $NetBSD: bha.c,v 1.27 1998/11/19 21:53:00 thorpej Exp $ */ #undef BHADEBUG @@ -101,8 +101,6 @@ int bha_scsi_cmd(struct scsi_xfer *); int bha_poll(struct bha_softc *, struct scsi_xfer *, int); void bha_timeout(void *arg); int bha_create_ccbs(struct bha_softc *, struct bha_ccb *, int); -void bha_enqueue(struct bha_softc *, struct scsi_xfer *, int); -struct scsi_xfer *bha_dequeue(struct bha_softc *); struct cfdriver bha_cd = { NULL, "bha", DV_DULL @@ -120,47 +118,6 @@ struct scsi_device bha_dev = { #define BHA_ABORT_TIMEOUT 2000 /* time to wait for abort (mSec) */ /* - * 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 -bha_enqueue(sc, xs, infront) - struct bha_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 * -bha_dequeue(sc) - struct bha_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); -} - -/* * bha_cmd(iot, ioh, sc, icnt, ibuf, ocnt, obuf) * * Activate Adapter command @@ -325,7 +282,6 @@ bha_attach(sc, bpd) TAILQ_INIT(&sc->sc_free_ccb); TAILQ_INIT(&sc->sc_waiting_ccb); - LIST_INIT(&sc->sc_queue); s = splbio(); bha_inquire_setup_information(sc); @@ -845,17 +801,6 @@ bha_done(sc, ccb) bha_free_ccb(sc, ccb); xs->flags |= ITSDONE; scsi_done(xs); - - /* - * 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: bha_scsi_cmd() relies on our calling it with - * the first entry in the queue. - */ - if ((xs = LIST_FIRST(&sc->sc_queue)) != NULL) - (void) bha_scsi_cmd(xs); } /* @@ -1342,69 +1287,20 @@ bha_scsi_cmd(xs) bus_dma_tag_t dmat = sc->sc_dmat; struct bha_ccb *ccb; int error, seg, flags, s; - int fromqueue = 0, dontqueue = 0; SC_DEBUG(sc_link, SDEV_DB2, ("bha_scsi_cmd\n")); s = splbio(); /* protect the queue */ /* - * If we're running the queue from bha_done(), we've been - * called with the first queue entry as our argument. - */ - if (xs == LIST_FIRST(&sc->sc_queue)) { - xs = bha_dequeue(sc); - fromqueue = 1; - goto get_ccb; - } - - /* 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. - */ - bha_enqueue(sc, xs, 0); - xs = bha_dequeue(sc); - fromqueue = 1; - } - - get_ccb: - /* * get a ccb to use. If the transfer * is from a buf (possibly from interrupt time) * then we can't allow it to sleep */ flags = xs->flags; if ((ccb = bha_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. - */ - bha_enqueue(sc, xs, fromqueue); splx(s); - return (SUCCESSFULLY_QUEUED); + return (NO_CCB); } splx(s); /* done playing with the queue */ diff --git a/sys/dev/ic/bhavar.h b/sys/dev/ic/bhavar.h index 93732dde8bf..a089845d397 100644 --- a/sys/dev/ic/bhavar.h +++ b/sys/dev/ic/bhavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bhavar.h,v 1.3 2008/06/26 05:42:15 ray Exp $ */ +/* $OpenBSD: bhavar.h,v 1.4 2008/11/26 16:38:00 krw Exp $ */ /* $NetBSD: bhavar.h,v 1.12 1998/11/19 21:53:00 thorpej Exp $ */ /*- @@ -84,11 +84,8 @@ struct bha_softc { struct scsi_link sc_link; /* prototype for devs */ struct scsi_adapter sc_adapter; - LIST_HEAD(, scsi_xfer) sc_queue; - struct scsi_xfer *sc_queuelast; - - char sc_model[7], - sc_firmware[6]; + char sc_model[7]; + char sc_firmware[6]; }; /* |