xref: /openbmc/linux/include/linux/fpga/fpga-region.h (revision 83fc580d)
1 #ifndef _FPGA_REGION_H
2 #define _FPGA_REGION_H
3 
4 #include <linux/device.h>
5 #include <linux/fpga/fpga-mgr.h>
6 #include <linux/fpga/fpga-bridge.h>
7 
8 /**
9  * struct fpga_region - FPGA Region structure
10  * @dev: FPGA Region device
11  * @mutex: enforces exclusive reference to region
12  * @bridge_list: list of FPGA bridges specified in region
13  * @mgr: FPGA manager
14  * @info: FPGA image info
15  * @priv: private data
16  * @get_bridges: optional function to get bridges to a list
17  * @groups: optional attribute groups.
18  */
19 struct fpga_region {
20 	struct device dev;
21 	struct mutex mutex; /* for exclusive reference to region */
22 	struct list_head bridge_list;
23 	struct fpga_manager *mgr;
24 	struct fpga_image_info *info;
25 	void *priv;
26 	int (*get_bridges)(struct fpga_region *region);
27 	const struct attribute_group **groups;
28 };
29 
30 #define to_fpga_region(d) container_of(d, struct fpga_region, dev)
31 
32 struct fpga_region *fpga_region_class_find(
33 	struct device *start, const void *data,
34 	int (*match)(struct device *, const void *));
35 
36 int fpga_region_program_fpga(struct fpga_region *region);
37 int fpga_region_register(struct device *dev, struct fpga_region *region);
38 int fpga_region_unregister(struct fpga_region *region);
39 
40 #endif /* _FPGA_REGION_H */
41