From 7c01c46a1860a7ba6c95098899ea9815303ca243 Mon Sep 17 00:00:00 2001 From: patrick Date: Sat, 6 Aug 2016 11:04:47 +0000 Subject: [PATCH] Rework ampintc's interrupt disestablish code to make it actually do its job. Recalculate the mask after the handler is taken from the list to properly set the new prioritization. ok kettenis@ --- sys/arch/arm/cortex/ampintc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sys/arch/arm/cortex/ampintc.c b/sys/arch/arm/cortex/ampintc.c index c6e9d9954f7..048af313f4c 100644 --- a/sys/arch/arm/cortex/ampintc.c +++ b/sys/arch/arm/cortex/ampintc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ampintc.c,v 1.10 2016/08/04 15:52:52 kettenis Exp $ */ +/* $OpenBSD: ampintc.c,v 1.11 2016/08/06 11:04:47 patrick Exp $ */ /* * Copyright (c) 2007,2009,2011 Dale Rahn * @@ -583,17 +583,25 @@ ampintc_intr_establish(int irqno, int level, int (*func)(void *), void ampintc_intr_disestablish(void *cookie) { -#if 0 - int psw; - struct intrhand *ih = cookie; - int irqno = ih->ih_irq; + struct ampintc_softc *sc = ampintc; + struct intrhand *ih = cookie; + int psw; + +#ifdef DEBUG_INTC + printf("ampintc_intr_disestablish irq %d level %d [%s]\n", + ih->ih_irq, ih->ih_ipl, ih->ih_name); +#endif + psw = disable_interrupts(PSR_I); - TAILQ_REMOVE(&sc->sc_ampintc_handler[irqno].iq_list, ih, ih_list); + + TAILQ_REMOVE(&sc->sc_ampintc_handler[ih->ih_irq].iq_list, ih, ih_list); if (ih->ih_name != NULL) evcount_detach(&ih->ih_count); - free(ih, M_DEVBUF, 0); + free(ih, M_DEVBUF, sizeof(*ih)); + + ampintc_calc_mask(); + restore_interrupts(psw); -#endif } const char * -- 2.20.1