blob: 0eff7e92b1a9be98622b815e0165288b49212dbb [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * IRQ subsystem internal functions and variables:
3 */
Thomas Gleixnere1447102010-10-01 16:03:45 +02004#include <linux/irqdesc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
Thomas Gleixnerc1ee6262011-02-17 17:45:15 +01006#ifdef CONFIG_SPARSE_IRQ
7# define IRQ_BITMAP_BITS (NR_IRQS + 8196)
8#else
9# define IRQ_BITMAP_BITS NR_IRQS
10#endif
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012extern int noirqdebug;
13
Thomas Gleixnera77c4632010-10-01 14:44:58 +020014#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
15
Thomas Gleixner6a6de9e2006-06-29 02:24:51 -070016/* Set default functions for irq_chip structures: */
17extern void irq_chip_set_defaults(struct irq_chip *chip);
18
19/* Set default handler: */
20extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
21
David Brownell0c5d1eb2008-10-01 14:46:18 -070022extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
23 unsigned long flags);
Rafael J. Wysocki0a0c5162009-03-16 22:33:49 +010024extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
25extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
David Brownell0c5d1eb2008-10-01 14:46:18 -070026
Yinghai Lu85ac16d2009-04-27 18:00:38 -070027extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
Mike Travis0fa0ebb2009-01-10 22:24:06 -080028
Thomas Gleixnere1447102010-10-01 16:03:45 +020029/* Resending of interrupts :*/
30void check_irq_resend(struct irq_desc *desc, unsigned int irq);
Thomas Gleixnerfe200ae2011-02-07 10:34:30 +010031bool irq_wait_for_poll(struct irq_desc *desc);
Thomas Gleixnere1447102010-10-01 16:03:45 +020032
Linus Torvalds1da177e2005-04-16 15:20:36 -070033#ifdef CONFIG_PROC_FS
Yinghai Lu2c6927a2008-08-19 20:50:11 -070034extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
Thomas Gleixner13bfe992010-09-30 02:46:07 +020035extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -070036extern void register_handler_proc(unsigned int irq, struct irqaction *action);
37extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
38#else
Yinghai Lu2c6927a2008-08-19 20:50:11 -070039static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
Thomas Gleixner13bfe992010-09-30 02:46:07 +020040static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
Linus Torvalds1da177e2005-04-16 15:20:36 -070041static inline void register_handler_proc(unsigned int irq,
42 struct irqaction *action) { }
43static inline void unregister_handler_proc(unsigned int irq,
44 struct irqaction *action) { }
45#endif
46
Thomas Gleixner3b8249e2011-02-07 16:02:20 +010047extern int irq_select_affinity_usr(unsigned int irq, struct cpumask *mask);
Thomas Gleixnerf6d87f42008-11-07 13:18:30 +010048
Thomas Gleixner591d2fb2009-07-21 11:09:39 +020049extern void irq_set_thread_affinity(struct irq_desc *desc);
Yinghai Lu57b150c2009-04-27 17:59:53 -070050
Thomas Gleixner70aedd22009-08-13 12:17:48 +020051/* Inline functions for support of irq chips on slow busses */
Thomas Gleixner3876ec92010-09-27 12:44:35 +000052static inline void chip_bus_lock(struct irq_desc *desc)
Thomas Gleixner70aedd22009-08-13 12:17:48 +020053{
Thomas Gleixner3876ec92010-09-27 12:44:35 +000054 if (unlikely(desc->irq_data.chip->irq_bus_lock))
55 desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
Thomas Gleixner70aedd22009-08-13 12:17:48 +020056}
57
Thomas Gleixner3876ec92010-09-27 12:44:35 +000058static inline void chip_bus_sync_unlock(struct irq_desc *desc)
Thomas Gleixner70aedd22009-08-13 12:17:48 +020059{
Thomas Gleixner3876ec92010-09-27 12:44:35 +000060 if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
61 desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
Thomas Gleixner70aedd22009-08-13 12:17:48 +020062}
63
Ingo Molnar43f77752006-06-29 02:24:58 -070064/*
65 * Debugging printout:
66 */
67
68#include <linux/kallsyms.h>
69
70#define P(f) if (desc->status & f) printk("%14s set\n", #f)
71
72static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
73{
74 printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
75 irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
76 printk("->handle_irq(): %p, ", desc->handle_irq);
77 print_symbol("%s\n", (unsigned long)desc->handle_irq);
Thomas Gleixner6b8ff312010-10-01 12:58:38 +020078 printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
79 print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
Ingo Molnar43f77752006-06-29 02:24:58 -070080 printk("->action(): %p\n", desc->action);
81 if (desc->action) {
82 printk("->action->handler(): %p, ", desc->action->handler);
83 print_symbol("%s\n", (unsigned long)desc->action->handler);
84 }
85
86 P(IRQ_INPROGRESS);
87 P(IRQ_DISABLED);
88 P(IRQ_PENDING);
89 P(IRQ_REPLAY);
90 P(IRQ_AUTODETECT);
91 P(IRQ_WAITING);
92 P(IRQ_LEVEL);
93 P(IRQ_MASKED);
94#ifdef CONFIG_IRQ_PER_CPU
95 P(IRQ_PER_CPU);
96#endif
97 P(IRQ_NOPROBE);
98 P(IRQ_NOREQUEST);
99 P(IRQ_NOAUTOEN);
100}
101
102#undef P
103