diff options
-rw-r--r-- | sys/scsi/scsiconf.c | 46 | ||||
-rw-r--r-- | sys/scsi/scsiconf.h | 17 |
2 files changed, 41 insertions, 22 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index e89b04ea0dd..4ba438a897a 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.86 2004/02/21 00:47:42 krw Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.87 2004/03/10 01:37:40 krw Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -109,6 +109,9 @@ int scsidebug_targets = SCSIDEBUG_TARGETS; int scsidebug_luns = SCSIDEBUG_LUNS; int scsidebug_level = SCSIDEBUG_LEVEL; +int scsiforcelun_buses = SCSIFORCELUN_BUSES; +int scsiforcelun_targets = SCSIFORCELUN_TARGETS; + int scsi_autoconf = SCSI_AUTOCONF; int scsibusprint(void *, const char *); @@ -614,7 +617,7 @@ scsi_probedev(scsi, inqbuflun0, target, lun) struct scsi_link *sc_link; static struct scsi_inquiry_data inqbuf; const struct scsi_quirk_inquiry_pattern *finger; - int priority, rslt; + int priority, rslt = 0; struct scsibus_attach_args sa; struct cfdata *cf; @@ -669,24 +672,10 @@ scsi_probedev(scsi, inqbuflun0, target, lun) #endif /* SCSI_2_DEF */ /* Now go ask the device all about itself. */ - rslt = scsi_inquire(sc_link, &inqbuf, scsi_autoconf | SCSI_SILENT); - - if (lun == 0 && rslt != 0) { - /* A bad LUN 0 INQUIRY means no further LUNs possible. */ - SC_DEBUG(sc_link, SDEV_DB2, ("No LUN 0. rslt == %i\n", rslt)); - rslt = EINVAL; - goto bad; - } else if (rslt != 0) { - /* Just a failed LUN INQUIRY, try the next LUN. */ - SC_DEBUG(sc_link, SDEV_DB2, ("Bad LUN. rslt == %i\n", rslt)); - rslt = 0; - goto bad; - } else if (lun == 0) { - bcopy(&inqbuf, inqbuflun0, sizeof *inqbuflun0); - } else if (memcmp(&inqbuf, inqbuflun0, sizeof inqbuf) == 0) { - /* The device can't distinguish between LUNs. */ - SC_DEBUG(sc_link, SDEV_DB1, ("IDENTIFY not supported.\n")); - rslt = EINVAL; + if (scsi_inquire(sc_link, &inqbuf, scsi_autoconf | SCSI_SILENT) != 0) { + SC_DEBUG(sc_link, SDEV_DB2, ("Bad LUN. rslt = %i\n", rslt)); + if (lun == 0) + rslt = EINVAL; goto bad; } @@ -699,14 +688,29 @@ scsi_probedev(scsi, inqbuflun0, target, lun) goto bad; case SID_QUAL_LU_OK: - if ((inqbuf.device & SID_TYPE) == T_NODEVICE) + if ((inqbuf.device & SID_TYPE) == T_NODEVICE) { + SC_DEBUG(sc_link, SDEV_DB1, + ("Bad LUN. SID_TYPE = T_NODEVICE\n")); goto bad; + } break; default: break; } + if (lun == 0) + bcopy(&inqbuf, inqbuflun0, sizeof *inqbuflun0); + else if (((1 << sc_link->scsibus) & scsiforcelun_buses) && + ((1 << target) & scsiforcelun_targets)) + ; + else if (memcmp(&inqbuf, inqbuflun0, sizeof inqbuf) == 0) { + /* The device doesn't distinguish between LUNs. */ + SC_DEBUG(sc_link, SDEV_DB1, ("IDENTIFY not supported.\n")); + rslt = EINVAL; + goto bad; + } + finger = (const struct scsi_quirk_inquiry_pattern *)scsi_inqmatch( &inqbuf, scsi_quirk_patterns, sizeof(scsi_quirk_patterns)/sizeof(scsi_quirk_patterns[0]), diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 2d92c93ff94..def3ebdab17 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.41 2004/02/21 00:47:42 krw Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.42 2004/03/10 01:37:40 krw Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -96,6 +96,21 @@ struct scsi_link; extern int scsi_autoconf; /* + * Specify which buses and targets must scan all LUNs, even when IDENTIFY does + * not seem to be working. Some devices (e.g. some external RAID devices) may + * seem to have non-functional IDENTIFY because they return identical INQUIRY + * data for all LUNs. + */ +#ifndef SCSIFORCELUN_BUSES +#define SCSIFORCELUN_BUSES 0 +#endif +#ifndef SCSIFORCELUN_TARGETS +#define SCSIFORCELUN_TARGETS 0 +#endif + +extern int scsiforcelun_buses, scsiforcelun_targets; + +/* * These entrypoints are called by the high-end drivers to get services from * whatever low-end drivers they are attached to. Each adapter type has one * of these statically allocated. |