tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / r4p0_rel0 / linux / mali_memory_os_alloc.h
1 /*
2  * Copyright (C) 2010-2012 ARM Limited. All rights reserved.
3  * 
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.
6  * 
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.
9  */
10
11 #ifndef __MALI_MEMORY_OS_ALLOC_H__
12 #define __MALI_MEMORY_OS_ALLOC_H__
13
14 #include "mali_osk.h"
15 #include "mali_session.h"
16
17 #include "mali_memory_types.h"
18
19 /* OS memory allocator */
20 /** @brief Allocate memory from OS
21  *
22  * This function will create a descriptor, allocate pages and map these on the CPU and Mali.
23  *
24  * @param mali_addr Mali virtual address to use for Mali mapping
25  * @param size Size to allocate
26  * @param vma Pointer to vma for CPU mapping
27  * @param session Pointer to session doing the allocation
28  */
29 mali_mem_allocation *mali_mem_os_alloc(u32 mali_addr, u32 size, struct vm_area_struct *vma, struct mali_session_data *session);
30
31 /** @brief Release Mali OS memory
32  *
33  * The session memory_lock must be held when calling this function.
34  *
35  * @param descriptor Pointer to the descriptor to release
36  */
37 void mali_mem_os_release(mali_mem_allocation *descriptor);
38
39 _mali_osk_errcode_t mali_mem_os_get_table_page(u32 *phys, mali_io_address *mapping);
40
41 void mali_mem_os_release_table_page(u32 phys, void *virt);
42
43 _mali_osk_errcode_t mali_mem_os_init(void);
44 void mali_mem_os_term(void);
45 u32 mali_mem_os_stat(void);
46
47 #endif /* __MALI_MEMORY_OS_ALLOC_H__ */