1 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
2 /*
3  *
4  * (C) COPYRIGHT 2011-2015, 2017, 2020-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 #include <mali_kbase_defs.h>
24 #include <mali_kbase_config_defaults.h>
25 
kbasep_platform_device_init(struct kbase_device *kbdev)26 int kbasep_platform_device_init(struct kbase_device *kbdev)
27 {
28 	struct kbase_platform_funcs_conf *platform_funcs_p;
29 
30 	platform_funcs_p = (struct kbase_platform_funcs_conf *)PLATFORM_FUNCS;
31 	if (platform_funcs_p && platform_funcs_p->platform_init_func)
32 		return platform_funcs_p->platform_init_func(kbdev);
33 
34 	return 0;
35 }
36 
kbasep_platform_device_term(struct kbase_device *kbdev)37 void kbasep_platform_device_term(struct kbase_device *kbdev)
38 {
39 	struct kbase_platform_funcs_conf *platform_funcs_p;
40 
41 	platform_funcs_p = (struct kbase_platform_funcs_conf *)PLATFORM_FUNCS;
42 	if (platform_funcs_p && platform_funcs_p->platform_term_func)
43 		platform_funcs_p->platform_term_func(kbdev);
44 }
45 
kbasep_platform_device_late_init(struct kbase_device *kbdev)46 int kbasep_platform_device_late_init(struct kbase_device *kbdev)
47 {
48 	struct kbase_platform_funcs_conf *platform_funcs_p;
49 
50 	platform_funcs_p = (struct kbase_platform_funcs_conf *)PLATFORM_FUNCS;
51 	if (platform_funcs_p && platform_funcs_p->platform_late_init_func)
52 		platform_funcs_p->platform_late_init_func(kbdev);
53 
54 	return 0;
55 }
56 
kbasep_platform_device_late_term(struct kbase_device *kbdev)57 void kbasep_platform_device_late_term(struct kbase_device *kbdev)
58 {
59 	struct kbase_platform_funcs_conf *platform_funcs_p;
60 
61 	platform_funcs_p = (struct kbase_platform_funcs_conf *)PLATFORM_FUNCS;
62 	if (platform_funcs_p && platform_funcs_p->platform_late_term_func)
63 		platform_funcs_p->platform_late_term_func(kbdev);
64 }
65 
66 #if !MALI_USE_CSF
kbasep_platform_context_init(struct kbase_context *kctx)67 int kbasep_platform_context_init(struct kbase_context *kctx)
68 {
69 	struct kbase_platform_funcs_conf *platform_funcs_p;
70 
71 	platform_funcs_p = (struct kbase_platform_funcs_conf *)PLATFORM_FUNCS;
72 	if (platform_funcs_p && platform_funcs_p->platform_handler_context_init_func)
73 		return platform_funcs_p->platform_handler_context_init_func(kctx);
74 
75 	return 0;
76 }
77 
kbasep_platform_context_term(struct kbase_context *kctx)78 void kbasep_platform_context_term(struct kbase_context *kctx)
79 {
80 	struct kbase_platform_funcs_conf *platform_funcs_p;
81 
82 	platform_funcs_p = (struct kbase_platform_funcs_conf *)PLATFORM_FUNCS;
83 	if (platform_funcs_p && platform_funcs_p->platform_handler_context_term_func)
84 		platform_funcs_p->platform_handler_context_term_func(kctx);
85 }
86 
kbasep_platform_event_atom_submit(struct kbase_jd_atom *katom)87 void kbasep_platform_event_atom_submit(struct kbase_jd_atom *katom)
88 {
89 	struct kbase_platform_funcs_conf *platform_funcs_p;
90 
91 	platform_funcs_p = (struct kbase_platform_funcs_conf *)PLATFORM_FUNCS;
92 	if (platform_funcs_p && platform_funcs_p->platform_handler_atom_submit_func)
93 		platform_funcs_p->platform_handler_atom_submit_func(katom);
94 }
95 
kbasep_platform_event_atom_complete(struct kbase_jd_atom *katom)96 void kbasep_platform_event_atom_complete(struct kbase_jd_atom *katom)
97 {
98 	struct kbase_platform_funcs_conf *platform_funcs_p;
99 
100 	platform_funcs_p = (struct kbase_platform_funcs_conf *)PLATFORM_FUNCS;
101 	if (platform_funcs_p && platform_funcs_p->platform_handler_atom_complete_func)
102 		platform_funcs_p->platform_handler_atom_complete_func(katom);
103 }
104 #endif
105