diff options
| author | scw <scw@NetBSD.org> | 2000-07-20 20:44:50 +0000 |
|---|---|---|
| committer | scw <scw@NetBSD.org> | 2000-07-20 20:44:50 +0000 |
| commit | a1b8e79bb11a2c47207fd7e7dddbcd08d0cffd3b (patch) | |
| tree | 0d28bb01dcf2bbf5d7abe3f563cf20146e238e63 /sys/dev/ic | |
| parent | 0a25b480c67ad867b34547b6208f224d7d62939e (diff) | |
Take advantage of generic soft interrupts, if available.
Diffstat (limited to 'sys/dev/ic')
| -rw-r--r-- | sys/dev/ic/clmpcc.c | 28 | ||||
| -rw-r--r-- | sys/dev/ic/clmpccvar.h | 8 |
2 files changed, 32 insertions, 4 deletions
diff --git a/sys/dev/ic/clmpcc.c b/sys/dev/ic/clmpcc.c index 2ee81ebfd9a..a33edbae8f8 100644 --- a/sys/dev/ic/clmpcc.c +++ b/sys/dev/ic/clmpcc.c @@ -1,4 +1,4 @@ -/* $NetBSD: clmpcc.c,v 1.12 2000/07/15 18:12:42 scw Exp $ */ +/* $NetBSD: clmpcc.c,v 1.13 2000/07/20 20:44:50 scw Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -59,6 +59,7 @@ #include <sys/malloc.h> #include <machine/bus.h> +#include <machine/intr.h> #include <machine/param.h> #include <dev/ic/clmpccreg.h> @@ -298,7 +299,16 @@ clmpcc_attach(sc) printf(": Cirrus Logic CD240%c Serial Controller\n", (clmpcc_rd_msvr(sc) & CLMPCC_MSVR_PORT_ID) ? '0' : '1'); +#ifndef __GENERIC_SOFT_INTERRUPTS sc->sc_soft_running = 0; +#else + sc->sc_softintr_cookie = + softintr_establish(IPL_SOFTSERIAL, clmpcc_softintr, sc); +#ifdef DEBUG + if (sc->sc_softintr_cookie == NULL) + panic("clmpcc_attach: softintr_establish"); +#endif +#endif memset(&(sc->sc_chans[0]), 0, sizeof(sc->sc_chans)); for (chan = 0; chan < CLMPCC_NUM_CHANS; chan++) { @@ -1218,10 +1228,14 @@ rx_done: } clmpcc_wrreg(sc, CLMPCC_REG_REOIR, 0); +#ifndef __GENERIC_SOFT_INTERRUPTS if ( sc->sc_soft_running == 0 ) { sc->sc_soft_running = 1; (sc->sc_softhook)(sc); } +#else + softintr_schedule(sc->sc_softintr_cookie); +#endif } else clmpcc_wrreg(sc, CLMPCC_REG_REOIR, CLMPCC_REOIR_NO_TRANS); @@ -1341,10 +1355,14 @@ clmpcc_txintr(arg) * Request Tx processing in the soft interrupt handler */ ch->ch_tx_done = 1; - if ( ! sc->sc_soft_running ) { +#ifndef __GENERIC_SOFT_INTERRUPTS + if ( sc->sc_soft_running == 0 ) { sc->sc_soft_running = 1; (sc->sc_softhook)(sc); } +#else + softintr_schedule(sc->sc_softintr_cookie); +#endif } clmpcc_wrreg(sc, CLMPCC_REG_IER, tir); @@ -1382,10 +1400,14 @@ clmpcc_mdintr(arg) clmpcc_wrreg(sc, CLMPCC_REG_MEOIR, 0); +#ifndef __GENERIC_SOFT_INTERRUPTS if ( sc->sc_soft_running == 0 ) { sc->sc_soft_running = 1; (sc->sc_softhook)(sc); } +#else + softintr_schedule(sc->sc_softintr_cookie); +#endif return 1; } @@ -1403,7 +1425,9 @@ clmpcc_softintr(arg) u_int c; int chan; +#ifndef __GENERIC_SOFT_INTERRUPTS sc->sc_soft_running = 0; +#endif /* Handle Modem state changes too... */ diff --git a/sys/dev/ic/clmpccvar.h b/sys/dev/ic/clmpccvar.h index d566635ea0f..8246a3790e4 100644 --- a/sys/dev/ic/clmpccvar.h +++ b/sys/dev/ic/clmpccvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: clmpccvar.h,v 1.4 2000/03/19 10:38:43 scw Exp $ */ +/* $NetBSD: clmpccvar.h,v 1.5 2000/07/20 20:44:50 scw Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -115,8 +115,13 @@ struct clmpcc_softc { #define CLMPCC_BYTESWAP_LOW 0x00 /* *byteswap pin is low */ #define CLMPCC_BYTESWAP_HIGH 0x03 /* *byteswap pin is high */ +#ifndef __GENERIC_SOFT_INTERRUPTS /* Called to request a soft interrupt callback to clmpcc_softintr */ void (*sc_softhook) __P((struct clmpcc_softc *)); + volatile int sc_soft_running; +#else + void *sc_softintr_cookie; +#endif /* Called when an interrupt has to be acknowledged in polled mode. */ void (*sc_iackhook) __P((struct clmpcc_softc *, int)); @@ -124,7 +129,6 @@ struct clmpcc_softc { /* * No user-serviceable parts below */ - volatile int sc_soft_running; struct clmpcc_chan sc_chans[CLMPCC_NUM_CHANS]; }; |
