summaryrefslogtreecommitdiffstats
path: root/kernel/arch/powerpc/include/asm/msi_bitmap.h
blob: 97ac3f46ae0d74a3b13c63acd2c764b1149d3aea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef _POWERPC_SYSDEV_MSI_BITMAP_H
#define _POWERPC_SYSDEV_MSI_BITMAP_H

/*
 * Copyright 2008, Michael Ellerman, IBM Corporation.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2 of the
 * License.
 *
 */

#include <linux/of.h>
#include <asm/irq.h>

struct msi_bitmap {
	struct device_node	*of_node;
	unsigned long		*bitmap;
	spinlock_t		lock;
	unsigned int		irq_count;
};

int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num);
void msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset,
			    unsigned int num);
void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq);

int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp);

int msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
		     struct device_node *of_node);
void msi_bitmap_free(struct msi_bitmap *bmp);

#endif /* _POWERPC_SYSDEV_MSI_BITMAP_H */