Module Name: src
Committed By: christos
Date: Mon Nov 17 18:43:48 UTC 2014
Modified Files:
src/sys/dev/scsipi: scsipi_base.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/scsipi/scsipi_base.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/scsipi/scsipi_base.c
diff -u src/sys/dev/scsipi/scsipi_base.c:1.162 src/sys/dev/scsipi/scsipi_base.c:1.163
--- src/sys/dev/scsipi/scsipi_base.c:1.162 Sat Oct 18 04:33:28 2014
+++ src/sys/dev/scsipi/scsipi_base.c Mon Nov 17 13:43:48 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: scsipi_base.c,v 1.162 2014/10/18 08:33:28 snj Exp $ */
+/* $NetBSD: scsipi_base.c,v 1.163 2014/11/17 18:43:48 christos 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.162 2014/10/18 08:33:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.163 2014/11/17 18:43:48 christos Exp $");
#include "opt_scsi.h"
@@ -1044,6 +1044,28 @@ scsipi_test_unit_ready(struct scsipi_per
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:
*
@@ -1081,7 +1103,7 @@ scsipi_inquire(struct scsipi_periph *per
10000, NULL, flags | XS_CTL_DATA_IN);
if (!error &&
inqbuf->additional_length > SCSIPI_INQUIRY_LENGTH_SCSI2 - 4) {
- if (inqbuf->additional_length <= SCSIPI_INQUIRY_LENGTH_SCSI3 - 4) {
+ if (scsipi_inquiry3_ok(inqbuf)) {
#if 0
printf("inquire: addlen=%d, retrying\n", inqbuf->additional_length);
#endif
@@ -1092,10 +1114,6 @@ printf("inquire: addlen=%d, retrying\n",
#if 0
printf("inquire: error=%d\n", error);
#endif
-#if 1
- } else {
-printf("inquire: addlen=%d, not retrying\n", inqbuf->additional_length);
-#endif
}
}