18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _M68K_IRQ_H_
38c2ecf20Sopenharmony_ci#define _M68K_IRQ_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci * This should be the same as the max(NUM_X_SOURCES) for all the
78c2ecf20Sopenharmony_ci * different m68k hosts compiled into the kernel.
88c2ecf20Sopenharmony_ci * Currently the Atari has 72 and the Amiga 24, but if both are
98c2ecf20Sopenharmony_ci * supported in the kernel it is better to make room for 72.
108c2ecf20Sopenharmony_ci * With EtherNAT add-on card on Atari, the highest interrupt
118c2ecf20Sopenharmony_ci * number is 140 so NR_IRQS needs to be 141.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci#if defined(CONFIG_COLDFIRE)
148c2ecf20Sopenharmony_ci#define NR_IRQS 256
158c2ecf20Sopenharmony_ci#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
168c2ecf20Sopenharmony_ci#define NR_IRQS 200
178c2ecf20Sopenharmony_ci#elif defined(CONFIG_ATARI)
188c2ecf20Sopenharmony_ci#define NR_IRQS 141
198c2ecf20Sopenharmony_ci#elif defined(CONFIG_MAC)
208c2ecf20Sopenharmony_ci#define NR_IRQS 72
218c2ecf20Sopenharmony_ci#elif defined(CONFIG_Q40)
228c2ecf20Sopenharmony_ci#define NR_IRQS	43
238c2ecf20Sopenharmony_ci#elif defined(CONFIG_AMIGA) || !defined(CONFIG_MMU)
248c2ecf20Sopenharmony_ci#define NR_IRQS	32
258c2ecf20Sopenharmony_ci#elif defined(CONFIG_APOLLO)
268c2ecf20Sopenharmony_ci#define NR_IRQS	24
278c2ecf20Sopenharmony_ci#elif defined(CONFIG_HP300)
288c2ecf20Sopenharmony_ci#define NR_IRQS	8
298c2ecf20Sopenharmony_ci#else
308c2ecf20Sopenharmony_ci#define NR_IRQS	0
318c2ecf20Sopenharmony_ci#endif
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#if defined(CONFIG_M68020) || defined(CONFIG_M68030) || \
348c2ecf20Sopenharmony_ci    defined(CONFIG_M68040) || defined(CONFIG_M68060)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/*
378c2ecf20Sopenharmony_ci * Interrupt source definitions
388c2ecf20Sopenharmony_ci * General interrupt sources are the level 1-7.
398c2ecf20Sopenharmony_ci * Adding an interrupt service routine for one of these sources
408c2ecf20Sopenharmony_ci * results in the addition of that routine to a chain of routines.
418c2ecf20Sopenharmony_ci * Each one is called in succession.  Each individual interrupt
428c2ecf20Sopenharmony_ci * service routine should determine if the device associated with
438c2ecf20Sopenharmony_ci * that routine requires service.
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define IRQ_SPURIOUS	0
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define IRQ_AUTO_1	1	/* level 1 interrupt */
498c2ecf20Sopenharmony_ci#define IRQ_AUTO_2	2	/* level 2 interrupt */
508c2ecf20Sopenharmony_ci#define IRQ_AUTO_3	3	/* level 3 interrupt */
518c2ecf20Sopenharmony_ci#define IRQ_AUTO_4	4	/* level 4 interrupt */
528c2ecf20Sopenharmony_ci#define IRQ_AUTO_5	5	/* level 5 interrupt */
538c2ecf20Sopenharmony_ci#define IRQ_AUTO_6	6	/* level 6 interrupt */
548c2ecf20Sopenharmony_ci#define IRQ_AUTO_7	7	/* level 7 interrupt (non-maskable) */
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define IRQ_USER	8
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistruct irq_data;
598c2ecf20Sopenharmony_cistruct irq_chip;
608c2ecf20Sopenharmony_cistruct irq_desc;
618c2ecf20Sopenharmony_ciextern unsigned int m68k_irq_startup(struct irq_data *data);
628c2ecf20Sopenharmony_ciextern unsigned int m68k_irq_startup_irq(unsigned int irq);
638c2ecf20Sopenharmony_ciextern void m68k_irq_shutdown(struct irq_data *data);
648c2ecf20Sopenharmony_ciextern void m68k_setup_auto_interrupt(void (*handler)(unsigned int,
658c2ecf20Sopenharmony_ci						      struct pt_regs *));
668c2ecf20Sopenharmony_ciextern void m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt);
678c2ecf20Sopenharmony_ciextern void m68k_setup_irq_controller(struct irq_chip *,
688c2ecf20Sopenharmony_ci				      void (*handle)(struct irq_desc *desc),
698c2ecf20Sopenharmony_ci				      unsigned int irq, unsigned int cnt);
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ciextern unsigned int irq_canonicalize(unsigned int irq);
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#else
748c2ecf20Sopenharmony_ci#define irq_canonicalize(irq)  (irq)
758c2ecf20Sopenharmony_ci#endif /* !(CONFIG_M68020 || CONFIG_M68030 || CONFIG_M68040 || CONFIG_M68060) */
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ciasmlinkage void do_IRQ(int irq, struct pt_regs *regs);
788c2ecf20Sopenharmony_ciextern atomic_t irq_err_count;
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#endif /* _M68K_IRQ_H_ */
81