1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright © 2022 Imagination Technologies Ltd.
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a copy
5bf215546Sopenharmony_ci * of this software and associated documentation files (the "Software"), to deal
6bf215546Sopenharmony_ci * in the Software without restriction, including without limitation the rights
7bf215546Sopenharmony_ci * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8bf215546Sopenharmony_ci * copies of the Software, and to permit persons to whom the Software is
9bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18bf215546Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20bf215546Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21bf215546Sopenharmony_ci * SOFTWARE.
22bf215546Sopenharmony_ci */
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ci/* TODO: This file is currently hand-maintained. However, the intention is to
25bf215546Sopenharmony_ci * auto-generate it in the future based on the hwdefs.
26bf215546Sopenharmony_ci */
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#include "assert.h"
29bf215546Sopenharmony_ci#include "errno.h"
30bf215546Sopenharmony_ci#include "pvr_device_info.h"
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ciconst struct pvr_device_ident pvr_device_ident_4_V_2_51 = {
33bf215546Sopenharmony_ci   .device_id = 0x6250,
34bf215546Sopenharmony_ci   .series_name = "Rogue",
35bf215546Sopenharmony_ci   .public_name = "GX6250",
36bf215546Sopenharmony_ci};
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_ciconst struct pvr_device_features pvr_device_features_4_V_2_51 = {
39bf215546Sopenharmony_ci   .has_astc = true,
40bf215546Sopenharmony_ci   .has_cluster_grouping = true,
41bf215546Sopenharmony_ci   .has_common_store_size_in_dwords = true,
42bf215546Sopenharmony_ci   .has_compute = true,
43bf215546Sopenharmony_ci   .has_compute_morton_capable = true,
44bf215546Sopenharmony_ci   .has_compute_overlap = true,
45bf215546Sopenharmony_ci   .has_eight_output_registers = true,
46bf215546Sopenharmony_ci   .has_gs_rta_support = true,
47bf215546Sopenharmony_ci   .has_isp_max_tiles_in_flight = true,
48bf215546Sopenharmony_ci   .has_isp_samples_per_pixel = true,
49bf215546Sopenharmony_ci   .has_max_instances_per_pds_task = true,
50bf215546Sopenharmony_ci   .has_max_multisample = true,
51bf215546Sopenharmony_ci   .has_max_partitions = true,
52bf215546Sopenharmony_ci   .has_max_usc_tasks = true,
53bf215546Sopenharmony_ci   .has_num_clusters = true,
54bf215546Sopenharmony_ci   .has_num_raster_pipes = true,
55bf215546Sopenharmony_ci   .has_num_user_clip_planes = true,
56bf215546Sopenharmony_ci   .has_robust_buffer_access = true,
57bf215546Sopenharmony_ci   .has_slc_cache_line_size_bits = true,
58bf215546Sopenharmony_ci   .has_slc_mcu_cache_controls = true,
59bf215546Sopenharmony_ci   .has_tf_bicubic_filter = true,
60bf215546Sopenharmony_ci   .has_tile_size_x = true,
61bf215546Sopenharmony_ci   .has_tile_size_y = true,
62bf215546Sopenharmony_ci   .has_tpu_array_textures = true,
63bf215546Sopenharmony_ci   .has_tpu_extended_integer_lookup = true,
64bf215546Sopenharmony_ci   .has_tpu_image_state_v2 = true,
65bf215546Sopenharmony_ci   .has_usc_f16sop_u8 = true,
66bf215546Sopenharmony_ci   .has_usc_min_output_registers_per_pix = true,
67bf215546Sopenharmony_ci   .has_usc_slots = true,
68bf215546Sopenharmony_ci   .has_uvs_banks = true,
69bf215546Sopenharmony_ci   .has_uvs_pba_entries = true,
70bf215546Sopenharmony_ci   .has_uvs_vtx_entries = true,
71bf215546Sopenharmony_ci   .has_vdm_cam_size = true,
72bf215546Sopenharmony_ci   .has_xt_top_infrastructure = true,
73bf215546Sopenharmony_ci   .has_zls_subtile = true,
74bf215546Sopenharmony_ci
75bf215546Sopenharmony_ci   .common_store_size_in_dwords = 1280U * 4U * 4U,
76bf215546Sopenharmony_ci   .isp_max_tiles_in_flight = 4U,
77bf215546Sopenharmony_ci   .isp_samples_per_pixel = 2U,
78bf215546Sopenharmony_ci   .max_instances_per_pds_task = 32U,
79bf215546Sopenharmony_ci   .max_multisample = 8U,
80bf215546Sopenharmony_ci   .max_partitions = 8U,
81bf215546Sopenharmony_ci   .max_usc_tasks = 56U,
82bf215546Sopenharmony_ci   .num_clusters = 2U,
83bf215546Sopenharmony_ci   .num_raster_pipes = 1U,
84bf215546Sopenharmony_ci   .num_user_clip_planes = 8U,
85bf215546Sopenharmony_ci   .slc_cache_line_size_bits = 512U,
86bf215546Sopenharmony_ci   .tile_size_x = 32U,
87bf215546Sopenharmony_ci   .tile_size_y = 32U,
88bf215546Sopenharmony_ci   .usc_min_output_registers_per_pix = 2U,
89bf215546Sopenharmony_ci   .usc_slots = 32U,
90bf215546Sopenharmony_ci   .uvs_banks = 8U,
91bf215546Sopenharmony_ci   .uvs_pba_entries = 320U,
92bf215546Sopenharmony_ci   .uvs_vtx_entries = 288U,
93bf215546Sopenharmony_ci   .vdm_cam_size = 256U,
94bf215546Sopenharmony_ci};
95bf215546Sopenharmony_ci
96bf215546Sopenharmony_ciconst struct pvr_device_enhancements pvr_device_enhancements_4_40_2_51 = {
97bf215546Sopenharmony_ci   .has_ern35421 = true,
98bf215546Sopenharmony_ci   .has_ern38020 = true,
99bf215546Sopenharmony_ci   .has_ern38748 = true,
100bf215546Sopenharmony_ci   .has_ern42307 = true,
101bf215546Sopenharmony_ci};
102bf215546Sopenharmony_ci
103bf215546Sopenharmony_ciconst struct pvr_device_quirks pvr_device_quirks_4_40_2_51 = {
104bf215546Sopenharmony_ci   .has_brn44079 = true,
105bf215546Sopenharmony_ci   .has_brn47727 = true,
106bf215546Sopenharmony_ci   .has_brn48492 = true,
107bf215546Sopenharmony_ci   .has_brn48545 = true,
108bf215546Sopenharmony_ci   .has_brn49032 = true,
109bf215546Sopenharmony_ci   .has_brn49927 = true,
110bf215546Sopenharmony_ci   .has_brn51025 = true,
111bf215546Sopenharmony_ci   .has_brn51210 = true,
112bf215546Sopenharmony_ci   .has_brn51764 = true,
113bf215546Sopenharmony_ci   .has_brn52354 = true,
114bf215546Sopenharmony_ci   .has_brn52942 = true,
115bf215546Sopenharmony_ci   .has_brn56279 = true,
116bf215546Sopenharmony_ci   .has_brn58839 = true,
117bf215546Sopenharmony_ci   .has_brn62269 = true,
118bf215546Sopenharmony_ci   .has_brn66011 = true,
119bf215546Sopenharmony_ci   .has_brn70165 = true,
120bf215546Sopenharmony_ci};
121bf215546Sopenharmony_ci
122bf215546Sopenharmony_ciconst struct pvr_device_ident pvr_device_ident_33_V_11_3 = {
123bf215546Sopenharmony_ci   .device_id = 0x33011003,
124bf215546Sopenharmony_ci   .series_name = "A-Series",
125bf215546Sopenharmony_ci   .public_name = "AXE-1-16M",
126bf215546Sopenharmony_ci};
127bf215546Sopenharmony_ci
128bf215546Sopenharmony_ciconst struct pvr_device_features pvr_device_features_33_V_11_3 = {
129bf215546Sopenharmony_ci   .has_common_store_size_in_dwords = true,
130bf215546Sopenharmony_ci   .has_compute = true,
131bf215546Sopenharmony_ci   .has_isp_max_tiles_in_flight = true,
132bf215546Sopenharmony_ci   .has_isp_samples_per_pixel = true,
133bf215546Sopenharmony_ci   .has_max_instances_per_pds_task = true,
134bf215546Sopenharmony_ci   .has_max_multisample = true,
135bf215546Sopenharmony_ci   .has_max_partitions = true,
136bf215546Sopenharmony_ci   .has_max_usc_tasks = true,
137bf215546Sopenharmony_ci   .has_num_clusters = true,
138bf215546Sopenharmony_ci   .has_num_raster_pipes = true,
139bf215546Sopenharmony_ci   .has_num_user_clip_planes = true,
140bf215546Sopenharmony_ci   .has_roguexe = true,
141bf215546Sopenharmony_ci   .has_screen_size8K = true,
142bf215546Sopenharmony_ci   .has_simple_internal_parameter_format = true,
143bf215546Sopenharmony_ci   .has_simple_internal_parameter_format_v2 = true,
144bf215546Sopenharmony_ci   .has_simple_parameter_format_version = true,
145bf215546Sopenharmony_ci   .has_slc_cache_line_size_bits = true,
146bf215546Sopenharmony_ci   .has_tile_size_16x16 = true,
147bf215546Sopenharmony_ci   .has_tile_size_x = true,
148bf215546Sopenharmony_ci   .has_tile_size_y = true,
149bf215546Sopenharmony_ci   .has_tpu_extended_integer_lookup = true,
150bf215546Sopenharmony_ci   .has_tpu_image_state_v2 = true,
151bf215546Sopenharmony_ci   .has_usc_f16sop_u8 = true,
152bf215546Sopenharmony_ci   .has_usc_min_output_registers_per_pix = true,
153bf215546Sopenharmony_ci   .has_usc_pixel_partition_mask = true,
154bf215546Sopenharmony_ci   .has_usc_slots = true,
155bf215546Sopenharmony_ci   .has_uvs_banks = true,
156bf215546Sopenharmony_ci   .has_uvs_pba_entries = true,
157bf215546Sopenharmony_ci   .has_uvs_vtx_entries = true,
158bf215546Sopenharmony_ci   .has_vdm_cam_size = true,
159bf215546Sopenharmony_ci   .has_vdm_degenerate_culling = true,
160bf215546Sopenharmony_ci
161bf215546Sopenharmony_ci   .common_store_size_in_dwords = 512U * 4U * 4U,
162bf215546Sopenharmony_ci   .isp_max_tiles_in_flight = 1U,
163bf215546Sopenharmony_ci   .isp_samples_per_pixel = 1U,
164bf215546Sopenharmony_ci   .max_instances_per_pds_task = 32U,
165bf215546Sopenharmony_ci   .max_multisample = 4U,
166bf215546Sopenharmony_ci   .max_partitions = 4U,
167bf215546Sopenharmony_ci   .max_usc_tasks = 24U,
168bf215546Sopenharmony_ci   .num_clusters = 1U,
169bf215546Sopenharmony_ci   .num_raster_pipes = 1U,
170bf215546Sopenharmony_ci   .num_user_clip_planes = 8U,
171bf215546Sopenharmony_ci   .simple_parameter_format_version = 2U,
172bf215546Sopenharmony_ci   .slc_cache_line_size_bits = 512U,
173bf215546Sopenharmony_ci   .tile_size_x = 16U,
174bf215546Sopenharmony_ci   .tile_size_y = 16U,
175bf215546Sopenharmony_ci   .usc_min_output_registers_per_pix = 1U,
176bf215546Sopenharmony_ci   .usc_slots = 14U,
177bf215546Sopenharmony_ci   .uvs_banks = 2U,
178bf215546Sopenharmony_ci   .uvs_pba_entries = 320U,
179bf215546Sopenharmony_ci   .uvs_vtx_entries = 288U,
180bf215546Sopenharmony_ci   .vdm_cam_size = 32U,
181bf215546Sopenharmony_ci
182bf215546Sopenharmony_ci   .has_s8xe = true,
183bf215546Sopenharmony_ci};
184bf215546Sopenharmony_ci
185bf215546Sopenharmony_ciconst struct pvr_device_enhancements pvr_device_enhancements_33_15_11_3 = {
186bf215546Sopenharmony_ci   .has_ern35421 = true,
187bf215546Sopenharmony_ci   .has_ern38748 = true,
188bf215546Sopenharmony_ci   .has_ern42307 = true,
189bf215546Sopenharmony_ci   .has_ern45493 = true,
190bf215546Sopenharmony_ci};
191bf215546Sopenharmony_ci
192bf215546Sopenharmony_ciconst struct pvr_device_quirks pvr_device_quirks_33_15_11_3 = {
193bf215546Sopenharmony_ci   .has_brn70165 = true,
194bf215546Sopenharmony_ci};
195bf215546Sopenharmony_ci
196bf215546Sopenharmony_ciconst struct pvr_device_ident pvr_device_ident_36_V_104_796 = {
197bf215546Sopenharmony_ci   .device_id = 0x36104796,
198bf215546Sopenharmony_ci   .series_name = "B-Series",
199bf215546Sopenharmony_ci   .public_name = "BXS-4-64",
200bf215546Sopenharmony_ci};
201bf215546Sopenharmony_ci
202bf215546Sopenharmony_ciconst struct pvr_device_features pvr_device_features_36_V_104_796 = {
203bf215546Sopenharmony_ci   .has_astc = true,
204bf215546Sopenharmony_ci   .has_common_store_size_in_dwords = true,
205bf215546Sopenharmony_ci   .has_compute = true,
206bf215546Sopenharmony_ci   .has_compute_overlap = true,
207bf215546Sopenharmony_ci   .has_gpu_multicore_support = true,
208bf215546Sopenharmony_ci   .has_gs_rta_support = true,
209bf215546Sopenharmony_ci   .has_isp_max_tiles_in_flight = true,
210bf215546Sopenharmony_ci   .has_isp_samples_per_pixel = true,
211bf215546Sopenharmony_ci   .has_max_instances_per_pds_task = true,
212bf215546Sopenharmony_ci   .has_max_multisample = true,
213bf215546Sopenharmony_ci   .has_max_partitions = true,
214bf215546Sopenharmony_ci   .has_max_usc_tasks = true,
215bf215546Sopenharmony_ci   .has_num_clusters = true,
216bf215546Sopenharmony_ci   .has_num_raster_pipes = true,
217bf215546Sopenharmony_ci   .has_num_user_clip_planes = true,
218bf215546Sopenharmony_ci   .has_paired_tiles = true,
219bf215546Sopenharmony_ci   .has_pds_ddmadt = true,
220bf215546Sopenharmony_ci   .has_roguexe = true,
221bf215546Sopenharmony_ci   .has_screen_size8K = true,
222bf215546Sopenharmony_ci   .has_simple_internal_parameter_format = true,
223bf215546Sopenharmony_ci   .has_simple_internal_parameter_format_v2 = true,
224bf215546Sopenharmony_ci   .has_simple_parameter_format_version = true,
225bf215546Sopenharmony_ci   .has_slc_cache_line_size_bits = true,
226bf215546Sopenharmony_ci   .has_tile_size_16x16 = true,
227bf215546Sopenharmony_ci   .has_tile_size_x = true,
228bf215546Sopenharmony_ci   .has_tile_size_y = true,
229bf215546Sopenharmony_ci   .has_tpu_extended_integer_lookup = true,
230bf215546Sopenharmony_ci   .has_tpu_image_state_v2 = true,
231bf215546Sopenharmony_ci   .has_usc_f16sop_u8 = true,
232bf215546Sopenharmony_ci   .has_usc_min_output_registers_per_pix = true,
233bf215546Sopenharmony_ci   .has_usc_pixel_partition_mask = true,
234bf215546Sopenharmony_ci   .has_usc_slots = true,
235bf215546Sopenharmony_ci   .has_uvs_banks = true,
236bf215546Sopenharmony_ci   .has_uvs_pba_entries = true,
237bf215546Sopenharmony_ci   .has_uvs_vtx_entries = true,
238bf215546Sopenharmony_ci   .has_vdm_cam_size = true,
239bf215546Sopenharmony_ci   .has_vdm_degenerate_culling = true,
240bf215546Sopenharmony_ci   .has_xpu_max_slaves = true,
241bf215546Sopenharmony_ci
242bf215546Sopenharmony_ci   .common_store_size_in_dwords = 1344U * 4U * 4U,
243bf215546Sopenharmony_ci   .isp_max_tiles_in_flight = 6U,
244bf215546Sopenharmony_ci   .isp_samples_per_pixel = 4U,
245bf215546Sopenharmony_ci   .max_instances_per_pds_task = 32U,
246bf215546Sopenharmony_ci   .max_multisample = 4U,
247bf215546Sopenharmony_ci   .max_partitions = 16U,
248bf215546Sopenharmony_ci   .max_usc_tasks = 156U,
249bf215546Sopenharmony_ci   .num_clusters = 1U,
250bf215546Sopenharmony_ci   .num_raster_pipes = 1U,
251bf215546Sopenharmony_ci   .num_user_clip_planes = 8U,
252bf215546Sopenharmony_ci   .simple_parameter_format_version = 2U,
253bf215546Sopenharmony_ci   .slc_cache_line_size_bits = 512U,
254bf215546Sopenharmony_ci   .tile_size_x = 16U,
255bf215546Sopenharmony_ci   .tile_size_y = 16U,
256bf215546Sopenharmony_ci   .usc_min_output_registers_per_pix = 2U,
257bf215546Sopenharmony_ci   .usc_slots = 64U,
258bf215546Sopenharmony_ci   .uvs_banks = 8U,
259bf215546Sopenharmony_ci   .uvs_pba_entries = 160U,
260bf215546Sopenharmony_ci   .uvs_vtx_entries = 144U,
261bf215546Sopenharmony_ci   .vdm_cam_size = 64U,
262bf215546Sopenharmony_ci   .xpu_max_slaves = 3U,
263bf215546Sopenharmony_ci
264bf215546Sopenharmony_ci   .has_s8xe = true,
265bf215546Sopenharmony_ci};
266bf215546Sopenharmony_ci
267bf215546Sopenharmony_ciconst struct pvr_device_enhancements pvr_device_enhancements_36_53_104_796 = {
268bf215546Sopenharmony_ci   .has_ern35421 = true,
269bf215546Sopenharmony_ci   .has_ern38748 = true,
270bf215546Sopenharmony_ci   .has_ern42307 = true,
271bf215546Sopenharmony_ci   .has_ern45493 = true,
272bf215546Sopenharmony_ci};
273bf215546Sopenharmony_ci
274bf215546Sopenharmony_ciconst struct pvr_device_quirks pvr_device_quirks_36_53_104_796 = {
275bf215546Sopenharmony_ci   .has_brn44079 = true,
276bf215546Sopenharmony_ci   .has_brn70165 = true,
277bf215546Sopenharmony_ci};
278bf215546Sopenharmony_ci
279bf215546Sopenharmony_ci/**
280bf215546Sopenharmony_ci * Initialize PowerVR device information.
281bf215546Sopenharmony_ci *
282bf215546Sopenharmony_ci * \param info Device info structure to initialize.
283bf215546Sopenharmony_ci * \param bvnc Packed BVNC.
284bf215546Sopenharmony_ci * \return
285bf215546Sopenharmony_ci *  * 0 on success, or
286bf215546Sopenharmony_ci *  * -%ENODEV if the device is not supported.
287bf215546Sopenharmony_ci */
288bf215546Sopenharmony_ciint pvr_device_info_init(struct pvr_device_info *info, uint64_t bvnc)
289bf215546Sopenharmony_ci{
290bf215546Sopenharmony_ci#define CASE_PACKED_BVNC_DEVICE_INFO(_b, _v, _n, _c)                          \
291bf215546Sopenharmony_ci   case PVR_BVNC_PACK(_b, _v, _n, _c):                                        \
292bf215546Sopenharmony_ci      info->ident = pvr_device_ident_##_b##_V_##_n##_##_c;                    \
293bf215546Sopenharmony_ci      info->ident.b = _b;                                                     \
294bf215546Sopenharmony_ci      info->ident.n = _n;                                                     \
295bf215546Sopenharmony_ci      info->ident.v = _v;                                                     \
296bf215546Sopenharmony_ci      info->ident.c = _c;                                                     \
297bf215546Sopenharmony_ci      info->features = pvr_device_features_##_b##_V_##_n##_##_c;              \
298bf215546Sopenharmony_ci      info->enhancements = pvr_device_enhancements_##_b##_##_v##_##_n##_##_c; \
299bf215546Sopenharmony_ci      info->quirks = pvr_device_quirks_##_b##_##_v##_##_n##_##_c;             \
300bf215546Sopenharmony_ci      return 0
301bf215546Sopenharmony_ci
302bf215546Sopenharmony_ci   switch (bvnc) {
303bf215546Sopenharmony_ci      CASE_PACKED_BVNC_DEVICE_INFO(4, 40, 2, 51);
304bf215546Sopenharmony_ci      CASE_PACKED_BVNC_DEVICE_INFO(33, 15, 11, 3);
305bf215546Sopenharmony_ci   }
306bf215546Sopenharmony_ci
307bf215546Sopenharmony_ci#undef CASE_PACKED_BVNC_DEVICE_INFO
308bf215546Sopenharmony_ci
309bf215546Sopenharmony_ci   assert(!"Unsupported Device");
310bf215546Sopenharmony_ci
311bf215546Sopenharmony_ci   return -ENODEV;
312bf215546Sopenharmony_ci}
313