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