/* maximum supported number of ports */ #define MAX_DFL_FPGA_PORT_NUM 4 /* plus one for fme device */ #define MAX_DFL_FEATURE_DEV_NUM (MAX_DFL_FPGA_PORT_NUM + 1)
/* Reserved 0xfe for Header Group Register and 0xff for AFU */ #define FEATURE_ID_FIU_HEADER 0xfe #define FEATURE_ID_AFU 0xff
/* * Device Feature Header Register Set * * For FIUs, they all have DFH + GUID + NEXT_AFU as common header registers. * For AFUs, they have DFH + GUID as common header registers. * For private features, they only have DFH register as common header.
*/ #define DFH 0x0 #define GUID_L 0x8 #define GUID_H 0x10 #define NEXT_AFU 0x18
#define DFH_SIZE 0x8
/* Device Feature Header Register Bitfield */ #define DFH_ID GENMASK_ULL(11, 0) /* Feature ID */ #define DFH_ID_FIU_FME 0 #define DFH_ID_FIU_PORT 1 #define DFH_REVISION GENMASK_ULL(15, 12) /* Feature revision */ #define DFH_NEXT_HDR_OFST GENMASK_ULL(39, 16) /* Offset to next DFH */ #define DFH_EOL BIT_ULL(40) /* End of list */ #define DFH_VERSION GENMASK_ULL(59, 52) /* DFH version */ #define DFH_TYPE GENMASK_ULL(63, 60) /* Feature type */ #define DFH_TYPE_AFU 1 #define DFH_TYPE_PRIVATE 3 #define DFH_TYPE_FIU 4
/* * DFHv1 Register Offset definitons * In DHFv1, DFH + GUID + CSR_START + CSR_SIZE_GROUP + PARAM_HDR + PARAM_DATA * as common header registers
*/ #define DFHv1_CSR_ADDR 0x18 /* CSR Register start address */ #define DFHv1_CSR_SIZE_GRP 0x20 /* Size of Reg Block and Group/tag */ #define DFHv1_PARAM_HDR 0x28 /* Optional First Param header */
/* * CSR Rel Bit, 1'b0 = relative (offset from feature DFH start), * 1'b1 = absolute (ARM or other non-PCIe use)
*/ #define DFHv1_CSR_ADDR_REL BIT_ULL(0)
/* CSR Header Register Bit Definitions */ #define DFHv1_CSR_ADDR_MASK GENMASK_ULL(63, 1) /* 63:1 of CSR address */
/* CSR SIZE Goup Register Bit Definitions */ #define DFHv1_CSR_SIZE_GRP_INSTANCE_ID GENMASK_ULL(15, 0) /* Enumeration instantiated IP */ #define DFHv1_CSR_SIZE_GRP_GROUPING_ID GENMASK_ULL(30, 16) /* Group Features/interfaces */ #define DFHv1_CSR_SIZE_GRP_HAS_PARAMS BIT_ULL(31) /* Presence of Parameters */ #define DFHv1_CSR_SIZE_GRP_SIZE GENMASK_ULL(63, 32) /* Size of CSR Block in bytes */
/* PARAM Header Register Bit Definitions */ #define DFHv1_PARAM_HDR_ID GENMASK_ULL(15, 0) /* Id of this Param */ #define DFHv1_PARAM_HDR_VER GENMASK_ULL(31, 16) /* Version Param */ #define DFHv1_PARAM_HDR_NEXT_OFFSET GENMASK_ULL(63, 35) /* Offset of next Param */ #define DFHv1_PARAM_HDR_NEXT_EOP BIT_ULL(32) #define DFHv1_PARAM_DATA 0x08 /* Offset of Param data from Param header */
/* Port Capability Register Bitfield */ #define PORT_CAP_PORT_NUM GENMASK_ULL(1, 0) /* ID of this port */ #define PORT_CAP_MMIO_SIZE GENMASK_ULL(23, 8) /* MMIO size in KB */ #define PORT_CAP_SUPP_INT_NUM GENMASK_ULL(35, 32) /* Interrupts num */
/* Port Control Register Bitfield */ #define PORT_CTRL_SFTRST BIT_ULL(0) /* Port soft reset */ /* Latency tolerance reporting. '1' >= 40us, '0' < 40us.*/ #define PORT_CTRL_LATENCY BIT_ULL(2) #define PORT_CTRL_SFTRST_ACK BIT_ULL(4) /* HW ack for reset */
/* Port Uint Capability Register */ #define PORT_UINT_CAP 0x8
/* Port Uint Capability Register Bitfield */ #define PORT_UINT_CAP_INT_NUM GENMASK_ULL(11, 0) /* Interrupts num */ #define PORT_UINT_CAP_FST_VECT GENMASK_ULL(23, 12) /* First Vector */
struct dfl_feature_dev_data;
/** * struct dfl_fpga_port_ops - port ops * * @name: name of this port ops, to match with port platform device. * @owner: pointer to the module which owns this port ops. * @node: node to link port ops to global list. * @get_id: get port id from hardware. * @enable_set: enable/disable the port.
*/ struct dfl_fpga_port_ops { constchar *name; struct module *owner; struct list_head node; int (*get_id)(struct dfl_feature_dev_data *fdata); int (*enable_set)(struct dfl_feature_dev_data *fdata, bool enable);
};
/** * struct dfl_feature_driver - dfl private feature driver * * @id_table: id_table for dfl private features supported by this driver. * @ops: ops of this dfl private feature driver.
*/ struct dfl_feature_driver { conststruct dfl_feature_id *id_table; conststruct dfl_feature_ops *ops;
};
/** * struct dfl_feature_irq_ctx - dfl private feature interrupt context * * @irq: Linux IRQ number of this interrupt. * @trigger: eventfd context to signal when interrupt happens. * @name: irq name needed when requesting irq.
*/ struct dfl_feature_irq_ctx { int irq; struct eventfd_ctx *trigger; char *name;
};
/** * struct dfl_feature - sub feature of the feature devices * * @dev: ptr to pdev of the feature device which has the sub feature. * @id: sub feature id. * @revision: revision of this sub feature. * @resource_index: each sub feature has one mmio resource for its registers. * this index is used to find its mmio resource from the * feature dev (platform device)'s resources. * @ioaddr: mapped mmio resource address. * @irq_ctx: interrupt context list. * @nr_irqs: number of interrupt contexts. * @ops: ops of this sub feature. * @ddev: ptr to the dfl device of this sub feature. * @priv: priv data of this feature. * @dfh_version: version of the DFH * @param_size: size of dfh parameters * @params: point to memory copy of dfh parameters
*/ struct dfl_feature { struct platform_device *dev;
u16 id;
u8 revision; int resource_index; void __iomem *ioaddr; struct dfl_feature_irq_ctx *irq_ctx; unsignedint nr_irqs; conststruct dfl_feature_ops *ops; struct dfl_device *ddev; void *priv;
u8 dfh_version; unsignedint param_size; void *params;
};
#define FEATURE_DEV_ID_UNUSED (-1)
/** * struct dfl_feature_dev_data - dfl enumeration data for dfl feature dev. * * @node: node to link the data structure to container device's port_dev_list. * @lock: mutex to protect feature dev data. * @dev: ptr to the feature's platform device linked with this structure. * @type: type of DFL FIU for the feature dev. See enum dfl_id_type. * @pdev_id: platform device id for the feature dev. * @pdev_name: platform device name for the feature dev. * @dfl_cdev: ptr to container device. * @id: id used for the feature device. * @disable_count: count for port disable. * @excl_open: set on feature device exclusive open. * @open_count: count for feature device open. * @num: number for sub features. * @private: ptr to feature dev private data. * @features: sub features for the feature dev. * @resource_num: number of resources for the feature dev. * @resources: resources for the feature dev.
*/ struct dfl_feature_dev_data { struct list_head node; struct mutex lock; struct platform_device *dev; enum dfl_id_type type; int pdev_id; constchar *pdev_name; struct dfl_fpga_cdev *dfl_cdev; int id; unsignedint disable_count; bool excl_open; int open_count; void *private; int num; struct dfl_feature *features; int resource_num; struct resource *resources;
};
/** * struct dfl_feature_platform_data - platform data for feature devices * * @cdev: cdev of feature dev. * @fdata: dfl enumeration data for the dfl feature device.
*/ struct dfl_feature_platform_data { struct cdev cdev; struct dfl_feature_dev_data *fdata;
};
staticinline int dfl_feature_dev_use_begin(struct dfl_feature_dev_data *fdata, bool excl)
{ if (fdata->excl_open) return -EBUSY;
/** * struct dfl_fpga_enum_info - DFL FPGA enumeration information * * @dev: parent device. * @dfls: list of device feature lists. * @nr_irqs: number of irqs for all feature devices. * @irq_table: Linux IRQ numbers for all irqs, indexed by hw irq numbers.
*/ struct dfl_fpga_enum_info { struct device *dev; struct list_head dfls; unsignedint nr_irqs; int *irq_table;
};
/** * struct dfl_fpga_enum_dfl - DFL FPGA enumeration device feature list info * * @start: base address of this device feature list. * @len: size of this device feature list. * @node: node in list of device feature lists.
*/ struct dfl_fpga_enum_dfl {
resource_size_t start;
resource_size_t len; struct list_head node;
};
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, unsignedint nr_irqs, int *irq_table); void dfl_fpga_enum_info_free(struct dfl_fpga_enum_info *info);
/** * struct dfl_fpga_cdev - container device of DFL based FPGA * * @parent: parent device of this container device. * @region: base fpga region. * @fme_dev: FME feature device under this container device. * @lock: mutex lock to protect the port device list. * @port_dev_list: list of all port feature devices under this container device. * @released_port_num: released port number under this container device.
*/ struct dfl_fpga_cdev { struct device *parent; struct fpga_region *region; struct device *fme_dev; struct mutex lock; struct list_head port_dev_list; int released_port_num;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.