blob: bbebcae72c02f0d5b04598c3a57b1ea48c175aba [file] [log] [blame]
Michal Simekeedbdab2009-03-27 14:25:49 +01001/*
2 * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2007-2009 PetaLogix
4 * Copyright (C) 2006 Atmark Techno, Inc.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/init.h>
Steven J. Magnanie6d79612010-04-12 16:01:36 -050012#include <linux/ftrace.h>
Michal Simekeedbdab2009-03-27 14:25:49 +010013#include <linux/kernel.h>
14#include <linux/hardirq.h>
15#include <linux/interrupt.h>
16#include <linux/irqflags.h>
17#include <linux/seq_file.h>
18#include <linux/kernel_stat.h>
19#include <linux/irq.h>
Grant Likelye3873442010-06-18 11:09:59 -060020#include <linux/of_irq.h>
Paul Gortmaker66421a62011-09-22 11:22:55 -040021#include <linux/export.h>
Michal Simekeedbdab2009-03-27 14:25:49 +010022
23#include <asm/prom.h>
24
Michal Simekeedbdab2009-03-27 14:25:49 +010025static u32 concurrent_irq;
26
Steven J. Magnanie6d79612010-04-12 16:01:36 -050027void __irq_entry do_IRQ(struct pt_regs *regs)
Michal Simekeedbdab2009-03-27 14:25:49 +010028{
29 unsigned int irq;
30 struct pt_regs *old_regs = set_irq_regs(regs);
Michal Simek0d9ec762010-05-25 13:44:38 +020031 trace_hardirqs_off();
Michal Simekeedbdab2009-03-27 14:25:49 +010032
33 irq_enter();
34 irq = get_irq(regs);
35next_irq:
Michal Simek6c7a2672011-12-09 10:45:20 +010036 BUG_ON(!irq);
37 /* Substract 1 because of get_irq */
38 generic_handle_irq(irq + IRQ_OFFSET - NO_IRQ_OFFSET);
Michal Simekeedbdab2009-03-27 14:25:49 +010039
40 irq = get_irq(regs);
Michal Simek6c7a2672011-12-09 10:45:20 +010041 if (irq) {
Michal Simekeedbdab2009-03-27 14:25:49 +010042 pr_debug("next irq: %d\n", irq);
43 ++concurrent_irq;
44 goto next_irq;
45 }
46
47 irq_exit();
48 set_irq_regs(old_regs);
Michal Simek0d9ec762010-05-25 13:44:38 +020049 trace_hardirqs_on();
Michal Simekeedbdab2009-03-27 14:25:49 +010050}
51
Michal Simekc6ba01a2010-01-14 15:16:31 +010052/* MS: There is no any advance mapping mechanism. We are using simple 32bit
53 intc without any cascades or any connection that's why mapping is 1:1 */
54unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq)
55{
Michal Simek6c7a2672011-12-09 10:45:20 +010056 return hwirq + IRQ_OFFSET;
Michal Simekc6ba01a2010-01-14 15:16:31 +010057}
58EXPORT_SYMBOL_GPL(irq_create_mapping);
59
60unsigned int irq_create_of_mapping(struct device_node *controller,
Grant Likelye3873442010-06-18 11:09:59 -060061 const u32 *intspec, unsigned int intsize)
Michal Simekc6ba01a2010-01-14 15:16:31 +010062{
Michal Simek6c7a2672011-12-09 10:45:20 +010063 return intspec[0] + IRQ_OFFSET;
Michal Simekc6ba01a2010-01-14 15:16:31 +010064}
65EXPORT_SYMBOL_GPL(irq_create_of_mapping);