xref: /openbmc/linux/arch/powerpc/include/asm/msi_bitmap.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*b886d83cSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
27e302869SMichael Ellerman #ifndef _POWERPC_SYSDEV_MSI_BITMAP_H
37e302869SMichael Ellerman #define _POWERPC_SYSDEV_MSI_BITMAP_H
47e302869SMichael Ellerman 
57e302869SMichael Ellerman /*
67e302869SMichael Ellerman  * Copyright 2008, Michael Ellerman, IBM Corporation.
77e302869SMichael Ellerman  */
87e302869SMichael Ellerman 
97e302869SMichael Ellerman #include <linux/of.h>
107e302869SMichael Ellerman #include <asm/irq.h>
117e302869SMichael Ellerman 
127e302869SMichael Ellerman struct msi_bitmap {
137e302869SMichael Ellerman 	struct device_node	*of_node;
147e302869SMichael Ellerman 	unsigned long		*bitmap;
157e302869SMichael Ellerman 	spinlock_t		lock;
167e302869SMichael Ellerman 	unsigned int		irq_count;
17cb2d3883SDenis Kirjanov 	bool		 	bitmap_from_slab;
187e302869SMichael Ellerman };
197e302869SMichael Ellerman 
207e302869SMichael Ellerman int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num);
217e302869SMichael Ellerman void msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset,
227e302869SMichael Ellerman 			    unsigned int num);
237e302869SMichael Ellerman void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq);
247e302869SMichael Ellerman 
257e302869SMichael Ellerman int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp);
267e302869SMichael Ellerman 
277e302869SMichael Ellerman int msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
287e302869SMichael Ellerman 		     struct device_node *of_node);
297e302869SMichael Ellerman void msi_bitmap_free(struct msi_bitmap *bmp);
307e302869SMichael Ellerman 
317e302869SMichael Ellerman #endif /* _POWERPC_SYSDEV_MSI_BITMAP_H */
32