1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2014, STMicroelectronics International N.V. 4 */ 5 6 #ifndef TEE_INTERNAL_API_EXTENSIONS_H 7 #define TEE_INTERNAL_API_EXTENSIONS_H 8 9 /* trace support */ 10 #include <trace.h> 11 #include <stdio.h> 12 #include <tee_api_defines_extensions.h> 13 #include <tee_api_types.h> 14 15 void tee_user_mem_mark_heap(void); 16 size_t tee_user_mem_check_heap(void); 17 /* Hint implementation defines */ 18 #define TEE_USER_MEM_HINT_NO_FILL_ZERO 0x80000000 19 20 /* 21 * Cache maintenance support (TA requires the CACHE_MAINTENANCE property) 22 * 23 * TEE_CacheClean() Write back to memory any dirty data cache lines. The line 24 * is marked as not dirty. The valid bit is unchanged. 25 * 26 * TEE_CacheFlush() Purges any valid data cache lines. Any dirty cache lines 27 * are first written back to memory, then the cache line is 28 * invalidated. 29 * 30 * TEE_CacheInvalidate() Invalidate any valid data cache lines. Any dirty line 31 * are not written back to memory. 32 */ 33 TEE_Result TEE_CacheClean(char *buf, size_t len); 34 TEE_Result TEE_CacheFlush(char *buf, size_t len); 35 TEE_Result TEE_CacheInvalidate(char *buf, size_t len); 36 37 /* 38 * tee_map_zi() - Map zero initialized memory 39 * @len: Number of bytes 40 * @flags: 0 or TEE_MEMORY_ACCESS_ANY_OWNER to allow sharing with other TAs 41 * 42 * Returns valid pointer on success or NULL on error. 43 */ 44 void *tee_map_zi(size_t len, uint32_t flags); 45 46 /* 47 * tee_unmap() - Unmap previously mapped memory 48 * @buf: Buffer 49 * @len: Number of bytes 50 * 51 * Note that supplied @buf and @len has to match exactly what has 52 * previously been returned by tee_map_zi(). 53 * 54 * Return TEE_SUCCESS on success or TEE_ERRROR_* on failure. 55 */ 56 TEE_Result tee_unmap(void *buf, size_t len); 57 58 /* 59 * Convert a UUID string @s into a TEE_UUID @uuid 60 * Expected format for @s is: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 61 * 'x' being any hexadecimal digit (0-9a-fA-F) 62 */ 63 TEE_Result tee_uuid_from_str(TEE_UUID *uuid, const char *s); 64 65 #endif 66