Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi Do a 36-byte SCSI 2 inquiry first, and iff th...
details: https://anonhg.NetBSD.org/src/rev/4e77d5e40bc7
branches: trunk
changeset: 553438:4e77d5e40bc7
user: mycroft <mycroft%NetBSD.org@localhost>
date: Thu Oct 16 17:34:43 2003 +0000
description:
Do a 36-byte SCSI 2 inquiry first, and iff that returns an additional length
>32 do a 74-byte inquiry. Fixes problems with devices that barf on longer
inquiries. (Linux uses 36 bytes almost everywhere, as a data point.)
diffstat:
sys/dev/scsipi/scsipi_all.h | 4 +++-
sys/dev/scsipi/scsipi_base.c | 25 ++++++++++++-------------
2 files changed, 15 insertions(+), 14 deletions(-)
diffs (88 lines):
diff -r 3b61934bf177 -r 4e77d5e40bc7 sys/dev/scsipi/scsipi_all.h
--- a/sys/dev/scsipi/scsipi_all.h Thu Oct 16 16:06:43 2003 +0000
+++ b/sys/dev/scsipi/scsipi_all.h Thu Oct 16 17:34:43 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scsipi_all.h,v 1.24 2003/09/08 03:33:31 mycroft Exp $ */
+/* $NetBSD: scsipi_all.h,v 1.25 2003/10/16 17:34:43 mycroft Exp $ */
/*
* SCSI and SCSI-like general interface description
@@ -280,6 +280,7 @@
/* 9*/ char vendor[8];
/*17*/ char product[16];
/*33*/ char revision[4];
+#define SCSIPI_INQUIRY_LENGTH_SCSI2 36
/*37*/ u_int8_t vendor_specific[20];
/*57*/ u_int8_t flags4;
#define SID_IUS 0x01
@@ -290,6 +291,7 @@
#define SID_CLOCKING_SD_DT 0x0C
/*58*/ u_int8_t reserved;
/*59*/ char version_descriptor[8][2];
+#define SCSIPI_INQUIRY_LENGTH_SCSI3 74
} __attribute__((packed)); /* 74 Bytes */
/* Data structures for mode select/mode sense */
diff -r 3b61934bf177 -r 4e77d5e40bc7 sys/dev/scsipi/scsipi_base.c
--- a/sys/dev/scsipi/scsipi_base.c Thu Oct 16 16:06:43 2003 +0000
+++ b/sys/dev/scsipi/scsipi_base.c Thu Oct 16 17:34:43 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scsipi_base.c,v 1.95 2003/10/12 03:21:56 thorpej Exp $ */
+/* $NetBSD: scsipi_base.c,v 1.96 2003/10/16 17:34:43 mycroft Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.95 2003/10/12 03:21:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.96 2003/10/16 17:34:43 mycroft Exp $");
#include "opt_scsi.h"
@@ -1083,8 +1083,13 @@
error = scsipi_command(periph,
(struct scsipi_generic *) &scsipi_cmd, sizeof(scsipi_cmd),
- (u_char *) inqbuf, sizeof(struct scsipi_inquiry_data),
+ (u_char *) inqbuf, SCSIPI_INQUIRY_LENGTH_SCSI2,
retries, 10000, NULL, XS_CTL_DATA_IN | flags);
+ if (!error && inqbuf->additional_length > SCSIPI_INQUIRY_LENGTH_SCSI2 - 4)
+ error = scsipi_command(periph,
+ (struct scsipi_generic *) &scsipi_cmd, sizeof(scsipi_cmd),
+ (u_char *) inqbuf, SCSIPI_INQUIRY_LENGTH_SCSI3,
+ retries, 10000, NULL, XS_CTL_DATA_IN | flags);
#ifdef SCSI_OLD_NOINQUIRY
/*
@@ -1101,12 +1106,9 @@
inqbuf->dev_qual2 = 0;
inqbuf->version = 0;
inqbuf->response_format = SID_FORMAT_SCSI1;
- inqbuf->additional_length = 3 + 28;
+ inqbuf->additional_length = SCSIPI_INQUIRY_LENGTH_SCSI2 - 4;
inqbuf->flags1 = inqbuf->flags2 = inqbuf->flags3 = 0;
- memcpy(inqbuf->vendor, "ADAPTEC ", sizeof(inqbuf->vendor));
- memcpy(inqbuf->product, "ACB-4000 ",
- sizeof(inqbuf->product));
- memcpy(inqbuf->revision, " ", sizeof(inqbuf->revision));
+ memcpy(inqbuf->vendor, "ADAPTEC ACB-4000 ", 28);
error = 0;
}
@@ -1124,12 +1126,9 @@
*/
inqbuf->device = (SID_QUAL_LU_PRESENT | T_SEQUENTIAL);
inqbuf->dev_qual2 = SID_REMOVABLE;
- inqbuf->additional_length = 3 + 28;
+ inqbuf->additional_length = SCSIPI_INQUIRY_LENGTH_SCSI2 - 4;
inqbuf->flags1 = inqbuf->flags2 = inqbuf->flags3 = 0;
- memcpy(inqbuf->vendor, "EMULEX ", sizeof(inqbuf->vendor));
- memcpy(inqbuf->product, "MT-02 QIC ",
- sizeof(inqbuf->product));
- memcpy(inqbuf->revision, " ", sizeof(inqbuf->revision));
+ memcpy(inqbuf->vendor, "EMULEX MT-02 QIC ", 28);
}
#endif /* SCSI_OLD_NOINQUIRY */
Home |
Main Index |
Thread Index |
Old Index