summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormycroft <mycroft@NetBSD.org>1993-06-15 01:50:32 +0000
committermycroft <mycroft@NetBSD.org>1993-06-15 01:50:32 +0000
commit5592ad3fbb84fcf1950e537f75940b7eeaff5234 (patch)
treea81dcdb15d29159e900b9fdd8e3b59a66724b71e /sys/dev
parent9751bf77a7de11aa0656a2f86c3443fb85425eec (diff)
Ignore interrupts if the device isn't open. This prevents stray interrupts
from hosing the works. What a stupid architecture.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/lpt.c12
-rw-r--r--sys/dev/ic/lptvar.h12
-rw-r--r--sys/dev/isa/lpt.c12
-rw-r--r--sys/dev/isa/lpt_isa.c12
4 files changed, 40 insertions, 8 deletions
diff --git a/sys/dev/ic/lpt.c b/sys/dev/ic/lpt.c
index ababf658551..ef0a0d857ee 100644
--- a/sys/dev/ic/lpt.c
+++ b/sys/dev/ic/lpt.c
@@ -45,7 +45,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: lpt.c,v 1.5 1993/06/05 22:58:31 cgd Exp $
+ * $Id: lpt.c,v 1.6 1993/06/15 01:50:32 mycroft Exp $
*/
/*
@@ -221,6 +221,7 @@ lptattach(isdp)
sc = lpt_sc + isdp->id_unit;
sc->sc_port = isdp->id_iobase;
+ sc->sc_state = 0;
outb(sc->sc_port+lpt_control, LPC_NINIT);
return (1);
}
@@ -390,8 +391,15 @@ lptintr(unit)
struct lpt_softc *sc = lpt_sc + unit;
int port = sc->sc_port,sts;
+ sts = inb(port+lpt_status);
+
+ if (!sc->sc_state) {
+ printf ("lpt%d: stray interrupt sts=0x%02x\n", unit, sts);
+ return;
+ }
+
/* is printer online and ready for output */
- if (((sts=inb(port+lpt_status)) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR/*|LPS_NACK*/)) ==
+ if ((sts & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR/*|LPS_NACK*/)) ==
(LPS_SEL|LPS_NBSY|LPS_NERR)) {
/* is this a false interrupt ? */
if ((sc->sc_state & OBUSY)
diff --git a/sys/dev/ic/lptvar.h b/sys/dev/ic/lptvar.h
index 958e4d484d3..98b114401ed 100644
--- a/sys/dev/ic/lptvar.h
+++ b/sys/dev/ic/lptvar.h
@@ -45,7 +45,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: lptvar.h,v 1.5 1993/06/05 22:58:31 cgd Exp $
+ * $Id: lptvar.h,v 1.6 1993/06/15 01:50:32 mycroft Exp $
*/
/*
@@ -221,6 +221,7 @@ lptattach(isdp)
sc = lpt_sc + isdp->id_unit;
sc->sc_port = isdp->id_iobase;
+ sc->sc_state = 0;
outb(sc->sc_port+lpt_control, LPC_NINIT);
return (1);
}
@@ -390,8 +391,15 @@ lptintr(unit)
struct lpt_softc *sc = lpt_sc + unit;
int port = sc->sc_port,sts;
+ sts = inb(port+lpt_status);
+
+ if (!sc->sc_state) {
+ printf ("lpt%d: stray interrupt sts=0x%02x\n", unit, sts);
+ return;
+ }
+
/* is printer online and ready for output */
- if (((sts=inb(port+lpt_status)) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR/*|LPS_NACK*/)) ==
+ if ((sts & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR/*|LPS_NACK*/)) ==
(LPS_SEL|LPS_NBSY|LPS_NERR)) {
/* is this a false interrupt ? */
if ((sc->sc_state & OBUSY)
diff --git a/sys/dev/isa/lpt.c b/sys/dev/isa/lpt.c
index ababf658551..ef0a0d857ee 100644
--- a/sys/dev/isa/lpt.c
+++ b/sys/dev/isa/lpt.c
@@ -45,7 +45,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: lpt.c,v 1.5 1993/06/05 22:58:31 cgd Exp $
+ * $Id: lpt.c,v 1.6 1993/06/15 01:50:32 mycroft Exp $
*/
/*
@@ -221,6 +221,7 @@ lptattach(isdp)
sc = lpt_sc + isdp->id_unit;
sc->sc_port = isdp->id_iobase;
+ sc->sc_state = 0;
outb(sc->sc_port+lpt_control, LPC_NINIT);
return (1);
}
@@ -390,8 +391,15 @@ lptintr(unit)
struct lpt_softc *sc = lpt_sc + unit;
int port = sc->sc_port,sts;
+ sts = inb(port+lpt_status);
+
+ if (!sc->sc_state) {
+ printf ("lpt%d: stray interrupt sts=0x%02x\n", unit, sts);
+ return;
+ }
+
/* is printer online and ready for output */
- if (((sts=inb(port+lpt_status)) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR/*|LPS_NACK*/)) ==
+ if ((sts & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR/*|LPS_NACK*/)) ==
(LPS_SEL|LPS_NBSY|LPS_NERR)) {
/* is this a false interrupt ? */
if ((sc->sc_state & OBUSY)
diff --git a/sys/dev/isa/lpt_isa.c b/sys/dev/isa/lpt_isa.c
index b2dc1abaec1..8f4b3865a53 100644
--- a/sys/dev/isa/lpt_isa.c
+++ b/sys/dev/isa/lpt_isa.c
@@ -45,7 +45,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: lpt_isa.c,v 1.5 1993/06/05 22:58:31 cgd Exp $
+ * $Id: lpt_isa.c,v 1.6 1993/06/15 01:50:32 mycroft Exp $
*/
/*
@@ -221,6 +221,7 @@ lptattach(isdp)
sc = lpt_sc + isdp->id_unit;
sc->sc_port = isdp->id_iobase;
+ sc->sc_state = 0;
outb(sc->sc_port+lpt_control, LPC_NINIT);
return (1);
}
@@ -390,8 +391,15 @@ lptintr(unit)
struct lpt_softc *sc = lpt_sc + unit;
int port = sc->sc_port,sts;
+ sts = inb(port+lpt_status);
+
+ if (!sc->sc_state) {
+ printf ("lpt%d: stray interrupt sts=0x%02x\n", unit, sts);
+ return;
+ }
+
/* is printer online and ready for output */
- if (((sts=inb(port+lpt_status)) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR/*|LPS_NACK*/)) ==
+ if ((sts & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR/*|LPS_NACK*/)) ==
(LPS_SEL|LPS_NBSY|LPS_NERR)) {
/* is this a false interrupt ? */
if ((sc->sc_state & OBUSY)