2 * Copyright (C) 2013-2014 ARM Limited. All rights reserved.
4 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
7 * A copy of the licence is included with the program, and can also be obtained from Free Software
8 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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 {
29 typedef struct mali_mem_os_mem {
30 struct list_head pages;
34 typedef struct mali_mem_dma_buf {
35 #if defined(CONFIG_DMA_SHARED_BUFFER)
36 struct mali_dma_buf_attachment *attachment;
40 typedef struct mali_mem_external {
45 typedef struct mali_mem_ump {
46 #if defined(CONFIG_MALI400_UMP)
51 typedef struct block_allocator_allocation {
52 /* The list will be released in reverse order */
53 struct block_info *last_allocated;
55 struct block_allocator *info;
56 } block_allocator_allocation;
58 typedef struct mali_mem_block_mem {
59 block_allocator_allocation mem;
62 typedef struct mali_mem_virt_mali_mapping {
63 mali_address_t addr; /* Virtual Mali address */
64 u32 properties; /* MMU Permissions + cache, must match MMU HW */
65 } mali_mem_virt_mali_mapping;
67 typedef struct mali_mem_virt_cpu_mapping {
70 } mali_mem_virt_cpu_mapping;
72 #define MALI_MEM_ALLOCATION_VALID_MAGIC 0xdeda110c
73 #define MALI_MEM_ALLOCATION_FREED_MAGIC 0x10101010
75 typedef struct mali_mem_allocation {
76 MALI_DEBUG_CODE(u32 magic);
77 mali_mem_type type; /**< Type of memory */
78 int id; /**< ID in the descriptor map for this allocation */
80 u32 size; /**< Size of the allocation */
81 u32 flags; /**< Flags for this allocation */
83 struct mali_session_data *session; /**< Pointer to session that owns the allocation */
85 /* Union selected by type. */
87 mali_mem_os_mem os_mem; /**< MALI_MEM_OS */
88 mali_mem_external ext_mem; /**< MALI_MEM_EXTERNAL */
89 mali_mem_dma_buf dma_buf; /**< MALI_MEM_DMA_BUF */
90 mali_mem_ump ump_mem; /**< MALI_MEM_UMP */
91 mali_mem_block_mem block_mem; /**< MALI_MEM_BLOCK */
94 mali_mem_virt_cpu_mapping cpu_mapping; /**< CPU mapping */
95 mali_mem_virt_mali_mapping mali_mapping; /**< Mali mapping */
96 } mali_mem_allocation;
98 #define MALI_MEM_FLAG_MALI_GUARD_PAGE (1 << 0)
99 #define MALI_MEM_FLAG_DONT_CPU_MAP (1 << 1)
101 #endif /* __MALI_MEMORY_TYPES__ */