7#ifndef ZEPHYR_INCLUDE_SIP_SVC_DRIVER_H_
8#define ZEPHYR_INCLUDE_SIP_SVC_DRIVER_H_
20#define SVC_CONDUIT_NAME_LENGTH (4)
27 unsigned long arg0,
unsigned long arg1,
unsigned long arg2,
28 unsigned long arg3,
unsigned long arg4,
unsigned long arg5,
70 unsigned long *a1,
unsigned long *a2,
unsigned long *a3,
71 unsigned long *a4,
unsigned long *a5,
unsigned long *a6,
72 unsigned long *a7,
char *buf,
size_t size);
79 char *buf,
size_t *size,
uint32_t *trans_id);
119 unsigned long arg0,
unsigned long arg1,
unsigned long arg2,
120 unsigned long arg3,
unsigned long arg4,
unsigned long arg5,
122static inline void z_impl_sip_supervisory_call(
const struct device *dev,
unsigned long function_id,
123 unsigned long arg0,
unsigned long arg1,
124 unsigned long arg2,
unsigned long arg3,
125 unsigned long arg4,
unsigned long arg5,
128 __ASSERT(dev,
"dev shouldn't be NULL");
132 __ASSERT(res,
"response pointer shouldn't be NULL");
149static inline bool z_impl_sip_svc_plat_func_id_valid(
const struct device *dev,
uint32_t command,
152 __ASSERT(dev,
"dev shouldn't be NULL");
156 "sip_svc_plat_func_id_valid func shouldn't be NULL");
172static inline uint32_t z_impl_sip_svc_plat_format_trans_id(
const struct device *dev,
175 __ASSERT(dev,
"dev shouldn't be NULL");
179 "sip_svc_plat_format_trans_id func shouldn't be NULL");
193static inline uint32_t z_impl_sip_svc_plat_get_trans_idx(
const struct device *dev,
196 __ASSERT(dev,
"dev shouldn't be NULL");
200 "sip_svc_plat_get_trans_idx func shouldn't be NULL");
214static inline void z_impl_sip_svc_plat_update_trans_id(
const struct device *dev,
218 __ASSERT(dev,
"dev shouldn't be NULL");
222 "sip_svc_plat_update_trans_id func shouldn't be NULL");
223 __ASSERT(request,
"request shouldn't be NULL");
238static inline uint32_t z_impl_sip_svc_plat_get_error_code(
const struct device *dev,
241 __ASSERT(dev,
"dev shouldn't be NULL");
245 "sip_svc_plat_get_error_code func shouldn't be NULL");
246 __ASSERT(res,
"res shouldn't be NULL");
269 unsigned long *a1,
unsigned long *a2,
unsigned long *a3,
270 unsigned long *a4,
unsigned long *a5,
unsigned long *a6,
271 unsigned long *a7,
char *buf,
size_t size);
272static inline int z_impl_sip_svc_plat_async_res_req(
const struct device *dev,
unsigned long *a0,
273 unsigned long *a1,
unsigned long *a2,
274 unsigned long *a3,
unsigned long *a4,
275 unsigned long *a5,
unsigned long *a6,
276 unsigned long *a7,
char *buf,
size_t size)
278 __ASSERT(dev,
"dev shouldn't be NULL");
282 "sip_svc_plat_async_res_req func shouldn't be NULL");
283 __ASSERT(a0,
"a0 shouldn't be NULL");
284 __ASSERT(a1,
"a1 shouldn't be NULL");
285 __ASSERT(a2,
"a2 shouldn't be NULL");
286 __ASSERT(a3,
"a3 shouldn't be NULL");
287 __ASSERT(a4,
"a4 shouldn't be NULL");
288 __ASSERT(a5,
"a5 shouldn't be NULL");
289 __ASSERT(a6,
"a6 shouldn't be NULL");
290 __ASSERT(a7,
"a7 shouldn't be NULL");
291 __ASSERT(((buf ==
NULL && size == 0) || (buf !=
NULL && size != 0)),
292 "buf and size should represent a buffer");
293 return api->
sip_svc_plat_async_res_req(dev, a0, a1, a2, a3, a4, a5, a6, a7, buf, size);
310 char *buf,
size_t *size,
uint32_t *trans_id);
311static inline int z_impl_sip_svc_plat_async_res_res(
const struct device *dev,
315 __ASSERT(dev,
"dev shouldn't be NULL");
319 "sip_svc_plat_async_res_res func shouldn't be NULL");
320 __ASSERT(res,
"res shouldn't be NULL");
321 __ASSERT(buf,
"buf shouldn't be NULL");
322 __ASSERT(size,
"size shouldn't be NULL");
323 __ASSERT(trans_id,
"buf shouldn't be NULL");
336static inline void z_impl_sip_svc_plat_free_async_memory(
const struct device *dev,
339 __ASSERT(dev,
"dev shouldn't be NULL");
343 "sip_svc_plat_free_async_memory func shouldn't be NULL");
344 __ASSERT(request,
"request shouldn't be NULL");
350#include <zephyr/syscalls/sip_svc_driver.h>
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1375
#define NULL
Definition iar_missing_defs.h:20
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:26
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:49
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:42
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:78
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:85
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:55
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:69
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:62
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:35
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.
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:513
SiP Service communication protocol request format.
Definition sip_svc_proto.h:133
API structure for sip_svc driver.
Definition sip_svc_driver.h:92
sip_svc_plat_update_trans_id_t sip_svc_plat_update_trans_id
Definition sip_svc_driver.h:97
sip_svc_plat_async_res_res_t sip_svc_plat_async_res_res
Definition sip_svc_driver.h:100
sip_svc_plat_get_trans_idx_t sip_svc_plat_get_trans_idx
Definition sip_svc_driver.h:96
sip_svc_plat_free_async_memory_t sip_svc_plat_free_async_memory
Definition sip_svc_driver.h:98
sip_supervisory_call_t sip_supervisory_call
Definition sip_svc_driver.h:93
sip_svc_plat_format_trans_id_t sip_svc_plat_format_trans_id
Definition sip_svc_driver.h:95
sip_svc_plat_async_res_req_t sip_svc_plat_async_res_req
Definition sip_svc_driver.h:99
sip_svc_plat_func_id_valid_t sip_svc_plat_func_id_valid
Definition sip_svc_driver.h:94
sip_svc_plat_get_error_code_t sip_svc_plat_get_error_code
Definition sip_svc_driver.h:101