summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/arc/dev/lpt_lbus.c10
-rw-r--r--sys/arch/hppa/gsc/lpt_gsc.c7
-rw-r--r--sys/dev/ic/lpt.c17
-rw-r--r--sys/dev/ic/lptvar.h6
-rw-r--r--sys/dev/isa/lpt_isa.c25
-rw-r--r--sys/dev/puc/lpt_puc.c7
6 files changed, 38 insertions, 34 deletions
diff --git a/sys/arch/arc/dev/lpt_lbus.c b/sys/arch/arc/dev/lpt_lbus.c
index fad7e1c3244..e793fe28941 100644
--- a/sys/arch/arc/dev/lpt_lbus.c
+++ b/sys/arch/arc/dev/lpt_lbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpt_lbus.c,v 1.3 1997/04/10 16:29:17 pefo Exp $ */
+/* $OpenBSD: lpt_lbus.c,v 1.4 2000/07/21 17:41:05 mickey Exp $ */
/*
* Copyright (c) 1993, 1994 Charles Hannum.
@@ -140,16 +140,12 @@ lpt_localbus_attach(parent, self, aux)
{
struct lpt_softc *sc = (void *)self;
struct confargs *ca = aux;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-
- printf("\n");
sc->sc_state = 0;
- iot = sc->sc_iot = &arc_bus_io;
+ sc->sc_iot = &arc_bus_io;
sc->sc_ioh = (bus_space_handle_t)BUS_CVTADDR(ca);
- bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT);
+ lpt_attach_common(sc);
BUS_INTR_ESTABLISH(ca, lptintr, sc);
}
diff --git a/sys/arch/hppa/gsc/lpt_gsc.c b/sys/arch/hppa/gsc/lpt_gsc.c
index ecb52179d2d..12e2903d1d5 100644
--- a/sys/arch/hppa/gsc/lpt_gsc.c
+++ b/sys/arch/hppa/gsc/lpt_gsc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpt_gsc.c,v 1.5 1999/08/16 02:48:39 mickey Exp $ */
+/* $OpenBSD: lpt_gsc.c,v 1.6 2000/07/21 17:41:06 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -165,13 +165,10 @@ lpt_gsc_attach(parent, self, aux)
/* sc->sc_flags |= LPT_POLLED; */
sc->sc_state = 0;
-
sc->sc_iot = ga->ga_iot;
sc->sc_ioh = ga->ga_hpa + LPTGSC_OFFSET;
- printf("\n");
-
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, lpt_control, LPC_NINIT);
+ lpt_attach_common(sc);
sc->sc_ih = gsc_intr_establish((struct gsc_softc *)parent, IPL_TTY,
ga->ga_irq, lptintr, sc, &sc->sc_dev);
diff --git a/sys/dev/ic/lpt.c b/sys/dev/ic/lpt.c
index c1d54a6353b..1935d137da5 100644
--- a/sys/dev/ic/lpt.c
+++ b/sys/dev/ic/lpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpt.c,v 1.3 1999/01/07 15:55:54 niklas Exp $ */
+/* $OpenBSD: lpt.c,v 1.4 2000/07/21 17:41:02 mickey Exp $ */
/* $NetBSD: lpt.c,v 1.42 1996/10/21 22:41:14 thorpej Exp $ */
/*
@@ -134,6 +134,17 @@ lpt_port_test(iot, ioh, base, off, data, mask)
return (temp == data);
}
+void
+lpt_attach_common(sc)
+ struct lpt_softc *sc;
+{
+ printf("\n");
+
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh, lpt_control, LPC_NINIT);
+
+ timeout_set(&sc->sc_wakeup_tmo, lptwakeup, sc);
+}
+
/*
* Reset the printer, then wait until it's selected and not busy.
*/
@@ -251,7 +262,7 @@ lptwakeup(arg)
lptintr(sc);
splx(s);
- timeout(lptwakeup, sc, STEP);
+ timeout_add(&sc->sc_wakeup_tmo, STEP);
}
/*
@@ -273,7 +284,7 @@ lptclose(dev, flag, mode, p)
(void) lptpushbytes(sc);
if ((sc->sc_flags & LPT_NOINTR) == 0)
- untimeout(lptwakeup, sc);
+ timeout_del(&sc->sc_wakeup_tmo);
bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT);
sc->sc_state = 0;
diff --git a/sys/dev/ic/lptvar.h b/sys/dev/ic/lptvar.h
index 84596d6471d..2167f2ec49a 100644
--- a/sys/dev/ic/lptvar.h
+++ b/sys/dev/ic/lptvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lptvar.h,v 1.1 1996/11/30 00:53:36 niklas Exp $ */
+/* $OpenBSD: lptvar.h,v 1.2 2000/07/21 17:41:02 mickey Exp $ */
/* $NetBSD: lpt.c,v 1.42 1996/10/21 22:41:14 thorpej Exp $ */
/*
@@ -50,9 +50,12 @@
* SUCH DAMAGE.
*/
+#include <sys/timeout.h>
+
struct lpt_softc {
struct device sc_dev;
void *sc_ih;
+ struct timeout sc_wakeup_tmo;
size_t sc_count;
struct buf *sc_inbuf;
@@ -76,3 +79,4 @@ struct lpt_softc {
int lptintr __P((void *));
int lpt_port_test __P((bus_space_tag_t, bus_space_handle_t, bus_addr_t,
bus_size_t, u_int8_t, u_int8_t));
+void lpt_attach_common __P((struct lpt_softc *));
diff --git a/sys/dev/isa/lpt_isa.c b/sys/dev/isa/lpt_isa.c
index fcd4ecdd9ac..ac7356c2064 100644
--- a/sys/dev/isa/lpt_isa.c
+++ b/sys/dev/isa/lpt_isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpt_isa.c,v 1.10 1999/01/30 01:41:48 imp Exp $ */
+/* $OpenBSD: lpt_isa.c,v 1.11 2000/07/21 17:41:03 mickey Exp $ */
/*
* Copyright (c) 1993, 1994 Charles Hannum.
@@ -176,24 +176,19 @@ lpt_isa_attach(parent, self, aux)
{
struct lpt_softc *sc = (void *)self;
struct isa_attach_args *ia = aux;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-
- if (ia->ia_irq != IRQUNK)
- printf("\n");
- else {
- sc->sc_flags |= LPT_POLLED;
- printf(": polled\n");
- }
sc->sc_state = 0;
-
- iot = sc->sc_iot = ia->ia_iot;
- if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh))
+ sc->sc_iot = ia->ia_iot;
+ if (bus_space_map(sc->sc_iot, ia->ia_iobase, ia->ia_iosize, 0,
+ &sc->sc_ioh))
panic("lpt_isa_attach: couldn't map I/O ports");
- sc->sc_ioh = ioh;
- bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT);
+ if (ia->ia_irq == IRQUNK) {
+ sc->sc_flags |= LPT_POLLED;
+ printf(": polled");
+ }
+
+ lpt_attach_common(sc);
if (ia->ia_irq != IRQUNK)
sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
diff --git a/sys/dev/puc/lpt_puc.c b/sys/dev/puc/lpt_puc.c
index 1e416472527..c00396e9738 100644
--- a/sys/dev/puc/lpt_puc.c
+++ b/sys/dev/puc/lpt_puc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpt_puc.c,v 1.1 1999/11/28 11:52:06 downsj Exp $ */
+/* $OpenBSD: lpt_puc.c,v 1.2 2000/07/21 17:41:04 mickey Exp $ */
/* $NetBSD: lpt_puc.c,v 1.1 1998/06/26 18:52:41 cgd Exp $ */
/*
@@ -95,8 +95,9 @@ lpt_puc_attach(parent, self, aux)
printf("\n");
return;
}
- printf(": interrupting at %s\n", intrstr);
+ printf(": interrupting at %s", intrstr);
sc->sc_state = 0;
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, lpt_control, LPC_NINIT);
+
+ lpt_attach_common(sc);
}