1f6ffbd4fSLucas Stach // SPDX-License-Identifier: GPL-2.0
2681c19c8SLucas Stach /*
3681c19c8SLucas Stach * Copyright (C) 2018 Etnaviv Project
4681c19c8SLucas Stach */
5681c19c8SLucas Stach
6681c19c8SLucas Stach #include "etnaviv_gpu.h"
7681c19c8SLucas Stach
8681c19c8SLucas Stach static const struct etnaviv_chip_identity etnaviv_chip_identities[] = {
9681c19c8SLucas Stach {
10f56f1579SChristian Gmeiner .model = 0x400,
11f56f1579SChristian Gmeiner .revision = 0x4652,
12f56f1579SChristian Gmeiner .product_id = 0x70001,
13f56f1579SChristian Gmeiner .customer_id = 0x100,
14f56f1579SChristian Gmeiner .eco_id = 0,
15f56f1579SChristian Gmeiner .stream_count = 4,
16f56f1579SChristian Gmeiner .register_max = 64,
17f56f1579SChristian Gmeiner .thread_count = 128,
18f56f1579SChristian Gmeiner .shader_core_count = 1,
19ab3d7b6dSTomeu Vizoso .nn_core_count = 0,
20f56f1579SChristian Gmeiner .vertex_cache_size = 8,
21f56f1579SChristian Gmeiner .vertex_output_buffer_size = 1024,
22f56f1579SChristian Gmeiner .pixel_pipes = 1,
23f56f1579SChristian Gmeiner .instruction_count = 256,
24f56f1579SChristian Gmeiner .num_constants = 320,
25f56f1579SChristian Gmeiner .buffer_size = 0,
26f56f1579SChristian Gmeiner .varyings_count = 8,
27f56f1579SChristian Gmeiner .features = 0xa0e9e004,
28f56f1579SChristian Gmeiner .minor_features0 = 0xe1299fff,
29f56f1579SChristian Gmeiner .minor_features1 = 0xbe13b219,
30f56f1579SChristian Gmeiner .minor_features2 = 0xce110010,
31f56f1579SChristian Gmeiner .minor_features3 = 0x8000001,
32f56f1579SChristian Gmeiner .minor_features4 = 0x20102,
33f56f1579SChristian Gmeiner .minor_features5 = 0x120000,
34f56f1579SChristian Gmeiner .minor_features6 = 0x0,
35f56f1579SChristian Gmeiner .minor_features7 = 0x0,
36f56f1579SChristian Gmeiner .minor_features8 = 0x0,
37f56f1579SChristian Gmeiner .minor_features9 = 0x0,
38f56f1579SChristian Gmeiner .minor_features10 = 0x0,
39f56f1579SChristian Gmeiner .minor_features11 = 0x0,
40f56f1579SChristian Gmeiner },
41f56f1579SChristian Gmeiner {
42349bf015SLucas Stach .model = 0x520,
43349bf015SLucas Stach .revision = 0x5341,
44349bf015SLucas Stach .product_id = 0x5202,
45349bf015SLucas Stach .customer_id = 0x204,
46349bf015SLucas Stach .eco_id = 0,
47349bf015SLucas Stach .stream_count = 1,
48349bf015SLucas Stach .register_max = 64,
49349bf015SLucas Stach .thread_count = 256,
50349bf015SLucas Stach .shader_core_count = 1,
51349bf015SLucas Stach .vertex_cache_size = 8,
52349bf015SLucas Stach .vertex_output_buffer_size = 512,
53349bf015SLucas Stach .pixel_pipes = 1,
54349bf015SLucas Stach .instruction_count = 256,
55349bf015SLucas Stach .num_constants = 168,
56349bf015SLucas Stach .buffer_size = 0,
57349bf015SLucas Stach .varyings_count = 8,
58349bf015SLucas Stach .features = 0xe02c7eca,
59349bf015SLucas Stach .minor_features0 = 0xe9399eff,
60349bf015SLucas Stach .minor_features1 = 0xfe1fb2db,
61349bf015SLucas Stach .minor_features2 = 0xcedf0080,
62349bf015SLucas Stach .minor_features3 = 0x10800005,
63349bf015SLucas Stach .minor_features4 = 0x20000000,
64349bf015SLucas Stach .minor_features5 = 0x00020880,
65349bf015SLucas Stach .minor_features6 = 0x00000000,
66349bf015SLucas Stach .minor_features7 = 0x00001000,
67349bf015SLucas Stach .minor_features8 = 0x00000000,
68349bf015SLucas Stach .minor_features9 = 0x00000000,
69349bf015SLucas Stach .minor_features10 = 0x00000000,
70349bf015SLucas Stach .minor_features11 = 0x00000000,
71349bf015SLucas Stach },
72349bf015SLucas Stach {
73681c19c8SLucas Stach .model = 0x7000,
7412495f4eSMichael Walle .revision = 0x6202,
7512495f4eSMichael Walle .product_id = 0x70003,
7612495f4eSMichael Walle .customer_id = 0,
7712495f4eSMichael Walle .eco_id = 0,
7812495f4eSMichael Walle .stream_count = 8,
7912495f4eSMichael Walle .register_max = 64,
8012495f4eSMichael Walle .thread_count = 512,
8112495f4eSMichael Walle .shader_core_count = 2,
82ab3d7b6dSTomeu Vizoso .nn_core_count = 0,
8312495f4eSMichael Walle .vertex_cache_size = 16,
8412495f4eSMichael Walle .vertex_output_buffer_size = 1024,
8512495f4eSMichael Walle .pixel_pipes = 1,
8612495f4eSMichael Walle .instruction_count = 512,
8712495f4eSMichael Walle .num_constants = 320,
8812495f4eSMichael Walle .buffer_size = 0,
8912495f4eSMichael Walle .varyings_count = 16,
9012495f4eSMichael Walle .features = 0xe0287cad,
9112495f4eSMichael Walle .minor_features0 = 0xc1489eff,
9212495f4eSMichael Walle .minor_features1 = 0xfefbfad9,
9312495f4eSMichael Walle .minor_features2 = 0xeb9d4fbf,
9412495f4eSMichael Walle .minor_features3 = 0xedfffced,
9512495f4eSMichael Walle .minor_features4 = 0xdb0dafc7,
9612495f4eSMichael Walle .minor_features5 = 0x3b5ac333,
9712495f4eSMichael Walle .minor_features6 = 0xfccee201,
9812495f4eSMichael Walle .minor_features7 = 0x03fffa6f,
9912495f4eSMichael Walle .minor_features8 = 0x00e10ef0,
10012495f4eSMichael Walle .minor_features9 = 0x0088003c,
10112495f4eSMichael Walle .minor_features10 = 0x00004040,
10212495f4eSMichael Walle .minor_features11 = 0x00000024,
10312495f4eSMichael Walle },
10412495f4eSMichael Walle {
10512495f4eSMichael Walle .model = 0x7000,
1061f5896caSMarco Felsch .revision = 0x6203,
1071f5896caSMarco Felsch .product_id = 0x70003,
1081f5896caSMarco Felsch .customer_id = 0x4,
1091f5896caSMarco Felsch .eco_id = 0,
1101f5896caSMarco Felsch .stream_count = 16,
1111f5896caSMarco Felsch .register_max = 64,
1121f5896caSMarco Felsch .thread_count = 512,
1131f5896caSMarco Felsch .shader_core_count = 2,
114ab3d7b6dSTomeu Vizoso .nn_core_count = 0,
1151f5896caSMarco Felsch .vertex_cache_size = 16,
1161f5896caSMarco Felsch .vertex_output_buffer_size = 1024,
1171f5896caSMarco Felsch .pixel_pipes = 1,
1181f5896caSMarco Felsch .instruction_count = 512,
1191f5896caSMarco Felsch .num_constants = 320,
1201f5896caSMarco Felsch .buffer_size = 0,
1211f5896caSMarco Felsch .varyings_count = 16,
1221f5896caSMarco Felsch .features = 0xe0287c8d,
1231f5896caSMarco Felsch .minor_features0 = 0xc1589eff,
1241f5896caSMarco Felsch .minor_features1 = 0xfefbfad9,
1251f5896caSMarco Felsch .minor_features2 = 0xeb9d4fbf,
1261f5896caSMarco Felsch .minor_features3 = 0xedfffced,
1271f5896caSMarco Felsch .minor_features4 = 0xdb0dafc7,
1281f5896caSMarco Felsch .minor_features5 = 0x3b5ac333,
1291f5896caSMarco Felsch .minor_features6 = 0xfcce6000,
1301f5896caSMarco Felsch .minor_features7 = 0xfffbfa6f,
1311f5896caSMarco Felsch .minor_features8 = 0x00e10ef3,
1321f5896caSMarco Felsch .minor_features9 = 0x00c8003c,
1331f5896caSMarco Felsch .minor_features10 = 0x00004040,
1341f5896caSMarco Felsch .minor_features11 = 0x00000024,
1351f5896caSMarco Felsch },
1361f5896caSMarco Felsch {
1371f5896caSMarco Felsch .model = 0x7000,
138989c9dadSSascha Hauer .revision = 0x6204,
139989c9dadSSascha Hauer .product_id = ~0U,
140989c9dadSSascha Hauer .customer_id = ~0U,
141989c9dadSSascha Hauer .eco_id = 0,
142989c9dadSSascha Hauer .stream_count = 16,
143989c9dadSSascha Hauer .register_max = 64,
144989c9dadSSascha Hauer .thread_count = 512,
145989c9dadSSascha Hauer .shader_core_count = 2,
146989c9dadSSascha Hauer .vertex_cache_size = 16,
147989c9dadSSascha Hauer .vertex_output_buffer_size = 1024,
148989c9dadSSascha Hauer .pixel_pipes = 1,
149989c9dadSSascha Hauer .instruction_count = 512,
150989c9dadSSascha Hauer .num_constants = 320,
151989c9dadSSascha Hauer .buffer_size = 0,
152989c9dadSSascha Hauer .varyings_count = 16,
153989c9dadSSascha Hauer .features = 0xe0287c8d,
154989c9dadSSascha Hauer .minor_features0 = 0xc1589eff,
155989c9dadSSascha Hauer .minor_features1 = 0xfefbfad9,
156989c9dadSSascha Hauer .minor_features2 = 0xeb9d4fbf,
157989c9dadSSascha Hauer .minor_features3 = 0xedfffced,
158989c9dadSSascha Hauer .minor_features4 = 0xdb0dafc7,
159989c9dadSSascha Hauer .minor_features5 = 0x3b5ac333,
160989c9dadSSascha Hauer .minor_features6 = 0xfcce6000,
161989c9dadSSascha Hauer .minor_features7 = 0xfffbfa6f,
162989c9dadSSascha Hauer .minor_features8 = 0x00e10ef3,
163989c9dadSSascha Hauer .minor_features9 = 0x04c8003c,
164989c9dadSSascha Hauer .minor_features10 = 0x00004060,
165989c9dadSSascha Hauer .minor_features11 = 0x00000024,
166989c9dadSSascha Hauer },
167989c9dadSSascha Hauer {
168989c9dadSSascha Hauer .model = 0x7000,
169681c19c8SLucas Stach .revision = 0x6214,
170a51d1f37SChristian Gmeiner .product_id = ~0U,
171a51d1f37SChristian Gmeiner .customer_id = ~0U,
172a51d1f37SChristian Gmeiner .eco_id = ~0U,
173681c19c8SLucas Stach .stream_count = 16,
174681c19c8SLucas Stach .register_max = 64,
175681c19c8SLucas Stach .thread_count = 1024,
176681c19c8SLucas Stach .shader_core_count = 4,
177ab3d7b6dSTomeu Vizoso .nn_core_count = 0,
178681c19c8SLucas Stach .vertex_cache_size = 16,
179681c19c8SLucas Stach .vertex_output_buffer_size = 1024,
180681c19c8SLucas Stach .pixel_pipes = 2,
181681c19c8SLucas Stach .instruction_count = 512,
182681c19c8SLucas Stach .num_constants = 320,
183681c19c8SLucas Stach .buffer_size = 0,
184681c19c8SLucas Stach .varyings_count = 16,
185681c19c8SLucas Stach .features = 0xe0287cad,
186681c19c8SLucas Stach .minor_features0 = 0xc1799eff,
187681c19c8SLucas Stach .minor_features1 = 0xfefbfad9,
188681c19c8SLucas Stach .minor_features2 = 0xeb9d4fbf,
189681c19c8SLucas Stach .minor_features3 = 0xedfffced,
190681c19c8SLucas Stach .minor_features4 = 0xdb0dafc7,
191681c19c8SLucas Stach .minor_features5 = 0xbb5ac333,
192681c19c8SLucas Stach .minor_features6 = 0xfc8ee200,
193681c19c8SLucas Stach .minor_features7 = 0x03fbfa6f,
194681c19c8SLucas Stach .minor_features8 = 0x00ef0ef0,
195681c19c8SLucas Stach .minor_features9 = 0x0edbf03c,
196681c19c8SLucas Stach .minor_features10 = 0x90044250,
197681c19c8SLucas Stach .minor_features11 = 0x00000024,
198681c19c8SLucas Stach },
19949b5ff4cSTomeu Vizoso {
20049b5ff4cSTomeu Vizoso .model = 0x8000,
20149b5ff4cSTomeu Vizoso .revision = 0x7120,
20249b5ff4cSTomeu Vizoso .product_id = 0x45080009,
20349b5ff4cSTomeu Vizoso .customer_id = 0x88,
20449b5ff4cSTomeu Vizoso .eco_id = 0,
20549b5ff4cSTomeu Vizoso .stream_count = 8,
20649b5ff4cSTomeu Vizoso .register_max = 64,
20749b5ff4cSTomeu Vizoso .thread_count = 256,
20849b5ff4cSTomeu Vizoso .shader_core_count = 1,
20949b5ff4cSTomeu Vizoso .nn_core_count = 8,
21049b5ff4cSTomeu Vizoso .vertex_cache_size = 16,
21149b5ff4cSTomeu Vizoso .vertex_output_buffer_size = 1024,
21249b5ff4cSTomeu Vizoso .pixel_pipes = 1,
21349b5ff4cSTomeu Vizoso .instruction_count = 512,
21449b5ff4cSTomeu Vizoso .num_constants = 320,
21549b5ff4cSTomeu Vizoso .buffer_size = 0,
21649b5ff4cSTomeu Vizoso .varyings_count = 16,
21749b5ff4cSTomeu Vizoso .features = 0xe0287cac,
21849b5ff4cSTomeu Vizoso .minor_features0 = 0xc1799eff,
21949b5ff4cSTomeu Vizoso .minor_features1 = 0xfefbfadb,
22049b5ff4cSTomeu Vizoso .minor_features2 = 0xeb9d6fbf,
22149b5ff4cSTomeu Vizoso .minor_features3 = 0xedfffced,
22249b5ff4cSTomeu Vizoso .minor_features4 = 0xd30dafc7,
22349b5ff4cSTomeu Vizoso .minor_features5 = 0x7b5ac333,
22449b5ff4cSTomeu Vizoso .minor_features6 = 0xfc8ee200,
22549b5ff4cSTomeu Vizoso .minor_features7 = 0x03fffa6f,
22649b5ff4cSTomeu Vizoso .minor_features8 = 0x00fe0ef0,
22749b5ff4cSTomeu Vizoso .minor_features9 = 0x0088003c,
22849b5ff4cSTomeu Vizoso .minor_features10 = 0x108048c0,
22949b5ff4cSTomeu Vizoso .minor_features11 = 0x00000010,
23049b5ff4cSTomeu Vizoso },
23181372e4eSLucas Stach {
23281372e4eSLucas Stach .model = 0x8000,
23381372e4eSLucas Stach .revision = 0x8002,
23481372e4eSLucas Stach .product_id = 0x5080009,
23581372e4eSLucas Stach .customer_id = 0x9f,
23681372e4eSLucas Stach .eco_id = 0x6000000,
23781372e4eSLucas Stach .stream_count = 8,
23881372e4eSLucas Stach .register_max = 64,
23981372e4eSLucas Stach .thread_count = 256,
24081372e4eSLucas Stach .shader_core_count = 1,
24181372e4eSLucas Stach .nn_core_count = 6,
24281372e4eSLucas Stach .vertex_cache_size = 16,
24381372e4eSLucas Stach .vertex_output_buffer_size = 1024,
24481372e4eSLucas Stach .pixel_pipes = 1,
24581372e4eSLucas Stach .instruction_count = 512,
24681372e4eSLucas Stach .num_constants = 320,
24781372e4eSLucas Stach .buffer_size = 0,
24881372e4eSLucas Stach .varyings_count = 16,
24981372e4eSLucas Stach .features = 0xe0287cac,
25081372e4eSLucas Stach .minor_features0 = 0xc1799eff,
25181372e4eSLucas Stach .minor_features1 = 0xfefbfadb,
25281372e4eSLucas Stach .minor_features2 = 0xeb9d6fbf,
25381372e4eSLucas Stach .minor_features3 = 0xedfffced,
25481372e4eSLucas Stach .minor_features4 = 0xd30dafc7,
25581372e4eSLucas Stach .minor_features5 = 0x7b5ac333,
25681372e4eSLucas Stach .minor_features6 = 0xfc8ee200,
25781372e4eSLucas Stach .minor_features7 = 0x03fffa6f,
25881372e4eSLucas Stach .minor_features8 = 0x00fe0ef0,
25981372e4eSLucas Stach .minor_features9 = 0x0088003c,
26081372e4eSLucas Stach .minor_features10 = 0x108048c0,
26181372e4eSLucas Stach .minor_features11 = 0x00000010,
26281372e4eSLucas Stach },
263681c19c8SLucas Stach };
264681c19c8SLucas Stach
etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu * gpu)265681c19c8SLucas Stach bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu)
266681c19c8SLucas Stach {
267681c19c8SLucas Stach struct etnaviv_chip_identity *ident = &gpu->identity;
268*bc8e5fdaSChristian Gmeiner const u32 product_id = ident->product_id;
269*bc8e5fdaSChristian Gmeiner const u32 customer_id = ident->customer_id;
270*bc8e5fdaSChristian Gmeiner const u32 eco_id = ident->eco_id;
271681c19c8SLucas Stach int i;
272681c19c8SLucas Stach
273681c19c8SLucas Stach for (i = 0; i < ARRAY_SIZE(etnaviv_chip_identities); i++) {
274681c19c8SLucas Stach if (etnaviv_chip_identities[i].model == ident->model &&
2754078a118SChristian Gmeiner etnaviv_chip_identities[i].revision == ident->revision &&
2764078a118SChristian Gmeiner (etnaviv_chip_identities[i].product_id == ident->product_id ||
2774078a118SChristian Gmeiner etnaviv_chip_identities[i].product_id == ~0U) &&
2784078a118SChristian Gmeiner (etnaviv_chip_identities[i].customer_id == ident->customer_id ||
2794078a118SChristian Gmeiner etnaviv_chip_identities[i].customer_id == ~0U) &&
2804078a118SChristian Gmeiner (etnaviv_chip_identities[i].eco_id == ident->eco_id ||
2814078a118SChristian Gmeiner etnaviv_chip_identities[i].eco_id == ~0U)) {
282681c19c8SLucas Stach memcpy(ident, &etnaviv_chip_identities[i],
283681c19c8SLucas Stach sizeof(*ident));
284*bc8e5fdaSChristian Gmeiner
285*bc8e5fdaSChristian Gmeiner /* Restore some id values as ~0U aka 'don't care' might been used. */
286*bc8e5fdaSChristian Gmeiner ident->product_id = product_id;
287*bc8e5fdaSChristian Gmeiner ident->customer_id = customer_id;
288*bc8e5fdaSChristian Gmeiner ident->eco_id = eco_id;
289*bc8e5fdaSChristian Gmeiner
290681c19c8SLucas Stach return true;
291681c19c8SLucas Stach }
292681c19c8SLucas Stach }
293681c19c8SLucas Stach
294681c19c8SLucas Stach return false;
295681c19c8SLucas Stach }
296