7#ifndef ZEPHYR_INCLUDE_SIP_SVC_DRIVER_H_
8#define ZEPHYR_INCLUDE_SIP_SVC_DRIVER_H_
16#define DEV_API(dev) ((struct svc_driver_api *)(dev)->api)
22#define SVC_CONDUIT_NAME_LENGTH (4)
29 unsigned long arg0,
unsigned long arg1,
unsigned long arg2,
30 unsigned long arg3,
unsigned long arg4,
unsigned long arg5,
72 unsigned long *a1,
unsigned long *a2,
unsigned long *a3,
73 unsigned long *a4,
unsigned long *a5,
unsigned long *a6,
74 unsigned long *a7,
char *buf,
size_t size);
81 char *buf,
size_t *size,
uint32_t *trans_id);
121 unsigned long arg0,
unsigned long arg1,
unsigned long arg2,
122 unsigned long arg3,
unsigned long arg4,
unsigned long arg5,
124static inline void z_impl_sip_supervisory_call(
const struct device *dev,
unsigned long function_id,
125 unsigned long arg0,
unsigned long arg1,
126 unsigned long arg2,
unsigned long arg3,
127 unsigned long arg4,
unsigned long arg5,
130 __ASSERT(dev,
"dev shouldn't be NULL");
134 __ASSERT(res,
"response pointer shouldn't be NULL");
151static inline bool z_impl_sip_svc_plat_func_id_valid(
const struct device *dev,
uint32_t command,
154 __ASSERT(dev,
"dev shouldn't be NULL");
158 "sip_svc_plat_func_id_valid func shouldn't be NULL");
174static inline uint32_t z_impl_sip_svc_plat_format_trans_id(
const struct device *dev,
177 __ASSERT(dev,
"dev shouldn't be NULL");
181 "sip_svc_plat_format_trans_id func shouldn't be NULL");
195static inline uint32_t z_impl_sip_svc_plat_get_trans_idx(
const struct device *dev,
198 __ASSERT(dev,
"dev shouldn't be NULL");
202 "sip_svc_plat_get_trans_idx func shouldn't be NULL");
216static inline void z_impl_sip_svc_plat_update_trans_id(
const struct device *dev,
220 __ASSERT(dev,
"dev shouldn't be NULL");
224 "sip_svc_plat_update_trans_id func shouldn't be NULL");
225 __ASSERT(request,
"request shouldn't be NULL");
240static inline uint32_t z_impl_sip_svc_plat_get_error_code(
const struct device *dev,
243 __ASSERT(dev,
"dev shouldn't be NULL");
247 "sip_svc_plat_get_error_code func shouldn't be NULL");
248 __ASSERT(res,
"res shouldn't be NULL");
271 unsigned long *a1,
unsigned long *a2,
unsigned long *a3,
272 unsigned long *a4,
unsigned long *a5,
unsigned long *a6,
273 unsigned long *a7,
char *buf,
size_t size);
274static inline int z_impl_sip_svc_plat_async_res_req(
const struct device *dev,
unsigned long *a0,
275 unsigned long *a1,
unsigned long *a2,
276 unsigned long *a3,
unsigned long *a4,
277 unsigned long *a5,
unsigned long *a6,
278 unsigned long *a7,
char *buf,
size_t size)
280 __ASSERT(dev,
"dev shouldn't be NULL");
284 "sip_svc_plat_async_res_req func shouldn't be NULL");
285 __ASSERT(a0,
"a0 shouldn't be NULL");
286 __ASSERT(a1,
"a1 shouldn't be NULL");
287 __ASSERT(a2,
"a2 shouldn't be NULL");
288 __ASSERT(a3,
"a3 shouldn't be NULL");
289 __ASSERT(a4,
"a4 shouldn't be NULL");
290 __ASSERT(a5,
"a5 shouldn't be NULL");
291 __ASSERT(a6,
"a6 shouldn't be NULL");
292 __ASSERT(a7,
"a7 shouldn't be NULL");
293 __ASSERT(((buf == NULL && size == 0) || (buf != NULL && size != 0)),
294 "buf and size should represent a buffer");
295 return api->
sip_svc_plat_async_res_req(dev, a0, a1, a2, a3, a4, a5, a6, a7, buf, size);
312 char *buf,
size_t *size,
uint32_t *trans_id);
313static inline int z_impl_sip_svc_plat_async_res_res(
const struct device *dev,
317 __ASSERT(dev,
"dev shouldn't be NULL");
321 "sip_svc_plat_async_res_res func shouldn't be NULL");
322 __ASSERT(res,
"res shouldn't be NULL");
323 __ASSERT(buf,
"buf shouldn't be NULL");
324 __ASSERT(size,
"size shouldn't be NULL");
325 __ASSERT(trans_id,
"buf shouldn't be NULL");
338static inline void z_impl_sip_svc_plat_free_async_memory(
const struct device *dev,
341 __ASSERT(dev,
"dev shouldn't be NULL");
345 "sip_svc_plat_free_async_memory func shouldn't be NULL");
346 __ASSERT(request,
"request shouldn't be NULL");
352#include <zephyr/syscalls/sip_svc_driver.h>
void sip_svc_plat_update_trans_id(const struct device *dev, struct sip_svc_request *request, uint32_t trans_id)
Update transaction id for sip_svc_request for lower layer.
int sip_svc_plat_async_res_res(const struct device *dev, struct arm_smccc_res *res, char *buf, size_t *size, uint32_t *trans_id)
Check the response of polling supervisory call and retrieve the response size and transaction id.
void(* sip_supervisory_call_t)(const struct device *dev, unsigned long function_id, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5, unsigned long arg6, struct arm_smccc_res *res)
Callback API for executing the supervisory call See sip_supervisory_call() for argument description.
Definition: sip_svc_driver.h:28
uint32_t sip_svc_plat_get_error_code(const struct device *dev, struct arm_smccc_res *res)
Retrieve the error code from arm_smccc_res response.
uint32_t(* sip_svc_plat_get_trans_idx_t)(const struct device *dev, uint32_t trans_id)
Callback API for retrieving client transaction id from transaction id See sip_svc_plat_get_trans_idx(...
Definition: sip_svc_driver.h:51
uint32_t(* sip_svc_plat_format_trans_id_t)(const struct device *dev, uint32_t client_idx, uint32_t trans_idx)
Callback API for generating the transaction id from client id.
Definition: sip_svc_driver.h:44
int(* sip_svc_plat_async_res_res_t)(const struct device *dev, struct arm_smccc_res *res, char *buf, size_t *size, uint32_t *trans_id)
Callback API to check the response of polling request See sip_svc_plat_async_res_res() for argument d...
Definition: sip_svc_driver.h:80
void sip_supervisory_call(const struct device *dev, unsigned long function_id, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5, unsigned long arg6, struct arm_smccc_res *res)
supervisory call function which will execute the smc/hvc call
bool sip_svc_plat_func_id_valid(const struct device *dev, uint32_t command, uint32_t func_id)
Validate the function id for the supervisory call.
uint32_t(* sip_svc_plat_get_error_code_t)(const struct device *dev, struct arm_smccc_res *res)
Callback API for retrieving error code from a supervisory call response.
Definition: sip_svc_driver.h:87
void(* sip_svc_plat_update_trans_id_t)(const struct device *dev, struct sip_svc_request *request, uint32_t trans_id)
Callback API for updating transaction id for request packet for lower layer See sip_svc_plat_update_t...
Definition: sip_svc_driver.h:57
int(* sip_svc_plat_async_res_req_t)(const struct device *dev, unsigned long *a0, unsigned long *a1, unsigned long *a2, unsigned long *a3, unsigned long *a4, unsigned long *a5, unsigned long *a6, unsigned long *a7, char *buf, size_t size)
Callback API to construct Polling packet for ASYNC transaction.
Definition: sip_svc_driver.h:71
void sip_svc_plat_free_async_memory(const struct device *dev, struct sip_svc_request *request)
Free the command buffer used for ASYNC packet after sending it to lower layers.
void(* sip_svc_plat_free_async_memory_t)(const struct device *dev, struct sip_svc_request *request)
Callback API for freeing command buffer in ASYNC packets See sip_svc_plat_free_async_memory() for arg...
Definition: sip_svc_driver.h:64
int sip_svc_plat_async_res_req(const struct device *dev, unsigned long *a0, unsigned long *a1, unsigned long *a2, unsigned long *a3, unsigned long *a4, unsigned long *a5, unsigned long *a6, unsigned long *a7, char *buf, size_t size)
Set arguments for polling supervisory call.
bool(* sip_svc_plat_func_id_valid_t)(const struct device *dev, uint32_t command, uint32_t func_id)
Callback API for validating function id for the supervisory call.
Definition: sip_svc_driver.h:37
uint32_t sip_svc_plat_get_trans_idx(const struct device *dev, uint32_t trans_id)
Retrieve client transaction id from packet transaction id.
uint32_t sip_svc_plat_format_trans_id(const struct device *dev, uint32_t client_idx, uint32_t trans_idx)
Formats and generates the transaction id from client id.
#define DEV_API(dev)
Definition: sip_svc_driver.h:16
Arm SiP services communication protocol between service provider and client.
#define bool
Definition: stdbool.h:13
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
Definition: arm-smccc.h:14
Runtime device structure (in ROM) per driver instance.
Definition: device.h:403
SiP Service communication protocol request format.
Definition: sip_svc_proto.h:133
API structure for sip_svc driver.
Definition: sip_svc_driver.h:94
sip_svc_plat_update_trans_id_t sip_svc_plat_update_trans_id
Definition: sip_svc_driver.h:99
sip_svc_plat_async_res_res_t sip_svc_plat_async_res_res
Definition: sip_svc_driver.h:102
sip_svc_plat_get_trans_idx_t sip_svc_plat_get_trans_idx
Definition: sip_svc_driver.h:98
sip_svc_plat_free_async_memory_t sip_svc_plat_free_async_memory
Definition: sip_svc_driver.h:100
sip_supervisory_call_t sip_supervisory_call
Definition: sip_svc_driver.h:95
sip_svc_plat_format_trans_id_t sip_svc_plat_format_trans_id
Definition: sip_svc_driver.h:97
sip_svc_plat_async_res_req_t sip_svc_plat_async_res_req
Definition: sip_svc_driver.h:101
sip_svc_plat_func_id_valid_t sip_svc_plat_func_id_valid
Definition: sip_svc_driver.h:96
sip_svc_plat_get_error_code_t sip_svc_plat_get_error_code
Definition: sip_svc_driver.h:103