Call ADAPTER_REQ_GROW_RESOURCES from the completion thread, if possible.
This allows HBA drivers to call bus_dmamem_map() safely.
This commit is contained in:
parent
4adb2fae92
commit
a84535fd3e
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: scsipi_base.c,v 1.59 2001/10/14 19:03:43 bouyer Exp $ */
|
/* $NetBSD: scsipi_base.c,v 1.60 2001/10/14 20:31:24 bouyer Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
|
||||||
@ -269,8 +269,19 @@ scsipi_grow_resources(chan)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (chan->chan_flags & SCSIPI_CHAN_CANGROW) {
|
if (chan->chan_flags & SCSIPI_CHAN_CANGROW) {
|
||||||
scsipi_adapter_request(chan, ADAPTER_REQ_GROW_RESOURCES, NULL);
|
if ((chan->chan_flags & SCSIPI_CHAN_TACTIVE) == 0) {
|
||||||
return (scsipi_get_resource(chan));
|
scsipi_adapter_request(chan,
|
||||||
|
ADAPTER_REQ_GROW_RESOURCES, NULL);
|
||||||
|
return (scsipi_get_resource(chan));
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* ask the channel thread to do it. It'll have to thaw the
|
||||||
|
* queue
|
||||||
|
*/
|
||||||
|
scsipi_channel_freeze(chan, 1);
|
||||||
|
chan->chan_tflags |= SCSIPI_CHANT_GROWRES;
|
||||||
|
wakeup(&chan->chan_complete);
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
@ -1967,10 +1978,8 @@ scsipi_completion_thread(arg)
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
s = splbio();
|
s = splbio();
|
||||||
xs = TAILQ_FIRST(&chan->chan_complete);
|
xs = TAILQ_FIRST(&chan->chan_complete);
|
||||||
if (xs == NULL &&
|
if (xs == NULL && chan->chan_tflags == 0) {
|
||||||
(chan->chan_tflags &
|
/* nothing to do; wait */
|
||||||
(SCSIPI_CHANT_SHUTDOWN | SCSIPI_CHANT_CALLBACK |
|
|
||||||
SCSIPI_CHANT_KICK)) == 0) {
|
|
||||||
(void) tsleep(&chan->chan_complete, PRIBIO,
|
(void) tsleep(&chan->chan_complete, PRIBIO,
|
||||||
"sccomp", 0);
|
"sccomp", 0);
|
||||||
splx(s);
|
splx(s);
|
||||||
@ -1983,6 +1992,15 @@ scsipi_completion_thread(arg)
|
|||||||
splx(s);
|
splx(s);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (chan->chan_tflags & SCSIPI_CHANT_GROWRES) {
|
||||||
|
/* attempt to get more openings for this channel */
|
||||||
|
chan->chan_tflags &= ~SCSIPI_CHANT_GROWRES;
|
||||||
|
scsipi_adapter_request(chan,
|
||||||
|
ADAPTER_REQ_GROW_RESOURCES, NULL);
|
||||||
|
scsipi_channel_thaw(chan, 1);
|
||||||
|
splx(s);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (chan->chan_tflags & SCSIPI_CHANT_KICK) {
|
if (chan->chan_tflags & SCSIPI_CHANT_KICK) {
|
||||||
/* explicitly run the queues for this channel */
|
/* explicitly run the queues for this channel */
|
||||||
chan->chan_tflags &= ~SCSIPI_CHANT_KICK;
|
chan->chan_tflags &= ~SCSIPI_CHANT_KICK;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: scsipiconf.h,v 1.61 2001/10/14 19:03:44 bouyer Exp $ */
|
/* $NetBSD: scsipiconf.h,v 1.62 2001/10/14 20:31:24 bouyer Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
|
||||||
@ -310,6 +310,7 @@ struct scsipi_channel {
|
|||||||
#define SCSIPI_CHANT_SHUTDOWN 0x01 /* channel is shutting down */
|
#define SCSIPI_CHANT_SHUTDOWN 0x01 /* channel is shutting down */
|
||||||
#define SCSIPI_CHANT_CALLBACK 0x02 /* has to call chan_callback() */
|
#define SCSIPI_CHANT_CALLBACK 0x02 /* has to call chan_callback() */
|
||||||
#define SCSIPI_CHANT_KICK 0x04 /* need to run queues */
|
#define SCSIPI_CHANT_KICK 0x04 /* need to run queues */
|
||||||
|
#define SCSIPI_CHANT_GROWRES 0x08 /* call ADAPTER_REQ_GROW_RESOURCES */
|
||||||
|
|
||||||
#define SCSIPI_CHAN_MAX_PERIPH(chan) \
|
#define SCSIPI_CHAN_MAX_PERIPH(chan) \
|
||||||
(((chan)->chan_flags & SCSIPI_CHAN_OPENINGS) ? \
|
(((chan)->chan_flags & SCSIPI_CHAN_OPENINGS) ? \
|
||||||
|
Loading…
Reference in New Issue
Block a user