]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/mei_cl_bus.h
seccomp: Move speculation migitation control to arch code
[mirror_ubuntu-artful-kernel.git] / include / linux / mei_cl_bus.h
CommitLineData
e5354107
SO
1#ifndef _LINUX_MEI_CL_BUS_H
2#define _LINUX_MEI_CL_BUS_H
3
4#include <linux/device.h>
5#include <linux/uuid.h>
1f180359 6#include <linux/mod_devicetable.h>
e5354107
SO
7
8struct mei_cl_device;
512f64d9 9struct mei_device;
e5354107 10
7c7a6077 11typedef void (*mei_cldev_cb_t)(struct mei_cl_device *cldev);
dbac993f
TW
12
13/**
14 * struct mei_cl_device - MEI device handle
15 * An mei_cl_device pointer is returned from mei_add_device()
16 * and links MEI bus clients to their actual ME host client pointer.
17 * Drivers for MEI devices will get an mei_cl_device pointer
18 * when being probed and shall use it for doing ME bus I/O.
19 *
0ff0a8d8 20 * @bus_list: device on the bus list
512f64d9 21 * @bus: parent mei device
dbac993f
TW
22 * @dev: linux driver model device pointer
23 * @me_cl: me client
24 * @cl: mei client
25 * @name: device name
7c7a6077
AU
26 * @rx_work: async work to execute Rx event callback
27 * @rx_cb: Drivers register this callback to get asynchronous ME
28 * Rx buffer pending notifications.
29 * @notif_work: async work to execute FW notif event callback
30 * @notif_cb: Drivers register this callback to get asynchronous ME
31 * FW notification pending notifications.
71ce7891
TW
32 *
33 * @do_match: wheather device can be matched with a driver
0ff0a8d8 34 * @is_added: device is already scanned
dbac993f
TW
35 * @priv_data: client private data
36 */
37struct mei_cl_device {
0ff0a8d8 38 struct list_head bus_list;
512f64d9 39 struct mei_device *bus;
dbac993f
TW
40 struct device dev;
41
42 struct mei_me_client *me_cl;
43 struct mei_cl *cl;
44 char name[MEI_CL_NAME_SIZE];
45
7c7a6077
AU
46 struct work_struct rx_work;
47 mei_cldev_cb_t rx_cb;
48 struct work_struct notif_work;
49 mei_cldev_cb_t notif_cb;
71ce7891
TW
50
51 unsigned int do_match:1;
0ff0a8d8 52 unsigned int is_added:1;
dbac993f
TW
53
54 void *priv_data;
55};
56
e5354107
SO
57struct mei_cl_driver {
58 struct device_driver driver;
59 const char *name;
60
61 const struct mei_cl_device_id *id_table;
62
89391382 63 int (*probe)(struct mei_cl_device *cldev,
e5354107 64 const struct mei_cl_device_id *id);
89391382 65 int (*remove)(struct mei_cl_device *cldev);
e5354107
SO
66};
67
d49dc5e7
TW
68int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
69 struct module *owner);
70#define mei_cldev_driver_register(cldrv) \
71 __mei_cldev_driver_register(cldrv, THIS_MODULE)
333e4ee0 72
d49dc5e7 73void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv);
333e4ee0 74
5be149bd
TW
75/**
76 * module_mei_cl_driver - Helper macro for registering mei cl driver
77 *
076802d0 78 * @__mei_cldrv: mei_cl_driver structure
5be149bd
TW
79 *
80 * Helper macro for mei cl drivers which do not do anything special in module
81 * init/exit, for eliminating a boilerplate code.
82 */
83#define module_mei_cl_driver(__mei_cldrv) \
84 module_driver(__mei_cldrv, \
85 mei_cldev_driver_register,\
86 mei_cldev_driver_unregister)
87
d49dc5e7 88ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length);
076802d0
AU
89ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length);
90ssize_t mei_cldev_recv_nonblock(struct mei_cl_device *cldev, u8 *buf,
91 size_t length);
3e833295 92
7c7a6077
AU
93int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb);
94int mei_cldev_register_notif_cb(struct mei_cl_device *cldev,
95 mei_cldev_cb_t notif_cb);
3e833295 96
baeacd03
TW
97const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev);
98u8 mei_cldev_ver(const struct mei_cl_device *cldev);
99
d49dc5e7
TW
100void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev);
101void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data);
aa6aef21 102
d49dc5e7
TW
103int mei_cldev_enable(struct mei_cl_device *cldev);
104int mei_cldev_disable(struct mei_cl_device *cldev);
01a14ede 105bool mei_cldev_enabled(struct mei_cl_device *cldev);
e46980a1 106
e5354107 107#endif /* _LINUX_MEI_CL_BUS_H */