xref: /openbmc/linux/arch/microblaze/kernel/irq.c (revision 8a9e90a12816d0d26ccfb98cf6ac224a5a45d453)
1eedbdab9SMichal Simek /*
2eedbdab9SMichal Simek  * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
3eedbdab9SMichal Simek  * Copyright (C) 2007-2009 PetaLogix
4eedbdab9SMichal Simek  * Copyright (C) 2006 Atmark Techno, Inc.
5eedbdab9SMichal Simek  *
6eedbdab9SMichal Simek  * This file is subject to the terms and conditions of the GNU General Public
7eedbdab9SMichal Simek  * License. See the file "COPYING" in the main directory of this archive
8eedbdab9SMichal Simek  * for more details.
9eedbdab9SMichal Simek  */
10eedbdab9SMichal Simek 
11eedbdab9SMichal Simek #include <linux/init.h>
12e6d7961eSSteven J. Magnani #include <linux/ftrace.h>
13eedbdab9SMichal Simek #include <linux/kernel.h>
14eedbdab9SMichal Simek #include <linux/hardirq.h>
15eedbdab9SMichal Simek #include <linux/interrupt.h>
16eedbdab9SMichal Simek #include <linux/irqflags.h>
17eedbdab9SMichal Simek #include <linux/seq_file.h>
18eedbdab9SMichal Simek #include <linux/kernel_stat.h>
19eedbdab9SMichal Simek #include <linux/irq.h>
20*8a9e90a1SMichal Simek #include <linux/irqchip.h>
21e3873444SGrant Likely #include <linux/of_irq.h>
22eedbdab9SMichal Simek 
23eedbdab9SMichal Simek static u32 concurrent_irq;
24eedbdab9SMichal Simek 
25e6d7961eSSteven J. Magnani void __irq_entry do_IRQ(struct pt_regs *regs)
26eedbdab9SMichal Simek {
27eedbdab9SMichal Simek 	unsigned int irq;
28eedbdab9SMichal Simek 	struct pt_regs *old_regs = set_irq_regs(regs);
290d9ec762SMichal Simek 	trace_hardirqs_off();
30eedbdab9SMichal Simek 
31eedbdab9SMichal Simek 	irq_enter();
322462bacdSGrant Likely 	irq = get_irq();
33eedbdab9SMichal Simek next_irq:
346c7a2676SMichal Simek 	BUG_ON(!irq);
352462bacdSGrant Likely 	generic_handle_irq(irq);
36eedbdab9SMichal Simek 
372462bacdSGrant Likely 	irq = get_irq();
382462bacdSGrant Likely 	if (irq != -1U) {
39eedbdab9SMichal Simek 		pr_debug("next irq: %d\n", irq);
40eedbdab9SMichal Simek 		++concurrent_irq;
41eedbdab9SMichal Simek 		goto next_irq;
42eedbdab9SMichal Simek 	}
43eedbdab9SMichal Simek 
44eedbdab9SMichal Simek 	irq_exit();
45eedbdab9SMichal Simek 	set_irq_regs(old_regs);
460d9ec762SMichal Simek 	trace_hardirqs_on();
47eedbdab9SMichal Simek }
48*8a9e90a1SMichal Simek 
49*8a9e90a1SMichal Simek void __init init_IRQ(void)
50*8a9e90a1SMichal Simek {
51*8a9e90a1SMichal Simek 	/* process the entire interrupt tree in one go */
52*8a9e90a1SMichal Simek 	irqchip_init();
53*8a9e90a1SMichal Simek }
54