[PATCH] genirq: cleanup: merge pending_irq_cpumask[] into irq_desc[]
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / irq.h
CommitLineData
06fcb0c6
IM
1#ifndef _LINUX_IRQ_H
2#define _LINUX_IRQ_H
1da177e4
LT
3
4/*
5 * Please do not include this file in generic code. There is currently
6 * no requirement for any architecture to implement anything held
7 * within this file.
8 *
9 * Thanks. --rmk
10 */
11
23f9b317 12#include <linux/smp.h>
1da177e4 13
06fcb0c6 14#ifndef CONFIG_S390
1da177e4
LT
15
16#include <linux/linkage.h>
17#include <linux/cache.h>
18#include <linux/spinlock.h>
19#include <linux/cpumask.h>
908dcecd 20#include <linux/irqreturn.h>
1da177e4
LT
21
22#include <asm/irq.h>
23#include <asm/ptrace.h>
24
25/*
26 * IRQ line status.
27 */
28#define IRQ_INPROGRESS 1 /* IRQ handler active - do not enter! */
29#define IRQ_DISABLED 2 /* IRQ disabled - do not enter! */
30#define IRQ_PENDING 4 /* IRQ pending - replay on enable */
31#define IRQ_REPLAY 8 /* IRQ has been replayed but not acked yet */
32#define IRQ_AUTODETECT 16 /* IRQ is being autodetected */
33#define IRQ_WAITING 32 /* IRQ not yet seen - for autodetection */
34#define IRQ_LEVEL 64 /* IRQ level triggered */
35#define IRQ_MASKED 128 /* IRQ masked - shouldn't be seen again */
06fcb0c6 36#ifdef ARCH_HAS_IRQ_PER_CPU
f26fdd59
KW
37# define IRQ_PER_CPU 256 /* IRQ is per CPU */
38# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
39#else
40# define CHECK_IRQ_PER_CPU(var) 0
41#endif
1da177e4
LT
42
43/*
44 * Interrupt controller descriptor. This is all we need
45 * to describe about the low-level hardware.
46 */
47struct hw_interrupt_type {
71d218b7
IM
48 const char *typename;
49 unsigned int (*startup)(unsigned int irq);
50 void (*shutdown)(unsigned int irq);
51 void (*enable)(unsigned int irq);
52 void (*disable)(unsigned int irq);
53 void (*ack)(unsigned int irq);
54 void (*end)(unsigned int irq);
55 void (*set_affinity)(unsigned int irq, cpumask_t dest);
b77d6adc
PBG
56 /* Currently used only by UML, might disappear one day.*/
57#ifdef CONFIG_IRQ_RELEASE_METHOD
71d218b7 58 void (*release)(unsigned int irq, void *dev_id);
b77d6adc 59#endif
1da177e4
LT
60};
61
62typedef struct hw_interrupt_type hw_irq_controller;
63
4a733ee1
IM
64struct proc_dir_entry;
65
1da177e4
LT
66/*
67 * This is the "IRQ descriptor", which contains various information
68 * about the irq, including what kind of hardware handling it has,
69 * whether it is disabled etc etc.
70 *
71 * Pad this out to 32 bytes for cache and indexing reasons.
72 */
34ffdb72 73struct irq_desc {
71d218b7
IM
74 hw_irq_controller *chip;
75 void *chip_data;
76 struct irqaction *action; /* IRQ action list */
77 unsigned int status; /* IRQ status */
78 unsigned int depth; /* nested irq disables */
79 unsigned int irq_count; /* For detecting broken IRQs */
80 unsigned int irqs_unhandled;
81 spinlock_t lock;
a53da52f 82#ifdef CONFIG_SMP
71d218b7 83 cpumask_t affinity;
a53da52f 84#endif
06fcb0c6 85#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
cd916d31 86 cpumask_t pending_mask;
71d218b7 87 unsigned int move_irq; /* need to re-target IRQ dest */
54d5d424 88#endif
4a733ee1
IM
89#ifdef CONFIG_PROC_FS
90 struct proc_dir_entry *dir;
91#endif
34ffdb72 92} ____cacheline_aligned;
1da177e4 93
34ffdb72 94extern struct irq_desc irq_desc[NR_IRQS];
1da177e4 95
34ffdb72
IM
96/*
97 * Migration helpers for obsolete names, they will go away:
98 */
99typedef struct irq_desc irq_desc_t;
100
101/*
102 * Pick up the arch-dependent methods:
103 */
104#include <asm/hw_irq.h>
1da177e4 105
06fcb0c6 106extern int setup_irq(unsigned int irq, struct irqaction *new);
1da177e4
LT
107
108#ifdef CONFIG_GENERIC_HARDIRQS
06fcb0c6 109
54d5d424
AR
110#ifdef CONFIG_SMP
111static inline void set_native_irq_info(int irq, cpumask_t mask)
112{
a53da52f 113 irq_desc[irq].affinity = mask;
54d5d424
AR
114}
115#else
116static inline void set_native_irq_info(int irq, cpumask_t mask)
117{
118}
119#endif
120
121#ifdef CONFIG_SMP
122
06fcb0c6 123#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
54d5d424 124
c777ac55
AM
125void set_pending_irq(unsigned int irq, cpumask_t mask);
126void move_native_irq(int irq);
54d5d424
AR
127
128#ifdef CONFIG_PCI_MSI
129/*
130 * Wonder why these are dummies?
131 * For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq()
132 * counter part after translating the vector to irq info. We need to perform
133 * this operation on the real irq, when we dont use vector, i.e when
134 * pci_use_vector() is false.
135 */
136static inline void move_irq(int irq)
137{
138}
139
140static inline void set_irq_info(int irq, cpumask_t mask)
141{
142}
143
06fcb0c6 144#else /* CONFIG_PCI_MSI */
54d5d424
AR
145
146static inline void move_irq(int irq)
147{
148 move_native_irq(irq);
149}
150
151static inline void set_irq_info(int irq, cpumask_t mask)
152{
153 set_native_irq_info(irq, mask);
154}
54d5d424 155
06fcb0c6
IM
156#endif /* CONFIG_PCI_MSI */
157
158#else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */
159
160static inline void move_irq(int irq)
161{
162}
163
164static inline void move_native_irq(int irq)
165{
166}
167
168static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
169{
170}
54d5d424 171
54d5d424
AR
172static inline void set_irq_info(int irq, cpumask_t mask)
173{
174 set_native_irq_info(irq, mask);
175}
176
06fcb0c6 177#endif /* CONFIG_GENERIC_PENDING_IRQ */
54d5d424 178
06fcb0c6 179#else /* CONFIG_SMP */
54d5d424
AR
180
181#define move_irq(x)
182#define move_native_irq(x)
183
06fcb0c6 184#endif /* CONFIG_SMP */
54d5d424 185
1b61b910
ZY
186#ifdef CONFIG_IRQBALANCE
187extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask);
188#else
189static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
190{
191}
192#endif
193
71d218b7
IM
194#ifdef CONFIG_AUTO_IRQ_AFFINITY
195extern int select_smp_affinity(unsigned int irq);
196#else
197static inline int select_smp_affinity(unsigned int irq)
198{
199 return 1;
200}
201#endif
202
1da177e4
LT
203extern int no_irq_affinity;
204extern int noirqdebug_setup(char *str);
205
2e60bbb6
IM
206extern irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
207 struct irqaction *action);
208/*
209 * Explicit fastcall, because i386 4KSTACKS calls it from assembly:
210 */
1da177e4 211extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
2e60bbb6 212
34ffdb72 213extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
2e60bbb6 214 int action_ret, struct pt_regs *regs);
1da177e4
LT
215extern int can_request_irq(unsigned int irq, unsigned long irqflags);
216
217extern void init_irq_proc(void);
eee45269 218
06fcb0c6 219#endif /* CONFIG_GENERIC_HARDIRQS */
1da177e4
LT
220
221extern hw_irq_controller no_irq_type; /* needed in every arch ? */
222
06fcb0c6 223#endif /* !CONFIG_S390 */
1da177e4 224
06fcb0c6 225#endif /* _LINUX_IRQ_H */