xref: /openbmc/linux/arch/powerpc/include/asm/msi_bitmap.h (revision cb2d3883c6033831e2a93b396fcc43033108409c)
17e302869SMichael Ellerman #ifndef _POWERPC_SYSDEV_MSI_BITMAP_H
27e302869SMichael Ellerman #define _POWERPC_SYSDEV_MSI_BITMAP_H
37e302869SMichael Ellerman 
47e302869SMichael Ellerman /*
57e302869SMichael Ellerman  * Copyright 2008, Michael Ellerman, IBM Corporation.
67e302869SMichael Ellerman  *
77e302869SMichael Ellerman  * This program is free software; you can redistribute it and/or
87e302869SMichael Ellerman  * modify it under the terms of the GNU General Public License
97e302869SMichael Ellerman  * as published by the Free Software Foundation; version 2 of the
107e302869SMichael Ellerman  * License.
117e302869SMichael Ellerman  *
127e302869SMichael Ellerman  */
137e302869SMichael Ellerman 
147e302869SMichael Ellerman #include <linux/of.h>
157e302869SMichael Ellerman #include <asm/irq.h>
167e302869SMichael Ellerman 
177e302869SMichael Ellerman struct msi_bitmap {
187e302869SMichael Ellerman 	struct device_node	*of_node;
197e302869SMichael Ellerman 	unsigned long		*bitmap;
207e302869SMichael Ellerman 	spinlock_t		lock;
217e302869SMichael Ellerman 	unsigned int		irq_count;
22*cb2d3883SDenis Kirjanov 	bool		 	bitmap_from_slab;
237e302869SMichael Ellerman };
247e302869SMichael Ellerman 
257e302869SMichael Ellerman int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num);
267e302869SMichael Ellerman void msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset,
277e302869SMichael Ellerman 			    unsigned int num);
287e302869SMichael Ellerman void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq);
297e302869SMichael Ellerman 
307e302869SMichael Ellerman int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp);
317e302869SMichael Ellerman 
327e302869SMichael Ellerman int msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
337e302869SMichael Ellerman 		     struct device_node *of_node);
347e302869SMichael Ellerman void msi_bitmap_free(struct msi_bitmap *bmp);
357e302869SMichael Ellerman 
367e302869SMichael Ellerman #endif /* _POWERPC_SYSDEV_MSI_BITMAP_H */
37