18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2012 Advanced Micro Devices, Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next
128c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
138c2ecf20Sopenharmony_ci * Software.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
168c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
178c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
188c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
198c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
208c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
218c2ecf20Sopenharmony_ci * DEALINGS IN THE SOFTWARE.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * Authors:
248c2ecf20Sopenharmony_ci *     Alex Deucher <alexander.deucher@amd.com>
258c2ecf20Sopenharmony_ci */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#include <linux/types.h>
288c2ecf20Sopenharmony_ci#include <linux/bug.h>
298c2ecf20Sopenharmony_ci#include <linux/kernel.h>
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciconst u32 cik_default_state[] =
328c2ecf20Sopenharmony_ci{
338c2ecf20Sopenharmony_ci	0xc0066900,
348c2ecf20Sopenharmony_ci	0x00000000,
358c2ecf20Sopenharmony_ci	0x00000060, /* DB_RENDER_CONTROL */
368c2ecf20Sopenharmony_ci	0x00000000, /* DB_COUNT_CONTROL */
378c2ecf20Sopenharmony_ci	0x00000000, /* DB_DEPTH_VIEW */
388c2ecf20Sopenharmony_ci	0x0000002a, /* DB_RENDER_OVERRIDE */
398c2ecf20Sopenharmony_ci	0x00000000, /* DB_RENDER_OVERRIDE2 */
408c2ecf20Sopenharmony_ci	0x00000000, /* DB_HTILE_DATA_BASE */
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	0xc0046900,
438c2ecf20Sopenharmony_ci	0x00000008,
448c2ecf20Sopenharmony_ci	0x00000000, /* DB_DEPTH_BOUNDS_MIN */
458c2ecf20Sopenharmony_ci	0x00000000, /* DB_DEPTH_BOUNDS_MAX */
468c2ecf20Sopenharmony_ci	0x00000000, /* DB_STENCIL_CLEAR */
478c2ecf20Sopenharmony_ci	0x00000000, /* DB_DEPTH_CLEAR */
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	0xc0036900,
508c2ecf20Sopenharmony_ci	0x0000000f,
518c2ecf20Sopenharmony_ci	0x00000000, /* DB_DEPTH_INFO */
528c2ecf20Sopenharmony_ci	0x00000000, /* DB_Z_INFO */
538c2ecf20Sopenharmony_ci	0x00000000, /* DB_STENCIL_INFO */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	0xc0016900,
568c2ecf20Sopenharmony_ci	0x00000080,
578c2ecf20Sopenharmony_ci	0x00000000, /* PA_SC_WINDOW_OFFSET */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	0xc00d6900,
608c2ecf20Sopenharmony_ci	0x00000083,
618c2ecf20Sopenharmony_ci	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
628c2ecf20Sopenharmony_ci	0x00000000, /* PA_SC_CLIPRECT_0_TL */
638c2ecf20Sopenharmony_ci	0x20002000, /* PA_SC_CLIPRECT_0_BR */
648c2ecf20Sopenharmony_ci	0x00000000,
658c2ecf20Sopenharmony_ci	0x20002000,
668c2ecf20Sopenharmony_ci	0x00000000,
678c2ecf20Sopenharmony_ci	0x20002000,
688c2ecf20Sopenharmony_ci	0x00000000,
698c2ecf20Sopenharmony_ci	0x20002000,
708c2ecf20Sopenharmony_ci	0xaaaaaaaa, /* PA_SC_EDGERULE */
718c2ecf20Sopenharmony_ci	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
728c2ecf20Sopenharmony_ci	0x0000000f, /* CB_TARGET_MASK */
738c2ecf20Sopenharmony_ci	0x0000000f, /* CB_SHADER_MASK */
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	0xc0226900,
768c2ecf20Sopenharmony_ci	0x00000094,
778c2ecf20Sopenharmony_ci	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
788c2ecf20Sopenharmony_ci	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
798c2ecf20Sopenharmony_ci	0x80000000,
808c2ecf20Sopenharmony_ci	0x20002000,
818c2ecf20Sopenharmony_ci	0x80000000,
828c2ecf20Sopenharmony_ci	0x20002000,
838c2ecf20Sopenharmony_ci	0x80000000,
848c2ecf20Sopenharmony_ci	0x20002000,
858c2ecf20Sopenharmony_ci	0x80000000,
868c2ecf20Sopenharmony_ci	0x20002000,
878c2ecf20Sopenharmony_ci	0x80000000,
888c2ecf20Sopenharmony_ci	0x20002000,
898c2ecf20Sopenharmony_ci	0x80000000,
908c2ecf20Sopenharmony_ci	0x20002000,
918c2ecf20Sopenharmony_ci	0x80000000,
928c2ecf20Sopenharmony_ci	0x20002000,
938c2ecf20Sopenharmony_ci	0x80000000,
948c2ecf20Sopenharmony_ci	0x20002000,
958c2ecf20Sopenharmony_ci	0x80000000,
968c2ecf20Sopenharmony_ci	0x20002000,
978c2ecf20Sopenharmony_ci	0x80000000,
988c2ecf20Sopenharmony_ci	0x20002000,
998c2ecf20Sopenharmony_ci	0x80000000,
1008c2ecf20Sopenharmony_ci	0x20002000,
1018c2ecf20Sopenharmony_ci	0x80000000,
1028c2ecf20Sopenharmony_ci	0x20002000,
1038c2ecf20Sopenharmony_ci	0x80000000,
1048c2ecf20Sopenharmony_ci	0x20002000,
1058c2ecf20Sopenharmony_ci	0x80000000,
1068c2ecf20Sopenharmony_ci	0x20002000,
1078c2ecf20Sopenharmony_ci	0x80000000,
1088c2ecf20Sopenharmony_ci	0x20002000,
1098c2ecf20Sopenharmony_ci	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
1108c2ecf20Sopenharmony_ci	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci	0xc0046900,
1138c2ecf20Sopenharmony_ci	0x00000100,
1148c2ecf20Sopenharmony_ci	0xffffffff, /* VGT_MAX_VTX_INDX */
1158c2ecf20Sopenharmony_ci	0x00000000, /* VGT_MIN_VTX_INDX */
1168c2ecf20Sopenharmony_ci	0x00000000, /* VGT_INDX_OFFSET */
1178c2ecf20Sopenharmony_ci	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci	0xc0046900,
1208c2ecf20Sopenharmony_ci	0x00000105,
1218c2ecf20Sopenharmony_ci	0x00000000, /* CB_BLEND_RED */
1228c2ecf20Sopenharmony_ci	0x00000000, /* CB_BLEND_GREEN */
1238c2ecf20Sopenharmony_ci	0x00000000, /* CB_BLEND_BLUE */
1248c2ecf20Sopenharmony_ci	0x00000000, /* CB_BLEND_ALPHA */
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	0xc0016900,
1278c2ecf20Sopenharmony_ci	0x000001e0,
1288c2ecf20Sopenharmony_ci	0x00000000, /* CB_BLEND0_CONTROL */
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	0xc00c6900,
1318c2ecf20Sopenharmony_ci	0x00000200,
1328c2ecf20Sopenharmony_ci	0x00000000, /* DB_DEPTH_CONTROL */
1338c2ecf20Sopenharmony_ci	0x00000000, /* DB_EQAA */
1348c2ecf20Sopenharmony_ci	0x00cc0010, /* CB_COLOR_CONTROL */
1358c2ecf20Sopenharmony_ci	0x00000210, /* DB_SHADER_CONTROL */
1368c2ecf20Sopenharmony_ci	0x00010000, /* PA_CL_CLIP_CNTL */
1378c2ecf20Sopenharmony_ci	0x00000004, /* PA_SU_SC_MODE_CNTL */
1388c2ecf20Sopenharmony_ci	0x00000100, /* PA_CL_VTE_CNTL */
1398c2ecf20Sopenharmony_ci	0x00000000, /* PA_CL_VS_OUT_CNTL */
1408c2ecf20Sopenharmony_ci	0x00000000, /* PA_CL_NANINF_CNTL */
1418c2ecf20Sopenharmony_ci	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
1428c2ecf20Sopenharmony_ci	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
1438c2ecf20Sopenharmony_ci	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci	0xc0116900,
1468c2ecf20Sopenharmony_ci	0x00000280,
1478c2ecf20Sopenharmony_ci	0x00000000, /* PA_SU_POINT_SIZE */
1488c2ecf20Sopenharmony_ci	0x00000000, /* PA_SU_POINT_MINMAX */
1498c2ecf20Sopenharmony_ci	0x00000008, /* PA_SU_LINE_CNTL */
1508c2ecf20Sopenharmony_ci	0x00000000, /* PA_SC_LINE_STIPPLE */
1518c2ecf20Sopenharmony_ci	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
1528c2ecf20Sopenharmony_ci	0x00000000, /* VGT_HOS_CNTL */
1538c2ecf20Sopenharmony_ci	0x00000000,
1548c2ecf20Sopenharmony_ci	0x00000000,
1558c2ecf20Sopenharmony_ci	0x00000000,
1568c2ecf20Sopenharmony_ci	0x00000000,
1578c2ecf20Sopenharmony_ci	0x00000000,
1588c2ecf20Sopenharmony_ci	0x00000000,
1598c2ecf20Sopenharmony_ci	0x00000000,
1608c2ecf20Sopenharmony_ci	0x00000000,
1618c2ecf20Sopenharmony_ci	0x00000000,
1628c2ecf20Sopenharmony_ci	0x00000000,
1638c2ecf20Sopenharmony_ci	0x00000000, /* VGT_GS_MODE */
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci	0xc0026900,
1668c2ecf20Sopenharmony_ci	0x00000292,
1678c2ecf20Sopenharmony_ci	0x00000000, /* PA_SC_MODE_CNTL_0 */
1688c2ecf20Sopenharmony_ci	0x00000000, /* PA_SC_MODE_CNTL_1 */
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci	0xc0016900,
1718c2ecf20Sopenharmony_ci	0x000002a1,
1728c2ecf20Sopenharmony_ci	0x00000000, /* VGT_PRIMITIVEID_EN */
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci	0xc0016900,
1758c2ecf20Sopenharmony_ci	0x000002a5,
1768c2ecf20Sopenharmony_ci	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci	0xc0026900,
1798c2ecf20Sopenharmony_ci	0x000002a8,
1808c2ecf20Sopenharmony_ci	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
1818c2ecf20Sopenharmony_ci	0x00000000,
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci	0xc0026900,
1848c2ecf20Sopenharmony_ci	0x000002ad,
1858c2ecf20Sopenharmony_ci	0x00000000, /* VGT_REUSE_OFF */
1868c2ecf20Sopenharmony_ci	0x00000000,
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci	0xc0016900,
1898c2ecf20Sopenharmony_ci	0x000002d5,
1908c2ecf20Sopenharmony_ci	0x00000000, /* VGT_SHADER_STAGES_EN */
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci	0xc0016900,
1938c2ecf20Sopenharmony_ci	0x000002dc,
1948c2ecf20Sopenharmony_ci	0x0000aa00, /* DB_ALPHA_TO_MASK */
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci	0xc0066900,
1978c2ecf20Sopenharmony_ci	0x000002de,
1988c2ecf20Sopenharmony_ci	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
1998c2ecf20Sopenharmony_ci	0x00000000,
2008c2ecf20Sopenharmony_ci	0x00000000,
2018c2ecf20Sopenharmony_ci	0x00000000,
2028c2ecf20Sopenharmony_ci	0x00000000,
2038c2ecf20Sopenharmony_ci	0x00000000,
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci	0xc0026900,
2068c2ecf20Sopenharmony_ci	0x000002e5,
2078c2ecf20Sopenharmony_ci	0x00000000, /* VGT_STRMOUT_CONFIG */
2088c2ecf20Sopenharmony_ci	0x00000000,
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci	0xc01b6900,
2118c2ecf20Sopenharmony_ci	0x000002f5,
2128c2ecf20Sopenharmony_ci	0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
2138c2ecf20Sopenharmony_ci	0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
2148c2ecf20Sopenharmony_ci	0x00000000, /* PA_SC_LINE_CNTL */
2158c2ecf20Sopenharmony_ci	0x00000000, /* PA_SC_AA_CONFIG */
2168c2ecf20Sopenharmony_ci	0x00000005, /* PA_SU_VTX_CNTL */
2178c2ecf20Sopenharmony_ci	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
2188c2ecf20Sopenharmony_ci	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
2198c2ecf20Sopenharmony_ci	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
2208c2ecf20Sopenharmony_ci	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
2218c2ecf20Sopenharmony_ci	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
2228c2ecf20Sopenharmony_ci	0x00000000,
2238c2ecf20Sopenharmony_ci	0x00000000,
2248c2ecf20Sopenharmony_ci	0x00000000,
2258c2ecf20Sopenharmony_ci	0x00000000,
2268c2ecf20Sopenharmony_ci	0x00000000,
2278c2ecf20Sopenharmony_ci	0x00000000,
2288c2ecf20Sopenharmony_ci	0x00000000,
2298c2ecf20Sopenharmony_ci	0x00000000,
2308c2ecf20Sopenharmony_ci	0x00000000,
2318c2ecf20Sopenharmony_ci	0x00000000,
2328c2ecf20Sopenharmony_ci	0x00000000,
2338c2ecf20Sopenharmony_ci	0x00000000,
2348c2ecf20Sopenharmony_ci	0x00000000,
2358c2ecf20Sopenharmony_ci	0x00000000,
2368c2ecf20Sopenharmony_ci	0x00000000,
2378c2ecf20Sopenharmony_ci	0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
2388c2ecf20Sopenharmony_ci	0xffffffff,
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci	0xc0026900,
2418c2ecf20Sopenharmony_ci	0x00000316,
2428c2ecf20Sopenharmony_ci	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
2438c2ecf20Sopenharmony_ci	0x00000010, /*  */
2448c2ecf20Sopenharmony_ci};
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ciconst u32 cik_default_size = ARRAY_SIZE(cik_default_state);
247