blob: b5bfa24aa6a6b96867e1d3ee71a1c29a612f10fc [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);
31
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#ifdef CONFIG_PROC_FS
Yinghai Lu2c6927a2008-08-19 20:50:11 -070033extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
Thomas Gleixner13bfe992010-09-30 02:46:07 +020034extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -070035extern void register_handler_proc(unsigned int irq, struct irqaction *action);
36extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
37#else
Yinghai Lu2c6927a2008-08-19 20:50:11 -070038static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
Thomas Gleixner13bfe992010-09-30 02:46:07 +020039static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
Linus Torvalds1da177e2005-04-16 15:20:36 -070040static inline void register_handler_proc(unsigned int irq,
41 struct irqaction *action) { }
42static inline void unregister_handler_proc(unsigned int irq,
43 struct irqaction *action) { }
44#endif
45
Thomas Gleixner3b8249e2011-02-07 16:02:20 +010046extern int irq_select_affinity_usr(unsigned int irq, struct cpumask *mask);
Thomas Gleixnerf6d87f42008-11-07 13:18:30 +010047
Thomas Gleixner591d2fb2009-07-21 11:09:39 +020048extern void irq_set_thread_affinity(struct irq_desc *desc);
Yinghai Lu57b150c2009-04-27 17:59:53 -070049
Thomas Gleixnerbd151412010-10-01 15:17:14 +020050#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
51static inline void irq_end(unsigned int irq, struct irq_desc *desc)
52{
53 if (desc->irq_data.chip && desc->irq_data.chip->end)
54 desc->irq_data.chip->end(irq);
55}
56#else
57static inline void irq_end(unsigned int irq, struct irq_desc *desc) { }
58#endif
59
Thomas Gleixner70aedd22009-08-13 12:17:48 +020060/* Inline functions for support of irq chips on slow busses */
Thomas Gleixner3876ec92010-09-27 12:44:35 +000061static inline void chip_bus_lock(struct irq_desc *desc)
Thomas Gleixner70aedd22009-08-13 12:17:48 +020062{
Thomas Gleixner3876ec92010-09-27 12:44:35 +000063 if (unlikely(desc->irq_data.chip->irq_bus_lock))
64 desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
Thomas Gleixner70aedd22009-08-13 12:17:48 +020065}
66
Thomas Gleixner3876ec92010-09-27 12:44:35 +000067static inline void chip_bus_sync_unlock(struct irq_desc *desc)
Thomas Gleixner70aedd22009-08-13 12:17:48 +020068{
Thomas Gleixner3876ec92010-09-27 12:44:35 +000069 if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
70 desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
Thomas Gleixner70aedd22009-08-13 12:17:48 +020071}
72
Ingo Molnar43f77752006-06-29 02:24:58 -070073/*
74 * Debugging printout:
75 */
76
77#include <linux/kallsyms.h>
78
79#define P(f) if (desc->status & f) printk("%14s set\n", #f)
80
81static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
82{
83 printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
84 irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
85 printk("->handle_irq(): %p, ", desc->handle_irq);
86 print_symbol("%s\n", (unsigned long)desc->handle_irq);
Thomas Gleixner6b8ff312010-10-01 12:58:38 +020087 printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
88 print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
Ingo Molnar43f77752006-06-29 02:24:58 -070089 printk("->action(): %p\n", desc->action);
90 if (desc->action) {
91 printk("->action->handler(): %p, ", desc->action->handler);
92 print_symbol("%s\n", (unsigned long)desc->action->handler);
93 }
94
95 P(IRQ_INPROGRESS);
96 P(IRQ_DISABLED);
97 P(IRQ_PENDING);
98 P(IRQ_REPLAY);
99 P(IRQ_AUTODETECT);
100 P(IRQ_WAITING);
101 P(IRQ_LEVEL);
102 P(IRQ_MASKED);
103#ifdef CONFIG_IRQ_PER_CPU
104 P(IRQ_PER_CPU);
105#endif
106 P(IRQ_NOPROBE);
107 P(IRQ_NOREQUEST);
108 P(IRQ_NOAUTOEN);
109}
110
111#undef P
112