blob: 728cc30d04ead6ac671f20b4b538d49a3e566878 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifdef __KERNEL__
Paul Mackerras1b923132005-10-10 22:54:57 +10002#ifndef _ASM_POWERPC_IRQ_H
3#define _ASM_POWERPC_IRQ_H
4
5/*
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Grant Likelybae1d8f2012-02-14 14:06:50 -070012#include <linux/irqdomain.h>
Paul Mackerras1b923132005-10-10 22:54:57 +100013#include <linux/threads.h>
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100014#include <linux/list.h>
15#include <linux/radix-tree.h>
Paul Mackerras1b923132005-10-10 22:54:57 +100016
17#include <asm/types.h>
Arun Sharma60063492011-07-26 16:09:06 -070018#include <linux/atomic.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100020
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100021/* Define a way to iterate across irqs. */
22#define for_each_irq(i) \
23 for ((i) = 0; (i) < NR_IRQS; ++(i))
24
25extern atomic_t ppc_n_lost_interrupts;
26
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100027/* This number is used when no interrupt has been assigned */
28#define NO_IRQ (0)
29
30/* This is a special irq number to return from get_irq() to tell that
31 * no interrupt happened _and_ ignore it (don't count it as bad). Some
32 * platforms like iSeries rely on that.
33 */
34#define NO_IRQ_IGNORE ((unsigned int)-1)
35
Michael Ellerman551b81f2009-10-13 19:44:44 +000036/* Total number of virq in the platform */
37#define NR_IRQS CONFIG_NR_IRQS
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100038
39/* Number of irqs reserved for the legacy controller */
40#define NUM_ISA_INTERRUPTS 16
41
Michael Ellermancd015702009-10-13 19:45:03 +000042/* Same thing, used by the generic IRQ code */
43#define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS
44
Grant Likely476eb492011-05-04 15:02:15 +100045struct irq_data;
46extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d);
Olof Johansson35923f12007-06-04 14:47:04 +100047extern irq_hw_number_t virq_to_hw(unsigned int virq);
Benjamin Herrenschmidt0b05ac62011-04-04 13:46:58 +100048
Michael Ellerman40681b92006-08-02 11:13:50 +100049/**
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100050 * irq_early_init - Init irq remapping subsystem
51 */
52extern void irq_early_init(void);
53
54static __inline__ int irq_canonicalize(int irq)
55{
56 return irq;
57}
58
Paul Mackerras1b923132005-10-10 22:54:57 +100059extern int distribute_irqs;
60
61struct irqaction;
62struct pt_regs;
63
Paul Mackerrasc6622f62006-02-24 10:06:59 +110064#define __ARCH_HAS_DO_SOFTIRQ
65
Kumar Galabcf0b082008-04-30 03:49:55 -050066#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
67/*
68 * Per-cpu stacks for handling critical, debug and machine check
69 * level interrupts.
70 */
71extern struct thread_info *critirq_ctx[NR_CPUS];
72extern struct thread_info *dbgirq_ctx[NR_CPUS];
73extern struct thread_info *mcheckirq_ctx[NR_CPUS];
74extern void exc_lvl_ctx_init(void);
75#else
76#define exc_lvl_ctx_init()
77#endif
78
Paul Mackerras1b923132005-10-10 22:54:57 +100079/*
80 * Per-cpu stacks for handling hard and soft interrupts.
81 */
82extern struct thread_info *hardirq_ctx[NR_CPUS];
83extern struct thread_info *softirq_ctx[NR_CPUS];
84
85extern void irq_ctx_init(void);
86extern void call_do_softirq(struct thread_info *tp);
David Howells7d12e782006-10-05 14:55:46 +010087extern int call_handle_irq(int irq, void *p1,
Benjamin Herrenschmidtb9e5b4e2006-07-03 19:32:51 +100088 struct thread_info *tp, void *func);
Paul Mackerrasf2783c12005-10-20 09:23:26 +100089extern void do_IRQ(struct pt_regs *regs);
90
Stuart Yoder6ec36b52011-05-19 08:54:26 -050091int irq_choose_cpu(const struct cpumask *mask);
92
Linus Torvalds1da177e2005-04-16 15:20:36 -070093#endif /* _ASM_IRQ_H */
94#endif /* __KERNEL__ */