From 7f533ff73f7a0ad42b65cb04399c34630f650d6d Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Sun, 8 Jun 1997 17:15:31 +0000 Subject: [PATCH] Add safety check in case "conflicts" keyword specified more times than needed --- sys/amd64/isa/isa.c | 11 +++++++---- sys/i386/isa/isa.c | 11 +++++++---- sys/kern/kern_intr.c | 8 +++++++- sys/sys/interrupt.h | 3 ++- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/sys/amd64/isa/isa.c b/sys/amd64/isa/isa.c index 9af74ec3d471..62185c62f80b 100644 --- a/sys/amd64/isa/isa.c +++ b/sys/amd64/isa/isa.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: isa.c,v 1.89 1997/06/02 08:19:05 dfr Exp $ + * $Id: isa.c,v 1.90 1997/06/08 16:43:37 ache Exp $ */ /* @@ -537,9 +537,12 @@ config_isadev_c(isdp, mp, reconfig) undirect_isa_irq(rirq); /* free for ISA */ } #endif /* APIC_IO */ - if (!isdp->id_conflicts) - register_intr(ffs(isdp->id_irq) - 1, isdp->id_id, - isdp->id_ri_flags, isdp->id_intr, + if ( !isdp->id_conflicts + || !intr_registered(ffs(isdp->id_irq) - 1)) + register_intr(ffs(isdp->id_irq) - 1, + isdp->id_id, + isdp->id_ri_flags, + isdp->id_intr, mp, isdp->id_unit); } } else { diff --git a/sys/i386/isa/isa.c b/sys/i386/isa/isa.c index 9af74ec3d471..62185c62f80b 100644 --- a/sys/i386/isa/isa.c +++ b/sys/i386/isa/isa.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: isa.c,v 1.89 1997/06/02 08:19:05 dfr Exp $ + * $Id: isa.c,v 1.90 1997/06/08 16:43:37 ache Exp $ */ /* @@ -537,9 +537,12 @@ config_isadev_c(isdp, mp, reconfig) undirect_isa_irq(rirq); /* free for ISA */ } #endif /* APIC_IO */ - if (!isdp->id_conflicts) - register_intr(ffs(isdp->id_irq) - 1, isdp->id_id, - isdp->id_ri_flags, isdp->id_intr, + if ( !isdp->id_conflicts + || !intr_registered(ffs(isdp->id_irq) - 1)) + register_intr(ffs(isdp->id_irq) - 1, + isdp->id_id, + isdp->id_ri_flags, + isdp->id_intr, mp, isdp->id_unit); } } else { diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 4097ba24d9df..afce55744d4e 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: kern_intr.c,v 1.5 1997/06/02 08:19:06 dfr Exp $ + * $Id: kern_intr.c,v 1.6 1997/06/02 10:46:28 dfr Exp $ * */ @@ -88,6 +88,12 @@ intr_mux(void *arg) /* XXX better use NHWI from for array size ??? */ static intrec *intreclist_head[ICU_LEN]; +int +intr_registered(int irq) +{ + return (intreclist_head[irq] != NULL); +} + static intrec* find_idesc(unsigned *maskptr, int irq) { diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h index 233d1adef1da..c2c6f7418511 100644 --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: interrupt.h,v 1.3 1997/06/01 16:05:14 peter Exp $ + * $Id: interrupt.h,v 1.4 1997/06/02 10:46:20 dfr Exp $ */ /* XXX currently dev_instance must be set to the ISA device_id or -1 for PCI */ @@ -37,6 +37,7 @@ int intr_destroy(struct intrec *idesc); int intr_connect(struct intrec *idesc); int intr_disconnect(struct intrec *idesc); +int intr_registered(int irq); /* XXX emulate old interface for now ... */ int register_intr __P((int intr, int device_id, u_int flags,