1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Intel ISH client Interface definitions
5 * Copyright (c) 2019, Intel Corporation.
8 #ifndef _INTEL_ISH_CLIENT_IF_H_
9 #define _INTEL_ISH_CLIENT_IF_H_
11 struct ishtp_cl_device;
16 ISHTP_CL_INITIALIZING = 0,
19 ISHTP_CL_DISCONNECTING,
24 * struct ishtp_cl_device - ISHTP device handle
25 * @driver: driver instance on a bus
26 * @name: Name of the device for probe
27 * @probe: driver callback for device probe
28 * @remove: driver callback on device removal
30 * Client drivers defines to get probed/removed for ISHTP client device.
32 struct ishtp_cl_driver {
33 struct device_driver driver;
36 int (*probe)(struct ishtp_cl_device *dev);
37 int (*remove)(struct ishtp_cl_device *dev);
38 int (*reset)(struct ishtp_cl_device *dev);
39 const struct dev_pm_ops *pm;
43 * struct ishtp_msg_data - ISHTP message data struct
44 * @size: Size of data in the *data
45 * @data: Pointer to data
47 struct ishtp_msg_data {
53 * struct ishtp_cl_rb - request block structure
54 * @list: Link to list members
55 * @cl: ISHTP client instance
56 * @buffer: message header
57 * @buf_idx: Index into buffer
58 * @read_time: unused at this time
61 struct list_head list;
63 struct ishtp_msg_data buffer;
64 unsigned long buf_idx;
65 unsigned long read_time;
68 int ishtp_cl_driver_register(struct ishtp_cl_driver *driver,
69 struct module *owner);
70 void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver);
71 int ishtp_register_event_cb(struct ishtp_cl_device *device,
72 void (*read_cb)(struct ishtp_cl_device *));
74 /* Get the device * from ishtp device instance */
75 struct device *ishtp_device(struct ishtp_cl_device *cl_device);
76 /* Trace interface for clients */
77 void *ishtp_trace_callback(struct ishtp_cl_device *cl_device);
79 struct ishtp_cl *ishtp_cl_allocate(struct ishtp_cl_device *cl_device);
80 void ishtp_cl_free(struct ishtp_cl *cl);
81 int ishtp_cl_link(struct ishtp_cl *cl);
82 void ishtp_cl_unlink(struct ishtp_cl *cl);
83 int ishtp_cl_disconnect(struct ishtp_cl *cl);
84 int ishtp_cl_connect(struct ishtp_cl *cl);
85 int ishtp_cl_send(struct ishtp_cl *cl, uint8_t *buf, size_t length);
86 int ishtp_cl_flush_queues(struct ishtp_cl *cl);
87 int ishtp_cl_io_rb_recycle(struct ishtp_cl_rb *rb);
88 bool ishtp_cl_tx_empty(struct ishtp_cl *cl);
89 struct ishtp_cl_rb *ishtp_cl_rx_get_rb(struct ishtp_cl *cl);
91 #endif /* _INTEL_ISH_CLIENT_IF_H_ */