1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2014, STMicroelectronics International N.V.
4  */
5 
6 #ifndef TEE_SVC_STORAGE_H
7 #define TEE_SVC_STORAGE_H
8 
9 #include <tee_api_types.h>
10 #include <kernel/tee_ta_manager.h>
11 #include <tee/tee_fs.h>
12 
13 /*
14  * Persistant Object Functions
15  */
16 TEE_Result syscall_storage_obj_open(unsigned long storage_id, void *object_id,
17 			size_t object_id_len, unsigned long flags,
18 			uint32_t *obj);
19 
20 TEE_Result syscall_storage_obj_create(unsigned long storage_id, void *object_id,
21 			size_t object_id_len, unsigned long flags,
22 			unsigned long attr, void *data, size_t len,
23 			uint32_t *obj);
24 
25 TEE_Result syscall_storage_obj_del(unsigned long obj);
26 
27 TEE_Result syscall_storage_obj_rename(unsigned long obj, void *object_id,
28 			size_t object_id_len);
29 
30 /*
31  * Persistent Object Enumeration Functions
32  */
33 TEE_Result syscall_storage_alloc_enum(uint32_t *obj_enum);
34 
35 TEE_Result syscall_storage_free_enum(unsigned long obj_enum);
36 
37 TEE_Result syscall_storage_reset_enum(unsigned long obj_enum);
38 
39 TEE_Result syscall_storage_start_enum(unsigned long obj_enum,
40 			unsigned long storage_id);
41 
42 TEE_Result syscall_storage_next_enum(unsigned long obj_enum,
43 				     struct utee_object_info *info,
44 				     void *obj_id, uint64_t *len);
45 
46 /*
47  * Data Stream Access Functions
48  */
49 TEE_Result syscall_storage_obj_read(unsigned long obj, void *data, size_t len,
50 			uint64_t *count);
51 
52 TEE_Result syscall_storage_obj_write(unsigned long obj, void *data,
53 			size_t len);
54 
55 TEE_Result syscall_storage_obj_trunc(unsigned long obj, size_t len);
56 
57 TEE_Result syscall_storage_obj_seek(unsigned long obj, int32_t offset,
58 				    unsigned long whence);
59 
60 void tee_svc_storage_close_all_enum(struct user_ta_ctx *utc);
61 
62 void tee_svc_storage_init(void);
63 
64 #endif /* TEE_SVC_STORAGE_H */
65