Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sip_svc_driver.h File Reference
#include <zephyr/device.h>
#include <zephyr/kernel.h>
#include <zephyr/arch/arm64/arm-smccc.h>
#include <zephyr/drivers/sip_svc/sip_svc_proto.h>
#include <zephyr/sip_svc/sip_svc_controller.h>
#include <zephyr/syscalls/sip_svc_driver.h>

Go to the source code of this file.

Data Structures

struct  svc_driver_api
 API structure for sip_svc driver. More...
 

Macros

#define DEV_API(dev)   ((struct svc_driver_api *)(dev)->api)
 
#define SVC_CONDUIT_NAME_LENGTH   (4)
 Length of SVC conduit name.
 

Typedefs

typedef 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.
 
typedef 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.
 
typedef 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.
 
typedef 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() for argument description.
 
typedef 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_trans_id() for argument description.
 
typedef 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 argument description.
 
typedef 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.
 
typedef 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 description.
 
typedef 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.
 

Functions

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_format_trans_id (const struct device *dev, uint32_t client_idx, uint32_t trans_idx)
 Formats and generates the transaction id from client id.
 
uint32_t sip_svc_plat_get_trans_idx (const struct device *dev, uint32_t trans_id)
 Retrieve client transaction id from packet transaction id.
 
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.
 
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.
 
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.
 
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_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.
 

Macro Definition Documentation

◆ DEV_API

#define DEV_API (   dev)    ((struct svc_driver_api *)(dev)->api)

◆ SVC_CONDUIT_NAME_LENGTH

#define SVC_CONDUIT_NAME_LENGTH   (4)

Length of SVC conduit name.

Typedef Documentation

◆ sip_supervisory_call_t

typedef 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.

◆ sip_svc_plat_async_res_req_t

typedef 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.

See sip_svc_plat_async_res_req() for argument description

◆ sip_svc_plat_async_res_res_t

typedef 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 description.

◆ sip_svc_plat_format_trans_id_t

typedef 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.

See sip_svc_plat_format_trans_id() for argument description

◆ sip_svc_plat_free_async_memory_t

typedef 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 argument description.

◆ sip_svc_plat_func_id_valid_t

typedef 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.

See sip_svc_plat_func_id_valid() for argument description

◆ sip_svc_plat_get_error_code_t

typedef 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.

See sip_svc_plat_get_error_code() for argument description.

◆ sip_svc_plat_get_trans_idx_t

typedef 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() for argument description.

◆ sip_svc_plat_update_trans_id_t

typedef 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_trans_id() for argument description.

Function Documentation

◆ sip_supervisory_call()

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

Parameters
devPointer to the device structure for the driver instance.
function_idFunction identifier for the supervisory call.
arg0Argument 0 for supervisory call.
arg1Argument 1 for supervisory call.
arg2Argument 2 for supervisory call.
arg3Argument 3 for supervisory call.
arg4Argument 4 for supervisory call.
arg5Argument 5 for supervisory call.
arg6Argument 6 for supervisory call.
resPointer to response buffer for supervisory call.

◆ sip_svc_plat_async_res_req()

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.

For ASYNC polling of response.

Parameters
devPointer to the device structure for the driver instance.
a0Argument 0 for supervisory call.
a1Argument 1 for supervisory call.
a2Argument 2 for supervisory call.
a3Argument 3 for supervisory call.
a4Argument 4 for supervisory call.
a5Argument 5 for supervisory call.
a6Argument 6 for supervisory call.
a7Argument 7 for supervisory call.
bufPointer for response buffer.
sizeSize of response buffer.
Return values
0on success

◆ sip_svc_plat_async_res_res()

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.

Parameters
devPointer to the device structure for the driver instance.
resPointer to struct arm_smccc_res response.
bufPointer to response buffer.
sizeSize of response in response buffer
trans_idTransaction id of the response.
Return values
0on getting a valid polling response from supervisory call.
-EINPROGRESSon no valid polling response from supervisory call.

◆ sip_svc_plat_format_trans_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.

Parameters
devPointer to the device structure for the driver instance.
client_idxclient index.
trans_idxtransaction index.
Return values
transactionid, which is used for tracking each transaction.

◆ sip_svc_plat_free_async_memory()

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.

Parameters
devPointer to the device structure for the driver instance.
requestPointer to sip_svc_request packet.

◆ sip_svc_plat_func_id_valid()

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.

Parameters
devPointer to the device structure for the driver instance.
commandCommand which specify if the call is SYNC or ASYNC.
func_idFunction identifier
Return values
trueif command and function identifiers are valid.
falseif command and function identifiers are invalid.

◆ sip_svc_plat_get_error_code()

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.

Parameters
devPointer to the device structure for the driver instance.
resPointer to struct arm_smccc_res response.
Return values
0on success.
SIP_SVC_ID_INVALIDon failure

◆ sip_svc_plat_get_trans_idx()

uint32_t sip_svc_plat_get_trans_idx ( const struct device dev,
uint32_t  trans_id 
)

Retrieve client transaction id from packet transaction id.

Parameters
devPointer to the device structure for the driver instance.
trans_idtransaction identifier if for a transaction.
Return values
clienttransaction id form Transaction id.

◆ sip_svc_plat_update_trans_id()

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.

Parameters
devPointer to the device structure for the driver instance.
requestPointer to sip_svc_request structure.
trans_idTransaction id.