diff options
Diffstat (limited to 'drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_osk.h')
-rw-r--r-- | drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_osk.h | 108 |
1 files changed, 99 insertions, 9 deletions
diff --git a/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_osk.h b/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_osk.h index c35d90577a3..d1fb0a9a168 100644 --- a/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_osk.h +++ b/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_osk.h @@ -54,7 +54,7 @@ extern "C" /** @brief Mali Boolean type which uses MALI_TRUE and MALI_FALSE */ typedef unsigned long mali_bool; - + #ifndef MALI_TRUE #define MALI_TRUE ((mali_bool)1) #endif @@ -700,6 +700,16 @@ void _mali_osk_irq_schedulework( _mali_osk_irq_t *irq ); * resource whose IRQ handling is to be terminated. */ void _mali_osk_irq_term( _mali_osk_irq_t *irq ); + +/** @brief flushing workqueue. + * + * This will flush the workqueue. + * + * @param irq a pointer to the _mali_osk_irq_t object corresponding to the + * resource whose IRQ handling is to be terminated. + */ +void _mali_osk_flush_workqueue( _mali_osk_irq_t *irq ); + /** @} */ /* end group _mali_osk_irq */ @@ -785,6 +795,10 @@ void _mali_osk_atomic_term( _mali_osk_atomic_t *atom ); * Returns a buffer capable of containing at least \a n elements of \a size * bytes each. The buffer is initialized to zero. * + * If there is a need for a bigger block of memory (16KB or bigger), then + * consider to use _mali_osk_vmalloc() instead, as this function might + * map down to a OS function with size limitations. + * * The buffer is suitably aligned for storage and subsequent access of every * type that the compiler supports. Therefore, the pointer to the start of the * buffer may be cast into any pointer type, and be subsequently accessed from @@ -807,6 +821,10 @@ void *_mali_osk_calloc( u32 n, u32 size ); * Returns a buffer capable of containing at least \a size bytes. The * contents of the buffer are undefined. * + * If there is a need for a bigger block of memory (16KB or bigger), then + * consider to use _mali_osk_vmalloc() instead, as this function might + * map down to a OS function with size limitations. + * * The buffer is suitably aligned for storage and subsequent access of every * type that the compiler supports. Therefore, the pointer to the start of the * buffer may be cast into any pointer type, and be subsequently accessed from @@ -840,6 +858,46 @@ void *_mali_osk_malloc( u32 size ); */ void _mali_osk_free( void *ptr ); +/** @brief Allocate memory. + * + * Returns a buffer capable of containing at least \a size bytes. The + * contents of the buffer are undefined. + * + * This function is potentially slower than _mali_osk_malloc() and _mali_osk_calloc(), + * but do support bigger sizes. + * + * The buffer is suitably aligned for storage and subsequent access of every + * type that the compiler supports. Therefore, the pointer to the start of the + * buffer may be cast into any pointer type, and be subsequently accessed from + * such a pointer, without loss of information. + * + * When the buffer is no longer in use, it must be freed with _mali_osk_free(). + * Failure to do so will cause a memory leak. + * + * @note Most toolchains supply memory allocation functions that meet the + * compiler's alignment requirements. + * + * Remember to free memory using _mali_osk_free(). + * @param size Number of bytes to allocate + * @return On success, the buffer allocated. NULL on failure. + */ +void *_mali_osk_valloc( u32 size ); + +/** @brief Free memory. + * + * Reclaims the buffer pointed to by the parameter \a ptr for the system. + * All memory returned from _mali_osk_valloc() must be freed before the + * application exits. Otherwise a memory leak will occur. + * + * Memory must be freed once. It is an error to free the same non-NULL pointer + * more than once. + * + * It is legal to free the NULL pointer. + * + * @param ptr Pointer to buffer to free + */ +void _mali_osk_vfree( void *ptr ); + /** @brief Copies memory. * * Copies the \a len bytes from the buffer pointed by the parameter \a src @@ -871,7 +929,7 @@ void *_mali_osk_memset( void *s, u32 c, u32 n ); /** @brief Checks the amount of memory allocated * - * Checks that not more than \a max_allocated bytes are allocated. + * Checks that not more than \a max_allocated bytes are allocated. * * Some OS bring up an interactive out of memory dialogue when the * system runs out of memory. This can stall non-interactive @@ -879,7 +937,7 @@ void *_mali_osk_memset( void *s, u32 c, u32 n ); * not trigger the OOM dialogue by keeping allocations * within a certain limit. * - * @return MALI_TRUE when \a max_allocated bytes are not in use yet. MALI_FALSE + * @return MALI_TRUE when \a max_allocated bytes are not in use yet. MALI_FALSE * when at least \a max_allocated bytes are in use. */ mali_bool _mali_osk_mem_check_allocated( u32 max_allocated ); @@ -971,12 +1029,18 @@ void _mali_osk_lock_term( _mali_osk_lock_t *lock ); /** @brief Issue a memory barrier * - * This defines an arbitrary memory barrier operation, which affects memory - * mapped by _mali_osk_mem_mapregion. It will not be needed for memory - * mapped through _mali_osk_mem_mapioregion. + * This defines an arbitrary memory barrier operation, which forces an ordering constraint + * on memory read and write operations. */ void _mali_osk_mem_barrier( void ); +/** @brief Issue a write memory barrier + * + * This defines an write memory barrier operation which forces an ordering constraint + * on memory write operations. + */ +void _mali_osk_write_mem_barrier( void ); + /** @brief Map a physically contiguous region into kernel space * * This is primarily used for mapping in registers from resources, and Mali-MMU @@ -1120,7 +1184,21 @@ void _mali_osk_mem_unreqregion( u32 phys, u32 size ); u32 _mali_osk_mem_ioread32( volatile mali_io_address mapping, u32 offset ); /** @brief Write to a location currently mapped in through - * _mali_osk_mem_mapioregion + * _mali_osk_mem_mapioregion without memory barriers + * + * This write a 32-bit word to a 32-bit aligned location without using memory barrier. + * It is a programming error to provide unaligned locations, or to write to memory that is not + * mapped in, or not mapped through either _mali_osk_mem_mapioregion() or + * _mali_osk_mem_allocioregion(). + * + * @param mapping Mali IO address to write to + * @param offset Byte offset from the given IO address to operate on, must be a multiple of 4 + * @param val the 32-bit word to write. + */ +void _mali_osk_mem_iowrite32_relaxed( volatile mali_io_address addr, u32 offset, u32 val ); + +/** @brief Write to a location currently mapped in through + * _mali_osk_mem_mapioregion with write memory barrier * * This write a 32-bit word to a 32-bit aligned location. It is a programming * error to provide unaligned locations, or to write to memory that is not @@ -1147,7 +1225,7 @@ void _mali_osk_cache_flushall( void ); * * Some OS do not perform a full cache flush (including all outer caches) for uncached mapped memory. * They zero the memory through a cached mapping, then flush the inner caches but not the outer caches. - * This is required for MALI to have the correct view of the memory. + * This is required for MALI to have the correct view of the memory. */ void _mali_osk_cache_ensure_uncached_range_flushed( void *uncached_mapping, u32 offset, u32 size ); @@ -1522,7 +1600,7 @@ u32 _mali_osk_time_tickcount( void ); void _mali_osk_time_ubusydelay( u32 usecs ); /** @brief Return time in nano seconds, since any given reference. - * + * * @return Time in nano seconds */ u64 _mali_osk_time_get_ns( void ); @@ -1559,6 +1637,18 @@ u32 _mali_osk_clz( u32 val ); */ void _mali_osk_dbgmsg( const char *fmt, ... ); +/** @brief Print fmt into buf. + * + * The interpretation of \a fmt is the same as the \c format parameter in + * _mali_osu_vsnprintf(). + * + * @param buf a pointer to the result buffer + * @param size the total number of bytes allowed to write to \a buf + * @param fmt a _mali_osu_vsnprintf() style format string + * @param ... a variable-number of parameters suitable for \a fmt + */ +u32 _mali_osk_snprintf( char *buf, u32 size, const char *fmt, ... ); + /** @brief Abnormal process abort. * * Terminates the caller-process if this function is called. |