summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2001-08-18 02:24:03 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2001-08-18 02:24:03 +0000
commitd4c35e2ba06fe47532359bef6bc0ee6bbde7adc1 (patch)
treec718d9963fd105663314d34973f413e1a5d5de4e
parentf4293c1086d231c860bc4bd5fce6b9a061d60beb (diff)
Make siop pay attention to quirks table. This not only eliminates the
ugly INQUIRY snooping but avoids adding even uglier #ifdef's to turn off stuff, e.g. tagged queuing. Add two disk drives now known to lie about supporting tagged queuing to quirks table. One from millert@ (<MICROP, 4421-07 0329SJ, 0329>) and one from Hakan Olsson (<SEAGATE, ST150176LW, 0002>). Add field 'inquiry_flags2' to struct scsi_link to hold flags2 field from struct scsi_inquiry_data. These flags relate to SCSI-3 specific features. Clean up some logic, eliminating need for TARF_PPR flag.
-rw-r--r--sys/dev/ic/siop.c40
-rw-r--r--sys/dev/ic/siop_common.c37
-rw-r--r--sys/scsi/scsiconf.c8
-rw-r--r--sys/scsi/scsiconf.h3
4 files changed, 48 insertions, 40 deletions
diff --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c
index 1a64336a095..1fc52c2e858 100644
--- a/sys/dev/ic/siop.c
+++ b/sys/dev/ic/siop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siop.c,v 1.11 2001/07/04 22:55:03 espie Exp $ */
+/* $OpenBSD: siop.c,v 1.12 2001/08/18 02:24:02 krw Exp $ */
/* $NetBSD: siop.c,v 1.39 2001/02/11 18:04:49 bouyer Exp $ */
/*
@@ -212,6 +212,11 @@ siop_attach(sc)
(u_int32_t)sc->sc_scriptaddr, sc->sc_script);
#endif
+ /*
+ * sc->sc_link is the template for all device sc_link's
+ * for devices attached to this adapter. It is passed to
+ * the upper layers in config_found().
+ */
sc->sc_link.adapter_softc = sc;
sc->sc_link.openings = SIOP_OPENINGS;
sc->sc_link.adapter_buswidth =
@@ -225,6 +230,9 @@ siop_attach(sc)
sc->sc_link.adapter = &siop_adapter;
sc->sc_link.device = &siop_dev;
sc->sc_link.flags = 0;
+ sc->sc_link.quirks = 0;
+ if ((sc->features & SF_BUS_WIDE) == 0)
+ sc->sc_link.quirks |= SDEV_NOWIDE;
for (i = 0; i < 16; i++)
sc->targets[i] = NULL;
@@ -1189,7 +1197,7 @@ siop_handle_reset(sc)
}
}
sc->targets[target]->status = TARST_ASYNC;
- sc->targets[target]->flags &= ~(TARF_ISWIDE | TARF_ISDT | TARF_ISQAS | TARF_ISIUS);
+ sc->targets[target]->flags = 0;
}
/* Next commands from the urgent list */
for (siop_cmd = TAILQ_FIRST(&sc->urgent_list); siop_cmd != NULL;
@@ -1237,7 +1245,6 @@ int
siop_scsicmd(xs)
struct scsi_xfer *xs;
{
- struct scsi_inquiry_data *inqdata;
struct siop_softc *sc = (struct siop_softc *)xs->sc_link->adapter_softc;
struct siop_cmd *siop_cmd;
int s, error, i;
@@ -1365,32 +1372,9 @@ siop_scsicmd(xs)
siop_intr(sc);
if (xs->flags & ITSDONE) {
if ((xs->cmd->opcode == INQUIRY)
- && (xs->sc_link->lun == 0)
- && (xs->error == XS_NOERROR)) {
- inqdata = (struct scsi_inquiry_data *)xs->data;
-
- if (inqdata->flags & SID_CmdQue) {
- sc->targets[target]->flags |= TARF_TAG;
- xs->sc_link->openings += SIOP_NTAG - SIOP_OPENINGS;
- }
-
- if ((inqdata->flags & SID_WBus16) && (sc->features & SF_BUS_WIDE))
- sc->targets[target]->flags |= TARF_WIDE;
- if (inqdata->flags & SID_Sync)
- sc->targets[target]->flags |= TARF_SYNC;
-
- if ((sc->features & SF_CHIP_C10)
- && (sc->targets[target]->flags & TARF_WIDE)
- && (inqdata->flags2 & (SID_CLOCKING | SID_QAS | SID_IUS)))
- sc->targets[target]->flags |= TARF_PPR;
-
+ && (xs->error == XS_NOERROR)
+ && (sc->targets[target]->status == TARST_PROBING))
sc->targets[target]->status = TARST_ASYNC;
-
- if (sc->targets[target]->flags
- & (TARF_WIDE | TARF_SYNC | TARF_PPR)) {
- 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 67df285313e..c91bc1da8d6 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.9 2001/08/06 14:29:59 krw Exp $ */
+/* $OpenBSD: siop_common.c,v 1.10 2001/08/18 02:24:02 krw Exp $ */
/* $NetBSD: siop_common.c,v 1.12 2001/02/11 18:04:50 bouyer Exp $ */
/*
@@ -131,7 +131,8 @@ siop_setuptables(siop_cmd)
struct scsi_xfer *xs = siop_cmd->xs;
int target = xs->sc_link->target;
int lun = xs->sc_link->lun;
- int targ_flags = sc->targets[target]->flags;
+ int *targ_flags = &sc->targets[target]->flags;
+ int quirks;
siop_cmd->siop_tables.id = htole32(sc->targets[target]->id);
memset(siop_cmd->siop_tables.msg_out, 0, 8);
@@ -141,16 +142,32 @@ siop_setuptables(siop_cmd)
siop_cmd->siop_tables.msg_out[0] = MSG_IDENTIFY(lun, 0);
siop_cmd->siop_tables.t_msgout.count= htole32(1);
if (sc->targets[target]->status == TARST_ASYNC) {
- if (targ_flags & TARF_PPR) {
+ *targ_flags = 0;
+ quirks = xs->sc_link->quirks;
+
+ if ((quirks & SDEV_NOTAGS) == 0) {
+ *targ_flags |= TARF_TAG;
+ xs->sc_link->openings += SIOP_NTAG - SIOP_OPENINGS;
+ }
+ if ((quirks & SDEV_NOWIDE) == 0)
+ *targ_flags |= TARF_WIDE;
+ if ((quirks & SDEV_NOSYNC) == 0)
+ *targ_flags |= TARF_SYNC;
+
+ if (*targ_flags & (TARF_WIDE | TARF_SYNC))
+ siop_add_dev(sc, target, lun);
+
+ if ((sc->features & SF_CHIP_C10)
+ && (*targ_flags & TARF_WIDE)
+ && (xs->sc_link->inquiry_flags2 & (SID_CLOCKING | SID_QAS | SID_IUS))) {
sc->targets[target]->status = TARST_PPR_NEG;
- if (sc->min_dt_sync != 0)
- siop_ppr_msg(siop_cmd, 1, sc->min_dt_sync, sc->maxoff);
- else
- siop_ppr_msg(siop_cmd, 1, sc->min_st_sync, sc->maxoff);
- } else if (targ_flags & TARF_WIDE) {
+ siop_ppr_msg(siop_cmd, 1,
+ (sc->min_dt_sync == 0) ? sc->min_st_sync : sc->min_dt_sync,
+ sc->maxoff);
+ } else if (*targ_flags & TARF_WIDE) {
sc->targets[target]->status = TARST_WIDE_NEG;
siop_wdtr_msg(siop_cmd, 1, MSG_EXT_WDTR_BUS_16_BIT);
- } else if (targ_flags & TARF_SYNC) {
+ } else if (*targ_flags & TARF_SYNC) {
sc->targets[target]->status = TARST_SYNC_NEG;
siop_sdtr_msg(siop_cmd, 1, sc->min_st_sync, sc->maxoff);
} else {
@@ -158,7 +175,7 @@ siop_setuptables(siop_cmd)
siop_print_info(sc, target);
}
} else if (sc->targets[target]->status == TARST_OK &&
- (targ_flags & TARF_TAG) &&
+ (*targ_flags & TARF_TAG) &&
siop_cmd->status != CMDST_SENSE) {
siop_cmd->flags |= CMDFL_TAG;
}
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 5bed9a20af7..ab64248015c 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.58 2001/06/24 21:29:04 mickey Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.59 2001/08/18 02:24:02 krw Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -517,6 +517,10 @@ struct scsi_quirk_inquiry_pattern scsi_quirk_patterns[] = {
"TEAC", "FC-1", ""}, SDEV_NOSTARTUNIT},
{{T_DIRECT, T_FIXED,
"NEC ", "SD120S-200 ", "0001"}, SDEV_NOLUNS},
+ {{T_DIRECT, T_FIXED,
+ "MICROP", "4421-07 0329SJ", ""}, SDEV_NOTAGS},
+ {{T_DIRECT, T_FIXED,
+ "SEAGATE", "ST150176LW", "0002"}, SDEV_NOTAGS},
/* XXX: QIC-36 tape behind Emulex adapter. Very broken. */
{{T_SEQUENTIAL, T_REMOV,
@@ -746,6 +750,7 @@ scsi_probedev(scsi, target, lun)
sc_link->lun = lun;
sc_link->device = &probe_switch;
sc_link->inquiry_flags = 0;
+ sc_link->inquiry_flags2 = 0;
/*
* Ask the device what it is
@@ -821,6 +826,7 @@ scsi_probedev(scsi, target, lun)
* Save INQUIRY "flags" (SID_Linked, etc.) for low-level drivers.
*/
sc_link->inquiry_flags = inqbuf.flags;
+ sc_link->inquiry_flags2 = inqbuf.flags2;
/*
* note what BASIC type of device it is
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index 34976bea001..ba2348248be 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.h,v 1.27 2001/06/22 14:35:43 deraadt Exp $ */
+/* $OpenBSD: scsiconf.h,v 1.28 2001/08/18 02:24:02 krw Exp $ */
/* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */
/*
@@ -186,6 +186,7 @@ struct scsi_link {
#define ADEV_NOTUR 0x1000
#define ADEV_NODOORLOCK 0x2000
u_int8_t inquiry_flags; /* copy of flags from probe INQUIRY */
+ u_int8_t inquiry_flags2; /* copy of flags2 from probe INQUIRY */
struct scsi_device *device; /* device entry points etc. */
void *device_softc; /* needed for call to foo_start */
struct scsi_adapter *adapter; /* adapter entry points etc. */