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