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#ifndef PVR_DEVICE_INFO_H
25bf215546Sopenharmony_ci#define PVR_DEVICE_INFO_H
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ci/* TODO: This file is currently hand-maintained. However, the intention is to
28bf215546Sopenharmony_ci * auto-generate it in the future based on the hwdefs.
29bf215546Sopenharmony_ci */
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci#include <assert.h>
32bf215546Sopenharmony_ci#include <errno.h>
33bf215546Sopenharmony_ci#include <stdbool.h>
34bf215546Sopenharmony_ci#include <stdint.h>
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_ci#include "util/log.h"
37bf215546Sopenharmony_ci#include "util/macros.h"
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ci#define PVR_BVNC_PACK_SHIFT_B 48
40bf215546Sopenharmony_ci#define PVR_BVNC_PACK_SHIFT_V 32
41bf215546Sopenharmony_ci#define PVR_BVNC_PACK_SHIFT_N 16
42bf215546Sopenharmony_ci#define PVR_BVNC_PACK_SHIFT_C 0
43bf215546Sopenharmony_ci
44bf215546Sopenharmony_ci#define PVR_BVNC_PACK_MASK_B UINT64_C(0xFFFF000000000000)
45bf215546Sopenharmony_ci#define PVR_BVNC_PACK_MASK_V UINT64_C(0x0000FFFF00000000)
46bf215546Sopenharmony_ci#define PVR_BVNC_PACK_MASK_N UINT64_C(0x00000000FFFF0000)
47bf215546Sopenharmony_ci#define PVR_BVNC_PACK_MASK_C UINT64_C(0x000000000000FFFF)
48bf215546Sopenharmony_ci
49bf215546Sopenharmony_ci/**
50bf215546Sopenharmony_ci * Packs B, V, N and C values into a 64-bit unsigned integer.
51bf215546Sopenharmony_ci *
52bf215546Sopenharmony_ci * The packed layout is as follows:
53bf215546Sopenharmony_ci *
54bf215546Sopenharmony_ci * \verbatim
55bf215546Sopenharmony_ci *    +--------+--------+--------+-------+
56bf215546Sopenharmony_ci *    | 63..48 | 47..32 | 31..16 | 15..0 |
57bf215546Sopenharmony_ci *    +========+========+========+=======+
58bf215546Sopenharmony_ci *    | B      | V      | N      | C     |
59bf215546Sopenharmony_ci *    +--------+--------+--------+-------+
60bf215546Sopenharmony_ci * \endverbatim
61bf215546Sopenharmony_ci *
62bf215546Sopenharmony_ci * #pvr_get_packed_bvnc() should be used instead of this macro when a
63bf215546Sopenharmony_ci * #pvr_device_information is available in order to ensure proper type checking.
64bf215546Sopenharmony_ci *
65bf215546Sopenharmony_ci * \param b Branch ID.
66bf215546Sopenharmony_ci * \param v Version ID.
67bf215546Sopenharmony_ci * \param n Number of scalable units.
68bf215546Sopenharmony_ci * \param c Config ID.
69bf215546Sopenharmony_ci * \return Packed BVNC.
70bf215546Sopenharmony_ci *
71bf215546Sopenharmony_ci * \sa #pvr_get_packed_bvnc(), #PVR_BVNC_UNPACK_B(), #PVR_BVNC_UNPACK_V(),
72bf215546Sopenharmony_ci * #PVR_BVNC_UNPACK_N() and #PVR_BVNC_UNPACK_C()
73bf215546Sopenharmony_ci */
74bf215546Sopenharmony_ci#define PVR_BVNC_PACK(b, v, n, c)                                       \
75bf215546Sopenharmony_ci   ((((uint64_t)(b) << PVR_BVNC_PACK_SHIFT_B) & PVR_BVNC_PACK_MASK_B) | \
76bf215546Sopenharmony_ci    (((uint64_t)(v) << PVR_BVNC_PACK_SHIFT_V) & PVR_BVNC_PACK_MASK_V) | \
77bf215546Sopenharmony_ci    (((uint64_t)(n) << PVR_BVNC_PACK_SHIFT_N) & PVR_BVNC_PACK_MASK_N) | \
78bf215546Sopenharmony_ci    (((uint64_t)(c) << PVR_BVNC_PACK_SHIFT_C) & PVR_BVNC_PACK_MASK_C))
79bf215546Sopenharmony_ci
80bf215546Sopenharmony_ci/**
81bf215546Sopenharmony_ci * Unpacks B value (branch ID) from packed BVNC.
82bf215546Sopenharmony_ci *
83bf215546Sopenharmony_ci * \param bvnc Packed BVNC.
84bf215546Sopenharmony_ci * \return Branch ID.
85bf215546Sopenharmony_ci *
86bf215546Sopenharmony_ci * \sa #PVR_BVNC_UNPACK_V(), #PVR_BVNC_UNPACK_N(), #PVR_BVNC_UNPACK_C(),
87bf215546Sopenharmony_ci * #pvr_get_packed_bvnc() and #PVR_BVNC_PACK()
88bf215546Sopenharmony_ci */
89bf215546Sopenharmony_ci#define PVR_BVNC_UNPACK_B(bvnc) \
90bf215546Sopenharmony_ci   ((uint16_t)(((bvnc)&PVR_BVNC_PACK_MASK_B) >> PVR_BVNC_PACK_SHIFT_B))
91bf215546Sopenharmony_ci
92bf215546Sopenharmony_ci/**
93bf215546Sopenharmony_ci * Unpacks V value (version ID) from packed BVNC.
94bf215546Sopenharmony_ci *
95bf215546Sopenharmony_ci * \param bvnc Packed BVNC.
96bf215546Sopenharmony_ci * \return Version ID.
97bf215546Sopenharmony_ci *
98bf215546Sopenharmony_ci * \sa #PVR_BVNC_UNPACK_B(), #PVR_BVNC_UNPACK_N(), #PVR_BVNC_UNPACK_C(),
99bf215546Sopenharmony_ci * #pvr_get_packed_bvnc() and #PVR_BVNC_PACK()
100bf215546Sopenharmony_ci */
101bf215546Sopenharmony_ci#define PVR_BVNC_UNPACK_V(bvnc) \
102bf215546Sopenharmony_ci   ((uint16_t)(((bvnc)&PVR_BVNC_PACK_MASK_V) >> PVR_BVNC_PACK_SHIFT_V))
103bf215546Sopenharmony_ci
104bf215546Sopenharmony_ci/**
105bf215546Sopenharmony_ci * Unpacks N value (number of scalable units) from packed BVNC.
106bf215546Sopenharmony_ci *
107bf215546Sopenharmony_ci * \param bvnc Packed BVNC.
108bf215546Sopenharmony_ci * \return Number of scalable units.
109bf215546Sopenharmony_ci *
110bf215546Sopenharmony_ci * \sa #PVR_BVNC_UNPACK_B(), #PVR_BVNC_UNPACK_V(), #PVR_BVNC_UNPACK_C(),
111bf215546Sopenharmony_ci * #pvr_get_packed_bvnc() and #PVR_BVNC_PACK()
112bf215546Sopenharmony_ci */
113bf215546Sopenharmony_ci#define PVR_BVNC_UNPACK_N(bvnc) \
114bf215546Sopenharmony_ci   ((uint16_t)(((bvnc)&PVR_BVNC_PACK_MASK_N) >> PVR_BVNC_PACK_SHIFT_N))
115bf215546Sopenharmony_ci
116bf215546Sopenharmony_ci/**
117bf215546Sopenharmony_ci * Unpacks C value (config ID) from packed BVNC.
118bf215546Sopenharmony_ci *
119bf215546Sopenharmony_ci * \param bvnc Packed BVNC.
120bf215546Sopenharmony_ci * \return Config ID.
121bf215546Sopenharmony_ci *
122bf215546Sopenharmony_ci * \sa #PVR_BVNC_UNPACK_B(), #PVR_BVNC_UNPACK_V(), #PVR_BVNC_UNPACK_N(),
123bf215546Sopenharmony_ci * #pvr_get_packed_bvnc() and #PVR_BVNC_PACK()
124bf215546Sopenharmony_ci */
125bf215546Sopenharmony_ci#define PVR_BVNC_UNPACK_C(bvnc) \
126bf215546Sopenharmony_ci   ((uint16_t)(((bvnc)&PVR_BVNC_PACK_MASK_C) >> PVR_BVNC_PACK_SHIFT_C))
127bf215546Sopenharmony_ci
128bf215546Sopenharmony_ci/**
129bf215546Sopenharmony_ci * Tests whether a physical device has a given feature.
130bf215546Sopenharmony_ci *
131bf215546Sopenharmony_ci * Feature names are derived from those found in #pvr_device_features by
132bf215546Sopenharmony_ci * dropping the 'has_' prefix, which is applied by this macro.
133bf215546Sopenharmony_ci *
134bf215546Sopenharmony_ci * \param dev_info #pvr_device_info object associated with the target physical
135bf215546Sopenharmony_ci *                 device.
136bf215546Sopenharmony_ci * \param feature  Device feature name.
137bf215546Sopenharmony_ci *
138bf215546Sopenharmony_ci * \return
139bf215546Sopenharmony_ci *  * true if the named feature is present in the hardware.
140bf215546Sopenharmony_ci *  * false if the named feature is not present in the hardware.
141bf215546Sopenharmony_ci *
142bf215546Sopenharmony_ci * \sa #PVR_FEATURE_VALUE() and #PVR_GET_FEATURE_VALUE()
143bf215546Sopenharmony_ci */
144bf215546Sopenharmony_ci#define PVR_HAS_FEATURE(dev_info, feature) ((dev_info)->features.has_##feature)
145bf215546Sopenharmony_ci
146bf215546Sopenharmony_ci/**
147bf215546Sopenharmony_ci * Gets a physical device feature value if feature is supported.
148bf215546Sopenharmony_ci *
149bf215546Sopenharmony_ci * Feature names are derived from those found in #pvr_device_features by
150bf215546Sopenharmony_ci * dropping the 'has_' prefix.
151bf215546Sopenharmony_ci *
152bf215546Sopenharmony_ci * This macro should be used in preference to #PVR_GET_FEATURE_VALUE() as it has
153bf215546Sopenharmony_ci * proper error handling.
154bf215546Sopenharmony_ci *
155bf215546Sopenharmony_ci * \param dev_info  #pvr_device_info object associated with the target physical
156bf215546Sopenharmony_ci *                  device.
157bf215546Sopenharmony_ci * \param feature   Feature name.
158bf215546Sopenharmony_ci * \param value_out Feature value.
159bf215546Sopenharmony_ci *
160bf215546Sopenharmony_ci * \return
161bf215546Sopenharmony_ci *  * 0 on success, or
162bf215546Sopenharmony_ci *  * -%EINVAL if the named feature is not present in the hardware.
163bf215546Sopenharmony_ci *
164bf215546Sopenharmony_ci * \sa #PVR_HAS_FEATURE() and #PVR_GET_FEATURE_VALUE()
165bf215546Sopenharmony_ci */
166bf215546Sopenharmony_ci#define PVR_FEATURE_VALUE(dev_info, feature, value_out)    \
167bf215546Sopenharmony_ci   ({                                                      \
168bf215546Sopenharmony_ci      const struct pvr_device_info *__dev_info = dev_info; \
169bf215546Sopenharmony_ci      int __ret = -EINVAL;                                 \
170bf215546Sopenharmony_ci      if (__dev_info->features.has_##feature) {            \
171bf215546Sopenharmony_ci         *(value_out) = __dev_info->features.feature;      \
172bf215546Sopenharmony_ci         __ret = 0;                                        \
173bf215546Sopenharmony_ci      }                                                    \
174bf215546Sopenharmony_ci      __ret;                                               \
175bf215546Sopenharmony_ci   })
176bf215546Sopenharmony_ci
177bf215546Sopenharmony_ci/**
178bf215546Sopenharmony_ci * Gets a physical device feature value if supported, but otherwise returns a
179bf215546Sopenharmony_ci * default value.
180bf215546Sopenharmony_ci *
181bf215546Sopenharmony_ci * Feature names are derived from those found in #pvr_device_features by
182bf215546Sopenharmony_ci * dropping the 'has_' prefix.
183bf215546Sopenharmony_ci *
184bf215546Sopenharmony_ci * #PVR_FEATURE_VALUE() should be used in preference to this macro when errors
185bf215546Sopenharmony_ci * can be returned by the caller. This macro is intended for cases where errors
186bf215546Sopenharmony_ci * can't be returned.
187bf215546Sopenharmony_ci *
188bf215546Sopenharmony_ci * \param dev_info      #pvr_device_info object associated with the target
189bf215546Sopenharmony_ci *                      physical device.
190bf215546Sopenharmony_ci * \param feature       Feature name.
191bf215546Sopenharmony_ci * \param default_value Default feature value.
192bf215546Sopenharmony_ci *
193bf215546Sopenharmony_ci * \return Feature value.
194bf215546Sopenharmony_ci *
195bf215546Sopenharmony_ci * \sa #PVR_HAS_FEATURE() and #PVR_FEATURE_VALUE()
196bf215546Sopenharmony_ci */
197bf215546Sopenharmony_ci#define PVR_GET_FEATURE_VALUE(dev_info, feature, default_value)     \
198bf215546Sopenharmony_ci   ({                                                               \
199bf215546Sopenharmony_ci      const struct pvr_device_info *__dev_info = dev_info;          \
200bf215546Sopenharmony_ci      __typeof__(default_value) __ret = default_value;              \
201bf215546Sopenharmony_ci      if (__dev_info->features.has_##feature) {                     \
202bf215546Sopenharmony_ci         __ret = __dev_info->features.feature;                      \
203bf215546Sopenharmony_ci      } else {                                                      \
204bf215546Sopenharmony_ci         mesa_logw("Missing " #feature                              \
205bf215546Sopenharmony_ci                   " feature (defaulting to: " #default_value ")"); \
206bf215546Sopenharmony_ci         assert(0);                                                 \
207bf215546Sopenharmony_ci      }                                                             \
208bf215546Sopenharmony_ci      __ret;                                                        \
209bf215546Sopenharmony_ci   })
210bf215546Sopenharmony_ci
211bf215546Sopenharmony_ci/**
212bf215546Sopenharmony_ci * Tests whether a physical device has a given enhancement.
213bf215546Sopenharmony_ci *
214bf215546Sopenharmony_ci * Enhancement numbers are derived from those found in #pvr_device_enhancements
215bf215546Sopenharmony_ci * by dropping the 'has_ern' prefix, which is applied by this macro.
216bf215546Sopenharmony_ci *
217bf215546Sopenharmony_ci * \param dev_info #pvr_device_info object associated with the target physical
218bf215546Sopenharmony_ci *                 device.
219bf215546Sopenharmony_ci * \param number   Enhancement number.
220bf215546Sopenharmony_ci *
221bf215546Sopenharmony_ci * \return
222bf215546Sopenharmony_ci *  * true if the enhancement is present in the hardware.
223bf215546Sopenharmony_ci *  * false if the enhancement is not present in the hardware.
224bf215546Sopenharmony_ci */
225bf215546Sopenharmony_ci#define PVR_HAS_ERN(dev_info, number) ((dev_info)->enhancements.has_ern##number)
226bf215546Sopenharmony_ci
227bf215546Sopenharmony_ci/**
228bf215546Sopenharmony_ci * Tests whether a physical device has a given quirk.
229bf215546Sopenharmony_ci *
230bf215546Sopenharmony_ci * Quirk numbers are derived from those found in #pvr_device_quirks by
231bf215546Sopenharmony_ci * dropping the 'has_brn' prefix, which is applied by this macro.
232bf215546Sopenharmony_ci *
233bf215546Sopenharmony_ci * \param dev_info #pvr_device_info object associated with the target physical
234bf215546Sopenharmony_ci *                 device.
235bf215546Sopenharmony_ci * \param number   Quirk number.
236bf215546Sopenharmony_ci *
237bf215546Sopenharmony_ci * \return
238bf215546Sopenharmony_ci *  * true if the quirk is present in the hardware.
239bf215546Sopenharmony_ci *  * false if the quirk is not present in the hardware.
240bf215546Sopenharmony_ci */
241bf215546Sopenharmony_ci#define PVR_HAS_QUIRK(dev_info, number) ((dev_info)->quirks.has_brn##number)
242bf215546Sopenharmony_ci
243bf215546Sopenharmony_cistruct pvr_device_ident {
244bf215546Sopenharmony_ci   uint16_t b, v, n, c;
245bf215546Sopenharmony_ci   uint32_t device_id;
246bf215546Sopenharmony_ci   const char *series_name;
247bf215546Sopenharmony_ci   const char *public_name;
248bf215546Sopenharmony_ci};
249bf215546Sopenharmony_ci
250bf215546Sopenharmony_cistruct pvr_device_features {
251bf215546Sopenharmony_ci   bool has_astc : 1;
252bf215546Sopenharmony_ci   bool has_cluster_grouping : 1;
253bf215546Sopenharmony_ci   bool has_common_store_size_in_dwords : 1;
254bf215546Sopenharmony_ci   bool has_compute : 1;
255bf215546Sopenharmony_ci   bool has_compute_morton_capable : 1;
256bf215546Sopenharmony_ci   bool has_compute_overlap : 1;
257bf215546Sopenharmony_ci   bool has_eight_output_registers : 1;
258bf215546Sopenharmony_ci   bool has_gpu_multicore_support : 1;
259bf215546Sopenharmony_ci   bool has_gs_rta_support : 1;
260bf215546Sopenharmony_ci   bool has_isp_max_tiles_in_flight : 1;
261bf215546Sopenharmony_ci   bool has_isp_samples_per_pixel : 1;
262bf215546Sopenharmony_ci   bool has_max_instances_per_pds_task : 1;
263bf215546Sopenharmony_ci   bool has_max_multisample : 1;
264bf215546Sopenharmony_ci   bool has_max_partitions : 1;
265bf215546Sopenharmony_ci   bool has_max_usc_tasks : 1;
266bf215546Sopenharmony_ci   bool has_num_clusters : 1;
267bf215546Sopenharmony_ci   bool has_num_raster_pipes : 1;
268bf215546Sopenharmony_ci   bool has_num_user_clip_planes : 1;
269bf215546Sopenharmony_ci   bool has_paired_tiles : 1;
270bf215546Sopenharmony_ci   bool has_pds_ddmadt : 1;
271bf215546Sopenharmony_ci   bool has_robust_buffer_access : 1;
272bf215546Sopenharmony_ci   bool has_roguexe : 1;
273bf215546Sopenharmony_ci   bool has_screen_size8K : 1;
274bf215546Sopenharmony_ci   bool has_simple_internal_parameter_format : 1;
275bf215546Sopenharmony_ci   bool has_simple_internal_parameter_format_v2 : 1;
276bf215546Sopenharmony_ci   bool has_simple_parameter_format_version : 1;
277bf215546Sopenharmony_ci   bool has_slc_cache_line_size_bits : 1;
278bf215546Sopenharmony_ci   bool has_slc_mcu_cache_controls : 1;
279bf215546Sopenharmony_ci   bool has_tf_bicubic_filter : 1;
280bf215546Sopenharmony_ci   bool has_tile_size_16x16 : 1;
281bf215546Sopenharmony_ci   bool has_tile_size_x : 1;
282bf215546Sopenharmony_ci   bool has_tile_size_y : 1;
283bf215546Sopenharmony_ci   bool has_tpu_array_textures : 1;
284bf215546Sopenharmony_ci   bool has_tpu_extended_integer_lookup : 1;
285bf215546Sopenharmony_ci   bool has_tpu_image_state_v2 : 1;
286bf215546Sopenharmony_ci   bool has_usc_f16sop_u8 : 1;
287bf215546Sopenharmony_ci   bool has_usc_min_output_registers_per_pix : 1;
288bf215546Sopenharmony_ci   bool has_usc_pixel_partition_mask : 1;
289bf215546Sopenharmony_ci   bool has_usc_slots : 1;
290bf215546Sopenharmony_ci   bool has_uvs_banks : 1;
291bf215546Sopenharmony_ci   bool has_uvs_pba_entries : 1;
292bf215546Sopenharmony_ci   bool has_uvs_vtx_entries : 1;
293bf215546Sopenharmony_ci   bool has_vdm_cam_size : 1;
294bf215546Sopenharmony_ci   bool has_vdm_degenerate_culling : 1;
295bf215546Sopenharmony_ci   bool has_xpu_max_slaves : 1;
296bf215546Sopenharmony_ci   bool has_xt_top_infrastructure : 1;
297bf215546Sopenharmony_ci   bool has_zls_subtile : 1;
298bf215546Sopenharmony_ci
299bf215546Sopenharmony_ci   uint32_t common_store_size_in_dwords;
300bf215546Sopenharmony_ci   uint32_t isp_max_tiles_in_flight;
301bf215546Sopenharmony_ci   uint32_t isp_samples_per_pixel;
302bf215546Sopenharmony_ci   uint32_t max_instances_per_pds_task;
303bf215546Sopenharmony_ci   uint32_t max_multisample;
304bf215546Sopenharmony_ci   uint32_t max_partitions;
305bf215546Sopenharmony_ci   uint32_t max_usc_tasks;
306bf215546Sopenharmony_ci   uint32_t num_clusters;
307bf215546Sopenharmony_ci   uint32_t num_raster_pipes;
308bf215546Sopenharmony_ci   uint32_t num_user_clip_planes;
309bf215546Sopenharmony_ci   uint32_t simple_parameter_format_version;
310bf215546Sopenharmony_ci   uint32_t slc_cache_line_size_bits;
311bf215546Sopenharmony_ci   uint32_t tile_size_x;
312bf215546Sopenharmony_ci   uint32_t tile_size_y;
313bf215546Sopenharmony_ci   uint32_t usc_min_output_registers_per_pix;
314bf215546Sopenharmony_ci   uint32_t usc_slots;
315bf215546Sopenharmony_ci   uint32_t uvs_banks;
316bf215546Sopenharmony_ci   uint32_t uvs_pba_entries;
317bf215546Sopenharmony_ci   uint32_t uvs_vtx_entries;
318bf215546Sopenharmony_ci   uint32_t vdm_cam_size;
319bf215546Sopenharmony_ci   uint32_t xpu_max_slaves;
320bf215546Sopenharmony_ci
321bf215546Sopenharmony_ci   /* Derived features. */
322bf215546Sopenharmony_ci   bool has_s8xe : 1;
323bf215546Sopenharmony_ci};
324bf215546Sopenharmony_ci
325bf215546Sopenharmony_cistruct pvr_device_enhancements {
326bf215546Sopenharmony_ci   bool has_ern35421 : 1;
327bf215546Sopenharmony_ci   bool has_ern38020 : 1;
328bf215546Sopenharmony_ci   bool has_ern38748 : 1;
329bf215546Sopenharmony_ci   bool has_ern42307 : 1;
330bf215546Sopenharmony_ci   bool has_ern45493 : 1;
331bf215546Sopenharmony_ci};
332bf215546Sopenharmony_ci
333bf215546Sopenharmony_cistruct pvr_device_quirks {
334bf215546Sopenharmony_ci   bool has_brn44079 : 1;
335bf215546Sopenharmony_ci   bool has_brn47727 : 1;
336bf215546Sopenharmony_ci   bool has_brn48492 : 1;
337bf215546Sopenharmony_ci   bool has_brn48545 : 1;
338bf215546Sopenharmony_ci   bool has_brn49032 : 1;
339bf215546Sopenharmony_ci   bool has_brn49927 : 1;
340bf215546Sopenharmony_ci   bool has_brn51025 : 1;
341bf215546Sopenharmony_ci   bool has_brn51210 : 1;
342bf215546Sopenharmony_ci   bool has_brn51764 : 1;
343bf215546Sopenharmony_ci   bool has_brn52354 : 1;
344bf215546Sopenharmony_ci   bool has_brn52942 : 1;
345bf215546Sopenharmony_ci   bool has_brn56279 : 1;
346bf215546Sopenharmony_ci   bool has_brn58839 : 1;
347bf215546Sopenharmony_ci   bool has_brn62269 : 1;
348bf215546Sopenharmony_ci   bool has_brn66011 : 1;
349bf215546Sopenharmony_ci   bool has_brn70165 : 1;
350bf215546Sopenharmony_ci};
351bf215546Sopenharmony_ci
352bf215546Sopenharmony_cistruct pvr_device_info {
353bf215546Sopenharmony_ci   struct pvr_device_ident ident;
354bf215546Sopenharmony_ci   struct pvr_device_features features;
355bf215546Sopenharmony_ci   struct pvr_device_enhancements enhancements;
356bf215546Sopenharmony_ci   struct pvr_device_quirks quirks;
357bf215546Sopenharmony_ci};
358bf215546Sopenharmony_ci
359bf215546Sopenharmony_cistruct pvr_device_runtime_info {
360bf215546Sopenharmony_ci   uint64_t min_free_list_size;
361bf215546Sopenharmony_ci   uint64_t reserved_shared_size;
362bf215546Sopenharmony_ci   uint64_t total_reserved_partition_size;
363bf215546Sopenharmony_ci   uint64_t num_phantoms;
364bf215546Sopenharmony_ci   uint64_t max_coeffs;
365bf215546Sopenharmony_ci   uint64_t cdm_max_local_mem_size_regs;
366bf215546Sopenharmony_ci   uint32_t core_count;
367bf215546Sopenharmony_ci};
368bf215546Sopenharmony_ci
369bf215546Sopenharmony_ci/**
370bf215546Sopenharmony_ci * Packs B, V, N and C values into a 64-bit unsigned integer.
371bf215546Sopenharmony_ci *
372bf215546Sopenharmony_ci * The packed layout is as follows:
373bf215546Sopenharmony_ci *
374bf215546Sopenharmony_ci * \verbatim
375bf215546Sopenharmony_ci *    +--------+--------+--------+-------+
376bf215546Sopenharmony_ci *    | 63..48 | 47..32 | 31..16 | 15..0 |
377bf215546Sopenharmony_ci *    +========+========+========+=======+
378bf215546Sopenharmony_ci *    | B      | V      | N      | C     |
379bf215546Sopenharmony_ci *    +--------+--------+--------+-------+
380bf215546Sopenharmony_ci * \endverbatim
381bf215546Sopenharmony_ci *
382bf215546Sopenharmony_ci * This should be used in preference to #PVR_BVNC_PACK() when a
383bf215546Sopenharmony_ci * #pvr_device_info is available in order to ensure proper type checking.
384bf215546Sopenharmony_ci *
385bf215546Sopenharmony_ci * \param dev_info Device information.
386bf215546Sopenharmony_ci * \return Packed BVNC.
387bf215546Sopenharmony_ci */
388bf215546Sopenharmony_cistatic ALWAYS_INLINE uint64_t
389bf215546Sopenharmony_cipvr_get_packed_bvnc(const struct pvr_device_info *dev_info)
390bf215546Sopenharmony_ci{
391bf215546Sopenharmony_ci   return PVR_BVNC_PACK(dev_info->ident.b,
392bf215546Sopenharmony_ci                        dev_info->ident.v,
393bf215546Sopenharmony_ci                        dev_info->ident.n,
394bf215546Sopenharmony_ci                        dev_info->ident.c);
395bf215546Sopenharmony_ci}
396bf215546Sopenharmony_ci
397bf215546Sopenharmony_ciint pvr_device_info_init(struct pvr_device_info *info, uint64_t bvnc);
398bf215546Sopenharmony_ci
399bf215546Sopenharmony_ci#endif /* PVR_DEVICE_INFO_H */
400