diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2006-07-18 16:40:31 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2006-07-18 16:40:31 +0000 |
commit | ee89b6dd44105f4b5edefd527dde2e41ddd84f95 (patch) | |
tree | 2a2b747037aa7e5cfafec53d8aa4e8e63c1f5908 /sys/dev | |
parent | f9014f87878027e3d21e68f677fe9112a1966f50 (diff) |
modify interrupt handlers to exit early and return 0 on shared interrupts.
pointed out by deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/rt2560.c | 11 | ||||
-rw-r--r-- | sys/dev/ic/rt2661.c | 17 |
2 files changed, 17 insertions, 11 deletions
diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index 50ea6735500..c66475263dc 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.21 2006/06/18 18:44:04 damien Exp $ */ +/* $OpenBSD: rt2560.c,v 1.22 2006/07/18 16:40:30 damien Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1377,16 +1377,19 @@ rt2560_intr(void *arg) struct ifnet *ifp = &sc->sc_ic.ic_if; uint32_t r; + if ((r = RAL_READ(sc, RT2560_CSR7)) == 0) + return 0; /* not for us */ + /* disable interrupts */ RAL_WRITE(sc, RT2560_CSR8, 0xffffffff); + /* acknowledge interrupts */ + RAL_WRITE(sc, RT2560_CSR7, r); + /* don't re-enable interrupts if we're shutting down */ if (!(ifp->if_flags & IFF_RUNNING)) return 0; - r = RAL_READ(sc, RT2560_CSR7); - RAL_WRITE(sc, RT2560_CSR7, r); - if (r & RT2560_BEACON_EXPIRE) rt2560_beacon_expire(sc); diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index eb8725a5879..adf38416660 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2661.c,v 1.23 2006/06/18 18:44:04 damien Exp $ */ +/* $OpenBSD: rt2661.c,v 1.24 2006/07/18 16:40:30 damien Exp $ */ /*- * Copyright (c) 2006 @@ -1223,20 +1223,23 @@ rt2661_intr(void *arg) struct ifnet *ifp = &sc->sc_ic.ic_if; uint32_t r1, r2; + r1 = RAL_READ(sc, RT2661_INT_SOURCE_CSR); + r2 = RAL_READ(sc, RT2661_MCU_INT_SOURCE_CSR); + if (r1 == 0 && r2 == 0) + return 0; /* not for us */ + /* disable MAC and MCU interrupts */ RAL_WRITE(sc, RT2661_INT_MASK_CSR, 0xffffff7f); RAL_WRITE(sc, RT2661_MCU_INT_MASK_CSR, 0xffffffff); + /* acknowledge interrupts */ + RAL_WRITE(sc, RT2661_INT_SOURCE_CSR, r1); + RAL_WRITE(sc, RT2661_MCU_INT_SOURCE_CSR, r2); + /* don't re-enable interrupts if we're shutting down */ if (!(ifp->if_flags & IFF_RUNNING)) return 0; - r1 = RAL_READ(sc, RT2661_INT_SOURCE_CSR); - RAL_WRITE(sc, RT2661_INT_SOURCE_CSR, r1); - - r2 = RAL_READ(sc, RT2661_MCU_INT_SOURCE_CSR); - RAL_WRITE(sc, RT2661_MCU_INT_SOURCE_CSR, r2); - if (r1 & RT2661_MGT_DONE) rt2661_tx_dma_intr(sc, &sc->mgtq); |