summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2001-10-08 01:25:08 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2001-10-08 01:25:08 +0000
commitc8df2c18c3cfe119097f876dc7c0851722649261 (patch)
tree4919d4d3f354a28d27a03a4740c55764027ec644
parent2b2efa7af0445aba498cff98b5ab549623977d51 (diff)
Complete (I hope) the changes to siop that make it pay attention
to the quirks table. These latest changes, triggered by problems Dan Weeks was having and developed with a lot of testing by Dan, should ensure that siop is a) using the quirks of the correct LUN during wide/sync negotiations and b) calling siop_add_dev() for all LUN's which return valid information from an INQUIRY command.
-rw-r--r--sys/dev/ic/siop.c15
-rw-r--r--sys/dev/ic/siop_common.c33
2 files changed, 40 insertions, 8 deletions
diff --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c
index da327c0cba5..f57b087b33e 100644
--- a/sys/dev/ic/siop.c
+++ b/sys/dev/ic/siop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siop.c,v 1.13 2001/08/26 02:39:05 krw Exp $ */
+/* $OpenBSD: siop.c,v 1.14 2001/10/08 01:25:06 krw Exp $ */
/* $NetBSD: siop.c,v 1.39 2001/02/11 18:04:49 bouyer Exp $ */
/*
@@ -1376,9 +1376,16 @@ siop_scsicmd(xs)
siop_intr(sc);
if (xs->flags & ITSDONE) {
if ((xs->cmd->opcode == INQUIRY)
- && (xs->error == XS_NOERROR)
- && (sc->targets[target]->status == TARST_PROBING))
- sc->targets[target]->status = TARST_ASYNC;
+ && (xs->error == XS_NOERROR)) {
+ error = ((struct scsi_inquiry_data *)xs->data)->device & SID_QUAL;
+ if (error != SID_QUAL_BAD_LU) {
+ if (sc->targets[target]->status == TARST_PROBING)
+ sc->targets[target]->status = TARST_ASYNC;
+ /* Can't do lun 0 here, because flags not set yet */
+ if (lun > 0)
+ siop_add_dev(sc, target, lun);
+ }
+ }
break;
}
delay(1000);
diff --git a/sys/dev/ic/siop_common.c b/sys/dev/ic/siop_common.c
index c91bc1da8d6..17b330e4161 100644
--- a/sys/dev/ic/siop_common.c
+++ b/sys/dev/ic/siop_common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siop_common.c,v 1.10 2001/08/18 02:24:02 krw Exp $ */
+/* $OpenBSD: siop_common.c,v 1.11 2001/10/08 01:25:07 krw Exp $ */
/* $NetBSD: siop_common.c,v 1.12 2001/02/11 18:04:50 bouyer Exp $ */
/*
@@ -55,6 +55,8 @@
#undef DEBUG
#undef DEBUG_DR
+int siop_find_lun0_quirks __P((struct siop_softc *, u_int8_t, u_int16_t));
+
void
siop_common_reset(sc)
struct siop_softc *sc;
@@ -121,6 +123,26 @@ siop_common_reset(sc)
sc->sc_reset(sc);
}
+int
+siop_find_lun0_quirks(sc, bus, target)
+ struct siop_softc *sc;
+ u_int8_t bus;
+ u_int16_t target;
+{
+ struct scsi_link *sc_link;
+ struct device *dev;
+
+ for (dev = TAILQ_FIRST(&alldevs); dev != NULL; dev = TAILQ_NEXT(dev, dv_list))
+ if (dev->dv_parent == (struct device *)sc) {
+ sc_link = ((struct scsibus_softc *)dev)->sc_link[target][0];
+ if ((sc_link != NULL) && (sc_link->scsibus == bus))
+ return sc_link->quirks;
+ }
+
+ /* If we can't find a quirks entry, assume the worst */
+ return (SDEV_NOTAGS | SDEV_NOWIDE | SDEV_NOSYNC);
+}
+
/* prepare tables before sending a cmd */
void
siop_setuptables(siop_cmd)
@@ -143,7 +165,10 @@ siop_setuptables(siop_cmd)
siop_cmd->siop_tables.t_msgout.count= htole32(1);
if (sc->targets[target]->status == TARST_ASYNC) {
*targ_flags = 0;
- quirks = xs->sc_link->quirks;
+ if (lun == 0)
+ quirks = xs->sc_link->quirks;
+ else
+ quirks = siop_find_lun0_quirks(sc, xs->sc_link->scsibus, target);
if ((quirks & SDEV_NOTAGS) == 0) {
*targ_flags |= TARF_TAG;
@@ -154,8 +179,8 @@ siop_setuptables(siop_cmd)
if ((quirks & SDEV_NOSYNC) == 0)
*targ_flags |= TARF_SYNC;
- if (*targ_flags & (TARF_WIDE | TARF_SYNC))
- siop_add_dev(sc, target, lun);
+ /* Safe to call siop_add_dev() multiple times */
+ siop_add_dev(sc, target, 0);
if ((sc->features & SF_CHIP_C10)
&& (*targ_flags & TARF_WIDE)