nvme: Add tertiary number to NVME_VS
[linux-2.6-block.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
d49dc5e7
TW
11typedef void (*mei_cldev_event_cb_t)(struct mei_cl_device *cldev,
12 u32 events, void *context);
dbac993f
TW
13
14/**
15 * struct mei_cl_device - MEI device handle
16 * An mei_cl_device pointer is returned from mei_add_device()
17 * and links MEI bus clients to their actual ME host client pointer.
18 * Drivers for MEI devices will get an mei_cl_device pointer
19 * when being probed and shall use it for doing ME bus I/O.
20 *
0ff0a8d8 21 * @bus_list: device on the bus list
512f64d9 22 * @bus: parent mei device
dbac993f
TW
23 * @dev: linux driver model device pointer
24 * @me_cl: me client
25 * @cl: mei client
26 * @name: device name
27 * @event_work: async work to execute event callback
28 * @event_cb: Drivers register this callback to get asynchronous ME
29 * events (e.g. Rx buffer pending) notifications.
30 * @event_context: event callback run context
bb2ef9c3 31 * @events_mask: Events bit mask requested by driver.
dbac993f 32 * @events: Events bitmask sent to the driver.
71ce7891
TW
33 *
34 * @do_match: wheather device can be matched with a driver
0ff0a8d8 35 * @is_added: device is already scanned
dbac993f
TW
36 * @priv_data: client private data
37 */
38struct mei_cl_device {
0ff0a8d8 39 struct list_head bus_list;
512f64d9 40 struct mei_device *bus;
dbac993f
TW
41 struct device dev;
42
43 struct mei_me_client *me_cl;
44 struct mei_cl *cl;
45 char name[MEI_CL_NAME_SIZE];
46
47 struct work_struct event_work;
d49dc5e7 48 mei_cldev_event_cb_t event_cb;
dbac993f 49 void *event_context;
bb2ef9c3 50 unsigned long events_mask;
dbac993f 51 unsigned long events;
71ce7891
TW
52
53 unsigned int do_match:1;
0ff0a8d8 54 unsigned int is_added:1;
dbac993f
TW
55
56 void *priv_data;
57};
58
e5354107
SO
59struct mei_cl_driver {
60 struct device_driver driver;
61 const char *name;
62
63 const struct mei_cl_device_id *id_table;
64
89391382 65 int (*probe)(struct mei_cl_device *cldev,
e5354107 66 const struct mei_cl_device_id *id);
89391382 67 int (*remove)(struct mei_cl_device *cldev);
e5354107
SO
68};
69
d49dc5e7
TW
70int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
71 struct module *owner);
72#define mei_cldev_driver_register(cldrv) \
73 __mei_cldev_driver_register(cldrv, THIS_MODULE)
333e4ee0 74
d49dc5e7 75void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv);
333e4ee0 76
d49dc5e7
TW
77ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length);
78ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length);
3e833295 79
d49dc5e7
TW
80int mei_cldev_register_event_cb(struct mei_cl_device *cldev,
81 unsigned long event_mask,
82 mei_cldev_event_cb_t read_cb, void *context);
3e833295
SO
83
84#define MEI_CL_EVENT_RX 0
85#define MEI_CL_EVENT_TX 1
bb2ef9c3 86#define MEI_CL_EVENT_NOTIF 2
3e833295 87
baeacd03
TW
88const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev);
89u8 mei_cldev_ver(const struct mei_cl_device *cldev);
90
d49dc5e7
TW
91void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev);
92void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data);
aa6aef21 93
d49dc5e7
TW
94int mei_cldev_enable(struct mei_cl_device *cldev);
95int mei_cldev_disable(struct mei_cl_device *cldev);
01a14ede 96bool mei_cldev_enabled(struct mei_cl_device *cldev);
e46980a1 97
e5354107 98#endif /* _LINUX_MEI_CL_BUS_H */