Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/dev/scsipi Pull up the following revisions, requested...



details:   https://anonhg.NetBSD.org/src/rev/3682895f1b54
branches:  netbsd-7
changeset: 799153:3682895f1b54
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Mar 26 16:09:52 2015 +0000

description:
Pull up the following revisions, requested by christos in #644:

        sys/dev/scsipi/scsipi_base.c    1.161 - 1.164

Use size for the size argument of memcmp, not the result of a compare.

PR/49054: Add a quirk for the ES-6600 RAID controller which does not do
INQUIRY3 properly. Unfortunately looking at the length does not solve
the problem since other devices send greater lengths too.

src is too big these days to tolerate superfluous apostrophes.  It's
"its", people!

PR/49054: Uwe Toenjes: Some RAID controllers return more bytes in the
scsi 3 inquiry command than expected by the size of the scsi 3 inquiry
packet. This can be detected by looking at the additional_length field
returned by the scsi 2 inquiry. If that's the case, avoid doing the
scsi 3 inquiry because we can't handle the extra bytes later.

diffstat:

 sys/dev/scsipi/scsipi_base.c |  34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 deletions(-)

diffs (90 lines):

diff -r 47b1eb679517 -r 3682895f1b54 sys/dev/scsipi/scsipi_base.c
--- a/sys/dev/scsipi/scsipi_base.c      Thu Mar 26 13:44:46 2015 +0000
+++ b/sys/dev/scsipi/scsipi_base.c      Thu Mar 26 16:09:52 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsipi_base.c,v 1.160 2014/07/13 17:12:23 dholland Exp $       */
+/*     $NetBSD: scsipi_base.c,v 1.160.2.1 2015/03/26 16:09:52 martin Exp $     */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.160 2014/07/13 17:12:23 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.160.2.1 2015/03/26 16:09:52 martin Exp $");
 
 #include "opt_scsi.h"
 
@@ -808,7 +808,7 @@
 #endif
 
        /*
-        * If the periph has it's own error handler, call it first.
+        * If the periph has its own error handler, call it first.
         * If it returns a legit error value, return that, otherwise
         * it wants us to continue with normal error processing.
         */
@@ -1044,6 +1044,28 @@
            retries, 10000, NULL, flags));
 }
 
+static const struct scsipi_inquiry3_pattern {
+       const char vendor[8];
+       const char product[16];
+       const char revision[4];
+} scsipi_inquiry3_quirk[] = {
+       { "ES-6600 ", "", "" },
+};
+
+static int
+scsipi_inquiry3_ok(const struct scsipi_inquiry_data *ib)
+{
+       for (size_t i = 0; i < __arraycount(scsipi_inquiry3_quirk); i++) {
+               const struct scsipi_inquiry3_pattern *q =
+                   &scsipi_inquiry3_quirk[i];
+#define MATCH(field) \
+    (q->field[0] ? memcmp(ib->field, q->field, sizeof(ib->field)) == 0 : 1)
+               if (MATCH(vendor) && MATCH(product) && MATCH(revision))
+                       return 0;
+       }
+       return 1;
+}
+
 /*
  * scsipi_inquire:
  *
@@ -1064,7 +1086,7 @@
 
        /*
         * If we request more data than the device can provide, it SHOULD just
-        * return a short reponse.  However, some devices error with an
+        * return a short response.  However, some devices error with an
         * ILLEGAL REQUEST sense code, and yet others have even more special
         * failture modes (such as the GL641USB flash adapter, which goes loony
         * and sends corrupted CRCs).  To work around this, and to bring our
@@ -1081,6 +1103,7 @@
            10000, NULL, flags | XS_CTL_DATA_IN);
        if (!error &&
            inqbuf->additional_length > SCSIPI_INQUIRY_LENGTH_SCSI2 - 4) {
+           if (scsipi_inquiry3_ok(inqbuf)) {
 #if 0
 printf("inquire: addlen=%d, retrying\n", inqbuf->additional_length);
 #endif
@@ -1091,6 +1114,7 @@
 #if 0
 printf("inquire: error=%d\n", error);
 #endif
+           }
        }
 
 #ifdef SCSI_OLD_NOINQUIRY
@@ -2445,7 +2469,7 @@
 
 #ifdef SCSIPI_DEBUG
 /*
- * Given a scsipi_xfer, dump the request, in all it's glory
+ * Given a scsipi_xfer, dump the request, in all its glory
  */
 void
 show_scsipi_xs(struct scsipi_xfer *xs)



Home | Main Index | Thread Index | Old Index