aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/arm/mali/backend/gpu/mali_kbase_model_linux.h
blob: 4cf1235311f2b58a15a17de22ca8a73a648b0215 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 *
 * (C) COPYRIGHT 2019-2022 ARM Limited. All rights reserved.
 *
 * This program is free software and is provided to you under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation, and any use by you of this program is subject to the terms
 * of such GNU license.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you can access it online at
 * http://www.gnu.org/licenses/gpl-2.0.html.
 *
 */

/*
 * Model Linux Framework interfaces.
 *
 * This framework is used to provide generic Kbase Models interfaces.
 * Note: Backends cannot be used together; the selection is done at build time.
 *
 * - Without Model Linux Framework:
 * +-----------------------------+
 * | Kbase read/write/IRQ        |
 * +-----------------------------+
 * | HW interface definitions    |
 * +-----------------------------+
 *
 * - With Model Linux Framework:
 * +-----------------------------+
 * | Kbase read/write/IRQ        |
 * +-----------------------------+
 * | Model Linux Framework       |
 * +-----------------------------+
 * | Model interface definitions |
 * +-----------------------------+
 */

#ifndef _KBASE_MODEL_LINUX_H_
#define _KBASE_MODEL_LINUX_H_

/*
 * Include Model definitions
 */

#if IS_ENABLED(CONFIG_MALI_NO_MALI)
#include <backend/gpu/mali_kbase_model_dummy.h>
#endif /* IS_ENABLED(CONFIG_MALI_NO_MALI) */

#if !IS_ENABLED(CONFIG_MALI_REAL_HW)
/**
 * kbase_gpu_device_create() - Generic create function.
 *
 * @kbdev: Kbase device.
 *
 * Specific model hook is implemented by midgard_model_create()
 *
 * Return: 0 on success, error code otherwise.
 */
int kbase_gpu_device_create(struct kbase_device *kbdev);

/**
 * kbase_gpu_device_destroy() - Generic create function.
 *
 * @kbdev: Kbase device.
 *
 * Specific model hook is implemented by midgard_model_destroy()
 */
void kbase_gpu_device_destroy(struct kbase_device *kbdev);

/**
 * midgard_model_create() - Private create function.
 *
 * @kbdev: Kbase device.
 *
 * This hook is specific to the model built in Kbase.
 *
 * Return: Model handle.
 */
void *midgard_model_create(struct kbase_device *kbdev);

/**
 * midgard_model_destroy() - Private destroy function.
 *
 * @h: Model handle.
 *
 * This hook is specific to the model built in Kbase.
 */
void midgard_model_destroy(void *h);

/**
 * midgard_model_write_reg() - Private model write function.
 *
 * @h: Model handle.
 * @addr: Address at which to write.
 * @value: value to write.
 *
 * This hook is specific to the model built in Kbase.
 */
void midgard_model_write_reg(void *h, u32 addr, u32 value);

/**
 * midgard_model_read_reg() - Private model read function.
 *
 * @h: Model handle.
 * @addr: Address from which to read.
 * @value: Pointer where to store the read value.
 *
 * This hook is specific to the model built in Kbase.
 */
void midgard_model_read_reg(void *h, u32 addr, u32 *const value);

/**
 * gpu_device_raise_irq() - Private IRQ raise function.
 *
 * @model: Model handle.
 * @irq: IRQ type to raise.
 *
 * This hook is global to the model Linux framework.
 */
void gpu_device_raise_irq(void *model, u32 irq);

/**
 * gpu_device_set_data() - Private model set data function.
 *
 * @model: Model handle.
 * @data: Data carried by model.
 *
 * This hook is global to the model Linux framework.
 */
void gpu_device_set_data(void *model, void *data);

/**
 * gpu_device_get_data() - Private model get data function.
 *
 * @model: Model handle.
 *
 * This hook is global to the model Linux framework.
 *
 * Return: Pointer to the data carried by model.
 */
void *gpu_device_get_data(void *model);
#endif /* !IS_ENABLED(CONFIG_MALI_REAL_HW) */

#endif /* _KBASE_MODEL_LINUX_H_ */