Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _M68K_IRQ_H_ |
| 2 | #define _M68K_IRQ_H_ |
| 3 | |
Roman Zippel | b5dc784 | 2006-06-25 05:47:00 -0700 | [diff] [blame^] | 4 | #include <linux/hardirq.h> |
| 5 | #include <linux/spinlock_types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | |
| 7 | /* |
Roman Zippel | 4facfde | 2006-06-25 05:46:59 -0700 | [diff] [blame] | 8 | * # of m68k auto vector interrupts |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #define SYS_IRQS 8 |
| 12 | |
| 13 | /* |
| 14 | * This should be the same as the max(NUM_X_SOURCES) for all the |
| 15 | * different m68k hosts compiled into the kernel. |
| 16 | * Currently the Atari has 72 and the Amiga 24, but if both are |
| 17 | * supported in the kernel it is better to make room for 72. |
| 18 | */ |
| 19 | #if defined(CONFIG_ATARI) || defined(CONFIG_MAC) |
| 20 | #define NR_IRQS (72+SYS_IRQS) |
| 21 | #else |
| 22 | #define NR_IRQS (24+SYS_IRQS) |
| 23 | #endif |
| 24 | |
| 25 | /* |
Al Viro | 85b07cd | 2006-01-12 01:06:10 -0800 | [diff] [blame] | 26 | * The hardirq mask has to be large enough to have |
| 27 | * space for potentially all IRQ sources in the system |
| 28 | * nesting on a single CPU: |
| 29 | */ |
| 30 | #if (1 << HARDIRQ_BITS) < NR_IRQS |
| 31 | # error HARDIRQ_BITS is too low! |
| 32 | #endif |
| 33 | |
| 34 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | * Interrupt source definitions |
| 36 | * General interrupt sources are the level 1-7. |
| 37 | * Adding an interrupt service routine for one of these sources |
| 38 | * results in the addition of that routine to a chain of routines. |
| 39 | * Each one is called in succession. Each individual interrupt |
| 40 | * service routine should determine if the device associated with |
| 41 | * that routine requires service. |
| 42 | */ |
| 43 | |
Roman Zippel | 4facfde | 2006-06-25 05:46:59 -0700 | [diff] [blame] | 44 | #define IRQ_SPURIOUS 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
Roman Zippel | 4facfde | 2006-06-25 05:46:59 -0700 | [diff] [blame] | 46 | #define IRQ_AUTO_1 1 /* level 1 interrupt */ |
| 47 | #define IRQ_AUTO_2 2 /* level 2 interrupt */ |
| 48 | #define IRQ_AUTO_3 3 /* level 3 interrupt */ |
| 49 | #define IRQ_AUTO_4 4 /* level 4 interrupt */ |
| 50 | #define IRQ_AUTO_5 5 /* level 5 interrupt */ |
| 51 | #define IRQ_AUTO_6 6 /* level 6 interrupt */ |
| 52 | #define IRQ_AUTO_7 7 /* level 7 interrupt (non-maskable) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Roman Zippel | 4facfde | 2006-06-25 05:46:59 -0700 | [diff] [blame] | 54 | #define IRQ_USER 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | static __inline__ int irq_canonicalize(int irq) |
| 57 | { |
| 58 | return irq; |
| 59 | } |
| 60 | |
| 61 | /* |
| 62 | * Machine specific interrupt sources. |
| 63 | * |
| 64 | * Adding an interrupt service routine for a source with this bit |
| 65 | * set indicates a special machine specific interrupt source. |
| 66 | * The machine specific files define these sources. |
| 67 | * |
| 68 | * The IRQ_MACHSPEC bit is now gone - the only thing it did was to |
| 69 | * introduce unnecessary overhead. |
| 70 | * |
| 71 | * All interrupt handling is actually machine specific so it is better |
| 72 | * to use function pointers, as used by the Sparc port, and select the |
| 73 | * interrupt handling functions when initializing the kernel. This way |
| 74 | * we save some unnecessary overhead at run-time. |
| 75 | * 01/11/97 - Jes |
| 76 | */ |
| 77 | |
| 78 | extern void (*enable_irq)(unsigned int); |
| 79 | extern void (*disable_irq)(unsigned int); |
Al Viro | 00fc00d | 2006-01-18 21:22:55 -0500 | [diff] [blame] | 80 | #define disable_irq_nosync disable_irq |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | |
| 82 | struct pt_regs; |
| 83 | |
| 84 | extern int cpu_request_irq(unsigned int, |
Roman Zippel | b5dc784 | 2006-06-25 05:47:00 -0700 | [diff] [blame^] | 85 | int (*)(int, void *, struct pt_regs *), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | unsigned long, const char *, void *); |
| 87 | extern void cpu_free_irq(unsigned int, void *); |
| 88 | |
| 89 | /* |
| 90 | * various flags for request_irq() - the Amiga now uses the standard |
| 91 | * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ |
| 92 | * are your friends. |
| 93 | */ |
| 94 | #ifndef MACH_AMIGA_ONLY |
| 95 | #define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */ |
| 96 | #define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */ |
| 97 | #define IRQ_FLG_FAST (0x0004) |
| 98 | #define IRQ_FLG_SLOW (0x0008) |
| 99 | #define IRQ_FLG_STD (0x8000) /* internally used */ |
| 100 | #endif |
| 101 | |
| 102 | /* |
| 103 | * This structure is used to chain together the ISRs for a particular |
| 104 | * interrupt source (if it supports chaining). |
| 105 | */ |
| 106 | typedef struct irq_node { |
Roman Zippel | b5dc784 | 2006-06-25 05:47:00 -0700 | [diff] [blame^] | 107 | int (*handler)(int, void *, struct pt_regs *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | void *dev_id; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | struct irq_node *next; |
Roman Zippel | b5dc784 | 2006-06-25 05:47:00 -0700 | [diff] [blame^] | 110 | unsigned long flags; |
| 111 | const char *devname; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | } irq_node_t; |
| 113 | |
| 114 | /* |
| 115 | * This structure has only 4 elements for speed reasons |
| 116 | */ |
| 117 | typedef struct irq_handler { |
Roman Zippel | b5dc784 | 2006-06-25 05:47:00 -0700 | [diff] [blame^] | 118 | int (*handler)(int, void *, struct pt_regs *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | unsigned long flags; |
| 120 | void *dev_id; |
| 121 | const char *devname; |
| 122 | } irq_handler_t; |
| 123 | |
Roman Zippel | b5dc784 | 2006-06-25 05:47:00 -0700 | [diff] [blame^] | 124 | struct irq_controller { |
| 125 | const char *name; |
| 126 | spinlock_t lock; |
| 127 | int (*startup)(unsigned int irq); |
| 128 | void (*shutdown)(unsigned int irq); |
| 129 | void (*enable)(unsigned int irq); |
| 130 | void (*disable)(unsigned int irq); |
| 131 | }; |
| 132 | |
| 133 | extern int m68k_irq_startup(unsigned int); |
| 134 | extern void m68k_irq_shutdown(unsigned int); |
| 135 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | /* count of spurious interrupts */ |
| 137 | extern volatile unsigned int num_spurious; |
| 138 | |
| 139 | /* |
| 140 | * This function returns a new irq_node_t |
| 141 | */ |
| 142 | extern irq_node_t *new_irq_node(void); |
| 143 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | #endif /* _M68K_IRQ_H_ */ |