18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ASM_SH_IRQ_H
38c2ecf20Sopenharmony_ci#define __ASM_SH_IRQ_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/cpumask.h>
68c2ecf20Sopenharmony_ci#include <asm/machvec.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/*
98c2ecf20Sopenharmony_ci * Only legacy non-sparseirq platforms have to set a reasonably sane
108c2ecf20Sopenharmony_ci * value here. sparseirq platforms allocate their irq_descs on the fly,
118c2ecf20Sopenharmony_ci * so will expand automatically based on the number of registered IRQs.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci#ifdef CONFIG_SPARSE_IRQ
148c2ecf20Sopenharmony_ci# define NR_IRQS		8
158c2ecf20Sopenharmony_ci#else
168c2ecf20Sopenharmony_ci# define NR_IRQS		512
178c2ecf20Sopenharmony_ci#endif
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/*
208c2ecf20Sopenharmony_ci * This is a special IRQ number for indicating that no IRQ has been
218c2ecf20Sopenharmony_ci * triggered and to simply ignore the IRQ dispatch. This is a special
228c2ecf20Sopenharmony_ci * case that can happen with IRQ auto-distribution when multiple CPUs
238c2ecf20Sopenharmony_ci * are woken up and signalled in parallel.
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_ci#define NO_IRQ_IGNORE		((unsigned int)-1)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/*
288c2ecf20Sopenharmony_ci * Simple Mask Register Support
298c2ecf20Sopenharmony_ci */
308c2ecf20Sopenharmony_ciextern void make_maskreg_irq(unsigned int irq);
318c2ecf20Sopenharmony_ciextern unsigned short *irq_mask_register;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/*
348c2ecf20Sopenharmony_ci * PINT IRQs
358c2ecf20Sopenharmony_ci */
368c2ecf20Sopenharmony_civoid init_IRQ_pint(void);
378c2ecf20Sopenharmony_civoid make_imask_irq(unsigned int irq);
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistatic inline int generic_irq_demux(int irq)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci	return irq;
428c2ecf20Sopenharmony_ci}
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define irq_demux(irq)		sh_mv.mv_irq_demux(irq)
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_civoid init_IRQ(void);
478c2ecf20Sopenharmony_civoid migrate_irqs(void);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciasmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs);
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#ifdef CONFIG_IRQSTACKS
528c2ecf20Sopenharmony_ciextern void irq_ctx_init(int cpu);
538c2ecf20Sopenharmony_ciextern void irq_ctx_exit(int cpu);
548c2ecf20Sopenharmony_ci# define __ARCH_HAS_DO_SOFTIRQ
558c2ecf20Sopenharmony_ci#else
568c2ecf20Sopenharmony_ci# define irq_ctx_init(cpu) do { } while (0)
578c2ecf20Sopenharmony_ci# define irq_ctx_exit(cpu) do { } while (0)
588c2ecf20Sopenharmony_ci#endif
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#ifdef CONFIG_INTC_BALANCING
618c2ecf20Sopenharmony_ciextern unsigned int irq_lookup(unsigned int irq);
628c2ecf20Sopenharmony_ciextern void irq_finish(unsigned int irq);
638c2ecf20Sopenharmony_ci#else
648c2ecf20Sopenharmony_ci#define irq_lookup(irq)		(irq)
658c2ecf20Sopenharmony_ci#define irq_finish(irq)		do { } while (0)
668c2ecf20Sopenharmony_ci#endif
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#include <asm-generic/irq.h>
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#endif /* __ASM_SH_IRQ_H */
71