blob: 325c86f8512d08b50e9dd9e3ed049c1bd975b93a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _M68K_IRQ_H_
2#define _M68K_IRQ_H_
3
4#include <linux/config.h>
5#include <linux/interrupt.h>
6
7/*
8 * # of m68k interrupts
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 Viro85b07cd2006-01-12 01:06:10 -080026 * 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 Torvalds1da177e2005-04-16 15:20:36 -070035 * 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
44#define IRQ1 (1) /* level 1 interrupt */
45#define IRQ2 (2) /* level 2 interrupt */
46#define IRQ3 (3) /* level 3 interrupt */
47#define IRQ4 (4) /* level 4 interrupt */
48#define IRQ5 (5) /* level 5 interrupt */
49#define IRQ6 (6) /* level 6 interrupt */
50#define IRQ7 (7) /* level 7 interrupt (non-maskable) */
51
52/*
53 * "Generic" interrupt sources
54 */
55
56#define IRQ_SCHED_TIMER (8) /* interrupt source for scheduling timer */
57
58static __inline__ int irq_canonicalize(int irq)
59{
60 return irq;
61}
62
63/*
64 * Machine specific interrupt sources.
65 *
66 * Adding an interrupt service routine for a source with this bit
67 * set indicates a special machine specific interrupt source.
68 * The machine specific files define these sources.
69 *
70 * The IRQ_MACHSPEC bit is now gone - the only thing it did was to
71 * introduce unnecessary overhead.
72 *
73 * All interrupt handling is actually machine specific so it is better
74 * to use function pointers, as used by the Sparc port, and select the
75 * interrupt handling functions when initializing the kernel. This way
76 * we save some unnecessary overhead at run-time.
77 * 01/11/97 - Jes
78 */
79
80extern void (*enable_irq)(unsigned int);
81extern void (*disable_irq)(unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070082#define enable_irq_nosync enable_irq
83
84struct pt_regs;
85
86extern int cpu_request_irq(unsigned int,
87 irqreturn_t (*)(int, void *, struct pt_regs *),
88 unsigned long, const char *, void *);
89extern void cpu_free_irq(unsigned int, void *);
90
91/*
92 * various flags for request_irq() - the Amiga now uses the standard
93 * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ
94 * are your friends.
95 */
96#ifndef MACH_AMIGA_ONLY
97#define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */
98#define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */
99#define IRQ_FLG_FAST (0x0004)
100#define IRQ_FLG_SLOW (0x0008)
101#define IRQ_FLG_STD (0x8000) /* internally used */
102#endif
103
104/*
105 * This structure is used to chain together the ISRs for a particular
106 * interrupt source (if it supports chaining).
107 */
108typedef struct irq_node {
109 irqreturn_t (*handler)(int, void *, struct pt_regs *);
110 unsigned long flags;
111 void *dev_id;
112 const char *devname;
113 struct irq_node *next;
114} irq_node_t;
115
116/*
117 * This structure has only 4 elements for speed reasons
118 */
119typedef struct irq_handler {
120 irqreturn_t (*handler)(int, void *, struct pt_regs *);
121 unsigned long flags;
122 void *dev_id;
123 const char *devname;
124} irq_handler_t;
125
126/* count of spurious interrupts */
127extern volatile unsigned int num_spurious;
128
129/*
130 * This function returns a new irq_node_t
131 */
132extern irq_node_t *new_irq_node(void);
133
134struct irqaction;
135struct pt_regs;
136int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
137
138#endif /* _M68K_IRQ_H_ */