18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci#ifndef _POWERPC_SYSDEV_MPIC_H
38c2ecf20Sopenharmony_ci#define _POWERPC_SYSDEV_MPIC_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci * Copyright 2006-2007, Michael Ellerman, IBM Corporation.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI_MSI
108c2ecf20Sopenharmony_ciextern void mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq);
118c2ecf20Sopenharmony_ciextern int mpic_msi_init_allocator(struct mpic *mpic);
128c2ecf20Sopenharmony_ciextern int mpic_u3msi_init(struct mpic *mpic);
138c2ecf20Sopenharmony_ci#else
148c2ecf20Sopenharmony_cistatic inline void mpic_msi_reserve_hwirq(struct mpic *mpic,
158c2ecf20Sopenharmony_ci					  irq_hw_number_t hwirq)
168c2ecf20Sopenharmony_ci{
178c2ecf20Sopenharmony_ci	return;
188c2ecf20Sopenharmony_ci}
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistatic inline int mpic_u3msi_init(struct mpic *mpic)
218c2ecf20Sopenharmony_ci{
228c2ecf20Sopenharmony_ci	return -1;
238c2ecf20Sopenharmony_ci}
248c2ecf20Sopenharmony_ci#endif
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#if defined(CONFIG_PCI_MSI) && defined(CONFIG_PPC_PASEMI)
278c2ecf20Sopenharmony_ciint mpic_pasemi_msi_init(struct mpic *mpic);
288c2ecf20Sopenharmony_ci#else
298c2ecf20Sopenharmony_cistatic inline int mpic_pasemi_msi_init(struct mpic *mpic) { return -1; }
308c2ecf20Sopenharmony_ci#endif
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciextern int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type);
338c2ecf20Sopenharmony_ciextern void mpic_set_vector(unsigned int virq, unsigned int vector);
348c2ecf20Sopenharmony_ciextern int mpic_set_affinity(struct irq_data *d,
358c2ecf20Sopenharmony_ci			     const struct cpumask *cpumask, bool force);
368c2ecf20Sopenharmony_ciextern void mpic_reset_core(int cpu);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#ifdef CONFIG_FSL_SOC
398c2ecf20Sopenharmony_ciextern int mpic_map_error_int(struct mpic *mpic, unsigned int virq, irq_hw_number_t  hw);
408c2ecf20Sopenharmony_ciextern void mpic_err_int_init(struct mpic *mpic, irq_hw_number_t irqnum);
418c2ecf20Sopenharmony_ciextern int mpic_setup_error_int(struct mpic *mpic, int intvec);
428c2ecf20Sopenharmony_ci#else
438c2ecf20Sopenharmony_cistatic inline int mpic_map_error_int(struct mpic *mpic, unsigned int virq, irq_hw_number_t  hw)
448c2ecf20Sopenharmony_ci{
458c2ecf20Sopenharmony_ci	return 0;
468c2ecf20Sopenharmony_ci}
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cistatic inline void mpic_err_int_init(struct mpic *mpic, irq_hw_number_t irqnum)
508c2ecf20Sopenharmony_ci{
518c2ecf20Sopenharmony_ci	return;
528c2ecf20Sopenharmony_ci}
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cistatic inline int mpic_setup_error_int(struct mpic *mpic, int intvec)
558c2ecf20Sopenharmony_ci{
568c2ecf20Sopenharmony_ci	return -1;
578c2ecf20Sopenharmony_ci}
588c2ecf20Sopenharmony_ci#endif
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#endif /* _POWERPC_SYSDEV_MPIC_H */
61