2 * This confidential and proprietary software may be used only as
3 * authorised by a licensing agreement from ARM Limited
4 * (C) COPYRIGHT 2013-2014 ARM Limited
6 * The entire notice above must be reproduced on all authorised
7 * copies and copies may only be made to the extent permitted
8 * by a licensing agreement from ARM Limited.
11 #ifndef __MALI_MEMORY_TYPES_H__
12 #define __MALI_MEMORY_TYPES_H__
14 #if defined(CONFIG_MALI400_UMP)
15 #include "ump_kernel_interface.h"
18 typedef u32 mali_address_t;
20 typedef enum mali_mem_type {
28 typedef struct mali_mem_os_mem {
29 struct list_head pages;
33 typedef struct mali_mem_dma_buf {
34 #if defined(CONFIG_DMA_SHARED_BUFFER)
35 struct mali_dma_buf_attachment *attachment;
39 typedef struct mali_mem_external {
44 typedef struct mali_mem_ump {
45 #if defined(CONFIG_MALI400_UMP)
50 typedef struct block_allocator_allocation {
51 /* The list will be released in reverse order */
52 struct block_info *last_allocated;
54 struct block_allocator *info;
55 } block_allocator_allocation;
57 typedef struct mali_mem_block_mem {
58 block_allocator_allocation mem;
61 typedef struct mali_mem_virt_mali_mapping {
62 mali_address_t addr; /* Virtual Mali address */
63 u32 properties; /* MMU Permissions + cache, must match MMU HW */
64 } mali_mem_virt_mali_mapping;
66 typedef struct mali_mem_virt_cpu_mapping {
69 } mali_mem_virt_cpu_mapping;
71 #define MALI_MEM_ALLOCATION_VALID_MAGIC 0xdeda110c
72 #define MALI_MEM_ALLOCATION_FREED_MAGIC 0x10101010
74 typedef struct mali_mem_allocation {
75 MALI_DEBUG_CODE(u32 magic);
76 mali_mem_type type; /**< Type of memory */
77 int id; /**< ID in the descriptor map for this allocation */
79 u32 size; /**< Size of the allocation */
80 u32 flags; /**< Flags for this allocation */
82 struct mali_session_data *session; /**< Pointer to session that owns the allocation */
84 /* Union selected by type. */
86 mali_mem_os_mem os_mem; /**< MALI_MEM_OS */
87 mali_mem_external ext_mem; /**< MALI_MEM_EXTERNAL */
88 mali_mem_dma_buf dma_buf; /**< MALI_MEM_DMA_BUF */
89 mali_mem_ump ump_mem; /**< MALI_MEM_UMP */
90 mali_mem_block_mem block_mem; /**< MALI_MEM_BLOCK */
93 mali_mem_virt_cpu_mapping cpu_mapping; /**< CPU mapping */
94 mali_mem_virt_mali_mapping mali_mapping; /**< Mali mapping */
95 } mali_mem_allocation;
97 #define MALI_MEM_FLAG_MALI_GUARD_PAGE (1 << 0)
98 #define MALI_MEM_FLAG_DONT_CPU_MAP (1 << 1)
100 #endif /* __MALI_MEMORY_TYPES__ */