Subject: Unit attention in ch
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 05/03/2002 12:26:47
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
with my DLT library, the first chio after I open/close the door gets an EIO
in open with a
ch0(ahc0:0:6:0): Check Condition on CDB: 0x00 00 00 00 00 00
SENSE KEY: Unit Attention
ASC/ASCQ: Not Ready To Ready Transition (Medium May Have Changed)
kernel message.
To solve this I made a change similar to the one I made to st.c a few days
ago, to solve a similar problem (ignore the condition if periph is not yet
open - but here I have to move |= PERIPH_OPEN to after the test unit ready).
Can I commit this ?
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff-ch
Index: ch.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/scsipi/ch.c,v
retrieving revision 1.48
diff -u -r1.48 ch.c
--- ch.c 2001/11/13 06:56:39 1.48
+++ ch.c 2002/05/03 10:20:46
@@ -272,8 +272,6 @@
if ((error = scsipi_adapter_addref(adapt)) != 0)
return (error);
- periph->periph_flags |= PERIPH_OPEN;
-
/*
* Make sure the unit is on-line. If a UNIT ATTENTION
* occurs, we will mark that an Init-Element-Status is
@@ -286,6 +284,8 @@
if (error)
goto bad;
+ periph->periph_flags |= PERIPH_OPEN;
+
/*
* Make sure our parameters are up to date.
*/
@@ -510,15 +510,18 @@
/* "Power On, Reset, or Bus Device Reset Occurred" */
sc->sc_periph->periph_flags &= ~PERIPH_MEDIA_LOADED;
/*
- * Enqueue an Element-Status-Changed event, and
- * wake up any processes waiting for them.
- */
- /*
* Enqueue an Element-Status-Changed event, and wake up
* any processes waiting for them.
*/
if ((xs->xs_control & XS_CTL_IGNORE_MEDIA_CHANGE) == 0)
ch_event(sc, CHEV_ELEMENT_STATUS_CHANGED);
+ if ((periph->periph_flags & PERIPH_OPEN) == 0) {
+ /*
+ * if the device is not yet open, we can ignore this
+ * information.
+ */
+ return (0);
+ }
break;
default:
break;
--82I3+IH0IqGh5yIs--