18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci#ifdef __KERNEL__
38c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_IRQ_H
48c2ecf20Sopenharmony_ci#define _ASM_POWERPC_IRQ_H
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci/*
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/irqdomain.h>
108c2ecf20Sopenharmony_ci#include <linux/threads.h>
118c2ecf20Sopenharmony_ci#include <linux/list.h>
128c2ecf20Sopenharmony_ci#include <linux/radix-tree.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <asm/types.h>
158c2ecf20Sopenharmony_ci#include <linux/atomic.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciextern atomic_t ppc_n_lost_interrupts;
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/* This number is used when no interrupt has been assigned */
218c2ecf20Sopenharmony_ci#define NO_IRQ			(0)
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* Total number of virq in the platform */
248c2ecf20Sopenharmony_ci#define NR_IRQS		CONFIG_NR_IRQS
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* Same thing, used by the generic IRQ code */
278c2ecf20Sopenharmony_ci#define NR_IRQS_LEGACY		NUM_ISA_INTERRUPTS
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciextern irq_hw_number_t virq_to_hw(unsigned int virq);
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cistatic __inline__ int irq_canonicalize(int irq)
328c2ecf20Sopenharmony_ci{
338c2ecf20Sopenharmony_ci	return irq;
348c2ecf20Sopenharmony_ci}
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciextern int distribute_irqs;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistruct pt_regs;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define __ARCH_HAS_DO_SOFTIRQ
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
438c2ecf20Sopenharmony_ci/*
448c2ecf20Sopenharmony_ci * Per-cpu stacks for handling critical, debug and machine check
458c2ecf20Sopenharmony_ci * level interrupts.
468c2ecf20Sopenharmony_ci */
478c2ecf20Sopenharmony_ciextern void *critirq_ctx[NR_CPUS];
488c2ecf20Sopenharmony_ciextern void *dbgirq_ctx[NR_CPUS];
498c2ecf20Sopenharmony_ciextern void *mcheckirq_ctx[NR_CPUS];
508c2ecf20Sopenharmony_ci#endif
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/*
538c2ecf20Sopenharmony_ci * Per-cpu stacks for handling hard and soft interrupts.
548c2ecf20Sopenharmony_ci */
558c2ecf20Sopenharmony_ciextern void *hardirq_ctx[NR_CPUS];
568c2ecf20Sopenharmony_ciextern void *softirq_ctx[NR_CPUS];
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_civoid call_do_softirq(void *sp);
598c2ecf20Sopenharmony_civoid call_do_irq(struct pt_regs *regs, void *sp);
608c2ecf20Sopenharmony_ciextern void do_IRQ(struct pt_regs *regs);
618c2ecf20Sopenharmony_ciextern void __init init_IRQ(void);
628c2ecf20Sopenharmony_ciextern void __do_irq(struct pt_regs *regs);
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ciint irq_choose_cpu(const struct cpumask *mask);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#endif /* _ASM_IRQ_H */
678c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
68