1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2021, Foundries.IO
10 #include <tee/optee_ta_scp03.h>
12 static int scp03_enable(bool provision)
14 const struct tee_optee_ta_uuid uuid = PTA_SCP03_UUID;
15 struct tee_open_session_arg session;
16 struct tee_invoke_arg invoke;
17 struct tee_param param;
18 struct udevice *tee = NULL;
20 tee = tee_find_device(tee, NULL, NULL, NULL);
24 memset(&session, 0, sizeof(session));
25 tee_optee_ta_uuid_to_octets(session.uuid, &uuid);
26 if (tee_open_session(tee, &session, 0, NULL))
29 memset(¶m, 0, sizeof(param));
30 param.attr = TEE_PARAM_ATTR_TYPE_VALUE_INPUT;
31 param.u.value.a = provision;
33 memset(&invoke, 0, sizeof(invoke));
34 invoke.func = PTA_CMD_ENABLE_SCP03;
35 invoke.session = session.session;
37 if (tee_invoke_func(tee, &invoke, 1, ¶m))
40 tee_close_session(tee, session.session);
45 int tee_enable_scp03(void)
47 return scp03_enable(false);
50 int tee_provision_scp03(void)
52 return scp03_enable(true);