If we got an xfer from our backlog queue, don't allow sleeping; we're in

interrupt context.

XXX This is fixed properly in the thorpej_scsipi branch, but that won't
be ready for 1.5, I don't think.
This commit is contained in:
thorpej 2000-02-12 19:12:52 +00:00
parent fc72b13d27
commit 1268cc5d6c
7 changed files with 46 additions and 21 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -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.

View File

@ -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 */
/*

View File

@ -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.

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
@ -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) {

View File

@ -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.