diff options
Diffstat (limited to 'include/linux/irq.h')
-rw-r--r-- | include/linux/irq.h | 140 |
1 files changed, 54 insertions, 86 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index 48d3cb3b6a47..52fc4052a0ae 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -21,6 +21,12 @@ | |||
21 | 21 | ||
22 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
23 | #include <asm/ptrace.h> | 23 | #include <asm/ptrace.h> |
24 | #include <asm/irq_regs.h> | ||
25 | |||
26 | struct irq_desc; | ||
27 | typedef void fastcall (*irq_flow_handler_t)(unsigned int irq, | ||
28 | struct irq_desc *desc); | ||
29 | |||
24 | 30 | ||
25 | /* | 31 | /* |
26 | * IRQ line status. | 32 | * IRQ line status. |
@@ -59,6 +65,7 @@ | |||
59 | #define IRQ_NOAUTOEN 0x08000000 /* IRQ will not be enabled on request irq */ | 65 | #define IRQ_NOAUTOEN 0x08000000 /* IRQ will not be enabled on request irq */ |
60 | #define IRQ_DELAYED_DISABLE 0x10000000 /* IRQ disable (masking) happens delayed. */ | 66 | #define IRQ_DELAYED_DISABLE 0x10000000 /* IRQ disable (masking) happens delayed. */ |
61 | #define IRQ_WAKEUP 0x20000000 /* IRQ triggers system wakeup */ | 67 | #define IRQ_WAKEUP 0x20000000 /* IRQ triggers system wakeup */ |
68 | #define IRQ_MOVE_PENDING 0x40000000 /* need to re-target IRQ destination */ | ||
62 | 69 | ||
63 | struct proc_dir_entry; | 70 | struct proc_dir_entry; |
64 | 71 | ||
@@ -132,16 +139,14 @@ struct irq_chip { | |||
132 | * @affinity: IRQ affinity on SMP | 139 | * @affinity: IRQ affinity on SMP |
133 | * @cpu: cpu index useful for balancing | 140 | * @cpu: cpu index useful for balancing |
134 | * @pending_mask: pending rebalanced interrupts | 141 | * @pending_mask: pending rebalanced interrupts |
135 | * @move_irq: need to re-target IRQ destination | ||
136 | * @dir: /proc/irq/ procfs entry | 142 | * @dir: /proc/irq/ procfs entry |
137 | * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP | 143 | * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP |
144 | * @name: flow handler name for /proc/interrupts output | ||
138 | * | 145 | * |
139 | * Pad this out to 32 bytes for cache and indexing reasons. | 146 | * Pad this out to 32 bytes for cache and indexing reasons. |
140 | */ | 147 | */ |
141 | struct irq_desc { | 148 | struct irq_desc { |
142 | void fastcall (*handle_irq)(unsigned int irq, | 149 | irq_flow_handler_t handle_irq; |
143 | struct irq_desc *desc, | ||
144 | struct pt_regs *regs); | ||
145 | struct irq_chip *chip; | 150 | struct irq_chip *chip; |
146 | void *handler_data; | 151 | void *handler_data; |
147 | void *chip_data; | 152 | void *chip_data; |
@@ -159,11 +164,11 @@ struct irq_desc { | |||
159 | #endif | 164 | #endif |
160 | #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) | 165 | #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) |
161 | cpumask_t pending_mask; | 166 | cpumask_t pending_mask; |
162 | unsigned int move_irq; /* need to re-target IRQ dest */ | ||
163 | #endif | 167 | #endif |
164 | #ifdef CONFIG_PROC_FS | 168 | #ifdef CONFIG_PROC_FS |
165 | struct proc_dir_entry *dir; | 169 | struct proc_dir_entry *dir; |
166 | #endif | 170 | #endif |
171 | const char *name; | ||
167 | } ____cacheline_aligned; | 172 | } ____cacheline_aligned; |
168 | 173 | ||
169 | extern struct irq_desc irq_desc[NR_IRQS]; | 174 | extern struct irq_desc irq_desc[NR_IRQS]; |
@@ -206,36 +211,7 @@ static inline void set_native_irq_info(int irq, cpumask_t mask) | |||
206 | 211 | ||
207 | void set_pending_irq(unsigned int irq, cpumask_t mask); | 212 | void set_pending_irq(unsigned int irq, cpumask_t mask); |
208 | void move_native_irq(int irq); | 213 | void move_native_irq(int irq); |
209 | 214 | void move_masked_irq(int irq); | |
210 | #ifdef CONFIG_PCI_MSI | ||
211 | /* | ||
212 | * Wonder why these are dummies? | ||
213 | * For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq() | ||
214 | * counter part after translating the vector to irq info. We need to perform | ||
215 | * this operation on the real irq, when we dont use vector, i.e when | ||
216 | * pci_use_vector() is false. | ||
217 | */ | ||
218 | static inline void move_irq(int irq) | ||
219 | { | ||
220 | } | ||
221 | |||
222 | static inline void set_irq_info(int irq, cpumask_t mask) | ||
223 | { | ||
224 | } | ||
225 | |||
226 | #else /* CONFIG_PCI_MSI */ | ||
227 | |||
228 | static inline void move_irq(int irq) | ||
229 | { | ||
230 | move_native_irq(irq); | ||
231 | } | ||
232 | |||
233 | static inline void set_irq_info(int irq, cpumask_t mask) | ||
234 | { | ||
235 | set_native_irq_info(irq, mask); | ||
236 | } | ||
237 | |||
238 | #endif /* CONFIG_PCI_MSI */ | ||
239 | 215 | ||
240 | #else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */ | 216 | #else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */ |
241 | 217 | ||
@@ -247,21 +223,20 @@ static inline void move_native_irq(int irq) | |||
247 | { | 223 | { |
248 | } | 224 | } |
249 | 225 | ||
250 | static inline void set_pending_irq(unsigned int irq, cpumask_t mask) | 226 | static inline void move_masked_irq(int irq) |
251 | { | 227 | { |
252 | } | 228 | } |
253 | 229 | ||
254 | static inline void set_irq_info(int irq, cpumask_t mask) | 230 | static inline void set_pending_irq(unsigned int irq, cpumask_t mask) |
255 | { | 231 | { |
256 | set_native_irq_info(irq, mask); | ||
257 | } | 232 | } |
258 | 233 | ||
259 | #endif /* CONFIG_GENERIC_PENDING_IRQ */ | 234 | #endif /* CONFIG_GENERIC_PENDING_IRQ */ |
260 | 235 | ||
261 | #else /* CONFIG_SMP */ | 236 | #else /* CONFIG_SMP */ |
262 | 237 | ||
263 | #define move_irq(x) | ||
264 | #define move_native_irq(x) | 238 | #define move_native_irq(x) |
239 | #define move_masked_irq(x) | ||
265 | 240 | ||
266 | #endif /* CONFIG_SMP */ | 241 | #endif /* CONFIG_SMP */ |
267 | 242 | ||
@@ -285,43 +260,25 @@ static inline int select_smp_affinity(unsigned int irq) | |||
285 | extern int no_irq_affinity; | 260 | extern int no_irq_affinity; |
286 | 261 | ||
287 | /* Handle irq action chains: */ | 262 | /* Handle irq action chains: */ |
288 | extern int handle_IRQ_event(unsigned int irq, struct pt_regs *regs, | 263 | extern int handle_IRQ_event(unsigned int irq, struct irqaction *action); |
289 | struct irqaction *action); | ||
290 | 264 | ||
291 | /* | 265 | /* |
292 | * Built-in IRQ handlers for various IRQ types, | 266 | * Built-in IRQ handlers for various IRQ types, |
293 | * callable via desc->chip->handle_irq() | 267 | * callable via desc->chip->handle_irq() |
294 | */ | 268 | */ |
295 | extern void fastcall | 269 | extern void fastcall handle_level_irq(unsigned int irq, struct irq_desc *desc); |
296 | handle_level_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs); | 270 | extern void fastcall handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); |
297 | extern void fastcall | 271 | extern void fastcall handle_edge_irq(unsigned int irq, struct irq_desc *desc); |
298 | handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc, | 272 | extern void fastcall handle_simple_irq(unsigned int irq, struct irq_desc *desc); |
299 | struct pt_regs *regs); | 273 | extern void fastcall handle_percpu_irq(unsigned int irq, struct irq_desc *desc); |
300 | extern void fastcall | 274 | extern void fastcall handle_bad_irq(unsigned int irq, struct irq_desc *desc); |
301 | handle_edge_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs); | ||
302 | extern void fastcall | ||
303 | handle_simple_irq(unsigned int irq, struct irq_desc *desc, | ||
304 | struct pt_regs *regs); | ||
305 | extern void fastcall | ||
306 | handle_percpu_irq(unsigned int irq, struct irq_desc *desc, | ||
307 | struct pt_regs *regs); | ||
308 | extern void fastcall | ||
309 | handle_bad_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs); | ||
310 | |||
311 | /* | ||
312 | * Get a descriptive string for the highlevel handler, for | ||
313 | * /proc/interrupts output: | ||
314 | */ | ||
315 | extern const char * | ||
316 | handle_irq_name(void fastcall (*handle)(unsigned int, struct irq_desc *, | ||
317 | struct pt_regs *)); | ||
318 | 275 | ||
319 | /* | 276 | /* |
320 | * Monolithic do_IRQ implementation. | 277 | * Monolithic do_IRQ implementation. |
321 | * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly) | 278 | * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly) |
322 | */ | 279 | */ |
323 | #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ | 280 | #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ |
324 | extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); | 281 | extern fastcall unsigned int __do_IRQ(unsigned int irq); |
325 | #endif | 282 | #endif |
326 | 283 | ||
327 | /* | 284 | /* |
@@ -330,23 +287,23 @@ extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); | |||
330 | * irqchip-style controller then we call the ->handle_irq() handler, | 287 | * irqchip-style controller then we call the ->handle_irq() handler, |
331 | * and it calls __do_IRQ() if it's attached to an irqtype-style controller. | 288 | * and it calls __do_IRQ() if it's attached to an irqtype-style controller. |
332 | */ | 289 | */ |
333 | static inline void generic_handle_irq(unsigned int irq, struct pt_regs *regs) | 290 | static inline void generic_handle_irq(unsigned int irq) |
334 | { | 291 | { |
335 | struct irq_desc *desc = irq_desc + irq; | 292 | struct irq_desc *desc = irq_desc + irq; |
336 | 293 | ||
337 | #ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ | 294 | #ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ |
338 | desc->handle_irq(irq, desc, regs); | 295 | desc->handle_irq(irq, desc); |
339 | #else | 296 | #else |
340 | if (likely(desc->handle_irq)) | 297 | if (likely(desc->handle_irq)) |
341 | desc->handle_irq(irq, desc, regs); | 298 | desc->handle_irq(irq, desc); |
342 | else | 299 | else |
343 | __do_IRQ(irq, regs); | 300 | __do_IRQ(irq); |
344 | #endif | 301 | #endif |
345 | } | 302 | } |
346 | 303 | ||
347 | /* Handling of unhandled and spurious interrupts: */ | 304 | /* Handling of unhandled and spurious interrupts: */ |
348 | extern void note_interrupt(unsigned int irq, struct irq_desc *desc, | 305 | extern void note_interrupt(unsigned int irq, struct irq_desc *desc, |
349 | int action_ret, struct pt_regs *regs); | 306 | int action_ret); |
350 | 307 | ||
351 | /* Resending of interrupts :*/ | 308 | /* Resending of interrupts :*/ |
352 | void check_irq_resend(struct irq_desc *desc, unsigned int irq); | 309 | void check_irq_resend(struct irq_desc *desc, unsigned int irq); |
@@ -366,24 +323,22 @@ extern struct irq_chip dummy_irq_chip; | |||
366 | 323 | ||
367 | extern void | 324 | extern void |
368 | set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, | 325 | set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, |
369 | void fastcall (*handle)(unsigned int, | 326 | irq_flow_handler_t handle); |
370 | struct irq_desc *, | ||
371 | struct pt_regs *)); | ||
372 | extern void | 327 | extern void |
373 | __set_irq_handler(unsigned int irq, | 328 | set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, |
374 | void fastcall (*handle)(unsigned int, struct irq_desc *, | 329 | irq_flow_handler_t handle, const char *name); |
375 | struct pt_regs *), | 330 | |
376 | int is_chained); | 331 | extern void |
332 | __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, | ||
333 | const char *name); | ||
377 | 334 | ||
378 | /* | 335 | /* |
379 | * Set a highlevel flow handler for a given IRQ: | 336 | * Set a highlevel flow handler for a given IRQ: |
380 | */ | 337 | */ |
381 | static inline void | 338 | static inline void |
382 | set_irq_handler(unsigned int irq, | 339 | set_irq_handler(unsigned int irq, irq_flow_handler_t handle) |
383 | void fastcall (*handle)(unsigned int, struct irq_desc *, | ||
384 | struct pt_regs *)) | ||
385 | { | 340 | { |
386 | __set_irq_handler(irq, handle, 0); | 341 | __set_irq_handler(irq, handle, 0, NULL); |
387 | } | 342 | } |
388 | 343 | ||
389 | /* | 344 | /* |
@@ -393,14 +348,27 @@ set_irq_handler(unsigned int irq, | |||
393 | */ | 348 | */ |
394 | static inline void | 349 | static inline void |
395 | set_irq_chained_handler(unsigned int irq, | 350 | set_irq_chained_handler(unsigned int irq, |
396 | void fastcall (*handle)(unsigned int, struct irq_desc *, | 351 | irq_flow_handler_t handle) |
397 | struct pt_regs *)) | ||
398 | { | 352 | { |
399 | __set_irq_handler(irq, handle, 1); | 353 | __set_irq_handler(irq, handle, 1, NULL); |
400 | } | 354 | } |
401 | 355 | ||
402 | /* Set/get chip/data for an IRQ: */ | 356 | /* Handle dynamic irq creation and destruction */ |
357 | extern int create_irq(void); | ||
358 | extern void destroy_irq(unsigned int irq); | ||
359 | |||
360 | /* Test to see if a driver has successfully requested an irq */ | ||
361 | static inline int irq_has_action(unsigned int irq) | ||
362 | { | ||
363 | struct irq_desc *desc = irq_desc + irq; | ||
364 | return desc->action != NULL; | ||
365 | } | ||
403 | 366 | ||
367 | /* Dynamic irq helper functions */ | ||
368 | extern void dynamic_irq_init(unsigned int irq); | ||
369 | extern void dynamic_irq_cleanup(unsigned int irq); | ||
370 | |||
371 | /* Set/get chip/data for an IRQ: */ | ||
404 | extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); | 372 | extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); |
405 | extern int set_irq_data(unsigned int irq, void *data); | 373 | extern int set_irq_data(unsigned int irq, void *data); |
406 | extern int set_irq_chip_data(unsigned int irq, void *data); | 374 | extern int set_irq_chip_data(unsigned int irq, void *data); |