fpga-region.h 1.3 KB

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