From ebaf2c29d762a723658b9e5f873bd6a7d0e1f2a8 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Sat, 25 Feb 2017 14:24:29 +0000 Subject: [PATCH] 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. --- sys/dev/usb/storage/cfumass.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/dev/usb/storage/cfumass.c b/sys/dev/usb/storage/cfumass.c index 8c8287349389..71fd6e549b03 100644 --- a/sys/dev/usb/storage/cfumass.c +++ b/sys/dev/usb/storage/cfumass.c @@ -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); }