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