xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/mali400/mali/linux/mali_memory_os_alloc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (C) 2013-2017 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_memory_types.h"
16 
17 
18 /** @brief Release Mali OS memory
19  *
20  * The session memory_lock must be held when calling this function.
21  *
22  * @param mem_bkend Pointer to the mali_mem_backend to release
23  */
24 u32 mali_mem_os_release(mali_mem_backend *mem_bkend);
25 
26 _mali_osk_errcode_t mali_mem_os_get_table_page(mali_dma_addr *phys, mali_io_address *mapping);
27 
28 void mali_mem_os_release_table_page(mali_dma_addr phys, void *virt);
29 
30 _mali_osk_errcode_t mali_mem_os_init(void);
31 
32 void mali_mem_os_term(void);
33 
34 u32 mali_mem_os_stat(void);
35 
36 void mali_mem_os_free_page_node(struct mali_page_node *m_page);
37 
38 int mali_mem_os_alloc_pages(mali_mem_os_mem *os_mem, u32 size);
39 
40 u32 mali_mem_os_free(struct list_head *os_pages, u32 pages_count, mali_bool cow_flag);
41 
42 _mali_osk_errcode_t mali_mem_os_put_page(struct page *page);
43 
44 _mali_osk_errcode_t mali_mem_os_resize_pages(mali_mem_os_mem *mem_from, mali_mem_os_mem *mem_to, u32 start_page, u32 page_count);
45 
46 _mali_osk_errcode_t mali_mem_os_mali_map(mali_mem_os_mem *os_mem, struct mali_session_data *session, u32 vaddr, u32 start_page, u32 mapping_pgae_num, u32 props);
47 
48 void mali_mem_os_mali_unmap(mali_mem_allocation *alloc);
49 
50 int mali_mem_os_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma);
51 
52 _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bkend, struct vm_area_struct *vma, unsigned long start_vaddr, u32 mappig_size);
53 
54 #endif /* __MALI_MEMORY_OS_ALLOC_H__ */
55