Subject: CVS commit: syssrc [thorpej_scsipi]
To: None <source-changes@netbsd.org>
From: Manuel BOUYER <bouyer@netbsd.org>
List: source-changes
Date: 01/15/2001 11:22:16
Module Name:	syssrc
Committed By:	bouyer
Date:		Mon Jan 15 09:22:16 UTC 2001

Modified Files:
	syssrc/sys/dev/scsipi [thorpej_scsipi]: scsipi_base.c scsipi_base.h
	    scsipiconf.h

Log Message:
Handle CHECK CONDITION status in mid-layer:
the REQUEST_SENSE command is generated from scsipi_complete() so it can
tsleep() (we use a regular scsipi_command() call for this). Add a new
periph_flag, PERIPH_SENSE, and a new xs_control, XS_CTL_REQSENSE.
When PERIPH_SENSE is set only xfer with XS_CTL_REQSENSE may be sent
(same logic as PERIPH_RECOVERING but with higther priority). xfer with
XS_CTL_REQSENSE need to have XS_CTL_URGENT urgent too.
XS_CTL_USERCMD xfers are now handled in scsipi_complete().

We need to pay special attention to SCSI resets, as we may have:
- an aborted REQUEST_SENSE. In this case we need to requeue the original
  command, not the request sense.
- sense pending for a command no longer in the queue but for which a
  request sense has not yet been queued. In this case we should not issue
  the request sense but requeue the original command instead.

For this:
- the xfer with the CHECK CONDITION status is stored in the scsipi_periph
  (periph_xscheck); the CHECK CONDITION is tested in scsipi_done, PERIPH_SENSE
  and periph_xscheck is set here.
- XS_CTL_REQSENSE xfers are not allowed to be requeued, and are terminated
  with EINTR in case of reset.
- we have a new async event, "ASYNC_EVENT_RESET", which cleanup the
  xfer in periph_xscheck.
- appropriate splbio/splx to avoid race condition (especially,
  scsipi_request_sense() runs at splbio. Should not be a real problem as it
  doesn't happen often.

While I'm there kill req_sense_length from struct scsipi_xfer, it's always set
to 0 and only checked by a few drivers.


To generate a diff of this commit:
cvs rdiff -r1.26.2.8 -r1.26.2.9 syssrc/sys/dev/scsipi/scsipi_base.c
cvs rdiff -r1.9.10.3 -r1.9.10.4 syssrc/sys/dev/scsipi/scsipi_base.h
cvs rdiff -r1.32.2.8 -r1.32.2.9 syssrc/sys/dev/scsipi/scsipiconf.h

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