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