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 		.vertex_cache_size = 8,
20 		.vertex_output_buffer_size = 1024,
21 		.pixel_pipes = 1,
22 		.instruction_count = 256,
23 		.num_constants = 320,
24 		.buffer_size = 0,
25 		.varyings_count = 8,
26 		.features = 0xa0e9e004,
27 		.minor_features0 = 0xe1299fff,
28 		.minor_features1 = 0xbe13b219,
29 		.minor_features2 = 0xce110010,
30 		.minor_features3 = 0x8000001,
31 		.minor_features4 = 0x20102,
32 		.minor_features5 = 0x120000,
33 		.minor_features6 = 0x0,
34 		.minor_features7 = 0x0,
35 		.minor_features8 = 0x0,
36 		.minor_features9 = 0x0,
37 		.minor_features10 = 0x0,
38 		.minor_features11 = 0x0,
39 	},
40 	{
41 		.model = 0x7000,
42 		.revision = 0x6202,
43 		.product_id = 0x70003,
44 		.customer_id = 0,
45 		.eco_id = 0,
46 		.stream_count = 8,
47 		.register_max = 64,
48 		.thread_count = 512,
49 		.shader_core_count = 2,
50 		.vertex_cache_size = 16,
51 		.vertex_output_buffer_size = 1024,
52 		.pixel_pipes = 1,
53 		.instruction_count = 512,
54 		.num_constants = 320,
55 		.buffer_size = 0,
56 		.varyings_count = 16,
57 		.features = 0xe0287cad,
58 		.minor_features0 = 0xc1489eff,
59 		.minor_features1 = 0xfefbfad9,
60 		.minor_features2 = 0xeb9d4fbf,
61 		.minor_features3 = 0xedfffced,
62 		.minor_features4 = 0xdb0dafc7,
63 		.minor_features5 = 0x3b5ac333,
64 		.minor_features6 = 0xfccee201,
65 		.minor_features7 = 0x03fffa6f,
66 		.minor_features8 = 0x00e10ef0,
67 		.minor_features9 = 0x0088003c,
68 		.minor_features10 = 0x00004040,
69 		.minor_features11 = 0x00000024,
70 	},
71 	{
72 		.model = 0x7000,
73 		.revision = 0x6203,
74 		.product_id = 0x70003,
75 		.customer_id = 0x4,
76 		.eco_id = 0,
77 		.stream_count = 16,
78 		.register_max = 64,
79 		.thread_count = 512,
80 		.shader_core_count = 2,
81 		.vertex_cache_size = 16,
82 		.vertex_output_buffer_size = 1024,
83 		.pixel_pipes = 1,
84 		.instruction_count = 512,
85 		.num_constants = 320,
86 		.buffer_size = 0,
87 		.varyings_count = 16,
88 		.features = 0xe0287c8d,
89 		.minor_features0 = 0xc1589eff,
90 		.minor_features1 = 0xfefbfad9,
91 		.minor_features2 = 0xeb9d4fbf,
92 		.minor_features3 = 0xedfffced,
93 		.minor_features4 = 0xdb0dafc7,
94 		.minor_features5 = 0x3b5ac333,
95 		.minor_features6 = 0xfcce6000,
96 		.minor_features7 = 0xfffbfa6f,
97 		.minor_features8 = 0x00e10ef3,
98 		.minor_features9 = 0x00c8003c,
99 		.minor_features10 = 0x00004040,
100 		.minor_features11 = 0x00000024,
101 	},
102 	{
103 		.model = 0x7000,
104 		.revision = 0x6204,
105 		.product_id = ~0U,
106 		.customer_id = ~0U,
107 		.eco_id = 0,
108 		.stream_count = 16,
109 		.register_max = 64,
110 		.thread_count = 512,
111 		.shader_core_count = 2,
112 		.vertex_cache_size = 16,
113 		.vertex_output_buffer_size = 1024,
114 		.pixel_pipes = 1,
115 		.instruction_count = 512,
116 		.num_constants = 320,
117 		.buffer_size = 0,
118 		.varyings_count = 16,
119 		.features = 0xe0287c8d,
120 		.minor_features0 = 0xc1589eff,
121 		.minor_features1 = 0xfefbfad9,
122 		.minor_features2 = 0xeb9d4fbf,
123 		.minor_features3 = 0xedfffced,
124 		.minor_features4 = 0xdb0dafc7,
125 		.minor_features5 = 0x3b5ac333,
126 		.minor_features6 = 0xfcce6000,
127 		.minor_features7 = 0xfffbfa6f,
128 		.minor_features8 = 0x00e10ef3,
129 		.minor_features9 = 0x04c8003c,
130 		.minor_features10 = 0x00004060,
131 		.minor_features11 = 0x00000024,
132 	},
133 	{
134 		.model = 0x7000,
135 		.revision = 0x6214,
136 		.product_id = ~0U,
137 		.customer_id = ~0U,
138 		.eco_id = ~0U,
139 		.stream_count = 16,
140 		.register_max = 64,
141 		.thread_count = 1024,
142 		.shader_core_count = 4,
143 		.vertex_cache_size = 16,
144 		.vertex_output_buffer_size = 1024,
145 		.pixel_pipes = 2,
146 		.instruction_count = 512,
147 		.num_constants = 320,
148 		.buffer_size = 0,
149 		.varyings_count = 16,
150 		.features = 0xe0287cad,
151 		.minor_features0 = 0xc1799eff,
152 		.minor_features1 = 0xfefbfad9,
153 		.minor_features2 = 0xeb9d4fbf,
154 		.minor_features3 = 0xedfffced,
155 		.minor_features4 = 0xdb0dafc7,
156 		.minor_features5 = 0xbb5ac333,
157 		.minor_features6 = 0xfc8ee200,
158 		.minor_features7 = 0x03fbfa6f,
159 		.minor_features8 = 0x00ef0ef0,
160 		.minor_features9 = 0x0edbf03c,
161 		.minor_features10 = 0x90044250,
162 		.minor_features11 = 0x00000024,
163 	},
164 };
165 
166 bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu)
167 {
168 	struct etnaviv_chip_identity *ident = &gpu->identity;
169 	int i;
170 
171 	for (i = 0; i < ARRAY_SIZE(etnaviv_chip_identities); i++) {
172 		if (etnaviv_chip_identities[i].model == ident->model &&
173 		    etnaviv_chip_identities[i].revision == ident->revision &&
174 		    (etnaviv_chip_identities[i].product_id == ident->product_id ||
175 			 etnaviv_chip_identities[i].product_id == ~0U) &&
176 		    (etnaviv_chip_identities[i].customer_id == ident->customer_id ||
177 			 etnaviv_chip_identities[i].customer_id == ~0U) &&
178 		    (etnaviv_chip_identities[i].eco_id == ident->eco_id ||
179 			 etnaviv_chip_identities[i].eco_id == ~0U)) {
180 			memcpy(ident, &etnaviv_chip_identities[i],
181 			       sizeof(*ident));
182 			return true;
183 		}
184 	}
185 
186 	return false;
187 }
188