• Home
  • Raw
  • Download

Lines Matching full:feature

3  * Driver for FPGA Device Feature List (DFL) Support
22 * when adding a new feature dev support in DFL framework, it's required to
28 * if the new feature dev needs chardev support, then it's required to add
47 * dfl_dev_info - dfl feature device information.
48 * @name: name string of the feature platform device.
49 * @dfh_id: id value in Device Feature Header (DFH) register by DFL spec.
50 * @id: idr id of the feature dev.
69 * dfl_chardev_info - chardev information of dfl feature device
144 * in such list, then other feature devices (e.g. FME), could use the port
354 struct dfl_feature *feature) in dfl_dev_add() argument
383 ddev->feature_id = feature->id; in dfl_dev_add()
387 parent_res = &pdev->resource[feature->resource_index]; in dfl_dev_add()
400 if (feature->nr_irqs) { in dfl_dev_add()
401 ddev->irqs = kcalloc(feature->nr_irqs, in dfl_dev_add()
408 for (i = 0; i < feature->nr_irqs; i++) in dfl_dev_add()
409 ddev->irqs[i] = feature->irq_ctx[i].irq; in dfl_dev_add()
411 ddev->num_irqs = feature->nr_irqs; in dfl_dev_add()
429 struct dfl_feature *feature; in dfl_devs_remove() local
431 dfl_fpga_dev_for_each_feature(pdata, feature) { in dfl_devs_remove()
432 if (feature->ddev) { in dfl_devs_remove()
433 device_unregister(&feature->ddev->dev); in dfl_devs_remove()
434 feature->ddev = NULL; in dfl_devs_remove()
441 struct dfl_feature *feature; in dfl_devs_add() local
445 dfl_fpga_dev_for_each_feature(pdata, feature) { in dfl_devs_add()
446 if (feature->ioaddr) in dfl_devs_add()
449 if (feature->ddev) { in dfl_devs_add()
454 ddev = dfl_dev_add(pdata, feature); in dfl_devs_add()
460 feature->ddev = ddev; in dfl_devs_add()
488 #define is_header_feature(feature) ((feature)->id == FEATURE_ID_FIU_HEADER) argument
491 * dfl_fpga_dev_feature_uinit - uinit for sub features of dfl feature device
492 * @pdev: feature device.
497 struct dfl_feature *feature; in dfl_fpga_dev_feature_uinit() local
501 dfl_fpga_dev_for_each_feature(pdata, feature) { in dfl_fpga_dev_feature_uinit()
502 if (feature->ops) { in dfl_fpga_dev_feature_uinit()
503 if (feature->ops->uinit) in dfl_fpga_dev_feature_uinit()
504 feature->ops->uinit(pdev, feature); in dfl_fpga_dev_feature_uinit()
505 feature->ops = NULL; in dfl_fpga_dev_feature_uinit()
513 struct dfl_feature *feature, in dfl_feature_instance_init() argument
519 if (!is_header_feature(feature)) { in dfl_feature_instance_init()
521 feature->resource_index); in dfl_feature_instance_init()
524 "ioremap failed for feature 0x%x!\n", in dfl_feature_instance_init()
525 feature->id); in dfl_feature_instance_init()
529 feature->ioaddr = base; in dfl_feature_instance_init()
533 ret = drv->ops->init(pdev, feature); in dfl_feature_instance_init()
538 feature->ops = drv->ops; in dfl_feature_instance_init()
543 static bool dfl_feature_drv_match(struct dfl_feature *feature, in dfl_feature_drv_match() argument
550 if (ids->id == feature->id) in dfl_feature_drv_match()
559 * dfl_fpga_dev_feature_init - init for sub features of dfl feature device
560 * @pdev: feature device.
563 * This function will match sub features with given feature drvs list and
564 * use matched drv to init related sub feature.
573 struct dfl_feature *feature; in dfl_fpga_dev_feature_init() local
577 dfl_fpga_dev_for_each_feature(pdata, feature) { in dfl_fpga_dev_feature_init()
578 if (dfl_feature_drv_match(feature, drv)) { in dfl_fpga_dev_feature_init()
580 feature, drv); in dfl_fpga_dev_feature_init()
638 * dfl_fpga_dev_ops_register - register cdev ops for feature dev
640 * @pdev: feature dev.
641 * @fops: file operations for feature dev's cdev.
656 * set parent to the feature device so that its refcount is in dfl_fpga_dev_ops_register()
658 * makes sure the feature device is valid during device in dfl_fpga_dev_ops_register()
668 * dfl_fpga_dev_ops_unregister - unregister cdev ops for feature dev
669 * @pdev: feature dev.
680 * struct build_feature_devs_info - info collected during feature dev build.
683 * @cdev: the container device for all feature devices.
684 * @nr_irqs: number of irqs for all feature devices.
687 * @feature_dev: current feature device.
691 * @sub_features: a sub features linked list for feature device in enumeration.
692 * @feature_num: number of sub features for feature device in enumeration.
709 * struct dfl_feature_info - sub feature info collected during feature dev build
711 * @fid: id of this sub feature.
712 * @mmio_res: mmio resource of this sub feature.
715 * @irq_base: start of irq index in this sub feature.
716 * @nr_irqs: number of irqs of this sub feature.
739 * register current feature device, it is called when we need to switch to
740 * another feature parsing or we have parsed all features on given device
741 * feature list.
783 /* each sub feature has one MMIO resource */ in build_info_commit_dev()
790 /* fill features and resource information for feature dev */ in build_info_commit_dev()
792 struct dfl_feature *feature = &pdata->features[index++]; in build_info_commit_dev() local
796 /* save resource information for each feature */ in build_info_commit_dev()
797 feature->dev = fdev; in build_info_commit_dev()
798 feature->id = finfo->fid; in build_info_commit_dev()
801 * the FIU header feature has some fundamental functions (sriov in build_info_commit_dev()
804 * DFL bus device. And we should not assign it to feature in build_info_commit_dev()
807 if (is_header_feature(feature)) { in build_info_commit_dev()
808 feature->resource_index = -1; in build_info_commit_dev()
809 feature->ioaddr = in build_info_commit_dev()
812 if (IS_ERR(feature->ioaddr)) in build_info_commit_dev()
813 return PTR_ERR(feature->ioaddr); in build_info_commit_dev()
815 feature->resource_index = res_idx; in build_info_commit_dev()
829 feature->irq_ctx = ctx; in build_info_commit_dev()
830 feature->nr_irqs = finfo->nr_irqs; in build_info_commit_dev()
848 * The resource of successfully registered feature devices in build_info_commit_dev()
950 * each feature in DFL Header, no field for interrupt resources. in parse_feature_irqs()
952 * registers of each private feature which supports interrupt. So in in parse_feature_irqs()
985 dev_dbg(binfo->dev, "feature: 0x%x, irq_base: %u, nr_irqs: %u\n", in parse_feature_irqs()
990 "Invalid interrupt number in feature 0x%x\n", fid); in parse_feature_irqs()
998 "Invalid irq table entry for feature 0x%x\n", in parse_feature_irqs()
1011 * when create sub feature instances, for private features, it doesn't need
1012 * to provide resource size and feature id as they could be read from DFH
1013 * register. For afu sub feature, its register region only contains user
1025 /* read feature size and id if inputs are invalid */ in create_feature_instance()
1141 /* create platform device for dfl feature dev */ in parse_feature_fiu()
1168 dev_err(binfo->dev, "the private feature 0x%x does not belong to any AFU.\n", in parse_feature_private()
1177 * parse_feature - parse a feature on given device feature list
1179 * @binfo: build feature devices information.
1200 "Feature Type %x is not supported.\n", type); in parse_feature()
1218 /* walk through the device feature list via DFH's next DFH pointer. */ in parse_feature_list()
1221 dev_err(binfo->dev, "The region is too small to contain a feature.\n"); in parse_feature_list()
1237 /* commit current feature device when reach the end of list */ in parse_feature_list()
1275 /* remove all device feature lists in the list. */ in dfl_fpga_enum_info_free()
1291 * dfl_fpga_enum_info_add_dfl - add info of a device feature list to enum info
1294 * @start: mmio resource address of the device feature list.
1295 * @len: mmio resource length of the device feature list.
1297 * One FPGA device may have one or more Device Feature Lists (DFLs), use this
1379 * dfl_fpga_feature_devs_enumerate - enumerate feature devices
1383 * feature devices based on the enumeration info and creates platform devices
1432 * start enumeration for all feature devices based on Device Feature in dfl_fpga_feature_devs_enumerate()
1457 * dfl_fpga_feature_devs_remove - remove all feature devices
1460 * Remove the container device and all feature devices under given container
1727 static int do_set_irq_trigger(struct dfl_feature *feature, unsigned int idx, in do_set_irq_trigger() argument
1730 struct platform_device *pdev = feature->dev; in do_set_irq_trigger()
1734 irq = feature->irq_ctx[idx].irq; in do_set_irq_trigger()
1736 if (feature->irq_ctx[idx].trigger) { in do_set_irq_trigger()
1737 free_irq(irq, feature->irq_ctx[idx].trigger); in do_set_irq_trigger()
1738 kfree(feature->irq_ctx[idx].name); in do_set_irq_trigger()
1739 eventfd_ctx_put(feature->irq_ctx[idx].trigger); in do_set_irq_trigger()
1740 feature->irq_ctx[idx].trigger = NULL; in do_set_irq_trigger()
1746 feature->irq_ctx[idx].name = in do_set_irq_trigger()
1748 dev_name(&pdev->dev), feature->id); in do_set_irq_trigger()
1749 if (!feature->irq_ctx[idx].name) in do_set_irq_trigger()
1759 feature->irq_ctx[idx].name, trigger); in do_set_irq_trigger()
1761 feature->irq_ctx[idx].trigger = trigger; in do_set_irq_trigger()
1767 kfree(feature->irq_ctx[idx].name); in do_set_irq_trigger()
1773 * dfl_fpga_set_irq_triggers - set eventfd triggers for dfl feature interrupts
1775 * @feature: dfl sub feature.
1776 * @start: start of irq index in this dfl sub feature.
1781 * Bind given eventfds with irqs in this dfl sub feature. Unbind related irq if
1787 int dfl_fpga_set_irq_triggers(struct dfl_feature *feature, unsigned int start, in dfl_fpga_set_irq_triggers() argument
1798 if (start + count > feature->nr_irqs) in dfl_fpga_set_irq_triggers()
1804 ret = do_set_irq_trigger(feature, start + i, fd); in dfl_fpga_set_irq_triggers()
1807 do_set_irq_trigger(feature, start + i, -1); in dfl_fpga_set_irq_triggers()
1817 * dfl_feature_ioctl_get_num_irqs - dfl feature _GET_IRQ_NUM ioctl interface.
1818 * @pdev: the feature device which has the sub feature
1819 * @feature: the dfl sub feature
1825 struct dfl_feature *feature, in dfl_feature_ioctl_get_num_irqs() argument
1828 return put_user(feature->nr_irqs, (__u32 __user *)arg); in dfl_feature_ioctl_get_num_irqs()
1833 * dfl_feature_ioctl_set_irq - dfl feature _SET_IRQ ioctl interface.
1834 * @pdev: the feature device which has the sub feature
1835 * @feature: the dfl sub feature
1841 struct dfl_feature *feature, in dfl_feature_ioctl_set_irq() argument
1849 if (!feature->nr_irqs) in dfl_feature_ioctl_set_irq()
1855 if (!hdr.count || (hdr.start + hdr.count > feature->nr_irqs) || in dfl_feature_ioctl_set_irq()
1865 ret = dfl_fpga_set_irq_triggers(feature, hdr.start, hdr.count, fds); in dfl_feature_ioctl_set_irq()
1883 MODULE_DESCRIPTION("FPGA Device Feature List (DFL) Support");