From c2e2054df07a0c5596c4cd58d07ddf2c89107e69 Mon Sep 17 00:00:00 2001 From: Constantine Sapuntzakis Date: Fri, 23 Jul 1999 04:24:32 +0000 Subject: 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. --- sys/dev/atapiscsi/atapiscsi.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'sys') 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); -- cgit v1.2.3