162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci#ifndef _POWERPC_SYSDEV_MSI_BITMAP_H
362306a36Sopenharmony_ci#define _POWERPC_SYSDEV_MSI_BITMAP_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci/*
662306a36Sopenharmony_ci * Copyright 2008, Michael Ellerman, IBM Corporation.
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/of.h>
1062306a36Sopenharmony_ci#include <asm/irq.h>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cistruct msi_bitmap {
1362306a36Sopenharmony_ci	struct device_node	*of_node;
1462306a36Sopenharmony_ci	unsigned long		*bitmap;
1562306a36Sopenharmony_ci	spinlock_t		lock;
1662306a36Sopenharmony_ci	unsigned int		irq_count;
1762306a36Sopenharmony_ci	bool		 	bitmap_from_slab;
1862306a36Sopenharmony_ci};
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciint msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num);
2162306a36Sopenharmony_civoid msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset,
2262306a36Sopenharmony_ci			    unsigned int num);
2362306a36Sopenharmony_civoid msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq);
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciint msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp);
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciint msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
2862306a36Sopenharmony_ci		     struct device_node *of_node);
2962306a36Sopenharmony_civoid msi_bitmap_free(struct msi_bitmap *bmp);
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#endif /* _POWERPC_SYSDEV_MSI_BITMAP_H */
32