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 			TEE_ObjectInfo *info, void *obj_id, uint64_t *len);
44 
45 /*
46  * Data Stream Access Functions
47  */
48 TEE_Result syscall_storage_obj_read(unsigned long obj, void *data, size_t len,
49 			uint64_t *count);
50 
51 TEE_Result syscall_storage_obj_write(unsigned long obj, void *data,
52 			size_t len);
53 
54 TEE_Result syscall_storage_obj_trunc(unsigned long obj, size_t len);
55 
56 TEE_Result syscall_storage_obj_seek(unsigned long obj, int32_t offset,
57 				    unsigned long whence);
58 
59 void tee_svc_storage_close_all_enum(struct user_ta_ctx *utc);
60 
61 void tee_svc_storage_init(void);
62 
63 #endif /* TEE_SVC_STORAGE_H */
64