summaryrefslogtreecommitdiff
path: root/sys/dev/ic/adv.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2008-11-26 16:38:01 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2008-11-26 16:38:01 +0000
commitabf4e906fb155b2dab27955a2001987d1c479ed4 (patch)
tree6436c20b738167e2fa2230501538087c0dd26a56 /sys/dev/ic/adv.c
parentc92fc7bca5870698ac07df4caa4f51829f75b9b0 (diff)
Stop maintaining internal queues of received scsi_xfer structures.
We can now just push unwanted ones back up into the SCSI layer with NO_CCB like other drivers.
Diffstat (limited to 'sys/dev/ic/adv.c')
-rw-r--r--sys/dev/ic/adv.c119
1 files changed, 2 insertions, 117 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);
}