xref: /optee_os/core/include/tee/tee_svc.h (revision a8d59198fdc30b2d06667ea0129b983a89d35b02)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2014, STMicroelectronics International N.V.
4  */
5 #ifndef TEE_SVC_H
6 #define TEE_SVC_H
7 
8 #include <stdint.h>
9 #include <types_ext.h>
10 #include <tee_api_types.h>
11 #include <utee_types.h>
12 
13 struct tee_ta_session;
14 
15 /* TA Properties */
16 struct tee_props {
17 	const char *name;
18 
19 	/* prop_type is of type enum user_ta_prop_type*/
20 	const uint32_t prop_type;
21 
22 	/* either get_prop_func or both data and len */
23 	TEE_Result (*get_prop_func)(struct tee_ta_session *sess,
24 				    void *buf, size_t *blen);
25 	const void *data;
26 	const size_t len;
27 };
28 
29 struct tee_vendor_props {
30 	const struct tee_props *props;
31 	size_t len;
32 };
33 void syscall_sys_return(unsigned long ret);
34 
35 void syscall_log(const void *buf, size_t len);
36 
37 void syscall_panic(unsigned long code);
38 
39 TEE_Result syscall_not_supported(void);
40 
41 /* prop_set defined by enum utee_property */
42 TEE_Result syscall_get_property(unsigned long prop_set,
43 				unsigned long index,
44 				void *name, uint32_t *name_len,
45 				void *buf, uint32_t *blen,
46 				uint32_t *prop_type);
47 TEE_Result syscall_get_property_name_to_index(unsigned long prop_set,
48 					      void *name,
49 					      unsigned long name_len,
50 					      uint32_t *index);
51 
52 TEE_Result syscall_open_ta_session(const TEE_UUID *dest,
53 			unsigned long cancel_req_to, struct utee_params *params,
54 			uint32_t *sess, uint32_t *ret_orig);
55 
56 TEE_Result syscall_close_ta_session(unsigned long sess);
57 
58 TEE_Result syscall_invoke_ta_command(unsigned long sess,
59 			unsigned long cancel_req_to, unsigned long cmd_id,
60 			struct utee_params *params, uint32_t *ret_orig);
61 
62 TEE_Result syscall_check_access_rights(unsigned long flags, const void *buf,
63 				       size_t len);
64 
65 TEE_Result syscall_get_cancellation_flag(uint32_t *cancel);
66 
67 TEE_Result syscall_unmask_cancellation(uint32_t *old_mask);
68 
69 TEE_Result syscall_mask_cancellation(uint32_t *old_mask);
70 
71 TEE_Result syscall_wait(unsigned long timeout);
72 
73 TEE_Result syscall_get_time(unsigned long cat, TEE_Time *time);
74 TEE_Result syscall_set_ta_time(const TEE_Time *time);
75 
76 #endif /* TEE_SVC_H */
77