File Index
Files and directories
Sign in
FILE

mei_cl_bus.h

File preview with syntax highlighting.

linux-6.19.14/include/linux/mei_cl_bus.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Copyright (c) 2013-2016, Intel Corporation. All rights reserved.
  4 */
  5#ifndef _LINUX_MEI_CL_BUS_H
  6#define _LINUX_MEI_CL_BUS_H
  7
  8#include <linux/device.h>
  9#include <linux/uuid.h>
 10#include <linux/mod_devicetable.h>
 11
 12struct mei_cl_device;
 13struct mei_device;
 14struct scatterlist;
 15
 16typedef void (*mei_cldev_cb_t)(struct mei_cl_device *cldev);
 17
 18/**
 19 * struct mei_cl_device - MEI device handle
 20 * An mei_cl_device pointer is returned from mei_add_device()
 21 * and links MEI bus clients to their actual ME host client pointer.
 22 * Drivers for MEI devices will get an mei_cl_device pointer
 23 * when being probed and shall use it for doing ME bus I/O.
 24 *
 25 * @bus_list: device on the bus list
 26 * @bus: parent mei device
 27 * @dev: linux driver model device pointer
 28 * @me_cl: me client
 29 * @cl: mei client
 30 * @name: device name
 31 * @rx_work: async work to execute Rx event callback
 32 * @rx_cb: Drivers register this callback to get asynchronous ME
 33 *	Rx buffer pending notifications.
 34 * @notif_work: async work to execute FW notify event callback
 35 * @notif_cb: Drivers register this callback to get asynchronous ME
 36 *	FW notification pending notifications.
 37 *
 38 * @do_match: whether the device can be matched with a driver
 39 * @is_added: device is already scanned
 40 * @priv_data: client private data
 41 */
 42struct mei_cl_device {
 43	struct list_head bus_list;
 44	struct mei_device *bus;
 45	struct device dev;
 46
 47	struct mei_me_client *me_cl;
 48	struct mei_cl *cl;
 49	char name[MEI_CL_NAME_SIZE];
 50
 51	struct work_struct rx_work;
 52	mei_cldev_cb_t rx_cb;
 53	struct work_struct notif_work;
 54	mei_cldev_cb_t notif_cb;
 55
 56	unsigned int do_match:1;
 57	unsigned int is_added:1;
 58
 59	void *priv_data;
 60};
 61
 62#define to_mei_cl_device(d) container_of(d, struct mei_cl_device, dev)
 63
 64struct mei_cl_driver {
 65	struct device_driver driver;
 66	const char *name;
 67
 68	const struct mei_cl_device_id *id_table;
 69
 70	int (*probe)(struct mei_cl_device *cldev,
 71		     const struct mei_cl_device_id *id);
 72	void (*remove)(struct mei_cl_device *cldev);
 73};
 74
 75int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
 76				struct module *owner);
 77#define mei_cldev_driver_register(cldrv)             \
 78	__mei_cldev_driver_register(cldrv, THIS_MODULE)
 79
 80void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv);
 81
 82/**
 83 * module_mei_cl_driver - Helper macro for registering mei cl driver
 84 *
 85 * @__mei_cldrv: mei_cl_driver structure
 86 *
 87 *  Helper macro for mei cl drivers which do not do anything special in module
 88 *  init/exit, for eliminating a boilerplate code.
 89 */
 90#define module_mei_cl_driver(__mei_cldrv) \
 91	module_driver(__mei_cldrv, \
 92		      mei_cldev_driver_register,\
 93		      mei_cldev_driver_unregister)
 94
 95ssize_t mei_cldev_send(struct mei_cl_device *cldev, const u8 *buf,
 96		       size_t length);
 97ssize_t mei_cldev_send_timeout(struct mei_cl_device *cldev, const u8 *buf,
 98			       size_t length, unsigned long timeout);
 99ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length);
100ssize_t mei_cldev_recv_timeout(struct mei_cl_device *cldev, u8 *buf, size_t length,
101			       unsigned long timeout);
102ssize_t mei_cldev_send_vtag(struct mei_cl_device *cldev, const u8 *buf,
103			    size_t length, u8 vtag);
104ssize_t mei_cldev_send_vtag_timeout(struct mei_cl_device *cldev, const u8 *buf,
105				    size_t length, u8 vtag, unsigned long timeout);
106ssize_t mei_cldev_recv_vtag(struct mei_cl_device *cldev, u8 *buf, size_t length,
107			    u8 *vtag);
108ssize_t mei_cldev_recv_vtag_timeout(struct mei_cl_device *cldev, u8 *buf, size_t length,
109			    u8 *vtag, unsigned long timeout);
110
111int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb);
112int mei_cldev_register_notif_cb(struct mei_cl_device *cldev,
113				mei_cldev_cb_t notif_cb);
114
115u8 mei_cldev_ver(const struct mei_cl_device *cldev);
116size_t mei_cldev_mtu(const struct mei_cl_device *cldev);
117
118void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev);
119void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data);
120
121int mei_cldev_enable(struct mei_cl_device *cldev);
122int mei_cldev_disable(struct mei_cl_device *cldev);
123bool mei_cldev_enabled(const struct mei_cl_device *cldev);
124ssize_t mei_cldev_send_gsc_command(struct mei_cl_device *cldev,
125				   u8 client_id, u32 fence_id,
126				   struct scatterlist *sg_in,
127				   size_t total_in_len,
128				   struct scatterlist *sg_out);
129
130void *mei_cldev_dma_map(struct mei_cl_device *cldev, u8 buffer_id, size_t size);
131int mei_cldev_dma_unmap(struct mei_cl_device *cldev);
132
133#endif /* _LINUX_MEI_CL_BUS_H */
~/ Read-only file preview.