/* SPDX-License-Identifier: GPL-2.0 */ /* * Header file for DFL driver and device API * * Copyright (C) 2020 Intel Corporation, Inc. */ #ifndef __LINUX_DFL_H #define __LINUX_DFL_H #include <linux/device.h> #include <linux/mod_devicetable.h> /** * enum dfl_id_type - define the DFL FIU types */ enum dfl_id_type { … }; /** * struct dfl_device - represent an dfl device on dfl bus * * @dev: generic device interface. * @id: id of the dfl device. * @type: type of DFL FIU of the device. See enum dfl_id_type. * @feature_id: feature identifier local to its DFL FIU type. * @revision: revision of this dfl device feature. * @mmio_res: mmio resource of this dfl device. * @irqs: list of Linux IRQ numbers of this dfl device. * @num_irqs: number of IRQs supported by this dfl device. * @cdev: pointer to DFL FPGA container device this dfl device belongs to. * @id_entry: matched id entry in dfl driver's id table. * @dfh_version: version of DFH for the device * @param_size: size of the block parameters in bytes * @params: pointer to block of parameters copied memory */ struct dfl_device { … }; /** * struct dfl_driver - represent an dfl device driver * * @drv: driver model structure. * @id_table: pointer to table of device IDs the driver is interested in. * { } member terminated. * @probe: mandatory callback for device binding. * @remove: callback for device unbinding. */ struct dfl_driver { … }; #define to_dfl_dev(d) … #define to_dfl_drv(d) … /* * use a macro to avoid include chaining to get THIS_MODULE. */ #define dfl_driver_register(drv) … int __dfl_driver_register(struct dfl_driver *dfl_drv, struct module *owner); void dfl_driver_unregister(struct dfl_driver *dfl_drv); /* * module_dfl_driver() - Helper macro for drivers that don't do * anything special in module init/exit. This eliminates a lot of * boilerplate. Each module may only use this macro once, and * calling it replaces module_init() and module_exit(). */ #define module_dfl_driver(__dfl_driver) … void *dfh_find_param(struct dfl_device *dfl_dev, int param_id, size_t *pcount); #endif /* __LINUX_DFL_H */