xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/bifrost/context/mali_kbase_context_internal.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
5  *
6  * This program is free software and is provided to you under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation, and any use by you of this program is subject to the terms
9  * of such GNU license.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you can access it online at
18  * http://www.gnu.org/licenses/gpl-2.0.html.
19  *
20  */
21 
22 #include <mali_kbase.h>
23 
24 typedef int kbase_context_init_method(struct kbase_context *kctx);
25 typedef void kbase_context_term_method(struct kbase_context *kctx);
26 
27 /**
28  * struct kbase_context_init - Device init/term methods.
29  * @init: Function pointer to a initialise method.
30  * @term: Function pointer to a terminate method.
31  * @err_mes: Error message to be printed when init method fails.
32  */
33 struct kbase_context_init {
34 	kbase_context_init_method *init;
35 	kbase_context_term_method *term;
36 	char *err_mes;
37 };
38 
39 int kbase_context_common_init(struct kbase_context *kctx);
40 void kbase_context_common_term(struct kbase_context *kctx);
41 
42 int kbase_context_mem_pool_group_init(struct kbase_context *kctx);
43 void kbase_context_mem_pool_group_term(struct kbase_context *kctx);
44 
45 int kbase_context_mmu_init(struct kbase_context *kctx);
46 void kbase_context_mmu_term(struct kbase_context *kctx);
47 
48 int kbase_context_mem_alloc_page(struct kbase_context *kctx);
49 void kbase_context_mem_pool_free(struct kbase_context *kctx);
50 
51 void kbase_context_sticky_resource_term(struct kbase_context *kctx);
52 
53 int kbase_context_add_to_dev_list(struct kbase_context *kctx);
54 void kbase_context_remove_from_dev_list(struct kbase_context *kctx);
55