summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2002-02-28 00:02:49 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2002-02-28 00:02:49 +0000
commit16e44cc329286b6ccbb392c624e75850532fe923 (patch)
treeecb1b0c6d24a19d54f46a0356efcd70f4fc5d09c
parent0e05ac80ccace355b049c32f61225576723d4653 (diff)
Start quirks off with NOWIDE, NOSYNC and NOTAGS and remove the
restrictions as the results of the INQUIRY command and the quirks table indicate. This should (for drivers that pay attention) make for more successful communication with devices having quirks, by using the lowest common denominator until more information is available. Issue a second TEST_UNIT_READY command after the INQUIRY command has been processed to allow drivers waiting for valid quirks data to set sync/wide/tags asap. Rework a little bit of the logic to ensure that negotiation messages produced by the TEST_UNIT_READY command do not get mixed up with attachment messages. This has the side benefit of putting the negotiation messages before the device description, where they have usually been displayed in the past. If a driver is examining and using quirks data before the INQUIRY command is processed, and not renegotiating after the INQUIRY command, it may now end up with async 8 bit, non-tagged transfers. Before it would have ended up with possibly unusable transfer parameters when talking to a device with quirks. ok costa@
-rw-r--r--sys/scsi/scsiconf.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 9e05bcceabc..0336019bf2a 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.64 2002/02/16 17:20:27 millert Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.65 2002/02/28 00:02:48 krw Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -782,6 +782,13 @@ scsi_probedev(scsi, target, lun)
sc_link->inquiry_flags2 = 0;
/*
+ * Tell drivers that are paying attention to avoid
+ * sync/wide/tags until INQUIRY data and quirks information
+ * are available.
+ */
+ sc_link->quirks = SDEV_NOSYNC | SDEV_NOWIDE | SDEV_NOTAGS;
+
+ /*
* Ask the device what it is
*/
#ifdef SCSIDEBUG
@@ -828,15 +835,15 @@ scsi_probedev(scsi, target, lun)
/*
* Based upon the inquiry flags we got back, and if we're
- * at SCSI-2 or better, set some limiting quirks.
+ * at SCSI-2 or better, remove some limiting quirks.
*/
if ((inqbuf.version & SID_ANSII) >= 2) {
- if ((inqbuf.flags & SID_CmdQue) == 0)
- sc_link->quirks |= SDEV_NOTAGS;
- if ((inqbuf.flags & SID_Sync) == 0)
- sc_link->quirks |= SDEV_NOSYNC;
- if ((inqbuf.flags & SID_WBus16) == 0)
- sc_link->quirks |= SDEV_NOWIDE;
+ if ((inqbuf.flags & SID_CmdQue) != 0)
+ sc_link->quirks &= ~SDEV_NOTAGS;
+ if ((inqbuf.flags & SID_Sync) != 0)
+ sc_link->quirks &= ~SDEV_NOSYNC;
+ if ((inqbuf.flags & SID_WBus16) != 0)
+ sc_link->quirks &= ~SDEV_NOWIDE;
}
/*
* Now apply any quirks from the table.
@@ -904,15 +911,26 @@ scsi_probedev(scsi, target, lun)
sa.sa_sc_link = sc_link;
sa.sa_inqbuf = &inqbuf;
- if ((cf = config_search(scsibussubmatch, (struct device *)scsi, &sa)) != 0) {
- scsi->sc_link[target][lun] = sc_link;
- config_attach((struct device *)scsi, cf, &sa, scsibusprint);
- } else {
+ if ((cf = config_search(scsibussubmatch, (struct device *)scsi, &sa)) == 0) {
scsibusprint(&sa, scsi->sc_dev.dv_xname);
printf(" not configured\n");
goto bad;
}
+ scsi->sc_link[target][lun] = sc_link;
+
+ /*
+ * Generate another TEST_UNIT_READY command. This gives
+ * drivers waiting for valid quirks data a chance to set
+ * wide/sync/tag options appropriately. Do this now so that
+ * any messages generated by config_attach() do not have
+ * negotiation messages inserted into their midst.
+ */
+ (void) scsi_test_unit_ready(sc_link,
+ scsi_autoconf | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_NOT_READY | SCSI_IGNORE_MEDIA_CHANGE);
+
+ config_attach((struct device *)scsi, cf, &sa, scsibusprint);
+
return;
bad: