summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcsapuntz <csapuntz@openbsd.org>1999-07-23 04:24:31 +0000
committercsapuntz <csapuntz@openbsd.org>1999-07-23 04:24:31 +0000
commit9291a9ab2e8905edece28bcf8893211a737ad13e (patch)
treeae368088ca6c8bef41ca9459ad2fdcb1dcf23e3d
parentEliminate namespace pollution, the crt0 file should not conflict (diff)
downloadwireguard-openbsd-9291a9ab2e8905edece28bcf8893211a737ad13e.tar.xz
wireguard-openbsd-9291a9ab2e8905edece28bcf8893211a737ad13e.zip
Identify Drive may have to access media. So, wait up to 10s (in polling mode)
for Identify Drive to do its thing. This should fix the "IDENTIFY timeout" some people are seeing. ATAPI SCSI buses only have 2 targets.
-rw-r--r--sys/dev/atapiscsi/atapiscsi.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c
index 63e8d5a1fab..a2ff393184f 100644
--- a/sys/dev/atapiscsi/atapiscsi.c
+++ b/sys/dev/atapiscsi/atapiscsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atapiscsi.c,v 1.5 1999/07/22 07:45:48 deraadt Exp $ */
+/* $OpenBSD: atapiscsi.c,v 1.6 1999/07/23 04:24:31 csapuntz Exp $ */
/*
* This code is derived from code with the copyright below.
@@ -194,6 +194,7 @@ atapiscsi_attach(parent, self, aux)
as->sc_channel = aa_link->aa_channel;
as->sc_adapterlink.adapter_softc = as;
as->sc_adapterlink.adapter_target = 7;
+ as->sc_adapterlink.adapter_buswidth = 2;
as->sc_adapterlink.adapter = &atapiscsi_switch;
as->sc_adapterlink.device = &atapiscsi_dev;
as->sc_adapterlink.openings = 1;
@@ -881,20 +882,14 @@ again:
case IDENTIFY_WAIT:
errstring = "IDENTIFY";
- if (wdcwait(chp, 0, 0, delay))
+ /* Some ATAPI devices need to try to read the media
+ before responding. Well, let's hope resets while
+ polling are few and far between */
+ if (wdcwait(chp, 0, 0, (irq == 0) ? 10000 : 0))
goto timeout;
- if (chp->ch_status & WDCS_ERR) {
- chp->ch_error = bus_space_read_1(chp->cmd_iot,
- chp->cmd_ioh,
- wd_error);
- goto error;
- }
-
- if (wdcwait(chp, WDCS_DRQ, WDCS_DRQ, 1000))
- goto timeout;
-
- if (chp->ch_status & WDCS_ERR) {
+ if (!(chp->ch_status & WDCS_DRQ) &&
+ chp->ch_status & WDCS_ERR) {
chp->ch_error = bus_space_read_1(chp->cmd_iot,
chp->cmd_ioh,
wd_error);