xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/mali400/ump/common/ump_kernel_memory_backend.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (C) 2010-2011, 2013-2014, 2016-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 /**
12  * @file ump_kernel_memory_mapping.h
13  */
14 
15 #ifndef __UMP_KERNEL_MEMORY_BACKEND_H__
16 #define __UMP_KERNEL_MEMORY_BACKEND_H__
17 
18 #include "ump_kernel_interface.h"
19 #include "ump_kernel_types.h"
20 
21 
22 typedef struct ump_memory_allocation {
23 	void                     *phys_addr;
24 	void                     *mapping;
25 	unsigned long             size;
26 	ump_dd_handle             handle;
27 	void                     *process_mapping_info;
28 	u32                       cookie;               /**< necessary on some U/K interface implementations */
29 	struct ump_session_data *ump_session;           /**< Session that this allocation belongs to */
30 	_mali_osk_list_t          list;                 /**< List for linking together memory allocations into the session's memory head */
31 	u32 is_cached;
32 } ump_memory_allocation;
33 
34 typedef struct ump_memory_backend {
35 	int (*allocate)(void *ctx, ump_dd_mem *descriptor);
36 	void (*release)(void *ctx, ump_dd_mem *descriptor);
37 	void (*shutdown)(struct ump_memory_backend *backend);
38 	u32(*stat)(struct ump_memory_backend *backend);
39 	int (*pre_allocate_physical_check)(void *ctx, u32 size);
40 	u32(*adjust_to_mali_phys)(void *ctx, u32 cpu_phys);
41 	void *ctx;
42 } ump_memory_backend;
43 
44 ump_memory_backend *ump_memory_backend_create(void);
45 void ump_memory_backend_destroy(void);
46 
47 #endif /*__UMP_KERNEL_MEMORY_BACKEND_H__ */
48 
49