Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb ATA passthrough commands, supported by many SPC-...



details:   https://anonhg.NetBSD.org/src/rev/d0e6b07157f6
branches:  trunk
changeset: 841776:d0e6b07157f6
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Thu May 30 21:44:49 2019 +0000

description:
ATA passthrough commands, supported by many SPC-2 disks, require more
sense data.

diffstat:

 sys/dev/usb/umass_scsipi.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r c2f3fd78e7a1 -r d0e6b07157f6 sys/dev/usb/umass_scsipi.c
--- a/sys/dev/usb/umass_scsipi.c        Thu May 30 21:43:23 2019 +0000
+++ b/sys/dev/usb/umass_scsipi.c        Thu May 30 21:44:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umass_scsipi.c,v 1.61 2019/03/28 10:44:29 kardel Exp $ */
+/*     $NetBSD: umass_scsipi.c,v 1.62 2019/05/30 21:44:49 mlelstv Exp $        */
 
 /*
  * Copyright (c) 2001, 2003, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.61 2019/03/28 10:44:29 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.62 2019/05/30 21:44:49 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -458,7 +458,7 @@
                        cmdlen = UFI_COMMAND_LENGTH;    /* XXX */
                else
                        cmdlen = sizeof(scbus->sc_sense_cmd);
-               if (periph->periph_version < 0x05) /* SPC-3 */
+               if (periph->periph_version < 0x04) /* SPC-2 */
                        senselen = 18;
                else
                        senselen = sizeof(xs->sense);
@@ -498,6 +498,7 @@
 {
        UMASSHIST_FUNC(); UMASSHIST_CALLED();
        struct scsipi_xfer *xs = priv;
+       size_t extra;
 
        DPRINTFM(UDMASS_CMD, "sc %#jx: xs=%#jx residue=%jd status=%jd",
            (uintptr_t)sc, (uintptr_t)xs, residue, status);
@@ -507,7 +508,9 @@
        case STATUS_CMD_OK:
        case STATUS_CMD_UNKNOWN:
                /* getting sense data succeeded */
-               if (residue == 0 || residue == 14)/* XXX */
+               extra = sizeof(xs->sense.scsi_sense)
+                     - sizeof(xs->sense.scsi_sense.extra_bytes);
+               if (residue <= extra)
                        xs->error = XS_SENSE;
                else
                        xs->error = XS_SHORTSENSE;



Home | Main Index | Thread Index | Old Index