xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/gr/nouveau_nvkm_engine_gr_ctxgf104.c (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: nouveau_nvkm_engine_gr_ctxgf104.c,v 1.3 2021/12/18 23:45:36 riastradh Exp $	*/
2 
3 /*
4  * Copyright 2013 Red Hat Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * Authors: Ben Skeggs <bskeggs@redhat.com>
25  */
26 #include <sys/cdefs.h>
27 __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_gr_ctxgf104.c,v 1.3 2021/12/18 23:45:36 riastradh Exp $");
28 
29 #include "ctxgf100.h"
30 
31 /*******************************************************************************
32  * PGRAPH context register lists
33  ******************************************************************************/
34 
35 const struct gf100_gr_init
36 gf104_grctx_init_tex_0[] = {
37 	{ 0x419a00,   1, 0x04, 0x000001f0 },
38 	{ 0x419a04,   1, 0x04, 0x00000001 },
39 	{ 0x419a08,   1, 0x04, 0x00000023 },
40 	{ 0x419a0c,   1, 0x04, 0x00020000 },
41 	{ 0x419a10,   1, 0x04, 0x00000000 },
42 	{ 0x419a14,   1, 0x04, 0x00000200 },
43 	{ 0x419a1c,   1, 0x04, 0x00000000 },
44 	{ 0x419a20,   1, 0x04, 0x00000800 },
45 	{ 0x419ac4,   1, 0x04, 0x0007f440 },
46 	{}
47 };
48 
49 const struct gf100_gr_init
50 gf104_grctx_init_l1c_0[] = {
51 	{ 0x419cb0,   1, 0x04, 0x00020048 },
52 	{ 0x419ce8,   1, 0x04, 0x00000000 },
53 	{ 0x419cf4,   1, 0x04, 0x00000183 },
54 	{}
55 };
56 
57 const struct gf100_gr_init
58 gf104_grctx_init_sm_0[] = {
59 	{ 0x419e04,   3, 0x04, 0x00000000 },
60 	{ 0x419e10,   1, 0x04, 0x00000002 },
61 	{ 0x419e44,   1, 0x04, 0x001beff2 },
62 	{ 0x419e48,   1, 0x04, 0x00000000 },
63 	{ 0x419e4c,   1, 0x04, 0x0000000f },
64 	{ 0x419e50,  17, 0x04, 0x00000000 },
65 	{ 0x419e98,   1, 0x04, 0x00000000 },
66 	{ 0x419ee0,   1, 0x04, 0x00011110 },
67 	{ 0x419f30,  11, 0x04, 0x00000000 },
68 	{}
69 };
70 
71 static const struct gf100_gr_pack
72 gf104_grctx_pack_tpc[] = {
73 	{ gf100_grctx_init_pe_0 },
74 	{ gf104_grctx_init_tex_0 },
75 	{ gf100_grctx_init_wwdx_0 },
76 	{ gf100_grctx_init_mpc_0 },
77 	{ gf104_grctx_init_l1c_0 },
78 	{ gf100_grctx_init_tpccs_0 },
79 	{ gf104_grctx_init_sm_0 },
80 	{}
81 };
82 
83 /*******************************************************************************
84  * PGRAPH context implementation
85  ******************************************************************************/
86 
87 const struct gf100_grctx_func
88 gf104_grctx = {
89 	.main  = gf100_grctx_generate_main,
90 	.unkn  = gf100_grctx_generate_unkn,
91 	.hub   = gf100_grctx_pack_hub,
92 	.gpc_0 = gf100_grctx_pack_gpc_0,
93 	.gpc_1 = gf100_grctx_pack_gpc_1,
94 	.zcull = gf100_grctx_pack_zcull,
95 	.tpc   = gf104_grctx_pack_tpc,
96 	.icmd  = gf100_grctx_pack_icmd,
97 	.mthd  = gf100_grctx_pack_mthd,
98 	.bundle = gf100_grctx_generate_bundle,
99 	.bundle_size = 0x1800,
100 	.pagepool = gf100_grctx_generate_pagepool,
101 	.pagepool_size = 0x8000,
102 	.attrib = gf100_grctx_generate_attrib,
103 	.attrib_nr_max = 0x324,
104 	.attrib_nr = 0x218,
105 	.sm_id = gf100_grctx_generate_sm_id,
106 	.tpc_nr = gf100_grctx_generate_tpc_nr,
107 	.r4060a8 = gf100_grctx_generate_r4060a8,
108 	.rop_mapping = gf100_grctx_generate_rop_mapping,
109 	.alpha_beta_tables = gf100_grctx_generate_alpha_beta_tables,
110 	.max_ways_evict = gf100_grctx_generate_max_ways_evict,
111 	.r419cb8 = gf100_grctx_generate_r419cb8,
112 };
113