Subject: CVS commit: src/sys/dev/scsipi
To: None <source-changes@NetBSD.org>
From: Manuel Bouyer <bouyer@netbsd.org>
List: source-changes
Date: 09/09/2004 19:35:33
Module Name:	src
Committed By:	bouyer
Date:		Thu Sep  9 19:35:33 UTC 2004

Modified Files:
	src/sys/dev/scsipi: atapi_base.c atapiconf.h cd.c ch.c if_se.c
	    scsi_base.c scsiconf.h scsipi_base.c scsipi_ioctl.c scsipiconf.c
	    scsipiconf.h sd.c ses.c ss_mustek.c ss_scanjet.c st.c st_scsi.c

Log Message:
Make the xxstart() functions reentrant again, as some drivers HBA can call
scsipi_done() from their scsipi_request().
For this, add a struct scsipi_xfer * argument to scsipi_command().
If not NULL scsipi_command() will use this to enqueue this xfer, otherwise
it'll try to allocate a new one. This scsipi_xfer has to be allocated
and initialised by scsipi_make_xs() or equivalent.
In xxstart(), allocate a scsipi_xfer using scsipi_make_xs(), and if not NULL,
dequeue the buffer before calling scsipi_command(). This makes sure that
scsipi_command() will not fail, and also makes sure that xxstart() won't
be called again between the BUFQ_PEEK() and BUFQ_GET().

Fix "dequeued wrong buf" panics reported by Juergen Hannken-Illjes in
private mail and Andreas Wrede on current-users@.
Thanks to Jason Thorpe and Chuck Silver for review, and Andreas Wrede for
testing the patch.


To generate a diff of this commit:
cvs rdiff -r1.21 -r1.22 src/sys/dev/scsipi/atapi_base.c
cvs rdiff -r1.17 -r1.18 src/sys/dev/scsipi/atapiconf.h
cvs rdiff -r1.204 -r1.205 src/sys/dev/scsipi/cd.c
cvs rdiff -r1.61 -r1.62 src/sys/dev/scsipi/ch.c
cvs rdiff -r1.46 -r1.47 src/sys/dev/scsipi/if_se.c
cvs rdiff -r1.80 -r1.81 src/sys/dev/scsipi/scsi_base.c
cvs rdiff -r1.51 -r1.52 src/sys/dev/scsipi/scsiconf.h
cvs rdiff -r1.111 -r1.112 src/sys/dev/scsipi/scsipi_base.c
cvs rdiff -r1.47 -r1.48 src/sys/dev/scsipi/scsipi_ioctl.c
cvs rdiff -r1.23 -r1.24 src/sys/dev/scsipi/scsipiconf.c \
    src/sys/dev/scsipi/ses.c
cvs rdiff -r1.86 -r1.87 src/sys/dev/scsipi/scsipiconf.h
cvs rdiff -r1.222 -r1.223 src/sys/dev/scsipi/sd.c
cvs rdiff -r1.20 -r1.21 src/sys/dev/scsipi/ss_mustek.c
cvs rdiff -r1.31 -r1.32 src/sys/dev/scsipi/ss_scanjet.c
cvs rdiff -r1.165 -r1.166 src/sys/dev/scsipi/st.c
cvs rdiff -r1.11 -r1.12 src/sys/dev/scsipi/st_scsi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.