]>
Commit | Line | Data |
---|---|---|
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 */ | |
0d7012a9 | 36 | #ifdef CONFIG_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 | 42 | |
3418d724 | 43 | #define IRQ_NOPROBE 512 /* IRQ is not valid for probing */ |
6550c775 | 44 | #define IRQ_NOREQUEST 1024 /* IRQ cannot be requested */ |
94d39e1f | 45 | #define IRQ_NOAUTOEN 2048 /* IRQ will not be enabled on request irq */ |
8fee5c36 IM |
46 | /** |
47 | * struct hw_interrupt_type - hardware interrupt type descriptor | |
48 | * | |
49 | * @name: name for /proc/interrupts | |
50 | * @startup: start up the interrupt (defaults to ->enable if NULL) | |
51 | * @shutdown: shut down the interrupt (defaults to ->disable if NULL) | |
52 | * @enable: enable the interrupt (defaults to chip->unmask if NULL) | |
53 | * @disable: disable the interrupt (defaults to chip->mask if NULL) | |
54 | * @handle_irq: irq flow handler called from the arch IRQ glue code | |
55 | * @ack: start of a new interrupt | |
56 | * @mask: mask an interrupt source | |
57 | * @mask_ack: ack and mask an interrupt source | |
58 | * @unmask: unmask an interrupt source | |
59 | * @hold: same interrupt while the handler is running | |
60 | * @end: end of interrupt | |
61 | * @set_affinity: set the CPU affinity on SMP machines | |
62 | * @retrigger: resend an IRQ to the CPU | |
63 | * @set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ | |
64 | * @set_wake: enable/disable power-management wake-on of an IRQ | |
65 | * | |
66 | * @release: release function solely used by UML | |
1da177e4 LT |
67 | */ |
68 | struct hw_interrupt_type { | |
71d218b7 IM |
69 | const char *typename; |
70 | unsigned int (*startup)(unsigned int irq); | |
71 | void (*shutdown)(unsigned int irq); | |
72 | void (*enable)(unsigned int irq); | |
73 | void (*disable)(unsigned int irq); | |
74 | void (*ack)(unsigned int irq); | |
75 | void (*end)(unsigned int irq); | |
76 | void (*set_affinity)(unsigned int irq, cpumask_t dest); | |
c0ad90a3 IM |
77 | int (*retrigger)(unsigned int irq); |
78 | ||
b77d6adc PBG |
79 | /* Currently used only by UML, might disappear one day.*/ |
80 | #ifdef CONFIG_IRQ_RELEASE_METHOD | |
71d218b7 | 81 | void (*release)(unsigned int irq, void *dev_id); |
b77d6adc | 82 | #endif |
1da177e4 LT |
83 | }; |
84 | ||
85 | typedef struct hw_interrupt_type hw_irq_controller; | |
86 | ||
4a733ee1 IM |
87 | struct proc_dir_entry; |
88 | ||
8fee5c36 IM |
89 | /** |
90 | * struct irq_desc - interrupt descriptor | |
91 | * | |
92 | * @handler: interrupt type dependent handler functions | |
93 | * @handler_data: data for the type handlers | |
94 | * @action: the irq action chain | |
95 | * @status: status information | |
96 | * @depth: disable-depth, for nested irq_disable() calls | |
97 | * @irq_count: stats field to detect stalled irqs | |
98 | * @irqs_unhandled: stats field for spurious unhandled interrupts | |
99 | * @lock: locking for SMP | |
100 | * @affinity: IRQ affinity on SMP | |
101 | * @pending_mask: pending rebalanced interrupts | |
102 | * @move_irq: need to re-target IRQ destination | |
103 | * @dir: /proc/irq/ procfs entry | |
104 | * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP | |
1da177e4 LT |
105 | * |
106 | * Pad this out to 32 bytes for cache and indexing reasons. | |
107 | */ | |
34ffdb72 | 108 | struct irq_desc { |
71d218b7 IM |
109 | hw_irq_controller *chip; |
110 | void *chip_data; | |
111 | struct irqaction *action; /* IRQ action list */ | |
112 | unsigned int status; /* IRQ status */ | |
113 | unsigned int depth; /* nested irq disables */ | |
114 | unsigned int irq_count; /* For detecting broken IRQs */ | |
115 | unsigned int irqs_unhandled; | |
116 | spinlock_t lock; | |
a53da52f | 117 | #ifdef CONFIG_SMP |
71d218b7 | 118 | cpumask_t affinity; |
a53da52f | 119 | #endif |
06fcb0c6 | 120 | #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) |
cd916d31 | 121 | cpumask_t pending_mask; |
71d218b7 | 122 | unsigned int move_irq; /* need to re-target IRQ dest */ |
54d5d424 | 123 | #endif |
4a733ee1 IM |
124 | #ifdef CONFIG_PROC_FS |
125 | struct proc_dir_entry *dir; | |
126 | #endif | |
34ffdb72 | 127 | } ____cacheline_aligned; |
1da177e4 | 128 | |
34ffdb72 | 129 | extern struct irq_desc irq_desc[NR_IRQS]; |
1da177e4 | 130 | |
34ffdb72 IM |
131 | /* |
132 | * Migration helpers for obsolete names, they will go away: | |
133 | */ | |
134 | typedef struct irq_desc irq_desc_t; | |
135 | ||
136 | /* | |
137 | * Pick up the arch-dependent methods: | |
138 | */ | |
139 | #include <asm/hw_irq.h> | |
1da177e4 | 140 | |
06fcb0c6 | 141 | extern int setup_irq(unsigned int irq, struct irqaction *new); |
1da177e4 LT |
142 | |
143 | #ifdef CONFIG_GENERIC_HARDIRQS | |
06fcb0c6 | 144 | |
54d5d424 AR |
145 | #ifdef CONFIG_SMP |
146 | static inline void set_native_irq_info(int irq, cpumask_t mask) | |
147 | { | |
a53da52f | 148 | irq_desc[irq].affinity = mask; |
54d5d424 AR |
149 | } |
150 | #else | |
151 | static inline void set_native_irq_info(int irq, cpumask_t mask) | |
152 | { | |
153 | } | |
154 | #endif | |
155 | ||
156 | #ifdef CONFIG_SMP | |
157 | ||
06fcb0c6 | 158 | #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) |
54d5d424 | 159 | |
c777ac55 AM |
160 | void set_pending_irq(unsigned int irq, cpumask_t mask); |
161 | void move_native_irq(int irq); | |
54d5d424 AR |
162 | |
163 | #ifdef CONFIG_PCI_MSI | |
164 | /* | |
165 | * Wonder why these are dummies? | |
166 | * For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq() | |
167 | * counter part after translating the vector to irq info. We need to perform | |
168 | * this operation on the real irq, when we dont use vector, i.e when | |
169 | * pci_use_vector() is false. | |
170 | */ | |
171 | static inline void move_irq(int irq) | |
172 | { | |
173 | } | |
174 | ||
175 | static inline void set_irq_info(int irq, cpumask_t mask) | |
176 | { | |
177 | } | |
178 | ||
06fcb0c6 | 179 | #else /* CONFIG_PCI_MSI */ |
54d5d424 AR |
180 | |
181 | static inline void move_irq(int irq) | |
182 | { | |
183 | move_native_irq(irq); | |
184 | } | |
185 | ||
186 | static inline void set_irq_info(int irq, cpumask_t mask) | |
187 | { | |
188 | set_native_irq_info(irq, mask); | |
189 | } | |
54d5d424 | 190 | |
06fcb0c6 IM |
191 | #endif /* CONFIG_PCI_MSI */ |
192 | ||
193 | #else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */ | |
194 | ||
195 | static inline void move_irq(int irq) | |
196 | { | |
197 | } | |
198 | ||
199 | static inline void move_native_irq(int irq) | |
200 | { | |
201 | } | |
202 | ||
203 | static inline void set_pending_irq(unsigned int irq, cpumask_t mask) | |
204 | { | |
205 | } | |
54d5d424 | 206 | |
54d5d424 AR |
207 | static inline void set_irq_info(int irq, cpumask_t mask) |
208 | { | |
209 | set_native_irq_info(irq, mask); | |
210 | } | |
211 | ||
06fcb0c6 | 212 | #endif /* CONFIG_GENERIC_PENDING_IRQ */ |
54d5d424 | 213 | |
06fcb0c6 | 214 | #else /* CONFIG_SMP */ |
54d5d424 AR |
215 | |
216 | #define move_irq(x) | |
217 | #define move_native_irq(x) | |
218 | ||
06fcb0c6 | 219 | #endif /* CONFIG_SMP */ |
54d5d424 | 220 | |
1b61b910 ZY |
221 | #ifdef CONFIG_IRQBALANCE |
222 | extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask); | |
223 | #else | |
224 | static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask) | |
225 | { | |
226 | } | |
227 | #endif | |
228 | ||
71d218b7 IM |
229 | #ifdef CONFIG_AUTO_IRQ_AFFINITY |
230 | extern int select_smp_affinity(unsigned int irq); | |
231 | #else | |
232 | static inline int select_smp_affinity(unsigned int irq) | |
233 | { | |
234 | return 1; | |
235 | } | |
236 | #endif | |
237 | ||
1da177e4 LT |
238 | extern int no_irq_affinity; |
239 | extern int noirqdebug_setup(char *str); | |
240 | ||
2e60bbb6 IM |
241 | extern irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs, |
242 | struct irqaction *action); | |
243 | /* | |
244 | * Explicit fastcall, because i386 4KSTACKS calls it from assembly: | |
245 | */ | |
1da177e4 | 246 | extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); |
2e60bbb6 | 247 | |
34ffdb72 | 248 | extern void note_interrupt(unsigned int irq, struct irq_desc *desc, |
2e60bbb6 | 249 | int action_ret, struct pt_regs *regs); |
1da177e4 LT |
250 | extern int can_request_irq(unsigned int irq, unsigned long irqflags); |
251 | ||
a4633adc TG |
252 | /* Resending of interrupts :*/ |
253 | void check_irq_resend(struct irq_desc *desc, unsigned int irq); | |
254 | ||
1da177e4 | 255 | extern void init_irq_proc(void); |
eee45269 | 256 | |
06fcb0c6 | 257 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
1da177e4 LT |
258 | |
259 | extern hw_irq_controller no_irq_type; /* needed in every arch ? */ | |
260 | ||
06fcb0c6 | 261 | #endif /* !CONFIG_S390 */ |
1da177e4 | 262 | |
06fcb0c6 | 263 | #endif /* _LINUX_IRQ_H */ |