summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2017-03-12 06:18:08 +0000
committermav <mav@FreeBSD.org>2017-03-12 06:18:08 +0000
commit705288e1792003f13357f2ed05ef3fd9dd67aefe (patch)
treefa7ab71fac94cd6255716e6860417f6dc13e27b3 /sys/cam
parent72853361ee8623a6bb54e0d3a661d292a8dcabb9 (diff)
downloadFreeBSD-src-705288e1792003f13357f2ed05ef3fd9dd67aefe.zip
FreeBSD-src-705288e1792003f13357f2ed05ef3fd9dd67aefe.tar.gz
MFC r314307: Add support for SIMs without autosense.
If we asked to send sense data by setting CAM_SEND_SENSE, but SIM didn't confirm transmission by setting CAM_SENT_SENSE, assume it was not sent. Queue the I/O back to CTL for later REQUEST SENSE with ctl_queue_sense(). This is needed for error reporting on SPI HBAs like ahc(4)/ahd(4).
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/ctl/scsi_ctl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c
index 7e56249..5eeac4b 100644
--- a/sys/cam/ctl/scsi_ctl.c
+++ b/sys/cam/ctl/scsi_ctl.c
@@ -1229,6 +1229,20 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
* datamove done routine.
*/
if ((io->io_hdr.flags & CTL_FLAG_DMA_INPROG) == 0) {
+ /*
+ * If we asked to send sense data but it wasn't sent,
+ * queue the I/O back to CTL for later REQUEST SENSE.
+ */
+ if ((done_ccb->ccb_h.flags & CAM_SEND_SENSE) != 0 &&
+ (done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP &&
+ (done_ccb->ccb_h.status & CAM_SENT_SENSE) == 0 &&
+ (io = ctl_alloc_io_nowait(bus_softc->port.ctl_pool_ref)) != NULL) {
+ PRIV_INFO(io) = PRIV_INFO(
+ (union ctl_io *)atio->ccb_h.io_ptr);
+ ctl_queue_sense(atio->ccb_h.io_ptr);
+ atio->ccb_h.io_ptr = io;
+ }
+
/* Abort ATIO if CTIO sending status has failed. */
if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) !=
CAM_REQ_CMP) {
OpenPOWER on IntegriCloud