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:
bouyer 2001-10-14 20:31:24 +00:00
parent 4adb2fae92
commit a84535fd3e
2 changed files with 27 additions and 8 deletions

View File

@ -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.
@ -269,8 +269,19 @@ scsipi_grow_resources(chan)
{
if (chan->chan_flags & SCSIPI_CHAN_CANGROW) {
scsipi_adapter_request(chan, ADAPTER_REQ_GROW_RESOURCES, NULL);
return (scsipi_get_resource(chan));
if ((chan->chan_flags & SCSIPI_CHAN_TACTIVE) == 0) {
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);
@ -1967,10 +1978,8 @@ scsipi_completion_thread(arg)
for (;;) {
s = splbio();
xs = TAILQ_FIRST(&chan->chan_complete);
if (xs == NULL &&
(chan->chan_tflags &
(SCSIPI_CHANT_SHUTDOWN | SCSIPI_CHANT_CALLBACK |
SCSIPI_CHANT_KICK)) == 0) {
if (xs == NULL && chan->chan_tflags == 0) {
/* nothing to do; wait */
(void) tsleep(&chan->chan_complete, PRIBIO,
"sccomp", 0);
splx(s);
@ -1983,6 +1992,15 @@ scsipi_completion_thread(arg)
splx(s);
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) {
/* explicitly run the queues for this channel */
chan->chan_tflags &= ~SCSIPI_CHANT_KICK;

View File

@ -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.
@ -310,6 +310,7 @@ struct scsipi_channel {
#define SCSIPI_CHANT_SHUTDOWN 0x01 /* channel is shutting down */
#define SCSIPI_CHANT_CALLBACK 0x02 /* has to call chan_callback() */
#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) \
(((chan)->chan_flags & SCSIPI_CHAN_OPENINGS) ? \