1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2014, STMicroelectronics International N.V.
4  */
5 
6 #ifndef UTEE_TYPES_H
7 #define UTEE_TYPES_H
8 
9 #include <inttypes.h>
10 #include <tee_api_defines.h>
11 
12 enum utee_time_category {
13 	UTEE_TIME_CAT_SYSTEM = 0,
14 	UTEE_TIME_CAT_TA_PERSISTENT,
15 	UTEE_TIME_CAT_REE
16 };
17 
18 enum utee_entry_func {
19 	UTEE_ENTRY_FUNC_OPEN_SESSION = 0,
20 	UTEE_ENTRY_FUNC_CLOSE_SESSION,
21 	UTEE_ENTRY_FUNC_INVOKE_COMMAND,
22 	/*
23 	 * UTEE_ENTRY_FUNC_DUMP_MEMSTATS
24 	 * [out] value[0].a  Byte size currently allocated
25 	 * [out] value[0].b  Max bytes allocated since stats reset
26 	 * [out] value[1].a  Pool byte size
27 	 * [out] value[1].b  Number of failed allocation requests
28 	 * [out] value[2].a  Biggest byte size which allocation failed
29 	 * [out] value[2].b  Biggest byte size which allocation succeeded
30 	 */
31 	UTEE_ENTRY_FUNC_DUMP_MEMSTATS,
32 };
33 
34 /*
35  * Cache operation types.
36  * Used when extensions TEE_CacheClean() / TEE_CacheFlush() /
37  * TEE_CacheInvalidate() are used
38  */
39 enum utee_cache_operation {
40 	TEE_CACHECLEAN = 0,
41 	TEE_CACHEFLUSH,
42 	TEE_CACHEINVALIDATE,
43 };
44 
45 struct utee_params {
46 	uint64_t types;
47 	/* vals[n * 2]	   corresponds to either value.a or memref.buffer
48 	 * vals[n * 2 + ]  corresponds to either value.b or memref.size
49 	 * when converting to/from struct tee_ta_param
50 	 */
51 	uint64_t vals[TEE_NUM_PARAMS * 2];
52 };
53 
54 struct utee_attribute {
55 	uint64_t a;	/* also serves as a pointer for references */
56 	uint64_t b;	/* also serves as a length for references */
57 	uint32_t attribute_id;
58 };
59 
60 struct utee_object_info {
61 	uint32_t obj_type;
62 	uint32_t obj_size;
63 	uint32_t max_obj_size;
64 	uint32_t obj_usage;
65 	uint32_t data_size;
66 	uint32_t data_pos;
67 	uint32_t handle_flags;
68 };
69 
70 #endif /* UTEE_TYPES_H */
71