diff options
| author | mycroft <mycroft@NetBSD.org> | 1994-04-07 06:48:19 +0000 |
|---|---|---|
| committer | mycroft <mycroft@NetBSD.org> | 1994-04-07 06:48:19 +0000 |
| commit | 3f5e4f423f85fb7774ba5acd9edc28ece6f20ec2 (patch) | |
| tree | 52df9b52a9901c7ad2a7259d5af5acc6fd3067ff /sys/dev/ic | |
| parent | ec249f458db5396251daf457be8498b7854d1665 (diff) | |
Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
Diffstat (limited to 'sys/dev/ic')
| -rw-r--r-- | sys/dev/ic/com.c | 17 | ||||
| -rw-r--r-- | sys/dev/ic/lpt.c | 26 | ||||
| -rw-r--r-- | sys/dev/ic/lptvar.h | 26 |
3 files changed, 44 insertions, 25 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 60f3d24dfc5..352dd834dc9 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: com.c,v 1.29 1994/03/29 04:35:44 mycroft Exp $ + * $Id: com.c,v 1.30 1994/04/07 06:50:28 mycroft Exp $ */ /* @@ -65,6 +65,7 @@ struct com_softc { struct device sc_dev; + struct intrhand sc_ih; u_short sc_iobase; u_char sc_hwflags; @@ -85,7 +86,7 @@ int comprobe(); void comattach(); int comopen __P((dev_t, int, int, struct proc *)); int comclose __P((dev_t, int, int, struct proc *)); -int comintr __P((int)); +int comintr __P((struct com_softc *)); int comparam __P((struct tty *, struct termios *)); void comstart __P((struct tty *)); @@ -208,6 +209,13 @@ comattach(parent, self, aux) outb(iobase + com_ier, 0); outb(iobase + com_mcr, 0); + if (!parent) { /* XXX no master */ + sc->sc_ih.ih_fun = comintr; + sc->sc_ih.ih_arg = sc; + sc->sc_ih.ih_level = IPL_TTY; + intr_establish(ia->ia_irq, &sc->sc_ih); + } + #ifdef KGDB if (kgdb_dev == makedev(commajor, unit)) { if (comconsole == unit) @@ -719,10 +727,9 @@ commint(sc) } int -comintr(unit) - int unit; +comintr(sc) + struct com_softc *sc; { - struct com_softc *sc = comcd.cd_devs[unit]; u_short iobase = sc->sc_iobase; struct tty *tp; u_char code; diff --git a/sys/dev/ic/lpt.c b/sys/dev/ic/lpt.c index 2452dacab1e..c654f30c50b 100644 --- a/sys/dev/ic/lpt.c +++ b/sys/dev/ic/lpt.c @@ -46,7 +46,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: lpt.c,v 1.15 1994/03/29 04:36:08 mycroft Exp $ + * $Id: lpt.c,v 1.16 1994/04/07 06:51:01 mycroft Exp $ */ /* @@ -86,6 +86,7 @@ int lptdebug = 1; struct lpt_softc { struct device sc_dev; + struct intrhand sc_ih; size_t sc_count; struct buf *sc_inbuf; @@ -106,7 +107,7 @@ struct lpt_softc { int lptprobe(); void lptattach(); -int lptintr __P((int)); +int lptintr __P((struct lpt_softc *)); struct cfdriver lptcd = { NULL, "lpt", lptprobe, lptattach, DV_TTY, sizeof(struct lpt_softc) @@ -239,17 +240,23 @@ lptattach(parent, self, aux) struct lpt_softc *sc = (void *)self; struct isa_attach_args *ia = aux; u_short iobase = ia->ia_iobase; - u_short irq = ia->ia_irq; - if (irq) + if (ia->ia_irq) printf("\n"); else printf(": polled\n"); sc->sc_iobase = iobase; - sc->sc_irq = irq; + sc->sc_irq = ia->ia_irq; sc->sc_state = 0; outb(iobase + lpt_control, LPC_NINIT); + + if (ia->ia_irq) { + sc->sc_ih.ih_fun = lptintr; + sc->sc_ih.ih_arg = sc; + sc->sc_ih.ih_level = IPL_NONE; + intr_establish(ia->ia_irq, &sc->sc_ih); + } } /* @@ -360,7 +367,7 @@ lptout(sc) return; s = spltty(); - lptintr(sc->sc_dev.dv_unit); + lptintr(sc); splx(s); timeout((timeout_t)lptout, (caddr_t)sc, STEP); @@ -437,7 +444,7 @@ pushbytes(sc) lprintf("%s: write %d\n", sc->sc_dev.dv_xname, sc->sc_count); s = spltty(); - (void) lptintr(sc->sc_dev.dv_unit); + (void) lptintr(sc); splx(s); } if (error = tsleep((caddr_t)sc, LPTPRI | PCATCH, @@ -482,10 +489,9 @@ lptwrite(dev, uio) * another char. */ int -lptintr(unit) - int unit; +lptintr(sc) + struct lpt_softc *sc; { - struct lpt_softc *sc = lptcd.cd_devs[unit]; u_short iobase = sc->sc_iobase; #if 0 diff --git a/sys/dev/ic/lptvar.h b/sys/dev/ic/lptvar.h index 5eac5754705..23e3119a69e 100644 --- a/sys/dev/ic/lptvar.h +++ b/sys/dev/ic/lptvar.h @@ -46,7 +46,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: lptvar.h,v 1.15 1994/03/29 04:36:08 mycroft Exp $ + * $Id: lptvar.h,v 1.16 1994/04/07 06:51:01 mycroft Exp $ */ /* @@ -86,6 +86,7 @@ int lptdebug = 1; struct lpt_softc { struct device sc_dev; + struct intrhand sc_ih; size_t sc_count; struct buf *sc_inbuf; @@ -106,7 +107,7 @@ struct lpt_softc { int lptprobe(); void lptattach(); -int lptintr __P((int)); +int lptintr __P((struct lpt_softc *)); struct cfdriver lptcd = { NULL, "lpt", lptprobe, lptattach, DV_TTY, sizeof(struct lpt_softc) @@ -239,17 +240,23 @@ lptattach(parent, self, aux) struct lpt_softc *sc = (void *)self; struct isa_attach_args *ia = aux; u_short iobase = ia->ia_iobase; - u_short irq = ia->ia_irq; - if (irq) + if (ia->ia_irq) printf("\n"); else printf(": polled\n"); sc->sc_iobase = iobase; - sc->sc_irq = irq; + sc->sc_irq = ia->ia_irq; sc->sc_state = 0; outb(iobase + lpt_control, LPC_NINIT); + + if (ia->ia_irq) { + sc->sc_ih.ih_fun = lptintr; + sc->sc_ih.ih_arg = sc; + sc->sc_ih.ih_level = IPL_NONE; + intr_establish(ia->ia_irq, &sc->sc_ih); + } } /* @@ -360,7 +367,7 @@ lptout(sc) return; s = spltty(); - lptintr(sc->sc_dev.dv_unit); + lptintr(sc); splx(s); timeout((timeout_t)lptout, (caddr_t)sc, STEP); @@ -437,7 +444,7 @@ pushbytes(sc) lprintf("%s: write %d\n", sc->sc_dev.dv_xname, sc->sc_count); s = spltty(); - (void) lptintr(sc->sc_dev.dv_unit); + (void) lptintr(sc); splx(s); } if (error = tsleep((caddr_t)sc, LPTPRI | PCATCH, @@ -482,10 +489,9 @@ lptwrite(dev, uio) * another char. */ int -lptintr(unit) - int unit; +lptintr(sc) + struct lpt_softc *sc; { - struct lpt_softc *sc = lptcd.cd_devs[unit]; u_short iobase = sc->sc_iobase; #if 0 |
