xref: /linux-6.15/arch/m68k/kernel/ints.c (revision e8abf5e7)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * linux/arch/m68k/kernel/ints.c -- Linux/m68k general interrupt handling code
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * This file is subject to the terms and conditions of the GNU General Public
51da177e4SLinus Torvalds  * License.  See the file COPYING in the main directory of this archive
61da177e4SLinus Torvalds  * for more details.
71da177e4SLinus Torvalds  *
81da177e4SLinus Torvalds  * 07/03/96: Timer initialization, and thus mach_sched_init(),
91da177e4SLinus Torvalds  *           removed from request_irq() and moved to init_time().
101da177e4SLinus Torvalds  *           We should therefore consider renaming our add_isr() and
111da177e4SLinus Torvalds  *           remove_isr() to request_irq() and free_irq()
121da177e4SLinus Torvalds  *           respectively, so they are compliant with the other
131da177e4SLinus Torvalds  *           architectures.                                     /Jes
141da177e4SLinus Torvalds  * 11/07/96: Changed all add_/remove_isr() to request_/free_irq() calls.
151da177e4SLinus Torvalds  *           Removed irq list support, if any machine needs an irq server
161da177e4SLinus Torvalds  *           it must implement this itself (as it's already done), instead
171da177e4SLinus Torvalds  *           only default handler are used with mach_default_handler.
181da177e4SLinus Torvalds  *           request_irq got some flags different from other architectures:
191da177e4SLinus Torvalds  *           - IRQ_FLG_REPLACE : Replace an existing handler (the default one
201da177e4SLinus Torvalds  *                               can be replaced without this flag)
211da177e4SLinus Torvalds  *           - IRQ_FLG_LOCK : handler can't be replaced
221da177e4SLinus Torvalds  *           There are other machine depending flags, see there
231da177e4SLinus Torvalds  *           If you want to replace a default handler you should know what
241da177e4SLinus Torvalds  *           you're doing, since it might handle different other irq sources
251da177e4SLinus Torvalds  *           which must be served                               /Roman Zippel
261da177e4SLinus Torvalds  */
271da177e4SLinus Torvalds 
281da177e4SLinus Torvalds #include <linux/module.h>
291da177e4SLinus Torvalds #include <linux/types.h>
301da177e4SLinus Torvalds #include <linux/sched.h>
316168a702SAndrew Morton #include <linux/interrupt.h>
321da177e4SLinus Torvalds #include <linux/kernel_stat.h>
331da177e4SLinus Torvalds #include <linux/errno.h>
341da177e4SLinus Torvalds #include <linux/init.h>
351da177e4SLinus Torvalds 
361da177e4SLinus Torvalds #include <asm/setup.h>
371da177e4SLinus Torvalds #include <asm/system.h>
381da177e4SLinus Torvalds #include <asm/irq.h>
391da177e4SLinus Torvalds #include <asm/traps.h>
401da177e4SLinus Torvalds #include <asm/page.h>
411da177e4SLinus Torvalds #include <asm/machdep.h>
4268387c44SRoman Zippel #include <asm/cacheflush.h>
432850bc27SAl Viro #include <asm/irq_regs.h>
441da177e4SLinus Torvalds 
451da177e4SLinus Torvalds #ifdef CONFIG_Q40
461da177e4SLinus Torvalds #include <asm/q40ints.h>
471da177e4SLinus Torvalds #endif
481da177e4SLinus Torvalds 
4968387c44SRoman Zippel extern u32 auto_irqhandler_fixup[];
5068387c44SRoman Zippel extern u32 user_irqhandler_fixup[];
5168387c44SRoman Zippel extern u16 user_irqvec_fixup[];
5268387c44SRoman Zippel 
531da177e4SLinus Torvalds /* table for system interrupt handlers */
546549d537SGeert Uytterhoeven static struct irq_data *irq_list[NR_IRQS];
55c288bf25SGeert Uytterhoeven static struct irq_chip *irq_chip[NR_IRQS];
5668387c44SRoman Zippel static int irq_depth[NR_IRQS];
5768387c44SRoman Zippel 
5868387c44SRoman Zippel static int m68k_first_user_vec;
59b5dc7840SRoman Zippel 
60c288bf25SGeert Uytterhoeven static struct irq_chip auto_irq_chip = {
61b5dc7840SRoman Zippel 	.name		= "auto",
62c288bf25SGeert Uytterhoeven 	.irq_startup	= m68k_irq_startup,
63c288bf25SGeert Uytterhoeven 	.irq_shutdown	= m68k_irq_shutdown,
64b5dc7840SRoman Zippel };
651da177e4SLinus Torvalds 
66c288bf25SGeert Uytterhoeven static struct irq_chip user_irq_chip = {
6768387c44SRoman Zippel 	.name		= "user",
68c288bf25SGeert Uytterhoeven 	.irq_startup	= m68k_irq_startup,
69c288bf25SGeert Uytterhoeven 	.irq_shutdown	= m68k_irq_shutdown,
701da177e4SLinus Torvalds };
711da177e4SLinus Torvalds 
721da177e4SLinus Torvalds #define NUM_IRQ_NODES 100
736549d537SGeert Uytterhoeven static struct irq_data nodes[NUM_IRQ_NODES];
741da177e4SLinus Torvalds 
751da177e4SLinus Torvalds /*
761da177e4SLinus Torvalds  * void init_IRQ(void)
771da177e4SLinus Torvalds  *
781da177e4SLinus Torvalds  * Parameters:	None
791da177e4SLinus Torvalds  *
801da177e4SLinus Torvalds  * Returns:	Nothing
811da177e4SLinus Torvalds  *
821da177e4SLinus Torvalds  * This function should be called during kernel startup to initialize
831da177e4SLinus Torvalds  * the IRQ handling routines.
841da177e4SLinus Torvalds  */
851da177e4SLinus Torvalds 
861da177e4SLinus Torvalds void __init init_IRQ(void)
871da177e4SLinus Torvalds {
881da177e4SLinus Torvalds 	int i;
891da177e4SLinus Torvalds 
906d2f16a8SRoman Zippel 	/* assembly irq entry code relies on this... */
916d2f16a8SRoman Zippel 	if (HARDIRQ_MASK != 0x00ff0000) {
926d2f16a8SRoman Zippel 		extern void hardirq_mask_is_broken(void);
936d2f16a8SRoman Zippel 		hardirq_mask_is_broken();
946d2f16a8SRoman Zippel 	}
956d2f16a8SRoman Zippel 
9668387c44SRoman Zippel 	for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++)
97c288bf25SGeert Uytterhoeven 		irq_chip[i] = &auto_irq_chip;
981da177e4SLinus Torvalds 
991da177e4SLinus Torvalds 	mach_init_IRQ();
1001da177e4SLinus Torvalds }
1011da177e4SLinus Torvalds 
10268387c44SRoman Zippel /**
10368387c44SRoman Zippel  * m68k_setup_auto_interrupt
10468387c44SRoman Zippel  * @handler: called from auto vector interrupts
10568387c44SRoman Zippel  *
10668387c44SRoman Zippel  * setup the handler to be called from auto vector interrupts instead of the
1072850bc27SAl Viro  * standard __m68k_handle_int(), it will be called with irq numbers in the range
10868387c44SRoman Zippel  * from IRQ_AUTO_1 - IRQ_AUTO_7.
10968387c44SRoman Zippel  */
11068387c44SRoman Zippel void __init m68k_setup_auto_interrupt(void (*handler)(unsigned int, struct pt_regs *))
11168387c44SRoman Zippel {
11268387c44SRoman Zippel 	if (handler)
11368387c44SRoman Zippel 		*auto_irqhandler_fixup = (u32)handler;
11468387c44SRoman Zippel 	flush_icache();
11568387c44SRoman Zippel }
11668387c44SRoman Zippel 
11768387c44SRoman Zippel /**
11868387c44SRoman Zippel  * m68k_setup_user_interrupt
11968387c44SRoman Zippel  * @vec: first user vector interrupt to handle
12068387c44SRoman Zippel  * @cnt: number of active user vector interrupts
12168387c44SRoman Zippel  * @handler: called from user vector interrupts
12268387c44SRoman Zippel  *
12368387c44SRoman Zippel  * setup user vector interrupts, this includes activating the specified range
12468387c44SRoman Zippel  * of interrupts, only then these interrupts can be requested (note: this is
12568387c44SRoman Zippel  * different from auto vector interrupts). An optional handler can be installed
1262850bc27SAl Viro  * to be called instead of the default __m68k_handle_int(), it will be called
12768387c44SRoman Zippel  * with irq numbers starting from IRQ_USER.
12868387c44SRoman Zippel  */
12968387c44SRoman Zippel void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
13068387c44SRoman Zippel 				      void (*handler)(unsigned int, struct pt_regs *))
13168387c44SRoman Zippel {
13268387c44SRoman Zippel 	int i;
13368387c44SRoman Zippel 
13427123cbcSGeert Uytterhoeven 	BUG_ON(IRQ_USER + cnt > NR_IRQS);
13568387c44SRoman Zippel 	m68k_first_user_vec = vec;
13668387c44SRoman Zippel 	for (i = 0; i < cnt; i++)
137c288bf25SGeert Uytterhoeven 		irq_chip[IRQ_USER + i] = &user_irq_chip;
13868387c44SRoman Zippel 	*user_irqvec_fixup = vec - IRQ_USER;
13968387c44SRoman Zippel 	if (handler)
14068387c44SRoman Zippel 		*user_irqhandler_fixup = (u32)handler;
14168387c44SRoman Zippel 	flush_icache();
14268387c44SRoman Zippel }
14368387c44SRoman Zippel 
14468387c44SRoman Zippel /**
145c288bf25SGeert Uytterhoeven  * m68k_setup_irq_chip
14668387c44SRoman Zippel  * @contr: irq controller which controls specified irq
14768387c44SRoman Zippel  * @irq: first irq to be managed by the controller
14868387c44SRoman Zippel  *
14968387c44SRoman Zippel  * Change the controller for the specified range of irq, which will be used to
15068387c44SRoman Zippel  * manage these irq. auto/user irq already have a default controller, which can
15168387c44SRoman Zippel  * be changed as well, but the controller probably should use m68k_irq_startup/
15268387c44SRoman Zippel  * m68k_irq_shutdown.
15368387c44SRoman Zippel  */
154c288bf25SGeert Uytterhoeven void m68k_setup_irq_chip(struct irq_chip *contr, unsigned int irq,
15568387c44SRoman Zippel 			       unsigned int cnt)
15668387c44SRoman Zippel {
15768387c44SRoman Zippel 	int i;
15868387c44SRoman Zippel 
15968387c44SRoman Zippel 	for (i = 0; i < cnt; i++)
160c288bf25SGeert Uytterhoeven 		irq_chip[irq + i] = contr;
16168387c44SRoman Zippel }
16268387c44SRoman Zippel 
1636549d537SGeert Uytterhoeven struct irq_data *new_irq_node(void)
1641da177e4SLinus Torvalds {
1656549d537SGeert Uytterhoeven 	struct irq_data *node;
1661da177e4SLinus Torvalds 	short i;
1671da177e4SLinus Torvalds 
168b5dc7840SRoman Zippel 	for (node = nodes, i = NUM_IRQ_NODES-1; i >= 0; node++, i--) {
169b5dc7840SRoman Zippel 		if (!node->handler) {
170b5dc7840SRoman Zippel 			memset(node, 0, sizeof(*node));
1711da177e4SLinus Torvalds 			return node;
172b5dc7840SRoman Zippel 		}
173b5dc7840SRoman Zippel 	}
1741da177e4SLinus Torvalds 
1751da177e4SLinus Torvalds 	printk ("new_irq_node: out of nodes\n");
1761da177e4SLinus Torvalds 	return NULL;
1771da177e4SLinus Torvalds }
1781da177e4SLinus Torvalds 
1796549d537SGeert Uytterhoeven int setup_irq(unsigned int irq, struct irq_data *node)
180b5dc7840SRoman Zippel {
181c288bf25SGeert Uytterhoeven 	struct irq_chip *contr;
1826549d537SGeert Uytterhoeven 	struct irq_data **prev;
183b5dc7840SRoman Zippel 	unsigned long flags;
184b5dc7840SRoman Zippel 
185c288bf25SGeert Uytterhoeven 	if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
186b5dc7840SRoman Zippel 		printk("%s: Incorrect IRQ %d from %s\n",
187f85e7cdcSHarvey Harrison 		       __func__, irq, node->devname);
188b5dc7840SRoman Zippel 		return -ENXIO;
189b5dc7840SRoman Zippel 	}
190b5dc7840SRoman Zippel 
191c288bf25SGeert Uytterhoeven 	local_irq_save(flags);
192b5dc7840SRoman Zippel 
193b5dc7840SRoman Zippel 	prev = irq_list + irq;
194b5dc7840SRoman Zippel 	if (*prev) {
195b5dc7840SRoman Zippel 		/* Can't share interrupts unless both agree to */
196b0b9fdc1SThomas Gleixner 		if (!((*prev)->flags & node->flags & IRQF_SHARED)) {
197c288bf25SGeert Uytterhoeven 			local_irq_restore(flags);
198b5dc7840SRoman Zippel 			return -EBUSY;
199b5dc7840SRoman Zippel 		}
200b5dc7840SRoman Zippel 		while (*prev)
201b5dc7840SRoman Zippel 			prev = &(*prev)->next;
202b5dc7840SRoman Zippel 	}
203b5dc7840SRoman Zippel 
204b5dc7840SRoman Zippel 	if (!irq_list[irq]) {
205c288bf25SGeert Uytterhoeven 		if (contr->irq_startup)
206*e8abf5e7SGeert Uytterhoeven 			contr->irq_startup(node);
207b5dc7840SRoman Zippel 		else
208*e8abf5e7SGeert Uytterhoeven 			contr->irq_enable(node);
209b5dc7840SRoman Zippel 	}
210b5dc7840SRoman Zippel 	node->next = NULL;
211b5dc7840SRoman Zippel 	*prev = node;
212b5dc7840SRoman Zippel 
213c288bf25SGeert Uytterhoeven 	local_irq_restore(flags);
214b5dc7840SRoman Zippel 
215b5dc7840SRoman Zippel 	return 0;
216b5dc7840SRoman Zippel }
217b5dc7840SRoman Zippel 
21868387c44SRoman Zippel int request_irq(unsigned int irq,
21940220c1aSDavid Howells 		irq_handler_t handler,
2201da177e4SLinus Torvalds 		unsigned long flags, const char *devname, void *dev_id)
2211da177e4SLinus Torvalds {
2226549d537SGeert Uytterhoeven 	struct irq_data *node;
223b5dc7840SRoman Zippel 	int res;
2241da177e4SLinus Torvalds 
225b5dc7840SRoman Zippel 	node = new_irq_node();
226b5dc7840SRoman Zippel 	if (!node)
227b5dc7840SRoman Zippel 		return -ENOMEM;
2281da177e4SLinus Torvalds 
2296549d537SGeert Uytterhoeven 	node->irq     = irq;
230b5dc7840SRoman Zippel 	node->handler = handler;
231b5dc7840SRoman Zippel 	node->flags   = flags;
232b5dc7840SRoman Zippel 	node->dev_id  = dev_id;
233b5dc7840SRoman Zippel 	node->devname = devname;
234b5dc7840SRoman Zippel 
235b5dc7840SRoman Zippel 	res = setup_irq(irq, node);
236b5dc7840SRoman Zippel 	if (res)
237b5dc7840SRoman Zippel 		node->handler = NULL;
238b5dc7840SRoman Zippel 
239b5dc7840SRoman Zippel 	return res;
2401da177e4SLinus Torvalds }
2411da177e4SLinus Torvalds 
24268387c44SRoman Zippel EXPORT_SYMBOL(request_irq);
24368387c44SRoman Zippel 
24468387c44SRoman Zippel void free_irq(unsigned int irq, void *dev_id)
2451da177e4SLinus Torvalds {
246c288bf25SGeert Uytterhoeven 	struct irq_chip *contr;
2476549d537SGeert Uytterhoeven 	struct irq_data **p, *node;
248b5dc7840SRoman Zippel 	unsigned long flags;
249b5dc7840SRoman Zippel 
250c288bf25SGeert Uytterhoeven 	if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
251f85e7cdcSHarvey Harrison 		printk("%s: Incorrect IRQ %d\n", __func__, irq);
2521da177e4SLinus Torvalds 		return;
2531da177e4SLinus Torvalds 	}
2541da177e4SLinus Torvalds 
255c288bf25SGeert Uytterhoeven 	local_irq_save(flags);
2561da177e4SLinus Torvalds 
257b5dc7840SRoman Zippel 	p = irq_list + irq;
258b5dc7840SRoman Zippel 	while ((node = *p)) {
259b5dc7840SRoman Zippel 		if (node->dev_id == dev_id)
260b5dc7840SRoman Zippel 			break;
261b5dc7840SRoman Zippel 		p = &node->next;
2621da177e4SLinus Torvalds 	}
2631da177e4SLinus Torvalds 
264b5dc7840SRoman Zippel 	if (node) {
265b5dc7840SRoman Zippel 		*p = node->next;
266b5dc7840SRoman Zippel 		node->handler = NULL;
267b5dc7840SRoman Zippel 	} else
268b5dc7840SRoman Zippel 		printk("%s: Removing probably wrong IRQ %d\n",
269f85e7cdcSHarvey Harrison 		       __func__, irq);
270b5dc7840SRoman Zippel 
27168387c44SRoman Zippel 	if (!irq_list[irq]) {
272c288bf25SGeert Uytterhoeven 		if (contr->irq_shutdown)
273*e8abf5e7SGeert Uytterhoeven 			contr->irq_shutdown(node);
27468387c44SRoman Zippel 		else
275*e8abf5e7SGeert Uytterhoeven 			contr->irq_disable(node);
27668387c44SRoman Zippel 	}
277b5dc7840SRoman Zippel 
278c288bf25SGeert Uytterhoeven 	local_irq_restore(flags);
279b5dc7840SRoman Zippel }
280b5dc7840SRoman Zippel 
28168387c44SRoman Zippel EXPORT_SYMBOL(free_irq);
28268387c44SRoman Zippel 
28368387c44SRoman Zippel void enable_irq(unsigned int irq)
28468387c44SRoman Zippel {
285c288bf25SGeert Uytterhoeven 	struct irq_chip *contr;
28668387c44SRoman Zippel 	unsigned long flags;
28768387c44SRoman Zippel 
288c288bf25SGeert Uytterhoeven 	if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
28968387c44SRoman Zippel 		printk("%s: Incorrect IRQ %d\n",
290f85e7cdcSHarvey Harrison 		       __func__, irq);
29168387c44SRoman Zippel 		return;
29268387c44SRoman Zippel 	}
29368387c44SRoman Zippel 
294c288bf25SGeert Uytterhoeven 	local_irq_save(flags);
29568387c44SRoman Zippel 	if (irq_depth[irq]) {
29668387c44SRoman Zippel 		if (!--irq_depth[irq]) {
297c288bf25SGeert Uytterhoeven 			if (contr->irq_enable)
298*e8abf5e7SGeert Uytterhoeven 				contr->irq_enable(irq_list[irq]);
29968387c44SRoman Zippel 		}
30068387c44SRoman Zippel 	} else
30168387c44SRoman Zippel 		WARN_ON(1);
302c288bf25SGeert Uytterhoeven 	local_irq_restore(flags);
30368387c44SRoman Zippel }
30468387c44SRoman Zippel 
30568387c44SRoman Zippel EXPORT_SYMBOL(enable_irq);
30668387c44SRoman Zippel 
30768387c44SRoman Zippel void disable_irq(unsigned int irq)
30868387c44SRoman Zippel {
309c288bf25SGeert Uytterhoeven 	struct irq_chip *contr;
31068387c44SRoman Zippel 	unsigned long flags;
31168387c44SRoman Zippel 
312c288bf25SGeert Uytterhoeven 	if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
31368387c44SRoman Zippel 		printk("%s: Incorrect IRQ %d\n",
314f85e7cdcSHarvey Harrison 		       __func__, irq);
31568387c44SRoman Zippel 		return;
31668387c44SRoman Zippel 	}
31768387c44SRoman Zippel 
318c288bf25SGeert Uytterhoeven 	local_irq_save(flags);
31968387c44SRoman Zippel 	if (!irq_depth[irq]++) {
320c288bf25SGeert Uytterhoeven 		if (contr->irq_disable)
321*e8abf5e7SGeert Uytterhoeven 			contr->irq_disable(irq_list[irq]);
32268387c44SRoman Zippel 	}
323c288bf25SGeert Uytterhoeven 	local_irq_restore(flags);
32468387c44SRoman Zippel }
32568387c44SRoman Zippel 
32668387c44SRoman Zippel EXPORT_SYMBOL(disable_irq);
32768387c44SRoman Zippel 
328e9ed7e72SAl Viro void disable_irq_nosync(unsigned int irq) __attribute__((alias("disable_irq")));
329e9ed7e72SAl Viro 
330e9ed7e72SAl Viro EXPORT_SYMBOL(disable_irq_nosync);
331e9ed7e72SAl Viro 
332*e8abf5e7SGeert Uytterhoeven unsigned int m68k_irq_startup_irq(unsigned int irq)
333b5dc7840SRoman Zippel {
334b5dc7840SRoman Zippel 	if (irq <= IRQ_AUTO_7)
335b5dc7840SRoman Zippel 		vectors[VEC_SPUR + irq] = auto_inthandler;
33668387c44SRoman Zippel 	else
33768387c44SRoman Zippel 		vectors[m68k_first_user_vec + irq - IRQ_USER] = user_inthandler;
338b5dc7840SRoman Zippel 	return 0;
339b5dc7840SRoman Zippel }
340b5dc7840SRoman Zippel 
341*e8abf5e7SGeert Uytterhoeven unsigned int m68k_irq_startup(struct irq_data *data)
342b5dc7840SRoman Zippel {
343*e8abf5e7SGeert Uytterhoeven 	return m68k_irq_startup_irq(data->irq);
344*e8abf5e7SGeert Uytterhoeven }
345*e8abf5e7SGeert Uytterhoeven 
346*e8abf5e7SGeert Uytterhoeven void m68k_irq_shutdown(struct irq_data *data)
347*e8abf5e7SGeert Uytterhoeven {
348*e8abf5e7SGeert Uytterhoeven 	unsigned int irq = data->irq;
349*e8abf5e7SGeert Uytterhoeven 
350b5dc7840SRoman Zippel 	if (irq <= IRQ_AUTO_7)
351b5dc7840SRoman Zippel 		vectors[VEC_SPUR + irq] = bad_inthandler;
35268387c44SRoman Zippel 	else
35368387c44SRoman Zippel 		vectors[m68k_first_user_vec + irq - IRQ_USER] = bad_inthandler;
354b5dc7840SRoman Zippel }
355b5dc7840SRoman Zippel 
356b5dc7840SRoman Zippel 
3571da177e4SLinus Torvalds /*
3581da177e4SLinus Torvalds  * Do we need these probe functions on the m68k?
3591da177e4SLinus Torvalds  *
3601da177e4SLinus Torvalds  *  ... may be useful with ISA devices
3611da177e4SLinus Torvalds  */
3621da177e4SLinus Torvalds unsigned long probe_irq_on (void)
3631da177e4SLinus Torvalds {
3641da177e4SLinus Torvalds #ifdef CONFIG_Q40
3651da177e4SLinus Torvalds 	if (MACH_IS_Q40)
3661da177e4SLinus Torvalds 		return q40_probe_irq_on();
3671da177e4SLinus Torvalds #endif
3681da177e4SLinus Torvalds 	return 0;
3691da177e4SLinus Torvalds }
3701da177e4SLinus Torvalds 
3711da177e4SLinus Torvalds EXPORT_SYMBOL(probe_irq_on);
3721da177e4SLinus Torvalds 
3731da177e4SLinus Torvalds int probe_irq_off (unsigned long irqs)
3741da177e4SLinus Torvalds {
3751da177e4SLinus Torvalds #ifdef CONFIG_Q40
3761da177e4SLinus Torvalds 	if (MACH_IS_Q40)
3771da177e4SLinus Torvalds 		return q40_probe_irq_off(irqs);
3781da177e4SLinus Torvalds #endif
3791da177e4SLinus Torvalds 	return 0;
3801da177e4SLinus Torvalds }
3811da177e4SLinus Torvalds 
3821da177e4SLinus Torvalds EXPORT_SYMBOL(probe_irq_off);
3831da177e4SLinus Torvalds 
38468387c44SRoman Zippel unsigned int irq_canonicalize(unsigned int irq)
3851da177e4SLinus Torvalds {
38668387c44SRoman Zippel #ifdef CONFIG_Q40
38768387c44SRoman Zippel 	if (MACH_IS_Q40 && irq == 11)
38868387c44SRoman Zippel 		irq = 10;
38968387c44SRoman Zippel #endif
39068387c44SRoman Zippel 	return irq;
3911da177e4SLinus Torvalds }
3921da177e4SLinus Torvalds 
39368387c44SRoman Zippel EXPORT_SYMBOL(irq_canonicalize);
3941da177e4SLinus Torvalds 
3952850bc27SAl Viro asmlinkage void m68k_handle_int(unsigned int irq)
3961da177e4SLinus Torvalds {
3976549d537SGeert Uytterhoeven 	struct irq_data *node;
39892445eaaSRoman Zippel 	kstat_cpu(0).irqs[irq]++;
399b5dc7840SRoman Zippel 	node = irq_list[irq];
400b5dc7840SRoman Zippel 	do {
4012850bc27SAl Viro 		node->handler(irq, node->dev_id);
402b5dc7840SRoman Zippel 		node = node->next;
403b5dc7840SRoman Zippel 	} while (node);
4041da177e4SLinus Torvalds }
40592445eaaSRoman Zippel 
4062850bc27SAl Viro asmlinkage void __m68k_handle_int(unsigned int irq, struct pt_regs *regs)
4072850bc27SAl Viro {
4082850bc27SAl Viro 	struct pt_regs *old_regs;
4092850bc27SAl Viro 	old_regs = set_irq_regs(regs);
4102850bc27SAl Viro 	m68k_handle_int(irq);
4112850bc27SAl Viro 	set_irq_regs(old_regs);
4122850bc27SAl Viro }
4132850bc27SAl Viro 
41492445eaaSRoman Zippel asmlinkage void handle_badint(struct pt_regs *regs)
41592445eaaSRoman Zippel {
41692445eaaSRoman Zippel 	kstat_cpu(0).irqs[0]++;
41792445eaaSRoman Zippel 	printk("unexpected interrupt from %u\n", regs->vector);
4181da177e4SLinus Torvalds }
4191da177e4SLinus Torvalds 
4201da177e4SLinus Torvalds int show_interrupts(struct seq_file *p, void *v)
4211da177e4SLinus Torvalds {
422c288bf25SGeert Uytterhoeven 	struct irq_chip *contr;
4236549d537SGeert Uytterhoeven 	struct irq_data *node;
4241da177e4SLinus Torvalds 	int i = *(loff_t *) v;
4251da177e4SLinus Torvalds 
4261da177e4SLinus Torvalds 	/* autovector interrupts */
42768387c44SRoman Zippel 	if (irq_list[i]) {
428c288bf25SGeert Uytterhoeven 		contr = irq_chip[i];
429b5dc7840SRoman Zippel 		node = irq_list[i];
43068387c44SRoman Zippel 		seq_printf(p, "%-8s %3u: %10u %s", contr->name, i, kstat_cpu(0).irqs[i], node->devname);
431b5dc7840SRoman Zippel 		while ((node = node->next))
432b5dc7840SRoman Zippel 			seq_printf(p, ", %s", node->devname);
433b5dc7840SRoman Zippel 		seq_puts(p, "\n");
43468387c44SRoman Zippel 	}
4351da177e4SLinus Torvalds 	return 0;
4361da177e4SLinus Torvalds }
4371da177e4SLinus Torvalds 
438da9870e4SGeert Uytterhoeven #ifdef CONFIG_PROC_FS
4391da177e4SLinus Torvalds void init_irq_proc(void)
4401da177e4SLinus Torvalds {
4411da177e4SLinus Torvalds 	/* Insert /proc/irq driver here */
4421da177e4SLinus Torvalds }
443da9870e4SGeert Uytterhoeven #endif
444