blob: b905f0ab1bb2d7319013522173b84988ccd08d54 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * IRQ subsystem internal functions and variables:
3 */
4
5extern int noirqdebug;
6
Thomas Gleixnera77c4632010-10-01 14:44:58 +02007#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
8
Thomas Gleixner6a6de9e2006-06-29 02:24:51 -07009/* Set default functions for irq_chip structures: */
10extern void irq_chip_set_defaults(struct irq_chip *chip);
11
12/* Set default handler: */
13extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
14
David Brownell0c5d1eb2008-10-01 14:46:18 -070015extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
16 unsigned long flags);
Rafael J. Wysocki0a0c5162009-03-16 22:33:49 +010017extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
18extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
David Brownell0c5d1eb2008-10-01 14:46:18 -070019
Yinghai Lu48a1b102008-12-11 00:15:01 -080020extern struct lock_class_key irq_desc_lock_class;
Yinghai Lu85ac16d2009-04-27 18:00:38 -070021extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
Yinghai Lu0f3c2a82009-02-08 16:18:03 -080022extern void clear_kstat_irqs(struct irq_desc *desc);
Thomas Gleixner239007b2009-11-17 16:46:45 +010023extern raw_spinlock_t sparse_irq_lock;
Mike Travis0fa0ebb2009-01-10 22:24:06 -080024
25#ifdef CONFIG_SPARSE_IRQ
Yinghai Lu99558f02010-02-10 01:20:34 -080026void replace_irq_desc(unsigned int irq, struct irq_desc *desc);
Mike Travis0fa0ebb2009-01-10 22:24:06 -080027#endif
Yinghai Lu48a1b102008-12-11 00:15:01 -080028
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#ifdef CONFIG_PROC_FS
Yinghai Lu2c6927a2008-08-19 20:50:11 -070030extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031extern void register_handler_proc(unsigned int irq, struct irqaction *action);
32extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
33#else
Yinghai Lu2c6927a2008-08-19 20:50:11 -070034static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
Linus Torvalds1da177e2005-04-16 15:20:36 -070035static inline void register_handler_proc(unsigned int irq,
36 struct irqaction *action) { }
37static inline void unregister_handler_proc(unsigned int irq,
38 struct irqaction *action) { }
39#endif
40
Thomas Gleixnerf6d87f42008-11-07 13:18:30 +010041extern int irq_select_affinity_usr(unsigned int irq);
42
Thomas Gleixner591d2fb2009-07-21 11:09:39 +020043extern void irq_set_thread_affinity(struct irq_desc *desc);
Yinghai Lu57b150c2009-04-27 17:59:53 -070044
Thomas Gleixnerbd151412010-10-01 15:17:14 +020045#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
46static inline void irq_end(unsigned int irq, struct irq_desc *desc)
47{
48 if (desc->irq_data.chip && desc->irq_data.chip->end)
49 desc->irq_data.chip->end(irq);
50}
51#else
52static inline void irq_end(unsigned int irq, struct irq_desc *desc) { }
53#endif
54
Thomas Gleixner70aedd22009-08-13 12:17:48 +020055/* Inline functions for support of irq chips on slow busses */
Thomas Gleixner3876ec92010-09-27 12:44:35 +000056static inline void chip_bus_lock(struct irq_desc *desc)
Thomas Gleixner70aedd22009-08-13 12:17:48 +020057{
Thomas Gleixner3876ec92010-09-27 12:44:35 +000058 if (unlikely(desc->irq_data.chip->irq_bus_lock))
59 desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
Thomas Gleixner70aedd22009-08-13 12:17:48 +020060}
61
Thomas Gleixner3876ec92010-09-27 12:44:35 +000062static inline void chip_bus_sync_unlock(struct irq_desc *desc)
Thomas Gleixner70aedd22009-08-13 12:17:48 +020063{
Thomas Gleixner3876ec92010-09-27 12:44:35 +000064 if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
65 desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
Thomas Gleixner70aedd22009-08-13 12:17:48 +020066}
67
Ingo Molnar43f77752006-06-29 02:24:58 -070068/*
69 * Debugging printout:
70 */
71
72#include <linux/kallsyms.h>
73
74#define P(f) if (desc->status & f) printk("%14s set\n", #f)
75
76static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
77{
78 printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
79 irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
80 printk("->handle_irq(): %p, ", desc->handle_irq);
81 print_symbol("%s\n", (unsigned long)desc->handle_irq);
Thomas Gleixner6b8ff312010-10-01 12:58:38 +020082 printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
83 print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
Ingo Molnar43f77752006-06-29 02:24:58 -070084 printk("->action(): %p\n", desc->action);
85 if (desc->action) {
86 printk("->action->handler(): %p, ", desc->action->handler);
87 print_symbol("%s\n", (unsigned long)desc->action->handler);
88 }
89
90 P(IRQ_INPROGRESS);
91 P(IRQ_DISABLED);
92 P(IRQ_PENDING);
93 P(IRQ_REPLAY);
94 P(IRQ_AUTODETECT);
95 P(IRQ_WAITING);
96 P(IRQ_LEVEL);
97 P(IRQ_MASKED);
98#ifdef CONFIG_IRQ_PER_CPU
99 P(IRQ_PER_CPU);
100#endif
101 P(IRQ_NOPROBE);
102 P(IRQ_NOREQUEST);
103 P(IRQ_NOAUTOEN);
104}
105
106#undef P
107