diff --git a/sys/dev/ic/adv.c b/sys/dev/ic/adv.c index e48ed22e7f7d..d8645cd16659 100644 --- a/sys/dev/ic/adv.c +++ b/sys/dev/ic/adv.c @@ -1,4 +1,4 @@ -/* $NetBSD: adv.c,v 1.14 1999/09/30 23:04:40 thorpej Exp $ */ +/* $NetBSD: adv.c,v 1.15 2000/02/12 19:12:52 thorpej Exp $ */ /* * Generic driver for the Advanced Systems Inc. Narrow SCSI controllers @@ -551,7 +551,7 @@ 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; + int fromqueue = 0, dontqueue = 0, nowait = 0; s = splbio(); /* protect the queue */ @@ -563,6 +563,7 @@ adv_scsi_cmd(xs) if (xs == TAILQ_FIRST(&sc->sc_queue)) { TAILQ_REMOVE(&sc->sc_queue, xs, adapter_q); fromqueue = 1; + nowait = 1; } else { /* Polled requests can't be queued for later. */ @@ -599,6 +600,8 @@ adv_scsi_cmd(xs) */ flags = xs->xs_control; + if (nowait) + flags |= XS_CTL_NOSLEEP; if ((ccb = adv_get_ccb(sc, flags)) == NULL) { /* * If we can't queue, we lose. diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c index a71adbcaae81..61cc597c4017 100644 --- a/sys/dev/ic/adw.c +++ b/sys/dev/ic/adw.c @@ -1,4 +1,4 @@ -/* $NetBSD: adw.c,v 1.13 2000/02/03 20:29:15 dante Exp $ */ +/* $NetBSD: adw.c,v 1.14 2000/02/12 19:19:42 thorpej Exp $ */ /* * Generic driver for the Advanced Systems Inc. SCSI controllers @@ -82,7 +82,7 @@ static ADW_CCB *adw_get_ccb __P((ADW_SOFTC *, int)); static int adw_queue_ccb __P((ADW_SOFTC *, ADW_CCB *, int)); static int adw_scsi_cmd __P((struct scsipi_xfer *)); -static int adw_build_req __P((struct scsipi_xfer *, ADW_CCB *)); +static int adw_build_req __P((struct scsipi_xfer *, ADW_CCB *, int)); static void adw_build_sglist __P((ADW_CCB *, ADW_SCSI_REQ_Q *, ADW_SG_BLOCK *)); static void adwminphys __P((struct buf *)); static void adw_isr_callback __P((ADW_SOFTC *, ADW_SCSI_REQ_Q *)); @@ -694,7 +694,8 @@ adw_scsi_cmd(xs) struct scsipi_link *sc_link = xs->sc_link; ADW_SOFTC *sc = sc_link->adapter_softc; ADW_CCB *ccb; - int s, fromqueue = 1, dontqueue = 0, retry = 0; + int s, fromqueue = 1, dontqueue = 0, nowait = 0, retry = 0; + int flags; s = splbio(); /* protect the queue */ @@ -705,6 +706,7 @@ adw_scsi_cmd(xs) if (xs == TAILQ_FIRST(&sc->sc_queue)) { TAILQ_REMOVE(&sc->sc_queue, xs, adapter_q); fromqueue = 1; + nowait = 1; } else { /* Polled requests can't be queued for later. */ @@ -740,7 +742,10 @@ adw_scsi_cmd(xs) * then we can't allow it to sleep */ - if ((ccb = adw_get_ccb(sc, xs->xs_control)) == NULL) { + flags = xs->xs_control; + if (nowait) + flags |= XS_CTL_NOSLEEP; + if ((ccb = adw_get_ccb(sc, flags)) == NULL) { /* * If we can't queue, we lose. */ @@ -765,7 +770,7 @@ adw_scsi_cmd(xs) ccb->xs = xs; ccb->timeout = xs->timeout; - if (adw_build_req(xs, ccb)) { + if (adw_build_req(xs, ccb, flags)) { retryagain: s = splbio(); retry = adw_queue_ccb(sc, ccb, retry); @@ -804,9 +809,10 @@ retryagain: * Build a request structure for the Wide Boards. */ static int -adw_build_req(xs, ccb) +adw_build_req(xs, ccb, flags) struct scsipi_xfer *xs; ADW_CCB *ccb; + int flags; { struct scsipi_link *sc_link = xs->sc_link; ADW_SOFTC *sc = sc_link->adapter_softc; @@ -853,14 +859,14 @@ adw_build_req(xs, ccb) if (xs->xs_control & SCSI_DATA_UIO) { error = bus_dmamap_load_uio(dmat, ccb->dmamap_xfer, (struct uio *) xs->data, - (xs->xs_control & XS_CTL_NOSLEEP) ? + (flags & XS_CTL_NOSLEEP) ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK); } else #endif /* TFS */ { error = bus_dmamap_load(dmat, ccb->dmamap_xfer, xs->data, xs->datalen, NULL, - (xs->xs_control & XS_CTL_NOSLEEP) ? + (flags & XS_CTL_NOSLEEP) ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK); } diff --git a/sys/dev/ic/aha.c b/sys/dev/ic/aha.c index 34d49bff4763..a0270b18ebf4 100644 --- a/sys/dev/ic/aha.c +++ b/sys/dev/ic/aha.c @@ -1,4 +1,4 @@ -/* $NetBSD: aha.c,v 1.24 1999/09/30 23:04:40 thorpej Exp $ */ +/* $NetBSD: aha.c,v 1.25 2000/02/12 19:12:52 thorpej Exp $ */ #include "opt_ddb.h" @@ -1182,7 +1182,7 @@ aha_scsi_cmd(xs) bus_dma_tag_t dmat = sc->sc_dmat; struct aha_ccb *ccb; int error, seg, flags, s; - int fromqueue = 0, dontqueue = 0; + int fromqueue = 0, dontqueue = 0, nowait = 0; SC_DEBUG(sc_link, SDEV_DB2, ("aha_scsi_cmd\n")); @@ -1195,6 +1195,7 @@ aha_scsi_cmd(xs) if (xs == TAILQ_FIRST(&sc->sc_queue)) { TAILQ_REMOVE(&sc->sc_queue, xs, adapter_q); fromqueue = 1; + nowait = 1; goto get_ccb; } @@ -1231,6 +1232,8 @@ aha_scsi_cmd(xs) * then we can't allow it to sleep */ flags = xs->xs_control; + if (nowait) + flags |= XS_CTL_NOSLEEP; if ((ccb = aha_get_ccb(sc, flags)) == NULL) { /* * If we can't queue, we lose. diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c index f4362c969222..3e7c149dc590 100644 --- a/sys/dev/ic/aic7xxx.c +++ b/sys/dev/ic/aic7xxx.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic7xxx.c,v 1.40 2000/02/03 06:25:09 thorpej Exp $ */ +/* $NetBSD: aic7xxx.c,v 1.41 2000/02/12 19:12:53 thorpej Exp $ */ /* * Generic driver for the aic7xxx based adaptec SCSI controllers @@ -2526,7 +2526,7 @@ ahc_scsi_cmd(xs) u_short mask; int s; #if defined(__NetBSD__) /* XXX */ - int dontqueue = 0, fromqueue = 0; + int dontqueue = 0, fromqueue = 0, nowait = 0; int error; #endif @@ -2553,6 +2553,7 @@ ahc_scsi_cmd(xs) if (xs == TAILQ_FIRST(&ahc->sc_q)) { TAILQ_REMOVE(&ahc->sc_q, xs, adapter_q); fromqueue = 1; + nowait = 1; goto get_scb; } @@ -2591,6 +2592,8 @@ ahc_scsi_cmd(xs) * then we can't allow it to sleep */ flags = xs->xs_control; + if (nowait) + flags |= XS_CTL_NOSLEEP; if (!(scb = ahc_get_scb(ahc, flags))) { #if defined(__NetBSD__) /* XXX */ /* diff --git a/sys/dev/ic/bha.c b/sys/dev/ic/bha.c index dc2d0cc498b7..376d4341dd7f 100644 --- a/sys/dev/ic/bha.c +++ b/sys/dev/ic/bha.c @@ -1,4 +1,4 @@ -/* $NetBSD: bha.c,v 1.33 1999/10/09 22:46:20 mycroft Exp $ */ +/* $NetBSD: bha.c,v 1.34 2000/02/12 19:12:53 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. @@ -292,7 +292,7 @@ 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; + int fromqueue = 0, dontqueue = 0, nowait = 0; SC_DEBUG(sc_link, SDEV_DB2, ("bha_scsi_cmd\n")); @@ -305,6 +305,7 @@ bha_scsi_cmd(xs) if (xs == TAILQ_FIRST(&sc->sc_queue)) { TAILQ_REMOVE(&sc->sc_queue, xs, adapter_q); fromqueue = 1; + nowait = 1; goto get_ccb; } @@ -341,6 +342,8 @@ bha_scsi_cmd(xs) * then we can't allow it to sleep */ flags = xs->xs_control; + if (nowait) + flags |= XS_CTL_NOSLEEP; if ((ccb = bha_get_ccb(sc, flags)) == NULL) { /* * If we can't queue, we lose. diff --git a/sys/dev/ic/dpt.c b/sys/dev/ic/dpt.c index 4263fd2f5bcf..f508560d938b 100644 --- a/sys/dev/ic/dpt.c +++ b/sys/dev/ic/dpt.c @@ -1,4 +1,4 @@ -/* $NetBSD: dpt.c,v 1.17 2000/01/16 14:08:42 ad Exp $ */ +/* $NetBSD: dpt.c,v 1.18 2000/02/12 19:12:54 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.17 2000/01/16 14:08:42 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.18 2000/02/12 19:12:54 thorpej Exp $"); #include #include @@ -801,7 +801,7 @@ int dpt_scsi_cmd(xs) struct scsipi_xfer *xs; { - int error, i, flags, s, fromqueue, dontqueue; + int error, i, flags, s, fromqueue, dontqueue, nowait; struct scsipi_link *sc_link; struct dpt_softc *sc; struct dpt_ccb *ccb; @@ -816,6 +816,7 @@ dpt_scsi_cmd(xs) dmat = sc->sc_dmat; fromqueue = 0; dontqueue = 0; + nowait = 0; SC_DEBUG(sc_link, SDEV_DB2, ("dpt_scsi_cmd\n")); @@ -829,6 +830,7 @@ dpt_scsi_cmd(xs) if (xs == TAILQ_FIRST(&sc->sc_queue)) { TAILQ_REMOVE(&sc->sc_queue, xs, adapter_q); fromqueue = 1; + nowait = 1; } else { /* Cmds must be no more than 12 bytes for us */ if (xs->cmdlen > 12) { @@ -867,6 +869,8 @@ dpt_scsi_cmd(xs) } /* Get a CCB */ + if (nowait) + flags |= XS_CTL_NOSLEEP; if ((ccb = dpt_alloc_ccb(sc, flags)) == NULL) { /* If we can't queue, we lose */ if (dontqueue) { diff --git a/sys/dev/ic/uha.c b/sys/dev/ic/uha.c index 3572714949ba..5f6391cf3e1b 100644 --- a/sys/dev/ic/uha.c +++ b/sys/dev/ic/uha.c @@ -1,4 +1,4 @@ -/* $NetBSD: uha.c,v 1.22 1999/09/30 23:04:41 thorpej Exp $ */ +/* $NetBSD: uha.c,v 1.23 2000/02/12 19:12:54 thorpej Exp $ */ #undef UHADEBUG #ifdef DDB @@ -464,7 +464,7 @@ uha_scsi_cmd(xs) struct uha_mscp *mscp; struct uha_dma_seg *sg; int error, seg, flags, s; - int fromqueue = 0, dontqueue = 0; + int fromqueue = 0, dontqueue = 0, nowait = 0; SC_DEBUG(sc_link, SDEV_DB2, ("uha_scsi_cmd\n")); @@ -477,6 +477,7 @@ uha_scsi_cmd(xs) if (xs == TAILQ_FIRST(&sc->sc_queue)) { TAILQ_REMOVE(&sc->sc_queue, xs, adapter_q); fromqueue = 1; + nowait = 1; goto get_mscp; } @@ -513,6 +514,8 @@ uha_scsi_cmd(xs) * then we can't allow it to sleep */ flags = xs->xs_control; + if (nowait) + flags |= XS_CTL_NOSLEEP; if ((mscp = uha_get_mscp(sc, flags)) == NULL) { /* * If we can't queue, we lose.