Lines Matching +full:wait +full:- +full:long

4  * SPDX-License-Identifier: Apache-2.0
7 #include <zephyr/arch/arm64/arm-smccc.h>
29 * OP-TEE specific capabilities
44 typedef void (*smc_call_t)(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3,
45 unsigned long a4, unsigned long a5, unsigned long a6, unsigned long a7,
55 struct k_sem wait; member
88 unsigned long sec_caps;
93 static void optee_smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, in optee_smccc_smc()
94 unsigned long a4, unsigned long a5, unsigned long a6, unsigned long a7, in optee_smccc_smc()
100 static void optee_smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, in optee_smccc_hvc()
101 unsigned long a4, unsigned long a5, unsigned long a6, unsigned long a7, in optee_smccc_hvc()
115 return -EINVAL; in param_to_msg_param()
121 return -EINVAL; in param_to_msg_param()
124 switch (tp->attr) { in param_to_msg_param()
126 mtp->attr = OPTEE_MSG_ATTR_TYPE_NONE; in param_to_msg_param()
127 memset(&mtp->u, 0, sizeof(mtp->u)); in param_to_msg_param()
132 mtp->attr = OPTEE_MSG_ATTR_TYPE_VALUE_INPUT + tp->attr - in param_to_msg_param()
134 mtp->u.value.a = tp->a; in param_to_msg_param()
135 mtp->u.value.b = tp->b; in param_to_msg_param()
136 mtp->u.value.c = tp->c; in param_to_msg_param()
141 mtp->attr = OPTEE_MSG_ATTR_TYPE_RMEM_INPUT + tp->attr - in param_to_msg_param()
143 mtp->u.rmem.shm_ref = tp->c; in param_to_msg_param()
144 mtp->u.rmem.size = tp->b; in param_to_msg_param()
145 mtp->u.rmem.offs = tp->a; in param_to_msg_param()
148 return -EINVAL; in param_to_msg_param()
158 struct tee_shm *shm = (struct tee_shm *)mp->u.tmem.shm_ref; in msg_param_to_tmp_mem()
160 p->attr = TEE_PARAM_ATTR_TYPE_MEMREF_INPUT + attr - OPTEE_MSG_ATTR_TYPE_TMEM_INPUT; in msg_param_to_tmp_mem()
161 p->b = mp->u.tmem.size; in msg_param_to_tmp_mem()
164 p->a = 0; in msg_param_to_tmp_mem()
165 p->c = 0; in msg_param_to_tmp_mem()
169 p->a = mp->u.tmem.buf_ptr - k_mem_phys_addr(shm->addr); in msg_param_to_tmp_mem()
170 p->c = mp->u.tmem.shm_ref; in msg_param_to_tmp_mem()
181 return -EINVAL; in msg_param_to_param()
185 uint32_t attr = mtp->attr & OPTEE_MSG_ATTR_TYPE_MASK; in msg_param_to_param()
189 return -EINVAL; in msg_param_to_param()
195 tp->attr = TEE_PARAM_ATTR_TYPE_NONE; in msg_param_to_param()
200 tp->attr = TEE_PARAM_ATTR_TYPE_VALUE_INPUT + attr - in msg_param_to_param()
202 tp->a = mtp->u.value.a; in msg_param_to_param()
203 tp->b = mtp->u.value.b; in msg_param_to_param()
204 tp->c = mtp->u.value.c; in msg_param_to_param()
209 tp->attr = TEE_PARAM_ATTR_TYPE_MEMREF_INPUT + attr - in msg_param_to_param()
211 tp->b = mtp->u.rmem.size; in msg_param_to_param()
213 if (!mtp->u.rmem.shm_ref) { in msg_param_to_param()
214 tp->a = 0; in msg_param_to_param()
215 tp->c = 0; in msg_param_to_param()
217 tp->a = mtp->u.rmem.offs; in msg_param_to_param()
218 tp->c = mtp->u.rmem.shm_ref; in msg_param_to_param()
228 return -EINVAL; in msg_param_to_param()
248 return arg->num_params == 1 && in check_param_input()
249 arg->params[0].attr == OPTEE_MSG_ATTR_TYPE_VALUE_INPUT; in check_param_input()
257 struct optee_driver_data *data = (struct optee_driver_data *)dev->data; in optee_call_supp()
258 struct optee_supp *supp = &data->supp; in optee_call_supp()
267 k_sem_init(&req->complete, 0, 1); in optee_call_supp()
268 req->func = func; in optee_call_supp()
269 req->num_params = num_params; in optee_call_supp()
270 req->param = param; in optee_call_supp()
273 k_mutex_lock(&supp->mutex, K_FOREVER); in optee_call_supp()
274 sys_dlist_append(&supp->reqs, &req->link); in optee_call_supp()
275 k_mutex_unlock(&supp->mutex); in optee_call_supp()
278 k_sem_give(&supp->reqs_c); in optee_call_supp()
281 * Wait for supplicant to process and return result, once we've in optee_call_supp()
282 * returned from k_sem_take(&req->c) successfully we have in optee_call_supp()
286 k_sem_take(&req->complete, K_FOREVER); in optee_call_supp()
288 ret = req->ret; in optee_call_supp()
336 arg->ret_origin = TEEC_ORIGIN_COMMS; in handle_cmd_alloc()
339 arg->ret = TEEC_ERROR_BAD_PARAMETERS; in handle_cmd_alloc()
343 switch (arg->params[0].u.value.a) { in handle_cmd_alloc()
346 rc = tee_add_shm(dev, NULL, 0, arg->params[0].u.value.b, TEE_SHM_ALLOC, &shm); in handle_cmd_alloc()
349 rc = cmd_alloc_suppl(dev, arg->params[0].u.value.b, &shm); in handle_cmd_alloc()
352 arg->ret = TEEC_ERROR_BAD_PARAMETERS; in handle_cmd_alloc()
357 if (rc == -ENOMEM) { in handle_cmd_alloc()
358 arg->ret = TEEC_ERROR_OUT_OF_MEMORY; in handle_cmd_alloc()
360 arg->ret = TEEC_ERROR_GENERIC; in handle_cmd_alloc()
365 pl = optee_construct_page_list(shm->addr, shm->size, &pl_phys_and_offset); in handle_cmd_alloc()
367 arg->ret = TEEC_ERROR_OUT_OF_MEMORY; in handle_cmd_alloc()
372 arg->params[0].attr = OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT | OPTEE_MSG_ATTR_NONCONTIG; in handle_cmd_alloc()
373 arg->params[0].u.tmem.buf_ptr = pl_phys_and_offset; in handle_cmd_alloc()
374 arg->params[0].u.tmem.size = shm->size; in handle_cmd_alloc()
375 arg->params[0].u.tmem.shm_ref = (uint64_t)shm; in handle_cmd_alloc()
376 arg->ret = TEEC_SUCCESS; in handle_cmd_alloc()
387 arg->ret = TEEC_ERROR_BAD_PARAMETERS; in handle_cmd_free()
391 switch (arg->params[0].u.value.a) { in handle_cmd_free()
393 rc = tee_rm_shm(dev, (struct tee_shm *)arg->params[0].u.value.b); in handle_cmd_free()
396 cmd_free_suppl(dev, (struct tee_shm *)arg->params[0].u.value.b); in handle_cmd_free()
399 arg->ret = TEEC_ERROR_BAD_PARAMETERS; in handle_cmd_free()
404 arg->ret = TEEC_ERROR_OUT_OF_MEMORY; in handle_cmd_free()
408 arg->ret = TEEC_SUCCESS; in handle_cmd_free()
417 if (arg->num_params != 1 || in handle_cmd_get_time()
418 (arg->params[0].attr & OPTEE_MSG_ATTR_TYPE_MASK) in handle_cmd_get_time()
420 arg->ret = TEEC_ERROR_BAD_PARAMETERS; in handle_cmd_get_time()
427 up_nsecs = k_ticks_to_ns_floor64(ticks - up_secs * CONFIG_SYS_CLOCK_TICKS_PER_SEC); in handle_cmd_get_time()
428 arg->params[0].u.value.a = up_secs; in handle_cmd_get_time()
429 arg->params[0].u.value.b = up_nsecs; in handle_cmd_get_time()
431 arg->ret = TEEC_SUCCESS; in handle_cmd_get_time()
439 SYS_DLIST_FOR_EACH_CONTAINER(&data->notif, iter, node) { in key_is_pending()
440 if (iter->key == key) { in key_is_pending()
441 k_sem_give(&iter->wait); in key_is_pending()
451 struct optee_driver_data *data = dev->data; in optee_notif_send()
455 return -EINVAL; in optee_notif_send()
458 sp_key = k_spin_lock(&data->notif_lock); in optee_notif_send()
460 /* If nobody is waiting for key - set bit in the bitmap */ in optee_notif_send()
461 sys_bitarray_set_bit(data->notif_bitmap, key); in optee_notif_send()
463 k_spin_unlock(&data->notif_lock, sp_key); in optee_notif_send()
471 struct optee_driver_data *data = dev->data; in optee_notif_wait()
477 return -EINVAL; in optee_notif_wait()
482 return -ENOMEM; in optee_notif_wait()
485 k_sem_init(&entry->wait, 0, 1); in optee_notif_wait()
486 entry->key = key; in optee_notif_wait()
488 sp_key = k_spin_lock(&data->notif_lock); in optee_notif_wait()
492 * Skipping wait. in optee_notif_wait()
494 rc = sys_bitarray_test_and_clear_bit(data->notif_bitmap, key, &prev_val); in optee_notif_wait()
503 rc = -EBUSY; in optee_notif_wait()
507 sys_dlist_append(&data->notif, &entry->node); in optee_notif_wait()
509 k_spin_unlock(&data->notif_lock, sp_key); in optee_notif_wait()
510 k_sem_take(&entry->wait, K_FOREVER); in optee_notif_wait()
511 sp_key = k_spin_lock(&data->notif_lock); in optee_notif_wait()
513 sys_dlist_remove(&entry->node); in optee_notif_wait()
515 k_spin_unlock(&data->notif_lock, sp_key); in optee_notif_wait()
525 arg->ret = TEEC_ERROR_BAD_PARAMETERS; in handle_cmd_notify()
529 switch (arg->params[0].u.value.a) { in handle_cmd_notify()
531 if (optee_notif_send(dev, arg->params[0].u.value.b)) { in handle_cmd_notify()
536 if (optee_notif_wait(dev, arg->params[0].u.value.b)) { in handle_cmd_notify()
544 arg->ret = TEEC_SUCCESS; in handle_cmd_notify()
548 arg->ret = TEEC_ERROR_BAD_PARAMETERS; in handle_cmd_notify()
554 arg->ret = TEEC_ERROR_BAD_PARAMETERS; in handle_cmd_wait()
558 k_sleep(K_MSEC(arg->params[0].u.value.a)); in handle_cmd_wait()
560 arg->ret = TEEC_SUCCESS; in handle_cmd_wait()
582 arg->ret_origin = TEEC_ORIGIN_COMMS; in handle_rpc_supp_cmd()
584 params = k_malloc(sizeof(*params) * arg->num_params); in handle_rpc_supp_cmd()
586 arg->ret = TEEC_ERROR_OUT_OF_MEMORY; in handle_rpc_supp_cmd()
590 ret = msg_param_to_param(params, arg->num_params, arg->params); in handle_rpc_supp_cmd()
592 arg->ret = TEEC_ERROR_BAD_PARAMETERS; in handle_rpc_supp_cmd()
593 arg->ret_origin = TEEC_ORIGIN_COMMS; in handle_rpc_supp_cmd()
597 arg->ret = optee_call_supp(dev, arg->cmd, arg->num_params, params); in handle_rpc_supp_cmd()
599 ret = param_to_msg_param(params, arg->num_params, arg->params); in handle_rpc_supp_cmd()
601 arg->ret = TEEC_ERROR_GENERIC; in handle_rpc_supp_cmd()
602 arg->ret_origin = TEEC_ORIGIN_COMMS; in handle_rpc_supp_cmd()
611 struct optee_msg_arg *arg = shm->addr; in handle_func_rpc_call()
613 switch (arg->cmd) { in handle_func_rpc_call()
647 switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) { in handle_rpc_call()
650 param->a1, in handle_rpc_call()
652 u64_to_regs((uint64_t)k_mem_phys_addr(shm->addr), &param->a1, &param->a2); in handle_rpc_call()
653 u64_to_regs((uint64_t)shm, &param->a4, &param->a5); in handle_rpc_call()
655 param->a1 = 0; in handle_rpc_call()
656 param->a2 = 0; in handle_rpc_call()
657 param->a4 = 0; in handle_rpc_call()
658 param->a5 = 0; in handle_rpc_call()
662 shm = (struct tee_shm *)regs_to_u64(param->a1, param->a2); in handle_rpc_call()
669 shm = (struct tee_shm *)regs_to_u64(param->a1, param->a2); in handle_rpc_call()
676 param->a0 = res; in handle_rpc_call()
681 struct optee_driver_data *data = (struct optee_driver_data *)dev->data; in optee_call()
689 k_sem_take(&data->call_sem, K_FOREVER); in optee_call()
693 data->smc_call(param.a0, param.a1, param.a2, param.a3, in optee_call()
704 k_sem_give(&data->call_sem); in optee_call()
714 return -EINVAL; in optee_get_version()
719 * OP-TEE OS. in optee_get_version()
722 info->impl_id = TEE_IMPL_ID_OPTEE; in optee_get_version()
723 info->impl_caps = TEE_OPTEE_CAP_TZ; in optee_get_version()
724 info->gen_caps = TEE_GEN_CAP_GP | TEE_GEN_CAP_REG_MEM; in optee_get_version()
743 marg = shm->addr; in optee_close_session()
744 marg->num_params = 0; in optee_close_session()
745 marg->cmd = OPTEE_MSG_CMD_CLOSE_SESSION; in optee_close_session()
746 marg->session = session_id; in optee_close_session()
766 return -EINVAL; in optee_open_session()
777 marg = shm->addr; in optee_open_session()
780 marg->num_params = num_param + 2; in optee_open_session()
781 marg->cmd = OPTEE_MSG_CMD_OPEN_SESSION; in optee_open_session()
782 marg->params[0].attr = OPTEE_MSG_ATTR_TYPE_VALUE_INPUT | OPTEE_MSG_ATTR_META; in optee_open_session()
783 marg->params[1].attr = OPTEE_MSG_ATTR_TYPE_VALUE_INPUT | OPTEE_MSG_ATTR_META; in optee_open_session()
785 memcpy(&marg->params[0].u.value, arg->uuid, sizeof(arg->uuid)); in optee_open_session()
786 memcpy(&marg->params[1].u.value, arg->uuid, sizeof(arg->clnt_uuid)); in optee_open_session()
788 marg->params[1].u.value.c = arg->clnt_login; in optee_open_session()
790 rc = param_to_msg_param(param, num_param, marg->params + 2); in optee_open_session()
795 arg->ret = optee_call(dev, marg); in optee_open_session()
796 if (arg->ret) { in optee_open_session()
797 arg->ret_origin = TEEC_ORIGIN_COMMS; in optee_open_session()
801 rc = msg_param_to_param(param, num_param, marg->params); in optee_open_session()
803 arg->ret = TEEC_ERROR_COMMUNICATION; in optee_open_session()
804 arg->ret_origin = TEEC_ORIGIN_COMMS; in optee_open_session()
809 ret = optee_close_session(dev, marg->session); in optee_open_session()
816 *session_id = marg->session; in optee_open_session()
818 arg->ret = marg->ret; in optee_open_session()
819 arg->ret_origin = marg->ret_origin; in optee_open_session()
843 marg = shm->addr; in optee_cancel()
844 marg->num_params = 0; in optee_cancel()
845 marg->cmd = OPTEE_MSG_CMD_CANCEL; in optee_cancel()
846 marg->cancel_id = cancel_id; in optee_cancel()
847 marg->session = session_id; in optee_cancel()
866 return -EINVAL; in optee_invoke_func()
877 marg = shm->addr; in optee_invoke_func()
880 marg->num_params = num_param; in optee_invoke_func()
881 marg->cmd = OPTEE_MSG_CMD_INVOKE_COMMAND; in optee_invoke_func()
882 marg->func = arg->func; in optee_invoke_func()
883 marg->session = arg->session; in optee_invoke_func()
885 rc = param_to_msg_param(param, num_param, marg->params); in optee_invoke_func()
890 arg->ret = optee_call(dev, marg); in optee_invoke_func()
891 if (arg->ret) { in optee_invoke_func()
892 arg->ret_origin = TEEC_ORIGIN_COMMS; in optee_invoke_func()
896 rc = msg_param_to_param(param, num_param, marg->params); in optee_invoke_func()
898 arg->ret = TEEC_ERROR_COMMUNICATION; in optee_invoke_func()
899 arg->ret_origin = TEEC_ORIGIN_COMMS; in optee_invoke_func()
903 arg->ret = marg->ret; in optee_invoke_func()
904 arg->ret_origin = marg->ret_origin; in optee_invoke_func()
917 const size_t num_pages_in_pl = OPTEE_NUMBER_OF_ADDR_PER_PAGE - 1; in optee_construct_page_list()
918 uint32_t page_offset = (uintptr_t)buf & (page_size - 1); in optee_construct_page_list()
926 uint64_t pages[OPTEE_NUMBER_OF_ADDR_PER_PAGE - 1]; in optee_construct_page_list()
948 num_pages--; in optee_construct_page_list()
980 msg_arg = shm_arg->addr; in optee_shm_register()
984 pl = optee_construct_page_list(shm->addr, shm->size, &pl_phys_and_offset); in optee_shm_register()
986 rc = -ENOMEM; in optee_shm_register()
990 /* for this command op-tee os should support CFG_CORE_DYN_SHM */ in optee_shm_register()
991 msg_arg->cmd = OPTEE_MSG_CMD_REGISTER_SHM; in optee_shm_register()
992 /* op-tee OS ingnore this cmd in case when TYPE_TMEM_OUTPUT and NONCONTIG aren't set */ in optee_shm_register()
993 msg_arg->params->attr = OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT | OPTEE_MSG_ATTR_NONCONTIG; in optee_shm_register()
994 msg_arg->num_params = 1; in optee_shm_register()
995 msg_arg->params->u.tmem.buf_ptr = pl_phys_and_offset; in optee_shm_register()
996 msg_arg->params->u.tmem.shm_ref = (uint64_t)shm; in optee_shm_register()
997 msg_arg->params->u.tmem.size = shm->size; in optee_shm_register()
1000 rc = -EINVAL; in optee_shm_register()
1022 msg_arg = shm_arg->addr; in optee_shm_unregister()
1026 msg_arg->cmd = OPTEE_MSG_CMD_UNREGISTER_SHM; in optee_shm_unregister()
1027 msg_arg->num_params = 1; in optee_shm_unregister()
1028 msg_arg->params[0].attr = OPTEE_MSG_ATTR_TYPE_RMEM_INPUT; in optee_shm_unregister()
1029 msg_arg->params[0].u.rmem.shm_ref = (uint64_t)shm; in optee_shm_unregister()
1032 rc = -EINVAL; in optee_shm_unregister()
1042 struct optee_driver_data *data = (struct optee_driver_data *)dev->data; in optee_suppl_recv()
1043 struct optee_supp *supp = &data->supp; in optee_suppl_recv()
1047 k_mutex_lock(&supp->mutex, K_FOREVER); in optee_suppl_recv()
1048 req = (struct optee_supp_req *)sys_dlist_peek_head(&supp->reqs); in optee_suppl_recv()
1051 if (supp->current) { in optee_suppl_recv()
1053 k_mutex_unlock(&supp->mutex); in optee_suppl_recv()
1054 return -EBUSY; in optee_suppl_recv()
1057 if (*num_params < req->num_params) { in optee_suppl_recv()
1059 req->num_params); in optee_suppl_recv()
1060 k_mutex_unlock(&supp->mutex); in optee_suppl_recv()
1061 return -EINVAL; in optee_suppl_recv()
1064 supp->current = req; in optee_suppl_recv()
1065 sys_dlist_remove(&req->link); in optee_suppl_recv()
1067 k_mutex_unlock(&supp->mutex); in optee_suppl_recv()
1073 k_sem_take(&supp->reqs_c, K_FOREVER); in optee_suppl_recv()
1076 *func = req->func; in optee_suppl_recv()
1077 *num_params = req->num_params; in optee_suppl_recv()
1078 memcpy(param, req->param, sizeof(struct tee_param) * req->num_params); in optee_suppl_recv()
1086 struct optee_driver_data *data = (struct optee_driver_data *)dev->data; in optee_suppl_send()
1087 struct optee_supp *supp = &data->supp; in optee_suppl_send()
1091 k_mutex_lock(&supp->mutex, K_FOREVER); in optee_suppl_send()
1092 if (supp->current && num_params >= supp->current->num_params) { in optee_suppl_send()
1093 req = supp->current; in optee_suppl_send()
1094 supp->current = NULL; in optee_suppl_send()
1096 LOG_ERR("Invalid number of parameters, expected %lu got %u", req->num_params, in optee_suppl_send()
1099 k_mutex_unlock(&supp->mutex); in optee_suppl_send()
1102 return -EINVAL; in optee_suppl_send()
1106 for (n = 0; n < req->num_params; n++) { in optee_suppl_send()
1107 struct tee_param *p = req->param + n; in optee_suppl_send()
1109 switch (p->attr & TEE_PARAM_ATTR_TYPE_MASK) { in optee_suppl_send()
1112 p->a = param[n].a; in optee_suppl_send()
1113 p->b = param[n].b; in optee_suppl_send()
1114 p->c = param[n].c; in optee_suppl_send()
1119 p->a = param[n].a; in optee_suppl_send()
1120 p->b = param[n].b; in optee_suppl_send()
1121 p->c = param[n].c; in optee_suppl_send()
1127 req->ret = ret; in optee_suppl_send()
1130 k_mutex_lock(&supp->mutex, K_FOREVER); in optee_suppl_send()
1131 supp->current = NULL; in optee_suppl_send()
1132 k_mutex_unlock(&supp->mutex); in optee_suppl_send()
1133 k_sem_give(&req->complete); in optee_suppl_send()
1140 const struct optee_driver_config *conf = dev->config; in set_optee_method()
1141 struct optee_driver_data *data = dev->data; in set_optee_method()
1143 if (!strcmp("hvc", conf->method)) { in set_optee_method()
1144 data->smc_call = optee_smccc_hvc; in set_optee_method()
1145 } else if (!strcmp("smc", conf->method)) { in set_optee_method()
1146 data->smc_call = optee_smccc_smc; in set_optee_method()
1149 return -EINVAL; in set_optee_method()
1158 struct optee_driver_data *data = (struct optee_driver_data *)dev->data; in optee_check_uid()
1160 data->smc_call(OPTEE_SMC_CALLS_UID, 0, 0, 0, 0, 0, 0, 0, &res); in optee_check_uid()
1172 struct optee_driver_data *data = (struct optee_driver_data *)dev->data; in optee_get_revision()
1175 data->smc_call(OPTEE_SMC_CALL_GET_OS_REVISION, 0, 0, 0, 0, 0, 0, 0, &res); in optee_get_revision()
1185 static bool optee_exchange_caps(const struct device *dev, unsigned long *sec_caps) in optee_exchange_caps()
1187 struct optee_driver_data *data = (struct optee_driver_data *)dev->data; in optee_exchange_caps()
1189 unsigned long a1 = 0; in optee_exchange_caps()
1195 data->smc_call(OPTEE_SMC_EXCHANGE_CAPABILITIES, a1, 0, 0, 0, 0, 0, 0, &res); in optee_exchange_caps()
1205 static unsigned long optee_get_thread_count(const struct device *dev, unsigned long *thread_count) in optee_get_thread_count()
1207 struct optee_driver_data *data = (struct optee_driver_data *)dev->data; in optee_get_thread_count()
1209 unsigned long a1 = 0; in optee_get_thread_count()
1211 data->smc_call(OPTEE_SMC_GET_THREAD_COUNT, a1, 0, 0, 0, 0, 0, 0, &res); in optee_get_thread_count()
1223 struct optee_driver_data *data = dev->data; in optee_init()
1224 unsigned long thread_count; in optee_init()
1227 return -ENOTSUP; in optee_init()
1230 sys_dlist_init(&data->notif); in optee_init()
1231 k_mutex_init(&data->supp.mutex); in optee_init()
1232 k_sem_init(&data->supp.reqs_c, 0, 1); in optee_init()
1233 sys_dlist_init(&data->supp.reqs); in optee_init()
1237 return -EINVAL; in optee_init()
1242 if (!optee_exchange_caps(dev, &data->sec_caps)) { in optee_init()
1244 return -EINVAL; in optee_init()
1247 if (!(data->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)) { in optee_init()
1249 return -ENOTSUP; in optee_init()
1254 return -ENOTSUP; in optee_init()
1257 k_sem_init(&data->call_sem, thread_count, thread_count); in optee_init()
1275 * Bitmap of the ongoing notificatons, received from OP-TEE. Maximum number is
1277 * was received before WAIT command from OP-TEE. In this case WAIT will not create