ixp425_intr.c revision 1.18.10.3 1 1.18.10.3 yamt /* $NetBSD: ixp425_intr.c,v 1.18.10.3 2010/08/11 22:51:42 yamt Exp $ */
2 1.1 ichiro
3 1.1 ichiro /*
4 1.1 ichiro * Copyright (c) 2003
5 1.1 ichiro * Ichiro FUKUHARA <ichiro (at) ichiro.org>.
6 1.1 ichiro * All rights reserved.
7 1.1 ichiro *
8 1.1 ichiro * Redistribution and use in source and binary forms, with or without
9 1.1 ichiro * modification, are permitted provided that the following conditions
10 1.1 ichiro * are met:
11 1.1 ichiro * 1. Redistributions of source code must retain the above copyright
12 1.1 ichiro * notice, this list of conditions and the following disclaimer.
13 1.1 ichiro * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 ichiro * notice, this list of conditions and the following disclaimer in the
15 1.1 ichiro * documentation and/or other materials provided with the distribution.
16 1.1 ichiro *
17 1.1 ichiro * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
18 1.1 ichiro * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 1.1 ichiro * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 1.1 ichiro * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
21 1.1 ichiro * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 1.1 ichiro * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 1.1 ichiro * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 1.1 ichiro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 1.1 ichiro * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 1.1 ichiro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 1.1 ichiro * SUCH DAMAGE.
28 1.1 ichiro */
29 1.1 ichiro /*
30 1.1 ichiro * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
31 1.1 ichiro * All rights reserved.
32 1.1 ichiro *
33 1.1 ichiro * Written by Jason R. Thorpe for Wasabi Systems, Inc.
34 1.1 ichiro *
35 1.1 ichiro * Redistribution and use in source and binary forms, with or without
36 1.1 ichiro * modification, are permitted provided that the following conditions
37 1.1 ichiro * are met:
38 1.1 ichiro * 1. Redistributions of source code must retain the above copyright
39 1.1 ichiro * notice, this list of conditions and the following disclaimer.
40 1.1 ichiro * 2. Redistributions in binary form must reproduce the above copyright
41 1.1 ichiro * notice, this list of conditions and the following disclaimer in the
42 1.1 ichiro * documentation and/or other materials provided with the distribution.
43 1.1 ichiro * 3. All advertising materials mentioning features or use of this software
44 1.1 ichiro * must display the following acknowledgement:
45 1.1 ichiro * This product includes software developed for the NetBSD Project by
46 1.1 ichiro * Wasabi Systems, Inc.
47 1.1 ichiro * 4. The name of Wasabi Systems, Inc. may not be used to endorse
48 1.1 ichiro * or promote products derived from this software without specific prior
49 1.1 ichiro * written permission.
50 1.1 ichiro *
51 1.1 ichiro * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
52 1.1 ichiro * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
53 1.1 ichiro * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
54 1.1 ichiro * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
55 1.1 ichiro * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
56 1.1 ichiro * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
57 1.1 ichiro * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
58 1.1 ichiro * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
59 1.1 ichiro * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
60 1.1 ichiro * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
61 1.1 ichiro * POSSIBILITY OF SUCH DAMAGE.
62 1.1 ichiro */
63 1.1 ichiro
64 1.1 ichiro #include <sys/cdefs.h>
65 1.18.10.3 yamt __KERNEL_RCSID(0, "$NetBSD: ixp425_intr.c,v 1.18.10.3 2010/08/11 22:51:42 yamt Exp $");
66 1.1 ichiro
67 1.1 ichiro #ifndef EVBARM_SPL_NOINLINE
68 1.1 ichiro #define EVBARM_SPL_NOINLINE
69 1.1 ichiro #endif
70 1.1 ichiro
71 1.1 ichiro /*
72 1.1 ichiro * Interrupt support for the Intel IXP425 NetworkProcessor.
73 1.1 ichiro */
74 1.1 ichiro
75 1.1 ichiro #include <sys/param.h>
76 1.1 ichiro #include <sys/systm.h>
77 1.1 ichiro #include <sys/malloc.h>
78 1.1 ichiro
79 1.1 ichiro #include <uvm/uvm_extern.h>
80 1.1 ichiro
81 1.1 ichiro #include <machine/bus.h>
82 1.1 ichiro #include <machine/intr.h>
83 1.1 ichiro
84 1.1 ichiro #include <arm/cpufunc.h>
85 1.1 ichiro
86 1.1 ichiro #include <arm/xscale/ixp425reg.h>
87 1.1 ichiro #include <arm/xscale/ixp425var.h>
88 1.1 ichiro
89 1.1 ichiro /* Interrupt handler queues. */
90 1.1 ichiro struct intrq intrq[NIRQ];
91 1.1 ichiro
92 1.1 ichiro /* Interrupts to mask at each level. */
93 1.1 ichiro int ixp425_imask[NIPL];
94 1.1 ichiro
95 1.1 ichiro /* Interrupts pending. */
96 1.12 perry volatile int ixp425_ipending;
97 1.1 ichiro
98 1.1 ichiro /* Software copy of the IRQs we have enabled. */
99 1.12 perry volatile uint32_t intr_enabled;
100 1.1 ichiro
101 1.1 ichiro /* Mask if interrupts steered to FIQs. */
102 1.1 ichiro uint32_t intr_steer;
103 1.1 ichiro
104 1.18 matt #ifdef __HAVE_FAST_SOFTINTS
105 1.1 ichiro /*
106 1.1 ichiro * Map a software interrupt queue index
107 1.9 scw *
108 1.9 scw * XXX: !NOTE! :XXX
109 1.9 scw * We 'borrow' bits from the interrupt status register for interrupt sources
110 1.9 scw * which are not used by the current IXP425 port. Should any of the following
111 1.9 scw * interrupt sources be used at some future time, this must be revisited.
112 1.9 scw *
113 1.9 scw * Bit#31: SW Interrupt 1
114 1.9 scw * Bit#30: SW Interrupt 0
115 1.9 scw * Bit#14: Timestamp Timer
116 1.9 scw * Bit#11: General-purpose Timer 1
117 1.9 scw */
118 1.1 ichiro static const uint32_t si_to_irqbit[SI_NQUEUES] = {
119 1.1 ichiro IXP425_INT_bit31, /* SI_SOFT */
120 1.1 ichiro IXP425_INT_bit30, /* SI_SOFTCLOCK */
121 1.9 scw IXP425_INT_bit14, /* SI_SOFTNET */
122 1.9 scw IXP425_INT_bit11, /* SI_SOFTSERIAL */
123 1.1 ichiro };
124 1.1 ichiro
125 1.1 ichiro #define SI_TO_IRQBIT(si) (1U << si_to_irqbit[(si)])
126 1.1 ichiro
127 1.1 ichiro /*
128 1.1 ichiro * Map a software interrupt queue to an interrupt priority level.
129 1.1 ichiro */
130 1.18 matt static const int si_to_ipl[] = {
131 1.18 matt [SI_SOFTCLOCK] = IPL_SOFTCLOCK,
132 1.18 matt [SI_SOFTBIO] = IPL_SOFTBIO,
133 1.18 matt [SI_SOFTNET] = IPL_SOFTNET,
134 1.18 matt [SI_SOFTSERIAL] = IPL_SOFTSERIAL,
135 1.1 ichiro };
136 1.18 matt #endif /* __HAVE_FAST_SOFTINTS */
137 1.1 ichiro void ixp425_intr_dispatch(struct clockframe *frame);
138 1.1 ichiro
139 1.12 perry static inline uint32_t
140 1.1 ichiro ixp425_irq_read(void)
141 1.1 ichiro {
142 1.1 ichiro return IXPREG(IXP425_INT_STATUS) & intr_enabled;
143 1.1 ichiro }
144 1.1 ichiro
145 1.12 perry static inline void
146 1.1 ichiro ixp425_set_intrsteer(void)
147 1.1 ichiro {
148 1.1 ichiro IXPREG(IXP425_INT_SELECT) = intr_steer & IXP425_INT_HWMASK;
149 1.1 ichiro }
150 1.1 ichiro
151 1.12 perry static inline void
152 1.1 ichiro ixp425_enable_irq(int irq)
153 1.1 ichiro {
154 1.1 ichiro
155 1.1 ichiro intr_enabled |= (1U << irq);
156 1.1 ichiro ixp425_set_intrmask();
157 1.1 ichiro }
158 1.1 ichiro
159 1.12 perry static inline void
160 1.1 ichiro ixp425_disable_irq(int irq)
161 1.1 ichiro {
162 1.1 ichiro
163 1.1 ichiro intr_enabled &= ~(1U << irq);
164 1.1 ichiro ixp425_set_intrmask();
165 1.1 ichiro }
166 1.1 ichiro
167 1.12 perry static inline u_int32_t
168 1.4 scw ixp425_irq2gpio_bit(int irq)
169 1.4 scw {
170 1.4 scw
171 1.4 scw static const u_int8_t int2gpio[32] __attribute__ ((aligned(32))) = {
172 1.4 scw 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* INT#0 -> INT#5 */
173 1.4 scw 0x00, 0x01, /* GPIO#0 -> GPIO#1 */
174 1.4 scw 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* INT#8 -> INT#13 */
175 1.4 scw 0xff, 0xff, 0xff, 0xff, 0xff, /* INT#14 -> INT#18 */
176 1.4 scw 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* GPIO#2 -> GPIO#7 */
177 1.4 scw 0x08, 0x09, 0x0a, 0x0b, 0x0c, /* GPIO#8 -> GPIO#12 */
178 1.4 scw 0xff, 0xff /* INT#30 -> INT#31 */
179 1.4 scw };
180 1.4 scw
181 1.4 scw #ifdef DEBUG
182 1.4 scw if (int2gpio[irq] == 0xff)
183 1.4 scw panic("ixp425_irq2gpio_bit: bad GPIO irq: %d\n", irq);
184 1.4 scw #endif
185 1.4 scw return (1U << int2gpio[irq]);
186 1.4 scw }
187 1.4 scw
188 1.1 ichiro /*
189 1.1 ichiro * NOTE: This routine must be called with interrupts disabled in the CPSR.
190 1.1 ichiro */
191 1.1 ichiro static void
192 1.1 ichiro ixp425_intr_calculate_masks(void)
193 1.1 ichiro {
194 1.1 ichiro struct intrq *iq;
195 1.1 ichiro struct intrhand *ih;
196 1.1 ichiro int irq, ipl;
197 1.1 ichiro
198 1.1 ichiro /* First, figure out which IPLs each IRQ has. */
199 1.1 ichiro for (irq = 0; irq < NIRQ; irq++) {
200 1.1 ichiro int levels = 0;
201 1.1 ichiro iq = &intrq[irq];
202 1.1 ichiro ixp425_disable_irq(irq);
203 1.1 ichiro for (ih = TAILQ_FIRST(&iq->iq_list); ih != NULL;
204 1.1 ichiro ih = TAILQ_NEXT(ih, ih_list))
205 1.1 ichiro levels |= (1U << ih->ih_ipl);
206 1.1 ichiro iq->iq_levels = levels;
207 1.1 ichiro }
208 1.1 ichiro
209 1.1 ichiro /* Next, figure out which IRQs are used by each IPL. */
210 1.1 ichiro for (ipl = 0; ipl < NIPL; ipl++) {
211 1.1 ichiro int irqs = 0;
212 1.1 ichiro for (irq = 0; irq < NIRQ; irq++) {
213 1.1 ichiro if (intrq[irq].iq_levels & (1U << ipl))
214 1.1 ichiro irqs |= (1U << irq);
215 1.1 ichiro }
216 1.1 ichiro ixp425_imask[ipl] = irqs;
217 1.1 ichiro }
218 1.1 ichiro
219 1.18 matt KASSERT(ixp425_imask[IPL_NONE] == 0);
220 1.1 ichiro
221 1.18 matt #ifdef __HAVE_FAST_SOFTINTS
222 1.1 ichiro /*
223 1.1 ichiro * Initialize the soft interrupt masks to block themselves.
224 1.1 ichiro */
225 1.1 ichiro ixp425_imask[IPL_SOFTCLOCK] = SI_TO_IRQBIT(SI_SOFTCLOCK);
226 1.16 ad ixp425_imask[IPL_SOFTBIO] = SI_TO_IRQBIT(SI_SOFTBIO);
227 1.1 ichiro ixp425_imask[IPL_SOFTNET] = SI_TO_IRQBIT(SI_SOFTNET);
228 1.1 ichiro ixp425_imask[IPL_SOFTSERIAL] = SI_TO_IRQBIT(SI_SOFTSERIAL);
229 1.18.10.3 yamt #else
230 1.18.10.3 yamt KASSERT(ixp425_imask[IPL_SOFTCLOCK] == 0);
231 1.18.10.3 yamt KASSERT(ixp425_imask[IPL_SOFTBIO] == 0);
232 1.18.10.3 yamt KASSERT(ixp425_imask[IPL_SOFTNET] == 0);
233 1.18.10.3 yamt KASSERT(ixp425_imask[IPL_SOFTSERIAL] == 0);
234 1.18 matt #endif
235 1.1 ichiro
236 1.1 ichiro /*
237 1.15 wiz * Enforce a hierarchy that gives "slow" device (or devices with
238 1.1 ichiro * limited input buffer space/"real-time" requirements) a better
239 1.1 ichiro * chance at not dropping data.
240 1.1 ichiro */
241 1.16 ad ixp425_imask[IPL_SCHED] |= ixp425_imask[IPL_VM];
242 1.16 ad ixp425_imask[IPL_HIGH] |= ixp425_imask[IPL_SCHED];
243 1.1 ichiro
244 1.1 ichiro /*
245 1.1 ichiro * Now compute which IRQs must be blocked when servicing any
246 1.1 ichiro * given IRQ.
247 1.1 ichiro */
248 1.1 ichiro for (irq = 0; irq < NIRQ; irq++) {
249 1.1 ichiro int irqs = (1U << irq);
250 1.1 ichiro iq = &intrq[irq];
251 1.1 ichiro if (TAILQ_FIRST(&iq->iq_list) != NULL)
252 1.1 ichiro ixp425_enable_irq(irq);
253 1.1 ichiro for (ih = TAILQ_FIRST(&iq->iq_list); ih != NULL;
254 1.1 ichiro ih = TAILQ_NEXT(ih, ih_list))
255 1.1 ichiro irqs |= ixp425_imask[ih->ih_ipl];
256 1.1 ichiro iq->iq_mask = irqs;
257 1.1 ichiro }
258 1.1 ichiro }
259 1.1 ichiro
260 1.1 ichiro void
261 1.1 ichiro splx(int new)
262 1.1 ichiro {
263 1.1 ichiro ixp425_splx(new);
264 1.1 ichiro }
265 1.1 ichiro
266 1.1 ichiro int
267 1.1 ichiro _spllower(int ipl)
268 1.1 ichiro {
269 1.1 ichiro return (ixp425_spllower(ipl));
270 1.1 ichiro }
271 1.1 ichiro
272 1.1 ichiro int
273 1.1 ichiro _splraise(int ipl)
274 1.1 ichiro {
275 1.1 ichiro return (ixp425_splraise(ipl));
276 1.1 ichiro }
277 1.1 ichiro
278 1.1 ichiro /*
279 1.1 ichiro * ixp425_icu_init:
280 1.1 ichiro *
281 1.1 ichiro * Called early in bootstrap to make clear interrupt register
282 1.1 ichiro */
283 1.1 ichiro void
284 1.1 ichiro ixp425_icu_init(void)
285 1.1 ichiro {
286 1.1 ichiro
287 1.1 ichiro intr_enabled = 0; /* All interrupts disabled */
288 1.1 ichiro ixp425_set_intrmask();
289 1.1 ichiro
290 1.1 ichiro intr_steer = 0; /* All interrupts steered to IRQ */
291 1.1 ichiro ixp425_set_intrsteer();
292 1.1 ichiro }
293 1.1 ichiro
294 1.1 ichiro /*
295 1.1 ichiro * ixp425_intr_init:
296 1.1 ichiro *
297 1.1 ichiro * Initialize the rest of the interrupt subsystem, making it
298 1.1 ichiro * ready to handle interrupts from devices.
299 1.1 ichiro */
300 1.1 ichiro void
301 1.1 ichiro ixp425_intr_init(void)
302 1.1 ichiro {
303 1.1 ichiro struct intrq *iq;
304 1.1 ichiro int i;
305 1.1 ichiro
306 1.1 ichiro intr_enabled = 0;
307 1.1 ichiro
308 1.1 ichiro for (i = 0; i < NIRQ; i++) {
309 1.1 ichiro iq = &intrq[i];
310 1.1 ichiro TAILQ_INIT(&iq->iq_list);
311 1.1 ichiro
312 1.1 ichiro sprintf(iq->iq_name, "irq %d", i);
313 1.1 ichiro evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
314 1.1 ichiro NULL, "ixp425", iq->iq_name);
315 1.1 ichiro }
316 1.1 ichiro
317 1.1 ichiro ixp425_intr_calculate_masks();
318 1.1 ichiro
319 1.1 ichiro /* Enable IRQs (don't yet use FIQs). */
320 1.1 ichiro enable_interrupts(I32_bit);
321 1.1 ichiro }
322 1.1 ichiro
323 1.1 ichiro void *
324 1.1 ichiro ixp425_intr_establish(int irq, int ipl, int (*func)(void *), void *arg)
325 1.1 ichiro {
326 1.1 ichiro struct intrq *iq;
327 1.1 ichiro struct intrhand *ih;
328 1.1 ichiro u_int oldirqstate;
329 1.1 ichiro
330 1.1 ichiro if (irq < 0 || irq > NIRQ)
331 1.1 ichiro panic("ixp425_intr_establish: IRQ %d out of range", irq);
332 1.1 ichiro #ifdef DEBUG
333 1.1 ichiro printf("ixp425_intr_establish(irq=%d, ipl=%d, func=%08x, arg=%08x)\n",
334 1.13 simonb irq, ipl, (u_int32_t) func, (u_int32_t) arg);
335 1.1 ichiro #endif
336 1.1 ichiro
337 1.1 ichiro ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT);
338 1.1 ichiro if (ih == NULL)
339 1.1 ichiro return (NULL);
340 1.1 ichiro
341 1.1 ichiro ih->ih_func = func;
342 1.1 ichiro ih->ih_arg = arg;
343 1.1 ichiro ih->ih_ipl = ipl;
344 1.1 ichiro ih->ih_irq = irq;
345 1.1 ichiro
346 1.1 ichiro iq = &intrq[irq];
347 1.1 ichiro
348 1.1 ichiro /* All IXP425 interrupts are level-triggered. */
349 1.1 ichiro iq->iq_ist = IST_LEVEL; /* XXX */
350 1.1 ichiro
351 1.1 ichiro oldirqstate = disable_interrupts(I32_bit);
352 1.1 ichiro
353 1.1 ichiro TAILQ_INSERT_TAIL(&iq->iq_list, ih, ih_list);
354 1.1 ichiro
355 1.1 ichiro ixp425_intr_calculate_masks();
356 1.1 ichiro
357 1.1 ichiro restore_interrupts(oldirqstate);
358 1.1 ichiro
359 1.1 ichiro return (ih);
360 1.1 ichiro }
361 1.1 ichiro
362 1.1 ichiro void
363 1.1 ichiro ixp425_intr_disestablish(void *cookie)
364 1.1 ichiro {
365 1.1 ichiro struct intrhand *ih = cookie;
366 1.1 ichiro struct intrq *iq = &intrq[ih->ih_irq];
367 1.1 ichiro int oldirqstate;
368 1.1 ichiro
369 1.1 ichiro oldirqstate = disable_interrupts(I32_bit);
370 1.1 ichiro
371 1.1 ichiro TAILQ_REMOVE(&iq->iq_list, ih, ih_list);
372 1.1 ichiro
373 1.1 ichiro ixp425_intr_calculate_masks();
374 1.1 ichiro
375 1.1 ichiro restore_interrupts(oldirqstate);
376 1.1 ichiro }
377 1.1 ichiro
378 1.1 ichiro void
379 1.1 ichiro ixp425_intr_dispatch(struct clockframe *frame)
380 1.1 ichiro {
381 1.1 ichiro struct intrq *iq;
382 1.1 ichiro struct intrhand *ih;
383 1.18.10.1 yamt int oldirqstate, irq, ibit, hwpend;
384 1.18.10.1 yamt struct cpu_info * const ci = curcpu();
385 1.18.10.1 yamt const int ppl = ci->ci_cpl;
386 1.18.10.1 yamt const uint32_t imask = ixp425_imask[ppl];
387 1.1 ichiro
388 1.1 ichiro hwpend = ixp425_irq_read();
389 1.1 ichiro
390 1.1 ichiro /*
391 1.1 ichiro * Disable all the interrupts that are pending. We will
392 1.1 ichiro * reenable them once they are processed and not masked.
393 1.1 ichiro */
394 1.1 ichiro intr_enabled &= ~hwpend;
395 1.1 ichiro ixp425_set_intrmask();
396 1.1 ichiro
397 1.1 ichiro while (hwpend != 0) {
398 1.1 ichiro irq = ffs(hwpend) - 1;
399 1.1 ichiro ibit = (1U << irq);
400 1.1 ichiro
401 1.1 ichiro hwpend &= ~ibit;
402 1.1 ichiro
403 1.18.10.1 yamt if (imask & ibit) {
404 1.1 ichiro /*
405 1.1 ichiro * IRQ is masked; mark it as pending and check
406 1.1 ichiro * the next one. Note: the IRQ is already disabled.
407 1.1 ichiro */
408 1.1 ichiro ixp425_ipending |= ibit;
409 1.1 ichiro continue;
410 1.1 ichiro }
411 1.1 ichiro
412 1.1 ichiro ixp425_ipending &= ~ibit;
413 1.1 ichiro
414 1.1 ichiro iq = &intrq[irq];
415 1.1 ichiro iq->iq_ev.ev_count++;
416 1.1 ichiro uvmexp.intrs++;
417 1.4 scw
418 1.4 scw /* Clear down non-level triggered GPIO interrupts now */
419 1.4 scw if ((ibit & IXP425_INT_GPIOMASK) && iq->iq_ist != IST_LEVEL) {
420 1.4 scw IXPREG(IXP425_GPIO_VBASE + IXP425_GPIO_GPISR) =
421 1.4 scw ixp425_irq2gpio_bit(irq);
422 1.4 scw }
423 1.4 scw
424 1.18.10.1 yamt TAILQ_FOREACH(ih, &iq->iq_list, ih_list) {
425 1.18.10.1 yamt ci->ci_cpl = ih->ih_ipl;
426 1.18.10.1 yamt oldirqstate = enable_interrupts(I32_bit);
427 1.7 scw (void) (*ih->ih_func)(ih->ih_arg ? ih->ih_arg : frame);
428 1.18.10.1 yamt restore_interrupts(oldirqstate);
429 1.1 ichiro }
430 1.4 scw
431 1.4 scw /* Clear down level triggered GPIO interrupts now */
432 1.4 scw if ((ibit & IXP425_INT_GPIOMASK) && iq->iq_ist == IST_LEVEL) {
433 1.4 scw IXPREG(IXP425_GPIO_VBASE + IXP425_GPIO_GPISR) =
434 1.4 scw ixp425_irq2gpio_bit(irq);
435 1.4 scw }
436 1.1 ichiro
437 1.18.10.1 yamt ci->ci_cpl = ppl;
438 1.1 ichiro
439 1.1 ichiro /* Re-enable this interrupt now that's it's cleared. */
440 1.1 ichiro intr_enabled |= ibit;
441 1.1 ichiro ixp425_set_intrmask();
442 1.8 scw
443 1.8 scw /*
444 1.8 scw * Don't forget to include interrupts which may have
445 1.8 scw * arrived in the meantime.
446 1.8 scw */
447 1.18.10.1 yamt hwpend |= ((ixp425_ipending & IXP425_INT_HWMASK) & ~imask);
448 1.1 ichiro }
449 1.1 ichiro
450 1.18 matt #ifdef __HAVE_FAST_SOFTINTS
451 1.18.10.1 yamt cpu_dosoftints();
452 1.18 matt #endif
453 1.1 ichiro }
454