1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2018 Etnaviv Project
4 */
5
6#include "etnaviv_gpu.h"
7
8static const struct etnaviv_chip_identity etnaviv_chip_identities[] = {
9 {
10 .model = 0x400,
11 .revision = 0x4652,
12 .product_id = 0x70001,
13 .customer_id = 0x100,
14 .eco_id = 0,
15 .stream_count = 4,
16 .register_max = 64,
17 .thread_count = 128,
18 .shader_core_count = 1,
19 .nn_core_count = 0,
20 .nn_mad_per_core = 0,
21 .tp_core_count = 0,
22 .on_chip_sram_size = 0,
23 .axi_sram_size = 0,
24 .vertex_cache_size = 8,
25 .vertex_output_buffer_size = 1024,
26 .pixel_pipes = 1,
27 .instruction_count = 256,
28 .num_constants = 320,
29 .buffer_size = 0,
30 .varyings_count = 8,
31 .features = 0xa0e9e004,
32 .minor_features0 = 0xe1299fff,
33 .minor_features1 = 0xbe13b219,
34 .minor_features2 = 0xce110010,
35 .minor_features3 = 0x8000001,
36 .minor_features4 = 0x20102,
37 .minor_features5 = 0x120000,
38 .minor_features6 = 0x0,
39 .minor_features7 = 0x0,
40 .minor_features8 = 0x0,
41 .minor_features9 = 0x0,
42 .minor_features10 = 0x0,
43 .minor_features11 = 0x0,
44 },
45 {
46 .model = 0x520,
47 .revision = 0x5341,
48 .product_id = 0x5202,
49 .customer_id = 0x204,
50 .eco_id = 0,
51 .stream_count = 1,
52 .register_max = 64,
53 .thread_count = 256,
54 .shader_core_count = 1,
55 .nn_core_count = 0,
56 .nn_mad_per_core = 0,
57 .tp_core_count = 0,
58 .on_chip_sram_size = 0,
59 .axi_sram_size = 0,
60 .vertex_cache_size = 8,
61 .vertex_output_buffer_size = 512,
62 .pixel_pipes = 1,
63 .instruction_count = 256,
64 .num_constants = 168,
65 .buffer_size = 0,
66 .varyings_count = 8,
67 .features = 0xe02c7eca,
68 .minor_features0 = 0xe9399eff,
69 .minor_features1 = 0xfe1fb2db,
70 .minor_features2 = 0xcedf0080,
71 .minor_features3 = 0x10800005,
72 .minor_features4 = 0x20000000,
73 .minor_features5 = 0x00020880,
74 .minor_features6 = 0x00000000,
75 .minor_features7 = 0x00001000,
76 .minor_features8 = 0x00000000,
77 .minor_features9 = 0x00000000,
78 .minor_features10 = 0x00000000,
79 .minor_features11 = 0x00000000,
80 },
81 {
82 .model = 0x7000,
83 .revision = 0x6202,
84 .product_id = 0x70003,
85 .customer_id = 0,
86 .eco_id = 0,
87 .stream_count = 8,
88 .register_max = 64,
89 .thread_count = 512,
90 .shader_core_count = 2,
91 .nn_core_count = 0,
92 .nn_mad_per_core = 0,
93 .tp_core_count = 0,
94 .on_chip_sram_size = 0,
95 .axi_sram_size = 0,
96 .vertex_cache_size = 16,
97 .vertex_output_buffer_size = 1024,
98 .pixel_pipes = 1,
99 .instruction_count = 512,
100 .num_constants = 320,
101 .buffer_size = 0,
102 .varyings_count = 16,
103 .features = 0xe0287cad,
104 .minor_features0 = 0xc1489eff,
105 .minor_features1 = 0xfefbfad9,
106 .minor_features2 = 0xeb9d4fbf,
107 .minor_features3 = 0xedfffced,
108 .minor_features4 = 0xdb0dafc7,
109 .minor_features5 = 0x3b5ac333,
110 .minor_features6 = 0xfccee201,
111 .minor_features7 = 0x03fffa6f,
112 .minor_features8 = 0x00e10ef0,
113 .minor_features9 = 0x0088003c,
114 .minor_features10 = 0x00004040,
115 .minor_features11 = 0x00000024,
116 },
117 {
118 .model = 0x7000,
119 .revision = 0x6203,
120 .product_id = 0x70003,
121 .customer_id = 0x4,
122 .eco_id = 0,
123 .stream_count = 16,
124 .register_max = 64,
125 .thread_count = 512,
126 .shader_core_count = 2,
127 .nn_core_count = 0,
128 .nn_mad_per_core = 0,
129 .tp_core_count = 0,
130 .on_chip_sram_size = 0,
131 .axi_sram_size = 0,
132 .vertex_cache_size = 16,
133 .vertex_output_buffer_size = 1024,
134 .pixel_pipes = 1,
135 .instruction_count = 512,
136 .num_constants = 320,
137 .buffer_size = 0,
138 .varyings_count = 16,
139 .features = 0xe0287c8d,
140 .minor_features0 = 0xc1589eff,
141 .minor_features1 = 0xfefbfad9,
142 .minor_features2 = 0xeb9d4fbf,
143 .minor_features3 = 0xedfffced,
144 .minor_features4 = 0xdb0dafc7,
145 .minor_features5 = 0x3b5ac333,
146 .minor_features6 = 0xfcce6000,
147 .minor_features7 = 0xfffbfa6f,
148 .minor_features8 = 0x00e10ef3,
149 .minor_features9 = 0x00c8003c,
150 .minor_features10 = 0x00004040,
151 .minor_features11 = 0x00000024,
152 },
153 {
154 .model = 0x7000,
155 .revision = 0x6204,
156 .product_id = ~0U,
157 .customer_id = ~0U,
158 .eco_id = 0,
159 .stream_count = 16,
160 .register_max = 64,
161 .thread_count = 512,
162 .shader_core_count = 2,
163 .nn_core_count = 0,
164 .nn_mad_per_core = 0,
165 .tp_core_count = 0,
166 .on_chip_sram_size = 0,
167 .axi_sram_size = 0,
168 .vertex_cache_size = 16,
169 .vertex_output_buffer_size = 1024,
170 .pixel_pipes = 1,
171 .instruction_count = 512,
172 .num_constants = 320,
173 .buffer_size = 0,
174 .varyings_count = 16,
175 .features = 0xe0287c8d,
176 .minor_features0 = 0xc1589eff,
177 .minor_features1 = 0xfefbfad9,
178 .minor_features2 = 0xeb9d4fbf,
179 .minor_features3 = 0xedfffced,
180 .minor_features4 = 0xdb0dafc7,
181 .minor_features5 = 0x3b5ac333,
182 .minor_features6 = 0xfcce6000,
183 .minor_features7 = 0xfffbfa6f,
184 .minor_features8 = 0x00e10ef3,
185 .minor_features9 = 0x04c8003c,
186 .minor_features10 = 0x00004060,
187 .minor_features11 = 0x00000024,
188 },
189 {
190 .model = 0x7000,
191 .revision = 0x6214,
192 .product_id = ~0U,
193 .customer_id = ~0U,
194 .eco_id = ~0U,
195 .stream_count = 16,
196 .register_max = 64,
197 .thread_count = 1024,
198 .shader_core_count = 4,
199 .nn_core_count = 0,
200 .nn_mad_per_core = 0,
201 .tp_core_count = 0,
202 .on_chip_sram_size = 0,
203 .axi_sram_size = 0,
204 .vertex_cache_size = 16,
205 .vertex_output_buffer_size = 1024,
206 .pixel_pipes = 2,
207 .instruction_count = 512,
208 .num_constants = 320,
209 .buffer_size = 0,
210 .varyings_count = 16,
211 .features = 0xe0287cad,
212 .minor_features0 = 0xc1799eff,
213 .minor_features1 = 0xfefbfad9,
214 .minor_features2 = 0xeb9d4fbf,
215 .minor_features3 = 0xedfffced,
216 .minor_features4 = 0xdb0dafc7,
217 .minor_features5 = 0xbb5ac333,
218 .minor_features6 = 0xfc8ee200,
219 .minor_features7 = 0x03fbfa6f,
220 .minor_features8 = 0x00ef0ef0,
221 .minor_features9 = 0x0edbf03c,
222 .minor_features10 = 0x90044250,
223 .minor_features11 = 0x00000024,
224 },
225 {
226 .model = 0x8000,
227 .revision = 0x7120,
228 .product_id = 0x45080009,
229 .customer_id = 0x88,
230 .eco_id = 0,
231 .stream_count = 8,
232 .register_max = 64,
233 .thread_count = 256,
234 .shader_core_count = 1,
235 .nn_core_count = 8,
236 .nn_mad_per_core = 64,
237 .tp_core_count = 4,
238 .on_chip_sram_size = 524288,
239 .axi_sram_size = 1048576,
240 .vertex_cache_size = 16,
241 .vertex_output_buffer_size = 1024,
242 .pixel_pipes = 1,
243 .instruction_count = 512,
244 .num_constants = 320,
245 .buffer_size = 0,
246 .varyings_count = 16,
247 .features = 0xe0287cac,
248 .minor_features0 = 0xc1799eff,
249 .minor_features1 = 0xfefbfadb,
250 .minor_features2 = 0xeb9d6fbf,
251 .minor_features3 = 0xedfffced,
252 .minor_features4 = 0xd30dafc7,
253 .minor_features5 = 0x7b5ac333,
254 .minor_features6 = 0xfc8ee200,
255 .minor_features7 = 0x03fffa6f,
256 .minor_features8 = 0x00fe0ef0,
257 .minor_features9 = 0x0088003c,
258 .minor_features10 = 0x108048c0,
259 .minor_features11 = 0x00000010,
260 },
261 {
262 .model = 0x8000,
263 .revision = 0x8002,
264 .product_id = 0x5080009,
265 .customer_id = 0x9f,
266 .eco_id = 0x6000000,
267 .stream_count = 8,
268 .register_max = 64,
269 .thread_count = 256,
270 .shader_core_count = 1,
271 .nn_core_count = 6,
272 .nn_mad_per_core = 64,
273 .tp_core_count = 3,
274 .on_chip_sram_size = 262144,
275 .axi_sram_size = 0,
276 .vertex_cache_size = 16,
277 .vertex_output_buffer_size = 1024,
278 .pixel_pipes = 1,
279 .instruction_count = 512,
280 .num_constants = 320,
281 .buffer_size = 0,
282 .varyings_count = 16,
283 .features = 0xe0287cac,
284 .minor_features0 = 0xc1799eff,
285 .minor_features1 = 0xfefbfadb,
286 .minor_features2 = 0xeb9d6fbf,
287 .minor_features3 = 0xedfffced,
288 .minor_features4 = 0xd30dafc7,
289 .minor_features5 = 0x7b5ac333,
290 .minor_features6 = 0xfc8ee200,
291 .minor_features7 = 0x03fffa6f,
292 .minor_features8 = 0x00fe0ef0,
293 .minor_features9 = 0x0088003c,
294 .minor_features10 = 0x108048c0,
295 .minor_features11 = 0x00000010,
296 },
297};
298
299bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu)
300{
301 struct etnaviv_chip_identity *ident = &gpu->identity;
302 const u32 product_id = ident->product_id;
303 const u32 customer_id = ident->customer_id;
304 const u32 eco_id = ident->eco_id;
305 int i;
306
307 for (i = 0; i < ARRAY_SIZE(etnaviv_chip_identities); i++) {
308 if (etnaviv_chip_identities[i].model == ident->model &&
309 etnaviv_chip_identities[i].revision == ident->revision &&
310 (etnaviv_chip_identities[i].product_id == ident->product_id ||
311 etnaviv_chip_identities[i].product_id == ~0U) &&
312 (etnaviv_chip_identities[i].customer_id == ident->customer_id ||
313 etnaviv_chip_identities[i].customer_id == ~0U) &&
314 (etnaviv_chip_identities[i].eco_id == ident->eco_id ||
315 etnaviv_chip_identities[i].eco_id == ~0U)) {
316 memcpy(ident, &etnaviv_chip_identities[i],
317 sizeof(*ident));
318
319 /* Restore some id values as ~0U aka 'don't care' might been used. */
320 ident->product_id = product_id;
321 ident->customer_id = customer_id;
322 ident->eco_id = eco_id;
323
324 return true;
325 }
326 }
327
328 return false;
329}
330

source code of linux/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c