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