Lines Matching +full:uuid +full:- +full:dev

1 // SPDX-License-Identifier: GPL-2.0+
18 * struct ta_entry - TA entries
19 * @uuid: UUID of an emulated TA
26 struct tee_optee_ta_uuid uuid; member
163 { .uuid = TA_AVB_UUID,
170 static void sandbox_tee_get_version(struct udevice *dev, in sandbox_tee_get_version() argument
180 static int sandbox_tee_close_session(struct udevice *dev, u32 session) in sandbox_tee_close_session() argument
182 struct sandbox_tee_state *state = dev_get_priv(dev); in sandbox_tee_close_session()
184 if (!state->ta || state->session != session) in sandbox_tee_close_session()
185 return -EINVAL; in sandbox_tee_close_session()
187 state->session = 0; in sandbox_tee_close_session()
188 state->ta = NULL; in sandbox_tee_close_session()
193 static const struct ta_entry *find_ta_entry(u8 uuid[TEE_UUID_LEN]) in find_ta_entry()
198 tee_optee_ta_uuid_from_octets(&u, uuid); in find_ta_entry()
201 if (!memcmp(&u, &ta_entries[n].uuid, sizeof(u))) in find_ta_entry()
207 static int sandbox_tee_open_session(struct udevice *dev, in sandbox_tee_open_session() argument
211 struct sandbox_tee_state *state = dev_get_priv(dev); in sandbox_tee_open_session()
214 if (state->ta) { in sandbox_tee_open_session()
216 return -EBUSY; in sandbox_tee_open_session()
219 ta = find_ta_entry(arg->uuid); in sandbox_tee_open_session()
222 arg->ret = TEE_ERROR_ITEM_NOT_FOUND; in sandbox_tee_open_session()
223 arg->ret_origin = TEE_ORIGIN_TEE; in sandbox_tee_open_session()
228 arg->ret = ta->open_session(num_params, params); in sandbox_tee_open_session()
229 arg->ret_origin = TEE_ORIGIN_TRUSTED_APP; in sandbox_tee_open_session()
231 if (!arg->ret) { in sandbox_tee_open_session()
232 state->ta = (void *)ta; in sandbox_tee_open_session()
233 state->session = 1; in sandbox_tee_open_session()
234 arg->session = state->session; in sandbox_tee_open_session()
242 static int sandbox_tee_invoke_func(struct udevice *dev, in sandbox_tee_invoke_func() argument
246 struct sandbox_tee_state *state = dev_get_priv(dev); in sandbox_tee_invoke_func()
247 struct ta_entry *ta = state->ta; in sandbox_tee_invoke_func()
249 if (!arg->session) { in sandbox_tee_invoke_func()
251 return -EINVAL; in sandbox_tee_invoke_func()
256 return -EINVAL; in sandbox_tee_invoke_func()
259 if (arg->session != state->session) { in sandbox_tee_invoke_func()
261 return -EINVAL; in sandbox_tee_invoke_func()
264 arg->ret = ta->invoke_func(arg->func, num_params, params); in sandbox_tee_invoke_func()
265 arg->ret_origin = TEE_ORIGIN_TRUSTED_APP; in sandbox_tee_invoke_func()
270 static int sandbox_tee_shm_register(struct udevice *dev, struct tee_shm *shm) in sandbox_tee_shm_register() argument
272 struct sandbox_tee_state *state = dev_get_priv(dev); in sandbox_tee_shm_register()
274 state->num_shms++; in sandbox_tee_shm_register()
279 static int sandbox_tee_shm_unregister(struct udevice *dev, struct tee_shm *shm) in sandbox_tee_shm_unregister() argument
281 struct sandbox_tee_state *state = dev_get_priv(dev); in sandbox_tee_shm_unregister()
283 state->num_shms--; in sandbox_tee_shm_unregister()