18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci#ifndef _POWERPC_SYSDEV_MSI_BITMAP_H 38c2ecf20Sopenharmony_ci#define _POWERPC_SYSDEV_MSI_BITMAP_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * Copyright 2008, Michael Ellerman, IBM Corporation. 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/of.h> 108c2ecf20Sopenharmony_ci#include <asm/irq.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_cistruct msi_bitmap { 138c2ecf20Sopenharmony_ci struct device_node *of_node; 148c2ecf20Sopenharmony_ci unsigned long *bitmap; 158c2ecf20Sopenharmony_ci spinlock_t lock; 168c2ecf20Sopenharmony_ci unsigned int irq_count; 178c2ecf20Sopenharmony_ci bool bitmap_from_slab; 188c2ecf20Sopenharmony_ci}; 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciint msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num); 218c2ecf20Sopenharmony_civoid msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset, 228c2ecf20Sopenharmony_ci unsigned int num); 238c2ecf20Sopenharmony_civoid msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq); 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ciint msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciint msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count, 288c2ecf20Sopenharmony_ci struct device_node *of_node); 298c2ecf20Sopenharmony_civoid msi_bitmap_free(struct msi_bitmap *bmp); 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#endif /* _POWERPC_SYSDEV_MSI_BITMAP_H */ 32