Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * IRQ subsystem internal functions and variables: |
| 3 | */ |
| 4 | |
| 5 | extern int noirqdebug; |
| 6 | |
Thomas Gleixner | a77c463 | 2010-10-01 14:44:58 +0200 | [diff] [blame] | 7 | #define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data) |
| 8 | |
Thomas Gleixner | 6a6de9e | 2006-06-29 02:24:51 -0700 | [diff] [blame] | 9 | /* Set default functions for irq_chip structures: */ |
| 10 | extern void irq_chip_set_defaults(struct irq_chip *chip); |
| 11 | |
| 12 | /* Set default handler: */ |
| 13 | extern void compat_irq_chip_set_default_handler(struct irq_desc *desc); |
| 14 | |
David Brownell | 0c5d1eb | 2008-10-01 14:46:18 -0700 | [diff] [blame] | 15 | extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq, |
| 16 | unsigned long flags); |
Rafael J. Wysocki | 0a0c516 | 2009-03-16 22:33:49 +0100 | [diff] [blame] | 17 | extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp); |
| 18 | extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume); |
David Brownell | 0c5d1eb | 2008-10-01 14:46:18 -0700 | [diff] [blame] | 19 | |
Yinghai Lu | 48a1b10 | 2008-12-11 00:15:01 -0800 | [diff] [blame] | 20 | extern struct lock_class_key irq_desc_lock_class; |
Yinghai Lu | 85ac16d | 2009-04-27 18:00:38 -0700 | [diff] [blame] | 21 | extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr); |
Yinghai Lu | 0f3c2a8 | 2009-02-08 16:18:03 -0800 | [diff] [blame] | 22 | extern void clear_kstat_irqs(struct irq_desc *desc); |
Thomas Gleixner | 239007b | 2009-11-17 16:46:45 +0100 | [diff] [blame] | 23 | extern raw_spinlock_t sparse_irq_lock; |
Mike Travis | 0fa0ebb | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 24 | |
| 25 | #ifdef CONFIG_SPARSE_IRQ |
Yinghai Lu | 99558f0 | 2010-02-10 01:20:34 -0800 | [diff] [blame] | 26 | void replace_irq_desc(unsigned int irq, struct irq_desc *desc); |
Mike Travis | 0fa0ebb | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 27 | #endif |
Yinghai Lu | 48a1b10 | 2008-12-11 00:15:01 -0800 | [diff] [blame] | 28 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #ifdef CONFIG_PROC_FS |
Yinghai Lu | 2c6927a | 2008-08-19 20:50:11 -0700 | [diff] [blame] | 30 | extern void register_irq_proc(unsigned int irq, struct irq_desc *desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | extern void register_handler_proc(unsigned int irq, struct irqaction *action); |
| 32 | extern void unregister_handler_proc(unsigned int irq, struct irqaction *action); |
| 33 | #else |
Yinghai Lu | 2c6927a | 2008-08-19 20:50:11 -0700 | [diff] [blame] | 34 | static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | static inline void register_handler_proc(unsigned int irq, |
| 36 | struct irqaction *action) { } |
| 37 | static inline void unregister_handler_proc(unsigned int irq, |
| 38 | struct irqaction *action) { } |
| 39 | #endif |
| 40 | |
Thomas Gleixner | f6d87f4 | 2008-11-07 13:18:30 +0100 | [diff] [blame] | 41 | extern int irq_select_affinity_usr(unsigned int irq); |
| 42 | |
Thomas Gleixner | 591d2fb | 2009-07-21 11:09:39 +0200 | [diff] [blame] | 43 | extern void irq_set_thread_affinity(struct irq_desc *desc); |
Yinghai Lu | 57b150c | 2009-04-27 17:59:53 -0700 | [diff] [blame] | 44 | |
Thomas Gleixner | bd15141 | 2010-10-01 15:17:14 +0200 | [diff] [blame] | 45 | #ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED |
| 46 | static 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 |
| 52 | static inline void irq_end(unsigned int irq, struct irq_desc *desc) { } |
| 53 | #endif |
| 54 | |
Thomas Gleixner | 70aedd2 | 2009-08-13 12:17:48 +0200 | [diff] [blame] | 55 | /* Inline functions for support of irq chips on slow busses */ |
Thomas Gleixner | 3876ec9 | 2010-09-27 12:44:35 +0000 | [diff] [blame] | 56 | static inline void chip_bus_lock(struct irq_desc *desc) |
Thomas Gleixner | 70aedd2 | 2009-08-13 12:17:48 +0200 | [diff] [blame] | 57 | { |
Thomas Gleixner | 3876ec9 | 2010-09-27 12:44:35 +0000 | [diff] [blame] | 58 | if (unlikely(desc->irq_data.chip->irq_bus_lock)) |
| 59 | desc->irq_data.chip->irq_bus_lock(&desc->irq_data); |
Thomas Gleixner | 70aedd2 | 2009-08-13 12:17:48 +0200 | [diff] [blame] | 60 | } |
| 61 | |
Thomas Gleixner | 3876ec9 | 2010-09-27 12:44:35 +0000 | [diff] [blame] | 62 | static inline void chip_bus_sync_unlock(struct irq_desc *desc) |
Thomas Gleixner | 70aedd2 | 2009-08-13 12:17:48 +0200 | [diff] [blame] | 63 | { |
Thomas Gleixner | 3876ec9 | 2010-09-27 12:44:35 +0000 | [diff] [blame] | 64 | if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock)) |
| 65 | desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data); |
Thomas Gleixner | 70aedd2 | 2009-08-13 12:17:48 +0200 | [diff] [blame] | 66 | } |
| 67 | |
Ingo Molnar | 43f7775 | 2006-06-29 02:24:58 -0700 | [diff] [blame] | 68 | /* |
| 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 | |
| 76 | static 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 Gleixner | 6b8ff31 | 2010-10-01 12:58:38 +0200 | [diff] [blame] | 82 | printk("->irq_data.chip(): %p, ", desc->irq_data.chip); |
| 83 | print_symbol("%s\n", (unsigned long)desc->irq_data.chip); |
Ingo Molnar | 43f7775 | 2006-06-29 02:24:58 -0700 | [diff] [blame] | 84 | 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 | |