diff options
| author | fredette <fredette@NetBSD.org> | 2001-11-26 20:39:29 +0000 |
|---|---|---|
| committer | fredette <fredette@NetBSD.org> | 2001-11-26 20:39:29 +0000 |
| commit | 83c021b2a70dcf8ef57cd57a48e8ce5c294db231 (patch) | |
| tree | 8c27d14ee4f57bfb59d4630e2b5a972c025ec43a /sys/dev/scsipi | |
| parent | fd7c36bef3791925cdbfcca74da2f36f1a7ce083 (diff) | |
Added quirk entries for Adaptec and Emulex SCSI interposer boards.
Decode a limited set of SASI/SCSI-1 sense codes, and under sun2
only, conjure up INQUIRY responses for these boards.
Diffstat (limited to 'sys/dev/scsipi')
| -rw-r--r-- | sys/dev/scsipi/scsiconf.c | 8 | ||||
| -rw-r--r-- | sys/dev/scsipi/scsipi_base.c | 82 |
2 files changed, 83 insertions, 7 deletions
diff --git a/sys/dev/scsipi/scsiconf.c b/sys/dev/scsipi/scsiconf.c index 7de5e70237d..6d68d713af2 100644 --- a/sys/dev/scsipi/scsiconf.c +++ b/sys/dev/scsipi/scsiconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsiconf.c,v 1.170 2001/11/19 22:50:00 tsutsui Exp $ */ +/* $NetBSD: scsiconf.c,v 1.171 2001/11/26 20:39:29 fredette Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.170 2001/11/19 22:50:00 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.171 2001/11/26 20:39:29 fredette Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -486,6 +486,8 @@ const struct scsi_quirk_inquiry_pattern scsi_quirk_patterns[] = { {{T_DIRECT, T_FIXED, "ADAPTEC ", "AEC-4412BD", "1.2A"}, PQUIRK_NOMODESENSE}, {{T_DIRECT, T_FIXED, + "ADAPTEC ", "ACB-4000", ""}, PQUIRK_FORCELUNS|PQUIRK_AUTOSAVE|PQUIRK_NOMODESENSE}, + {{T_DIRECT, T_FIXED, "DEC ", "RZ55 (C) DEC", ""}, PQUIRK_AUTOSAVE}, {{T_DIRECT, T_FIXED, "EMULEX ", "MD21/S2 ESDI", "A00"}, @@ -597,6 +599,8 @@ const struct scsi_quirk_inquiry_pattern scsi_quirk_patterns[] = { {{T_SEQUENTIAL, T_REMOV, " ", " ", " "}, PQUIRK_NOLUNS}, {{T_SEQUENTIAL, T_REMOV, + "EMULEX ", "MT-02 QIC ", ""}, PQUIRK_NOLUNS}, + {{T_SEQUENTIAL, T_REMOV, "CALIPER ", "CP150 ", ""}, PQUIRK_NOLUNS}, {{T_SEQUENTIAL, T_REMOV, "EXABYTE ", "EXB-8200 ", ""}, PQUIRK_NOLUNS}, diff --git a/sys/dev/scsipi/scsipi_base.c b/sys/dev/scsipi/scsipi_base.c index 240348f8a69..7e505812c27 100644 --- a/sys/dev/scsipi/scsipi_base.c +++ b/sys/dev/scsipi/scsipi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_base.c,v 1.63 2001/11/15 09:48:17 lukem Exp $ */ +/* $NetBSD: scsipi_base.c,v 1.64 2001/11/26 20:39:29 fredette Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.63 2001/11/15 09:48:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.64 2001/11/26 20:39:29 fredette Exp $"); #include "opt_scsi.h" @@ -796,6 +796,28 @@ scsipi_interpret_sense(xs) } /* otherwise use the default */ switch (sense->error_code & SSD_ERRCODE) { + + /* + * Old SCSI-1 and SASI devices respond with + * codes other than 70. + */ + case 0x00: /* no error (command completed OK) */ + return (0); + case 0x04: /* drive not ready after it was selected */ + if ((periph->periph_flags & PERIPH_REMOVABLE) != 0) + periph->periph_flags &= ~PERIPH_MEDIA_LOADED; + if ((xs->xs_control & XS_CTL_IGNORE_NOT_READY) != 0) + return (0); + /* XXX - display some sort of error here? */ + return (EIO); + case 0x20: /* invalid command */ + if ((xs->xs_control & + XS_CTL_IGNORE_ILLEGAL_REQUEST) != 0) + return (0); + return (EINVAL); + case 0x25: /* invalid LUN (Adaptec ACB-4000) */ + return (EACCES); + /* * If it's code 70, use the extended stuff and * interpret the key @@ -931,7 +953,7 @@ scsipi_interpret_sense(xs) return (error); /* - * Not code 70, just report it + * Some other code, just report it */ default: #if defined(SCSIDEBUG) || defined(DEBUG) @@ -1034,15 +1056,65 @@ scsipi_inquire(periph, inqbuf, flags) int flags; { struct scsipi_inquiry scsipi_cmd; + int error; memset(&scsipi_cmd, 0, sizeof(scsipi_cmd)); scsipi_cmd.opcode = INQUIRY; scsipi_cmd.length = sizeof(struct scsipi_inquiry_data); - return (scsipi_command(periph, + error = scsipi_command(periph, (struct scsipi_generic *) &scsipi_cmd, sizeof(scsipi_cmd), (u_char *) inqbuf, sizeof(struct scsipi_inquiry_data), - SCSIPIRETRIES, 10000, NULL, XS_CTL_DATA_IN | flags)); + SCSIPIRETRIES, 10000, NULL, XS_CTL_DATA_IN | flags); + +#ifdef sun2 + /* + * Kludge for the Adaptec ACB-4000 SCSI->MFM translator. + * This board doesn't support the INQUIRY command at all. + */ + if (error == EINVAL || error == EACCES) { + /* + * Conjure up an INQUIRY response. + */ + inqbuf->device = (error == EINVAL ? + SID_QUAL_LU_PRESENT : + SID_QUAL_LU_NOTPRESENT) | T_DIRECT; + inqbuf->dev_qual2 = 0; + inqbuf->version = 0; + inqbuf->response_format = SID_FORMAT_SCSI1; + inqbuf->additional_length = 3 + 28; + 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)); + error = 0; + } + + /* + * Kludge for the Emulex MT-02 SCSI->QIC translator. + * This board gives an empty response to an INQUIRY command. + */ + else if (error == 0 && + inqbuf->device == (SID_QUAL_LU_PRESENT | T_DIRECT) && + inqbuf->dev_qual2 == 0 && + inqbuf->version == 0 && + inqbuf->response_format == SID_FORMAT_SCSI1) { + /* + * Fill out the INQUIRY response. + */ + inqbuf->device = (SID_QUAL_LU_PRESENT | T_SEQUENTIAL); + inqbuf->dev_qual2 = SID_REMOVABLE; + inqbuf->additional_length = 3 + 28; + 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)); + } +#endif /* sun2 */ + + return error; } /* |
