1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * System Control and Management Interface (SCMI) Message Protocol
4*4882a593Smuzhiyun * driver common header file containing some definitions, structures
5*4882a593Smuzhiyun * and function prototypes used in all the different SCMI protocols.
6*4882a593Smuzhiyun *
7*4882a593Smuzhiyun * Copyright (C) 2018 ARM Ltd.
8*4882a593Smuzhiyun */
9*4882a593Smuzhiyun #ifndef _SCMI_COMMON_H
10*4882a593Smuzhiyun #define _SCMI_COMMON_H
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun #include <linux/bitfield.h>
13*4882a593Smuzhiyun #include <linux/completion.h>
14*4882a593Smuzhiyun #include <linux/device.h>
15*4882a593Smuzhiyun #include <linux/errno.h>
16*4882a593Smuzhiyun #include <linux/kernel.h>
17*4882a593Smuzhiyun #include <linux/module.h>
18*4882a593Smuzhiyun #include <linux/scmi_protocol.h>
19*4882a593Smuzhiyun #include <linux/types.h>
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun #include <asm/unaligned.h>
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun #include "notify.h"
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun #define PROTOCOL_REV_MINOR_MASK GENMASK(15, 0)
26*4882a593Smuzhiyun #define PROTOCOL_REV_MAJOR_MASK GENMASK(31, 16)
27*4882a593Smuzhiyun #define PROTOCOL_REV_MAJOR(x) (u16)(FIELD_GET(PROTOCOL_REV_MAJOR_MASK, (x)))
28*4882a593Smuzhiyun #define PROTOCOL_REV_MINOR(x) (u16)(FIELD_GET(PROTOCOL_REV_MINOR_MASK, (x)))
29*4882a593Smuzhiyun #define MAX_PROTOCOLS_IMP 16
30*4882a593Smuzhiyun #define MAX_OPPS 16
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun enum scmi_common_cmd {
33*4882a593Smuzhiyun PROTOCOL_VERSION = 0x0,
34*4882a593Smuzhiyun PROTOCOL_ATTRIBUTES = 0x1,
35*4882a593Smuzhiyun PROTOCOL_MESSAGE_ATTRIBUTES = 0x2,
36*4882a593Smuzhiyun };
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun /**
39*4882a593Smuzhiyun * struct scmi_msg_resp_prot_version - Response for a message
40*4882a593Smuzhiyun *
41*4882a593Smuzhiyun * @minor_version: Minor version of the ABI that firmware supports
42*4882a593Smuzhiyun * @major_version: Major version of the ABI that firmware supports
43*4882a593Smuzhiyun *
44*4882a593Smuzhiyun * In general, ABI version changes follow the rule that minor version increments
45*4882a593Smuzhiyun * are backward compatible. Major revision changes in ABI may not be
46*4882a593Smuzhiyun * backward compatible.
47*4882a593Smuzhiyun *
48*4882a593Smuzhiyun * Response to a generic message with message type SCMI_MSG_VERSION
49*4882a593Smuzhiyun */
50*4882a593Smuzhiyun struct scmi_msg_resp_prot_version {
51*4882a593Smuzhiyun __le16 minor_version;
52*4882a593Smuzhiyun __le16 major_version;
53*4882a593Smuzhiyun };
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun #define MSG_ID_MASK GENMASK(7, 0)
56*4882a593Smuzhiyun #define MSG_XTRACT_ID(hdr) FIELD_GET(MSG_ID_MASK, (hdr))
57*4882a593Smuzhiyun #define MSG_TYPE_MASK GENMASK(9, 8)
58*4882a593Smuzhiyun #define MSG_XTRACT_TYPE(hdr) FIELD_GET(MSG_TYPE_MASK, (hdr))
59*4882a593Smuzhiyun #define MSG_TYPE_COMMAND 0
60*4882a593Smuzhiyun #define MSG_TYPE_DELAYED_RESP 2
61*4882a593Smuzhiyun #define MSG_TYPE_NOTIFICATION 3
62*4882a593Smuzhiyun #define MSG_PROTOCOL_ID_MASK GENMASK(17, 10)
63*4882a593Smuzhiyun #define MSG_XTRACT_PROT_ID(hdr) FIELD_GET(MSG_PROTOCOL_ID_MASK, (hdr))
64*4882a593Smuzhiyun #define MSG_TOKEN_ID_MASK GENMASK(27, 18)
65*4882a593Smuzhiyun #define MSG_XTRACT_TOKEN(hdr) FIELD_GET(MSG_TOKEN_ID_MASK, (hdr))
66*4882a593Smuzhiyun #define MSG_TOKEN_MAX (MSG_XTRACT_TOKEN(MSG_TOKEN_ID_MASK) + 1)
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun /**
69*4882a593Smuzhiyun * struct scmi_msg_hdr - Message(Tx/Rx) header
70*4882a593Smuzhiyun *
71*4882a593Smuzhiyun * @id: The identifier of the message being sent
72*4882a593Smuzhiyun * @protocol_id: The identifier of the protocol used to send @id message
73*4882a593Smuzhiyun * @seq: The token to identify the message. When a message returns, the
74*4882a593Smuzhiyun * platform returns the whole message header unmodified including the
75*4882a593Smuzhiyun * token
76*4882a593Smuzhiyun * @status: Status of the transfer once it's complete
77*4882a593Smuzhiyun * @poll_completion: Indicate if the transfer needs to be polled for
78*4882a593Smuzhiyun * completion or interrupt mode is used
79*4882a593Smuzhiyun */
80*4882a593Smuzhiyun struct scmi_msg_hdr {
81*4882a593Smuzhiyun u8 id;
82*4882a593Smuzhiyun u8 protocol_id;
83*4882a593Smuzhiyun u16 seq;
84*4882a593Smuzhiyun u32 status;
85*4882a593Smuzhiyun bool poll_completion;
86*4882a593Smuzhiyun };
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun /**
89*4882a593Smuzhiyun * pack_scmi_header() - packs and returns 32-bit header
90*4882a593Smuzhiyun *
91*4882a593Smuzhiyun * @hdr: pointer to header containing all the information on message id,
92*4882a593Smuzhiyun * protocol id and sequence id.
93*4882a593Smuzhiyun *
94*4882a593Smuzhiyun * Return: 32-bit packed message header to be sent to the platform.
95*4882a593Smuzhiyun */
pack_scmi_header(struct scmi_msg_hdr * hdr)96*4882a593Smuzhiyun static inline u32 pack_scmi_header(struct scmi_msg_hdr *hdr)
97*4882a593Smuzhiyun {
98*4882a593Smuzhiyun return FIELD_PREP(MSG_ID_MASK, hdr->id) |
99*4882a593Smuzhiyun FIELD_PREP(MSG_TOKEN_ID_MASK, hdr->seq) |
100*4882a593Smuzhiyun FIELD_PREP(MSG_PROTOCOL_ID_MASK, hdr->protocol_id);
101*4882a593Smuzhiyun }
102*4882a593Smuzhiyun
103*4882a593Smuzhiyun /**
104*4882a593Smuzhiyun * unpack_scmi_header() - unpacks and records message and protocol id
105*4882a593Smuzhiyun *
106*4882a593Smuzhiyun * @msg_hdr: 32-bit packed message header sent from the platform
107*4882a593Smuzhiyun * @hdr: pointer to header to fetch message and protocol id.
108*4882a593Smuzhiyun */
unpack_scmi_header(u32 msg_hdr,struct scmi_msg_hdr * hdr)109*4882a593Smuzhiyun static inline void unpack_scmi_header(u32 msg_hdr, struct scmi_msg_hdr *hdr)
110*4882a593Smuzhiyun {
111*4882a593Smuzhiyun hdr->id = MSG_XTRACT_ID(msg_hdr);
112*4882a593Smuzhiyun hdr->protocol_id = MSG_XTRACT_PROT_ID(msg_hdr);
113*4882a593Smuzhiyun }
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun /**
116*4882a593Smuzhiyun * struct scmi_msg - Message(Tx/Rx) structure
117*4882a593Smuzhiyun *
118*4882a593Smuzhiyun * @buf: Buffer pointer
119*4882a593Smuzhiyun * @len: Length of data in the Buffer
120*4882a593Smuzhiyun */
121*4882a593Smuzhiyun struct scmi_msg {
122*4882a593Smuzhiyun void *buf;
123*4882a593Smuzhiyun size_t len;
124*4882a593Smuzhiyun };
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun /**
127*4882a593Smuzhiyun * struct scmi_xfer - Structure representing a message flow
128*4882a593Smuzhiyun *
129*4882a593Smuzhiyun * @transfer_id: Unique ID for debug & profiling purpose
130*4882a593Smuzhiyun * @hdr: Transmit message header
131*4882a593Smuzhiyun * @tx: Transmit message
132*4882a593Smuzhiyun * @rx: Receive message, the buffer should be pre-allocated to store
133*4882a593Smuzhiyun * message. If request-ACK protocol is used, we can reuse the same
134*4882a593Smuzhiyun * buffer for the rx path as we use for the tx path.
135*4882a593Smuzhiyun * @done: command message transmit completion event
136*4882a593Smuzhiyun * @async_done: pointer to delayed response message received event completion
137*4882a593Smuzhiyun */
138*4882a593Smuzhiyun struct scmi_xfer {
139*4882a593Smuzhiyun int transfer_id;
140*4882a593Smuzhiyun struct scmi_msg_hdr hdr;
141*4882a593Smuzhiyun struct scmi_msg tx;
142*4882a593Smuzhiyun struct scmi_msg rx;
143*4882a593Smuzhiyun struct completion done;
144*4882a593Smuzhiyun struct completion *async_done;
145*4882a593Smuzhiyun };
146*4882a593Smuzhiyun
147*4882a593Smuzhiyun struct scmi_xfer_ops;
148*4882a593Smuzhiyun
149*4882a593Smuzhiyun /**
150*4882a593Smuzhiyun * struct scmi_protocol_handle - Reference to an initialized protocol instance
151*4882a593Smuzhiyun *
152*4882a593Smuzhiyun * @dev: A reference to the associated SCMI instance device (handle->dev).
153*4882a593Smuzhiyun * @xops: A reference to a struct holding refs to the core xfer operations that
154*4882a593Smuzhiyun * can be used by the protocol implementation to generate SCMI messages.
155*4882a593Smuzhiyun * @set_priv: A method to set protocol private data for this instance.
156*4882a593Smuzhiyun * @get_priv: A method to get protocol private data previously set.
157*4882a593Smuzhiyun *
158*4882a593Smuzhiyun * This structure represents a protocol initialized against specific SCMI
159*4882a593Smuzhiyun * instance and it will be used as follows:
160*4882a593Smuzhiyun * - as a parameter fed from the core to the protocol initialization code so
161*4882a593Smuzhiyun * that it can access the core xfer operations to build and generate SCMI
162*4882a593Smuzhiyun * messages exclusively for the specific underlying protocol instance.
163*4882a593Smuzhiyun * - as an opaque handle fed by an SCMI driver user when it tries to access
164*4882a593Smuzhiyun * this protocol through its own protocol operations.
165*4882a593Smuzhiyun * In this case this handle will be returned as an opaque object together
166*4882a593Smuzhiyun * with the related protocol operations when the SCMI driver tries to access
167*4882a593Smuzhiyun * the protocol.
168*4882a593Smuzhiyun */
169*4882a593Smuzhiyun struct scmi_protocol_handle {
170*4882a593Smuzhiyun struct device *dev;
171*4882a593Smuzhiyun const struct scmi_xfer_ops *xops;
172*4882a593Smuzhiyun int (*set_priv)(const struct scmi_protocol_handle *ph, void *priv);
173*4882a593Smuzhiyun void *(*get_priv)(const struct scmi_protocol_handle *ph);
174*4882a593Smuzhiyun };
175*4882a593Smuzhiyun
176*4882a593Smuzhiyun /**
177*4882a593Smuzhiyun * struct scmi_xfer_ops - References to the core SCMI xfer operations.
178*4882a593Smuzhiyun * @version_get: Get this version protocol.
179*4882a593Smuzhiyun * @xfer_get_init: Initialize one struct xfer if any xfer slot is free.
180*4882a593Smuzhiyun * @reset_rx_to_maxsz: Reset rx size to max transport size.
181*4882a593Smuzhiyun * @do_xfer: Do the SCMI transfer.
182*4882a593Smuzhiyun * @do_xfer_with_response: Do the SCMI transfer waiting for a response.
183*4882a593Smuzhiyun * @xfer_put: Free the xfer slot.
184*4882a593Smuzhiyun *
185*4882a593Smuzhiyun * Note that all this operations expect a protocol handle as first parameter;
186*4882a593Smuzhiyun * they then internally use it to infer the underlying protocol number: this
187*4882a593Smuzhiyun * way is not possible for a protocol implementation to forge messages for
188*4882a593Smuzhiyun * another protocol.
189*4882a593Smuzhiyun */
190*4882a593Smuzhiyun struct scmi_xfer_ops {
191*4882a593Smuzhiyun int (*version_get)(const struct scmi_protocol_handle *ph, u32 *version);
192*4882a593Smuzhiyun int (*xfer_get_init)(const struct scmi_protocol_handle *ph, u8 msg_id,
193*4882a593Smuzhiyun size_t tx_size, size_t rx_size,
194*4882a593Smuzhiyun struct scmi_xfer **p);
195*4882a593Smuzhiyun void (*reset_rx_to_maxsz)(const struct scmi_protocol_handle *ph,
196*4882a593Smuzhiyun struct scmi_xfer *xfer);
197*4882a593Smuzhiyun int (*do_xfer)(const struct scmi_protocol_handle *ph,
198*4882a593Smuzhiyun struct scmi_xfer *xfer);
199*4882a593Smuzhiyun int (*do_xfer_with_response)(const struct scmi_protocol_handle *ph,
200*4882a593Smuzhiyun struct scmi_xfer *xfer);
201*4882a593Smuzhiyun void (*xfer_put)(const struct scmi_protocol_handle *ph,
202*4882a593Smuzhiyun struct scmi_xfer *xfer);
203*4882a593Smuzhiyun };
204*4882a593Smuzhiyun
205*4882a593Smuzhiyun struct scmi_revision_info *
206*4882a593Smuzhiyun scmi_get_revision_area(const struct scmi_protocol_handle *ph);
207*4882a593Smuzhiyun int scmi_handle_put(const struct scmi_handle *handle);
208*4882a593Smuzhiyun struct scmi_handle *scmi_handle_get(struct device *dev);
209*4882a593Smuzhiyun void scmi_set_handle(struct scmi_device *scmi_dev);
210*4882a593Smuzhiyun void scmi_setup_protocol_implemented(const struct scmi_protocol_handle *ph,
211*4882a593Smuzhiyun u8 *prot_imp);
212*4882a593Smuzhiyun
213*4882a593Smuzhiyun typedef int (*scmi_prot_init_ph_fn_t)(const struct scmi_protocol_handle *);
214*4882a593Smuzhiyun
215*4882a593Smuzhiyun /**
216*4882a593Smuzhiyun * struct scmi_protocol - Protocol descriptor
217*4882a593Smuzhiyun * @id: Protocol ID.
218*4882a593Smuzhiyun * @owner: Module reference if any.
219*4882a593Smuzhiyun * @init_instance: Mandatory protocol initialization function.
220*4882a593Smuzhiyun * @deinit_instance: Optional protocol de-initialization function.
221*4882a593Smuzhiyun * @ops: Optional reference to the operations provided by the protocol and
222*4882a593Smuzhiyun * exposed in scmi_protocol.h.
223*4882a593Smuzhiyun * @events: An optional reference to the events supported by this protocol.
224*4882a593Smuzhiyun */
225*4882a593Smuzhiyun struct scmi_protocol {
226*4882a593Smuzhiyun const u8 id;
227*4882a593Smuzhiyun struct module *owner;
228*4882a593Smuzhiyun const scmi_prot_init_ph_fn_t init_instance;
229*4882a593Smuzhiyun const scmi_prot_init_ph_fn_t deinit_instance;
230*4882a593Smuzhiyun const void *ops;
231*4882a593Smuzhiyun const struct scmi_protocol_events *events;
232*4882a593Smuzhiyun };
233*4882a593Smuzhiyun
234*4882a593Smuzhiyun int __init scmi_bus_init(void);
235*4882a593Smuzhiyun void __exit scmi_bus_exit(void);
236*4882a593Smuzhiyun
237*4882a593Smuzhiyun #define DECLARE_SCMI_REGISTER_UNREGISTER(func) \
238*4882a593Smuzhiyun int __init scmi_##func##_register(void); \
239*4882a593Smuzhiyun void __exit scmi_##func##_unregister(void)
240*4882a593Smuzhiyun DECLARE_SCMI_REGISTER_UNREGISTER(base);
241*4882a593Smuzhiyun DECLARE_SCMI_REGISTER_UNREGISTER(clock);
242*4882a593Smuzhiyun DECLARE_SCMI_REGISTER_UNREGISTER(perf);
243*4882a593Smuzhiyun DECLARE_SCMI_REGISTER_UNREGISTER(power);
244*4882a593Smuzhiyun DECLARE_SCMI_REGISTER_UNREGISTER(reset);
245*4882a593Smuzhiyun DECLARE_SCMI_REGISTER_UNREGISTER(sensors);
246*4882a593Smuzhiyun DECLARE_SCMI_REGISTER_UNREGISTER(voltage);
247*4882a593Smuzhiyun DECLARE_SCMI_REGISTER_UNREGISTER(system);
248*4882a593Smuzhiyun
249*4882a593Smuzhiyun #define DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(name, proto) \
250*4882a593Smuzhiyun int __init scmi_##name##_register(void) \
251*4882a593Smuzhiyun { \
252*4882a593Smuzhiyun return scmi_protocol_register(&(proto)); \
253*4882a593Smuzhiyun } \
254*4882a593Smuzhiyun \
255*4882a593Smuzhiyun void __exit scmi_##name##_unregister(void) \
256*4882a593Smuzhiyun { \
257*4882a593Smuzhiyun scmi_protocol_unregister(&(proto)); \
258*4882a593Smuzhiyun }
259*4882a593Smuzhiyun
260*4882a593Smuzhiyun const struct scmi_protocol *scmi_get_protocol(int protocol_id);
261*4882a593Smuzhiyun void scmi_put_protocol(int protocol_id);
262*4882a593Smuzhiyun
263*4882a593Smuzhiyun int scmi_acquire_protocol(const struct scmi_handle *handle, u8 protocol_id);
264*4882a593Smuzhiyun void scmi_release_protocol(const struct scmi_handle *handle, u8 protocol_id);
265*4882a593Smuzhiyun
266*4882a593Smuzhiyun /* SCMI Transport */
267*4882a593Smuzhiyun /**
268*4882a593Smuzhiyun * struct scmi_chan_info - Structure representing a SCMI channel information
269*4882a593Smuzhiyun *
270*4882a593Smuzhiyun * @dev: Reference to device in the SCMI hierarchy corresponding to this
271*4882a593Smuzhiyun * channel
272*4882a593Smuzhiyun * @handle: Pointer to SCMI entity handle
273*4882a593Smuzhiyun * @transport_info: Transport layer related information
274*4882a593Smuzhiyun */
275*4882a593Smuzhiyun struct scmi_chan_info {
276*4882a593Smuzhiyun struct device *dev;
277*4882a593Smuzhiyun struct scmi_handle *handle;
278*4882a593Smuzhiyun void *transport_info;
279*4882a593Smuzhiyun };
280*4882a593Smuzhiyun
281*4882a593Smuzhiyun /**
282*4882a593Smuzhiyun * struct scmi_transport_ops - Structure representing a SCMI transport ops
283*4882a593Smuzhiyun *
284*4882a593Smuzhiyun * @chan_available: Callback to check if channel is available or not
285*4882a593Smuzhiyun * @chan_setup: Callback to allocate and setup a channel
286*4882a593Smuzhiyun * @chan_free: Callback to free a channel
287*4882a593Smuzhiyun * @send_message: Callback to send a message
288*4882a593Smuzhiyun * @mark_txdone: Callback to mark tx as done
289*4882a593Smuzhiyun * @fetch_response: Callback to fetch response
290*4882a593Smuzhiyun * @fetch_notification: Callback to fetch notification
291*4882a593Smuzhiyun * @clear_channel: Callback to clear a channel
292*4882a593Smuzhiyun * @poll_done: Callback to poll transfer status
293*4882a593Smuzhiyun */
294*4882a593Smuzhiyun struct scmi_transport_ops {
295*4882a593Smuzhiyun bool (*chan_available)(struct device *dev, int idx);
296*4882a593Smuzhiyun int (*chan_setup)(struct scmi_chan_info *cinfo, struct device *dev,
297*4882a593Smuzhiyun bool tx);
298*4882a593Smuzhiyun int (*chan_free)(int id, void *p, void *data);
299*4882a593Smuzhiyun int (*send_message)(struct scmi_chan_info *cinfo,
300*4882a593Smuzhiyun struct scmi_xfer *xfer);
301*4882a593Smuzhiyun void (*mark_txdone)(struct scmi_chan_info *cinfo, int ret);
302*4882a593Smuzhiyun void (*fetch_response)(struct scmi_chan_info *cinfo,
303*4882a593Smuzhiyun struct scmi_xfer *xfer);
304*4882a593Smuzhiyun void (*fetch_notification)(struct scmi_chan_info *cinfo,
305*4882a593Smuzhiyun size_t max_len, struct scmi_xfer *xfer);
306*4882a593Smuzhiyun void (*clear_channel)(struct scmi_chan_info *cinfo);
307*4882a593Smuzhiyun bool (*poll_done)(struct scmi_chan_info *cinfo, struct scmi_xfer *xfer);
308*4882a593Smuzhiyun };
309*4882a593Smuzhiyun
310*4882a593Smuzhiyun int scmi_request_protocol_device(const struct scmi_device_id *id_table);
311*4882a593Smuzhiyun void scmi_unrequest_protocol_device(const struct scmi_device_id *id_table);
312*4882a593Smuzhiyun struct scmi_device *scmi_find_child_dev(struct device *parent,
313*4882a593Smuzhiyun int prot_id, const char *name);
314*4882a593Smuzhiyun
315*4882a593Smuzhiyun /**
316*4882a593Smuzhiyun * struct scmi_desc - Description of SoC integration
317*4882a593Smuzhiyun *
318*4882a593Smuzhiyun * @ops: Pointer to the transport specific ops structure
319*4882a593Smuzhiyun * @max_rx_timeout_ms: Timeout for communication with SoC (in Milliseconds)
320*4882a593Smuzhiyun * @max_msg: Maximum number of messages that can be pending
321*4882a593Smuzhiyun * simultaneously in the system
322*4882a593Smuzhiyun * @max_msg_size: Maximum size of data per message that can be handled.
323*4882a593Smuzhiyun */
324*4882a593Smuzhiyun struct scmi_desc {
325*4882a593Smuzhiyun const struct scmi_transport_ops *ops;
326*4882a593Smuzhiyun int max_rx_timeout_ms;
327*4882a593Smuzhiyun int max_msg;
328*4882a593Smuzhiyun int max_msg_size;
329*4882a593Smuzhiyun };
330*4882a593Smuzhiyun
331*4882a593Smuzhiyun extern const struct scmi_desc scmi_mailbox_desc;
332*4882a593Smuzhiyun #ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
333*4882a593Smuzhiyun extern const struct scmi_desc scmi_smc_desc;
334*4882a593Smuzhiyun #endif
335*4882a593Smuzhiyun
336*4882a593Smuzhiyun void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr);
337*4882a593Smuzhiyun void scmi_free_channel(struct scmi_chan_info *cinfo, struct idr *idr, int id);
338*4882a593Smuzhiyun
339*4882a593Smuzhiyun /* shmem related declarations */
340*4882a593Smuzhiyun struct scmi_shared_mem;
341*4882a593Smuzhiyun
342*4882a593Smuzhiyun void shmem_tx_prepare(struct scmi_shared_mem __iomem *shmem,
343*4882a593Smuzhiyun struct scmi_xfer *xfer);
344*4882a593Smuzhiyun u32 shmem_read_header(struct scmi_shared_mem __iomem *shmem);
345*4882a593Smuzhiyun void shmem_fetch_response(struct scmi_shared_mem __iomem *shmem,
346*4882a593Smuzhiyun struct scmi_xfer *xfer);
347*4882a593Smuzhiyun void shmem_fetch_notification(struct scmi_shared_mem __iomem *shmem,
348*4882a593Smuzhiyun size_t max_len, struct scmi_xfer *xfer);
349*4882a593Smuzhiyun void shmem_clear_channel(struct scmi_shared_mem __iomem *shmem);
350*4882a593Smuzhiyun bool shmem_poll_done(struct scmi_shared_mem __iomem *shmem,
351*4882a593Smuzhiyun struct scmi_xfer *xfer);
352*4882a593Smuzhiyun
353*4882a593Smuzhiyun void scmi_set_notification_instance_data(const struct scmi_handle *handle,
354*4882a593Smuzhiyun void *priv);
355*4882a593Smuzhiyun void *scmi_get_notification_instance_data(const struct scmi_handle *handle);
356*4882a593Smuzhiyun
357*4882a593Smuzhiyun #endif /* _SCMI_COMMON_H */
358