162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _M68K_IRQ_H_
362306a36Sopenharmony_ci#define _M68K_IRQ_H_
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci/*
662306a36Sopenharmony_ci * This should be the same as the max(NUM_X_SOURCES) for all the
762306a36Sopenharmony_ci * different m68k hosts compiled into the kernel.
862306a36Sopenharmony_ci * Currently the Atari has 72 and the Amiga 24, but if both are
962306a36Sopenharmony_ci * supported in the kernel it is better to make room for 72.
1062306a36Sopenharmony_ci * With EtherNAT add-on card on Atari, the highest interrupt
1162306a36Sopenharmony_ci * number is 140 so NR_IRQS needs to be 141.
1262306a36Sopenharmony_ci */
1362306a36Sopenharmony_ci#if defined(CONFIG_COLDFIRE)
1462306a36Sopenharmony_ci#define NR_IRQS 256
1562306a36Sopenharmony_ci#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || \
1662306a36Sopenharmony_ci      defined(CONFIG_SUN3X) || defined(CONFIG_VIRT)
1762306a36Sopenharmony_ci#define NR_IRQS 200
1862306a36Sopenharmony_ci#elif defined(CONFIG_ATARI)
1962306a36Sopenharmony_ci#define NR_IRQS 141
2062306a36Sopenharmony_ci#elif defined(CONFIG_MAC)
2162306a36Sopenharmony_ci#define NR_IRQS 72
2262306a36Sopenharmony_ci#elif defined(CONFIG_Q40)
2362306a36Sopenharmony_ci#define NR_IRQS	43
2462306a36Sopenharmony_ci#elif defined(CONFIG_AMIGA) || !defined(CONFIG_MMU)
2562306a36Sopenharmony_ci#define NR_IRQS	32
2662306a36Sopenharmony_ci#elif defined(CONFIG_APOLLO)
2762306a36Sopenharmony_ci#define NR_IRQS	24
2862306a36Sopenharmony_ci#elif defined(CONFIG_HP300)
2962306a36Sopenharmony_ci#define NR_IRQS	8
3062306a36Sopenharmony_ci#else
3162306a36Sopenharmony_ci#define NR_IRQS	0
3262306a36Sopenharmony_ci#endif
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#if defined(CONFIG_M68020) || defined(CONFIG_M68030) || \
3562306a36Sopenharmony_ci    defined(CONFIG_M68040) || defined(CONFIG_M68060)
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/*
3862306a36Sopenharmony_ci * Interrupt source definitions
3962306a36Sopenharmony_ci * General interrupt sources are the level 1-7.
4062306a36Sopenharmony_ci * Adding an interrupt service routine for one of these sources
4162306a36Sopenharmony_ci * results in the addition of that routine to a chain of routines.
4262306a36Sopenharmony_ci * Each one is called in succession.  Each individual interrupt
4362306a36Sopenharmony_ci * service routine should determine if the device associated with
4462306a36Sopenharmony_ci * that routine requires service.
4562306a36Sopenharmony_ci */
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define IRQ_SPURIOUS	0
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci#define IRQ_AUTO_1	1	/* level 1 interrupt */
5062306a36Sopenharmony_ci#define IRQ_AUTO_2	2	/* level 2 interrupt */
5162306a36Sopenharmony_ci#define IRQ_AUTO_3	3	/* level 3 interrupt */
5262306a36Sopenharmony_ci#define IRQ_AUTO_4	4	/* level 4 interrupt */
5362306a36Sopenharmony_ci#define IRQ_AUTO_5	5	/* level 5 interrupt */
5462306a36Sopenharmony_ci#define IRQ_AUTO_6	6	/* level 6 interrupt */
5562306a36Sopenharmony_ci#define IRQ_AUTO_7	7	/* level 7 interrupt (non-maskable) */
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define IRQ_USER	8
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_cistruct irq_data;
6062306a36Sopenharmony_cistruct irq_chip;
6162306a36Sopenharmony_cistruct irq_desc;
6262306a36Sopenharmony_ciextern unsigned int m68k_irq_startup(struct irq_data *data);
6362306a36Sopenharmony_ciextern unsigned int m68k_irq_startup_irq(unsigned int irq);
6462306a36Sopenharmony_ciextern void m68k_irq_shutdown(struct irq_data *data);
6562306a36Sopenharmony_ciextern void m68k_setup_auto_interrupt(void (*handler)(unsigned int,
6662306a36Sopenharmony_ci						      struct pt_regs *));
6762306a36Sopenharmony_ciextern void m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt);
6862306a36Sopenharmony_ciextern void m68k_setup_irq_controller(struct irq_chip *,
6962306a36Sopenharmony_ci				      void (*handle)(struct irq_desc *desc),
7062306a36Sopenharmony_ci				      unsigned int irq, unsigned int cnt);
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ciextern unsigned int irq_canonicalize(unsigned int irq);
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#else
7562306a36Sopenharmony_ci#define irq_canonicalize(irq)  (irq)
7662306a36Sopenharmony_ci#endif /* !(CONFIG_M68020 || CONFIG_M68030 || CONFIG_M68040 || CONFIG_M68060) */
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciasmlinkage void do_IRQ(int irq, struct pt_regs *regs);
7962306a36Sopenharmony_ciextern atomic_t irq_err_count;
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci#endif /* _M68K_IRQ_H_ */
82