#ifndef __FPGA_DFL_H
#define __FPGA_DFL_H
#include <linux/bitfield.h>
#include <linux/cdev.h>
#include <linux/delay.h>
#include <linux/eventfd.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/uuid.h>
#include <linux/fpga/fpga-region.h>
#define MAX_DFL_FPGA_PORT_NUM …
#define MAX_DFL_FEATURE_DEV_NUM …
#define FEATURE_ID_FIU_HEADER …
#define FEATURE_ID_AFU …
#define FME_FEATURE_ID_HEADER …
#define FME_FEATURE_ID_THERMAL_MGMT …
#define FME_FEATURE_ID_POWER_MGMT …
#define FME_FEATURE_ID_GLOBAL_IPERF …
#define FME_FEATURE_ID_GLOBAL_ERR …
#define FME_FEATURE_ID_PR_MGMT …
#define FME_FEATURE_ID_HSSI …
#define FME_FEATURE_ID_GLOBAL_DPERF …
#define PORT_FEATURE_ID_HEADER …
#define PORT_FEATURE_ID_AFU …
#define PORT_FEATURE_ID_ERROR …
#define PORT_FEATURE_ID_UMSG …
#define PORT_FEATURE_ID_UINT …
#define PORT_FEATURE_ID_STP …
#define DFH …
#define GUID_L …
#define GUID_H …
#define NEXT_AFU …
#define DFH_SIZE …
#define DFH_ID …
#define DFH_ID_FIU_FME …
#define DFH_ID_FIU_PORT …
#define DFH_REVISION …
#define DFH_NEXT_HDR_OFST …
#define DFH_EOL …
#define DFH_VERSION …
#define DFH_TYPE …
#define DFH_TYPE_AFU …
#define DFH_TYPE_PRIVATE …
#define DFH_TYPE_FIU …
#define DFHv1_CSR_ADDR …
#define DFHv1_CSR_SIZE_GRP …
#define DFHv1_PARAM_HDR …
#define DFHv1_CSR_ADDR_REL …
#define DFHv1_CSR_ADDR_MASK …
#define DFHv1_CSR_SIZE_GRP_INSTANCE_ID …
#define DFHv1_CSR_SIZE_GRP_GROUPING_ID …
#define DFHv1_CSR_SIZE_GRP_HAS_PARAMS …
#define DFHv1_CSR_SIZE_GRP_SIZE …
#define DFHv1_PARAM_HDR_ID …
#define DFHv1_PARAM_HDR_VER …
#define DFHv1_PARAM_HDR_NEXT_OFFSET …
#define DFHv1_PARAM_HDR_NEXT_EOP …
#define DFHv1_PARAM_DATA …
#define DFHv1_PARAM_ID_MSI_X …
#define DFHv1_PARAM_MSI_X_NUMV …
#define DFHv1_PARAM_MSI_X_STARTV …
#define NEXT_AFU_NEXT_DFH_OFST …
#define FME_HDR_DFH …
#define FME_HDR_GUID_L …
#define FME_HDR_GUID_H …
#define FME_HDR_NEXT_AFU …
#define FME_HDR_CAP …
#define FME_HDR_PORT_OFST(n) …
#define FME_PORT_OFST_BAR_SKIP …
#define FME_HDR_BITSTREAM_ID …
#define FME_HDR_BITSTREAM_MD …
#define FME_CAP_FABRIC_VERID …
#define FME_CAP_SOCKET_ID …
#define FME_CAP_PCIE0_LINK_AVL …
#define FME_CAP_PCIE1_LINK_AVL …
#define FME_CAP_COHR_LINK_AVL …
#define FME_CAP_IOMMU_AVL …
#define FME_CAP_NUM_PORTS …
#define FME_CAP_ADDR_WIDTH …
#define FME_CAP_CACHE_SIZE …
#define FME_CAP_CACHE_ASSOC …
#define FME_PORT_OFST_DFH_OFST …
#define FME_PORT_OFST_BAR_ID …
#define FME_PORT_OFST_ACC_CTRL …
#define FME_PORT_OFST_ACC_PF …
#define FME_PORT_OFST_ACC_VF …
#define FME_PORT_OFST_IMP …
#define FME_ERROR_CAP …
#define FME_ERROR_CAP_SUPP_INT …
#define FME_ERROR_CAP_INT_VECT …
#define PORT_HDR_DFH …
#define PORT_HDR_GUID_L …
#define PORT_HDR_GUID_H …
#define PORT_HDR_NEXT_AFU …
#define PORT_HDR_CAP …
#define PORT_HDR_CTRL …
#define PORT_HDR_STS …
#define PORT_HDR_USRCLK_CMD0 …
#define PORT_HDR_USRCLK_CMD1 …
#define PORT_HDR_USRCLK_STS0 …
#define PORT_HDR_USRCLK_STS1 …
#define PORT_CAP_PORT_NUM …
#define PORT_CAP_MMIO_SIZE …
#define PORT_CAP_SUPP_INT_NUM …
#define PORT_CTRL_SFTRST …
#define PORT_CTRL_LATENCY …
#define PORT_CTRL_SFTRST_ACK …
#define PORT_STS_AP2_EVT …
#define PORT_STS_AP1_EVT …
#define PORT_STS_PWR_STATE …
#define PORT_STS_PWR_STATE_NORM …
#define PORT_STS_PWR_STATE_AP1 …
#define PORT_STS_PWR_STATE_AP2 …
#define PORT_STS_PWR_STATE_AP6 …
#define PORT_ERROR_CAP …
#define PORT_ERROR_CAP_SUPP_INT …
#define PORT_ERROR_CAP_INT_VECT …
#define PORT_UINT_CAP …
#define PORT_UINT_CAP_INT_NUM …
#define PORT_UINT_CAP_FST_VECT …
struct dfl_fpga_port_ops { … };
void dfl_fpga_port_ops_add(struct dfl_fpga_port_ops *ops);
void dfl_fpga_port_ops_del(struct dfl_fpga_port_ops *ops);
struct dfl_fpga_port_ops *dfl_fpga_port_ops_get(struct platform_device *pdev);
void dfl_fpga_port_ops_put(struct dfl_fpga_port_ops *ops);
int dfl_fpga_check_port_id(struct platform_device *pdev, void *pport_id);
struct dfl_feature_id { … };
struct dfl_feature_driver { … };
struct dfl_feature_irq_ctx { … };
struct dfl_feature { … };
#define FEATURE_DEV_ID_UNUSED …
struct dfl_feature_platform_data { … };
static inline
int dfl_feature_dev_use_begin(struct dfl_feature_platform_data *pdata,
bool excl)
{ … }
static inline
void dfl_feature_dev_use_end(struct dfl_feature_platform_data *pdata)
{ … }
static inline
int dfl_feature_dev_use_count(struct dfl_feature_platform_data *pdata)
{ … }
static inline
void dfl_fpga_pdata_set_private(struct dfl_feature_platform_data *pdata,
void *private)
{ … }
static inline
void *dfl_fpga_pdata_get_private(struct dfl_feature_platform_data *pdata)
{ … }
struct dfl_feature_ops { … };
#define DFL_FPGA_FEATURE_DEV_FME …
#define DFL_FPGA_FEATURE_DEV_PORT …
void dfl_fpga_dev_feature_uinit(struct platform_device *pdev);
int dfl_fpga_dev_feature_init(struct platform_device *pdev,
struct dfl_feature_driver *feature_drvs);
int dfl_fpga_dev_ops_register(struct platform_device *pdev,
const struct file_operations *fops,
struct module *owner);
void dfl_fpga_dev_ops_unregister(struct platform_device *pdev);
static inline
struct platform_device *dfl_fpga_inode_to_feature_dev(struct inode *inode)
{ … }
#define dfl_fpga_dev_for_each_feature(pdata, feature) …
static inline
struct dfl_feature *dfl_get_feature_by_id(struct device *dev, u16 id)
{ … }
static inline
void __iomem *dfl_get_feature_ioaddr_by_id(struct device *dev, u16 id)
{ … }
static inline
struct device *dfl_fpga_pdata_to_parent(struct dfl_feature_platform_data *pdata)
{ … }
static inline bool dfl_feature_is_fme(void __iomem *base)
{ … }
static inline bool dfl_feature_is_port(void __iomem *base)
{ … }
static inline u8 dfl_feature_revision(void __iomem *base)
{ … }
struct dfl_fpga_enum_info { … };
struct dfl_fpga_enum_dfl { … };
struct dfl_fpga_enum_info *dfl_fpga_enum_info_alloc(struct device *dev);
int dfl_fpga_enum_info_add_dfl(struct dfl_fpga_enum_info *info,
resource_size_t start, resource_size_t len);
int dfl_fpga_enum_info_add_irq(struct dfl_fpga_enum_info *info,
unsigned int nr_irqs, int *irq_table);
void dfl_fpga_enum_info_free(struct dfl_fpga_enum_info *info);
struct dfl_fpga_cdev { … };
struct dfl_fpga_cdev *
dfl_fpga_feature_devs_enumerate(struct dfl_fpga_enum_info *info);
void dfl_fpga_feature_devs_remove(struct dfl_fpga_cdev *cdev);
struct platform_device *
__dfl_fpga_cdev_find_port(struct dfl_fpga_cdev *cdev, void *data,
int (*match)(struct platform_device *, void *));
static inline struct platform_device *
dfl_fpga_cdev_find_port(struct dfl_fpga_cdev *cdev, void *data,
int (*match)(struct platform_device *, void *))
{ … }
int dfl_fpga_cdev_release_port(struct dfl_fpga_cdev *cdev, int port_id);
int dfl_fpga_cdev_assign_port(struct dfl_fpga_cdev *cdev, int port_id);
void dfl_fpga_cdev_config_ports_pf(struct dfl_fpga_cdev *cdev);
int dfl_fpga_cdev_config_ports_vf(struct dfl_fpga_cdev *cdev, int num_vf);
int dfl_fpga_set_irq_triggers(struct dfl_feature *feature, unsigned int start,
unsigned int count, int32_t *fds);
long dfl_feature_ioctl_get_num_irqs(struct platform_device *pdev,
struct dfl_feature *feature,
unsigned long arg);
long dfl_feature_ioctl_set_irq(struct platform_device *pdev,
struct dfl_feature *feature,
unsigned long arg);
#endif