Set SCSI_NOSLEEP only when we really need to. This requires an additional

flags parameter to all xxstart routines so that the correct information can
be passed down into the device specific routines.  This is needed to ensure
that ccb/scb allocation routines don't hang.

Submitted by: John Dyson
This commit is contained in:
Justin T. Gibbs 1995-04-23 22:07:56 +00:00
parent c6baec432a
commit a34bad999b
7 changed files with 37 additions and 37 deletions

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* $Id: cd.c,v 1.37 1995/03/21 11:21:00 dufault Exp $
* $Id: cd.c,v 1.38 1995/04/14 15:10:24 dufault Exp $
*/
#define SPLCD splbio
@ -66,7 +66,7 @@ int32 cdstrats, cdqueues;
#define PARTITION(z) (minor(z) & 0x07)
#define RAW_PART 2
void cdstart(u_int32 unit);
void cdstart(u_int32 unit, u_int32 flags);
struct scsi_data {
u_int32 flags;
@ -412,7 +412,7 @@ cd_strategy(struct buf *bp, struct scsi_link *sc_link)
* Tell the device to get going on the transfer if it's
* not doing anything, otherwise just wait for completion
*/
cdstart(unit);
cdstart(unit, 0);
splx(opri);
return;
@ -445,8 +445,9 @@ cd_strategy(struct buf *bp, struct scsi_link *sc_link)
* cdstart() is called at SPLCD from cdstrategy and scsi_done
*/
void
cdstart(unit)
cdstart(unit, flags)
u_int32 unit;
u_int32 flags;
{
register struct buf *bp = 0;
register struct buf *dp;
@ -518,7 +519,7 @@ cdstart(unit)
CDRETRIES,
30000,
bp,
SCSI_NOSLEEP | ((bp->b_flags & B_READ) ?
flags | ((bp->b_flags & B_READ) ?
SCSI_DATA_IN : SCSI_DATA_OUT))
!= SUCCESSFULLY_QUEUED) {
bad:

View File

@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: pt.c,v 1.1 1995/03/04 20:50:46 dufault Exp $
* $Id: pt.c,v 1.2 1995/04/14 15:10:28 dufault Exp $
*/
/*
@ -57,7 +57,7 @@ struct scsi_data {
struct buf *buf_queue; /* the queue of pending IO operations */
};
void ptstart(u_int32 unit);
void ptstart(u_int32 unit, u_int32 flags);
void pt_strategy(struct buf *bp, struct scsi_link *sc_link);
int pt_sense(struct scsi_xfer *scsi_xfer);
@ -100,8 +100,9 @@ struct scsi_device pt_switch =
* ptstart() is called at splbio
*/
void
ptstart(unit)
ptstart(unit, flags)
u_int32 unit;
u_int32 flags;
{
struct scsi_link *sc_link = SCSI_LINK(&pt_switch, unit);
struct scsi_data *pt = sc_link->sd;
@ -116,7 +117,6 @@ ptstart(unit)
u_char control;
} cmd;
u_int32 flags;
SC_DEBUG(sc_link, SDEV_DB2, ("ptstart "));
/*
@ -142,10 +142,10 @@ ptstart(unit)
bzero(&cmd, sizeof(cmd));
if ((bp->b_flags & B_READ) == B_WRITE) {
cmd.op_code = PROCESSOR_SEND;
flags = SCSI_DATA_OUT;
flags |= SCSI_DATA_OUT;
} else {
cmd.op_code = PROCESSOR_RECEIVE;
flags = SCSI_DATA_IN;
flags |= SCSI_DATA_IN;
}
scsi_uto3b(bp->b_bcount, cmd.len);
@ -160,7 +160,7 @@ ptstart(unit)
0,
10000,
bp,
flags | SCSI_NOSLEEP) == SUCCESSFULLY_QUEUED) {
flags) == SUCCESSFULLY_QUEUED) {
} else {
printf("pt%ld: oops not queued\n", unit);
bp->b_flags |= B_ERROR;
@ -208,7 +208,7 @@ pt_strategy(struct buf *bp, struct scsi_link *sc_link)
* not doing anything, otherwise just wait for completion
* (All a bit silly if we're only allowing 1 open but..)
*/
ptstart(unit);
ptstart(unit, 0);
splx(opri);
return;

View File

@ -8,7 +8,7 @@
* file.
*
* Written by Julian Elischer (julian@dialix.oz.au)
* $Id: scsi_base.c,v 1.25 1995/03/28 07:57:23 bde Exp $
* $Id: scsi_base.c,v 1.27 1995/04/14 15:10:31 dufault Exp $
*/
#define SPLSD splbio
@ -106,7 +106,7 @@ free_xs(xs, sc_link, flags)
} else {
if (sc_link->device->start) {
SC_DEBUG(sc_link, SDEV_DB2, ("calling private start()\n"));
(*(sc_link->device->start)) (sc_link->dev_unit);
(*(sc_link->device->start)) (sc_link->dev_unit, flags);
}
}
}
@ -470,7 +470,6 @@ scsi_scsi_cmd(sc_link, scsi_cmd, cmdlen, data_addr, datalen,
}
}
if (bp && !(flags & SCSI_USER)) flags |= SCSI_NOSLEEP;
SC_DEBUG(sc_link, SDEV_DB2, ("scsi_cmd\n"));
xs = get_xs(sc_link, flags);

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* $Id: scsiconf.h,v 1.22 1995/04/14 15:10:39 dufault Exp $
* $Id: scsiconf.h,v 1.23 1995/04/23 07:47:12 bde Exp $
*/
#ifndef SCSI_SCSICONF_H
#define SCSI_SCSICONF_H 1
@ -164,7 +164,7 @@ struct scsi_device
{
/* 4*/ errval (*err_handler)(struct scsi_xfer *xs); /* return -1 to say
* err processing complete */
/* 8*/ void (*start)(u_int32 unit);
/* 8*/ void (*start)(u_int32 unit, u_int32 flags);
/* 12*/ int32 (*async)();
/* 16*/ int32 (*done)(); /* returns -1 to say done processing complete */
/* 20*/ char *name; /* name of device type */

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
* $Id: sd.c,v 1.57 1995/03/23 16:09:01 bde Exp $
* $Id: sd.c,v 1.59 1995/04/14 15:10:42 dufault Exp $
*/
#define SPLSD splbio
@ -61,7 +61,7 @@ errval sd_get_parms __P((int unit, int flags));
static void sdstrategy1 __P((struct buf *));
int sd_sense_handler __P((struct scsi_xfer *));
void sdstart __P((u_int32));
void sdstart __P((u_int32, u_int32));
struct scsi_data {
u_int32 flags;
@ -407,7 +407,7 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link)
* Tell the device to get going on the transfer if it's
* not doing anything, otherwise just wait for completion
*/
sdstart(unit);
sdstart(unit, 0);
splx(opri);
return /*0*/;
@ -450,7 +450,7 @@ sdstrategy1(struct buf *bp)
* sdstart() is called at SPLSD from sdstrategy and scsi_done
*/
void
sdstart(u_int32 unit)
sdstart(u_int32 unit, u_int32 flags)
{
register struct scsi_link *sc_link = SCSI_LINK(&sd_switch, unit);
register struct scsi_data *sd = sc_link->sd;
@ -525,7 +525,7 @@ sdstart(u_int32 unit)
SD_RETRIES,
10000,
bp,
SCSI_NOSLEEP | ((bp->b_flags & B_READ) ?
flags | ((bp->b_flags & B_READ) ?
SCSI_DATA_IN : SCSI_DATA_OUT))
== SUCCESSFULLY_QUEUED) {
sdqueues++;

View File

@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
* $Id: st.c,v 1.31 1995/03/21 11:21:08 dufault Exp $
* $Id: st.c,v 1.32 1995/04/14 15:10:44 dufault Exp $
*/
/*
@ -165,7 +165,7 @@ errval st_mode_select __P((u_int32 unit, u_int32 flags, \
errval st_comp __P((u_int32 unit, u_int32 mode));
void ststrategy();
int32 st_chkeod();
void ststart(u_int32 unit);
void ststart(u_int32 unit, u_int32 flags);
void st_unmount();
errval st_mount_tape();
void st_loadquirks();
@ -957,7 +957,7 @@ st_strategy(struct buf *bp, struct scsi_link *sc_link)
* not doing anything, otherwise just wait for completion
* (All a bit silly if we're only allowing 1 open but..)
*/
ststart(unit);
ststart(unit, 0);
splx(opri);
return;
@ -986,14 +986,14 @@ st_strategy(struct buf *bp, struct scsi_link *sc_link)
* ststart() is called at splbio
*/
void
ststart(unit)
ststart(unit, flags)
u_int32 unit;
u_int32 flags;
{
struct scsi_link *sc_link = SCSI_LINK(&st_switch, unit);
struct scsi_data *st = sc_link->sd;
register struct buf *bp = 0;
struct scsi_rw_tape cmd;
u_int32 flags;
SC_DEBUG(sc_link, SDEV_DB2, ("ststart "));
/*
@ -1072,10 +1072,10 @@ ststart(unit)
cmd.op_code = WRITE_COMMAND_TAPE;
st->flags &= ~ST_FM_WRITTEN;
st->flags |= ST_WRITTEN;
flags = SCSI_DATA_OUT;
flags |= SCSI_DATA_OUT;
} else {
cmd.op_code = READ_COMMAND_TAPE;
flags = SCSI_DATA_IN;
flags |= SCSI_DATA_IN;
}
/*
* Handle "fixed-block-mode" tape drives by using the

View File

@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: worm.c,v 1.2 1995/03/15 14:22:12 dufault Exp $
* $Id: worm.c,v 1.3 1995/04/23 07:39:21 bde Exp $
*/
/* XXX This is PRELIMINARY.
@ -66,7 +66,7 @@ struct scsi_data {
u_int32 blk_size; /* Size of each blocks */
};
void wormstart(u_int32 unit);
void wormstart(u_int32 unit, u_int32 flags);
errval worm_open(dev_t dev, int flags, int fmt, struct proc *p,
struct scsi_link *sc_link);
@ -157,8 +157,9 @@ wormattach(struct scsi_link *sc_link)
* handled in one place.
*/
void
wormstart(unit)
wormstart(unit, flags)
u_int32 unit;
u_int32 flags;
{
struct scsi_link *sc_link = SCSI_LINK(&worm_switch, unit);
struct scsi_data *worm = sc_link->sd;
@ -177,7 +178,6 @@ wormstart(unit)
u_char ctl;
} cmd;
u_int32 flags;
u_int32 lba; /* Logical block address */
u_int32 tl; /* Transfer length */
@ -213,10 +213,10 @@ wormstart(unit)
bzero(&cmd, sizeof(cmd));
if ((bp->b_flags & B_READ) == B_WRITE) {
cmd.op_code = WRITE_BIG;
flags = SCSI_DATA_OUT;
flags |= SCSI_DATA_OUT;
} else {
cmd.op_code = READ_BIG;
flags = SCSI_DATA_IN;
flags |= SCSI_DATA_IN;
}
@ -292,7 +292,7 @@ worm_strategy(struct buf *bp, struct scsi_link *sc_link)
*dp = bp;
bp->b_actf = NULL;
wormstart(unit);
wormstart(unit, 0);
splx(opri);
return;