diff options
-rw-r--r-- | sys/scsi/scsiconf.c | 42 |
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: |