Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Feb 2017 14:24:29 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314256 - head/sys/dev/usb/storage
Message-ID:  <201702251424.v1PEOTSl080320@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Feb 25 14:24:29 2017
New Revision: 314256
URL: https://svnweb.freebsd.org/changeset/base/314256

Log:
  Use ctl_queue_sense() to implement sense data reporting.
  
  USB MS BBB transport does not support autosense, so we have to queue any
  sense data back to CTL for later fetching via REQUEST SENSE.

Modified:
  head/sys/dev/usb/storage/cfumass.c

Modified: head/sys/dev/usb/storage/cfumass.c
==============================================================================
--- head/sys/dev/usb/storage/cfumass.c	Sat Feb 25 14:20:30 2017	(r314255)
+++ head/sys/dev/usb/storage/cfumass.c	Sat Feb 25 14:24:29 2017	(r314256)
@@ -987,19 +987,21 @@ cfumass_done(union ctl_io *io)
 		return;
 	}
 
-	switch (io->scsiio.scsi_status) {
-	case SCSI_STATUS_OK:
+	if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)
 		sc->sc_current_status = 0;
-		break;
-	default:
+	else
 		sc->sc_current_status = 1;
-		break;
-	}
+
+	/* XXX: How should we report BUSY, RESERVATION CONFLICT, etc? */
+	if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR &&
+	    io->scsiio.scsi_status == SCSI_STATUS_CHECK_COND)
+		ctl_queue_sense(io);
+	else
+		ctl_free_io(io);
 
 	CFUMASS_LOCK(sc);
 	cfumass_transfer_start(sc, CFUMASS_T_STATUS);
 	CFUMASS_UNLOCK(sc);
-	ctl_free_io(io);
 
 	refcount_release(&sc->sc_queued);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702251424.v1PEOTSl080320>