1 /* $NetBSD: nouveau_nvkm_engine_gr_gf119.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_gf119.c,v 1.3 2021/12/18 23:45:36 riastradh Exp $");
28
29 #include "gf100.h"
30 #include "ctxgf100.h"
31
32 #include <nvif/class.h>
33
34 /*******************************************************************************
35 * PGRAPH register lists
36 ******************************************************************************/
37
38 const struct gf100_gr_init
39 gf119_gr_init_pd_0[] = {
40 { 0x406024, 1, 0x04, 0x00000000 },
41 { 0x4064f0, 3, 0x04, 0x00000000 },
42 {}
43 };
44
45 const struct gf100_gr_init
46 gf119_gr_init_ds_0[] = {
47 { 0x405844, 1, 0x04, 0x00ffffff },
48 { 0x405850, 1, 0x04, 0x00000000 },
49 { 0x405900, 1, 0x04, 0x00002834 },
50 { 0x405908, 1, 0x04, 0x00000000 },
51 { 0x405928, 2, 0x04, 0x00000000 },
52 {}
53 };
54
55 const struct gf100_gr_init
56 gf119_gr_init_prop_0[] = {
57 { 0x418408, 1, 0x04, 0x00000000 },
58 { 0x4184a0, 3, 0x04, 0x00000000 },
59 {}
60 };
61
62 const struct gf100_gr_init
63 gf119_gr_init_gpm_0[] = {
64 { 0x418c04, 1, 0x04, 0x00000000 },
65 { 0x418c64, 2, 0x04, 0x00000000 },
66 { 0x418c88, 1, 0x04, 0x00000000 },
67 { 0x418cb4, 2, 0x04, 0x00000000 },
68 {}
69 };
70
71 const struct gf100_gr_init
72 gf119_gr_init_gpc_unk_1[] = {
73 { 0x418d00, 1, 0x04, 0x00000000 },
74 { 0x418d28, 2, 0x04, 0x00000000 },
75 { 0x418f00, 1, 0x04, 0x00000000 },
76 { 0x418f08, 1, 0x04, 0x00000000 },
77 { 0x418f20, 2, 0x04, 0x00000000 },
78 { 0x418e00, 1, 0x04, 0x00000003 },
79 { 0x418e08, 1, 0x04, 0x00000000 },
80 { 0x418e1c, 2, 0x04, 0x00000000 },
81 {}
82 };
83
84 const struct gf100_gr_init
85 gf119_gr_init_tex_0[] = {
86 { 0x419ab0, 1, 0x04, 0x00000000 },
87 { 0x419ac8, 1, 0x04, 0x00000000 },
88 { 0x419ab8, 1, 0x04, 0x000000e7 },
89 { 0x419abc, 2, 0x04, 0x00000000 },
90 { 0x419ab4, 1, 0x04, 0x00000000 },
91 {}
92 };
93
94 static const struct gf100_gr_init
95 gf119_gr_init_pe_0[] = {
96 { 0x41980c, 1, 0x04, 0x00000010 },
97 { 0x419810, 1, 0x04, 0x00000000 },
98 { 0x419814, 1, 0x04, 0x00000004 },
99 { 0x419844, 1, 0x04, 0x00000000 },
100 { 0x41984c, 1, 0x04, 0x0000a918 },
101 { 0x419850, 4, 0x04, 0x00000000 },
102 { 0x419880, 1, 0x04, 0x00000002 },
103 {}
104 };
105
106 static const struct gf100_gr_init
107 gf119_gr_init_wwdx_0[] = {
108 { 0x419bd4, 1, 0x04, 0x00800000 },
109 { 0x419bdc, 1, 0x04, 0x00000000 },
110 { 0x419bf8, 2, 0x04, 0x00000000 },
111 {}
112 };
113
114 static const struct gf100_gr_init
115 gf119_gr_init_tpccs_1[] = {
116 { 0x419d2c, 1, 0x04, 0x00000000 },
117 { 0x419d48, 2, 0x04, 0x00000000 },
118 {}
119 };
120
121 const struct gf100_gr_init
122 gf119_gr_init_sm_0[] = {
123 { 0x419e00, 1, 0x04, 0x00000000 },
124 { 0x419ea0, 1, 0x04, 0x00000000 },
125 { 0x419ea4, 1, 0x04, 0x00000100 },
126 { 0x419ea8, 1, 0x04, 0x02001100 },
127 { 0x419eac, 1, 0x04, 0x11100702 },
128 { 0x419eb0, 1, 0x04, 0x00000003 },
129 { 0x419eb4, 4, 0x04, 0x00000000 },
130 { 0x419ec8, 1, 0x04, 0x0e063818 },
131 { 0x419ecc, 1, 0x04, 0x0e060e06 },
132 { 0x419ed0, 1, 0x04, 0x00003818 },
133 { 0x419ed4, 1, 0x04, 0x011104f1 },
134 { 0x419edc, 1, 0x04, 0x00000000 },
135 { 0x419f00, 1, 0x04, 0x00000000 },
136 { 0x419f2c, 1, 0x04, 0x00000000 },
137 {}
138 };
139
140 const struct gf100_gr_init
141 gf119_gr_init_fe_1[] = {
142 { 0x40402c, 1, 0x04, 0x00000000 },
143 { 0x4040f0, 1, 0x04, 0x00000000 },
144 { 0x404174, 1, 0x04, 0x00000000 },
145 {}
146 };
147
148 static const struct gf100_gr_pack
149 gf119_gr_pack_mmio[] = {
150 { gf100_gr_init_main_0 },
151 { gf100_gr_init_fe_0 },
152 { gf100_gr_init_pri_0 },
153 { gf100_gr_init_rstr2d_0 },
154 { gf119_gr_init_pd_0 },
155 { gf119_gr_init_ds_0 },
156 { gf100_gr_init_scc_0 },
157 { gf119_gr_init_prop_0 },
158 { gf108_gr_init_gpc_unk_0 },
159 { gf100_gr_init_setup_0 },
160 { gf100_gr_init_crstr_0 },
161 { gf108_gr_init_setup_1 },
162 { gf100_gr_init_zcull_0 },
163 { gf119_gr_init_gpm_0 },
164 { gf119_gr_init_gpc_unk_1 },
165 { gf100_gr_init_gcc_0 },
166 { gf100_gr_init_tpccs_0 },
167 { gf119_gr_init_tex_0 },
168 { gf119_gr_init_pe_0 },
169 { gf100_gr_init_l1c_0 },
170 { gf119_gr_init_wwdx_0 },
171 { gf119_gr_init_tpccs_1 },
172 { gf100_gr_init_mpc_0 },
173 { gf119_gr_init_sm_0 },
174 { gf100_gr_init_be_0 },
175 { gf119_gr_init_fe_1 },
176 {}
177 };
178
179 /*******************************************************************************
180 * PGRAPH engine/subdev functions
181 ******************************************************************************/
182
183 static const struct gf100_gr_func
184 gf119_gr = {
185 .oneinit_tiles = gf100_gr_oneinit_tiles,
186 .oneinit_sm_id = gf100_gr_oneinit_sm_id,
187 .init = gf100_gr_init,
188 .init_gpc_mmu = gf100_gr_init_gpc_mmu,
189 .init_vsc_stream_master = gf100_gr_init_vsc_stream_master,
190 .init_zcull = gf100_gr_init_zcull,
191 .init_num_active_ltcs = gf100_gr_init_num_active_ltcs,
192 .init_fecs_exceptions = gf100_gr_init_fecs_exceptions,
193 .init_40601c = gf100_gr_init_40601c,
194 .init_419cc0 = gf100_gr_init_419cc0,
195 .init_419eb4 = gf100_gr_init_419eb4,
196 .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
197 .init_shader_exceptions = gf100_gr_init_shader_exceptions,
198 .init_400054 = gf100_gr_init_400054,
199 .trap_mp = gf100_gr_trap_mp,
200 .mmio = gf119_gr_pack_mmio,
201 .fecs.ucode = &gf100_gr_fecs_ucode,
202 .gpccs.ucode = &gf100_gr_gpccs_ucode,
203 .rops = gf100_gr_rops,
204 .grctx = &gf119_grctx,
205 .zbc = &gf100_gr_zbc,
206 .sclass = {
207 { -1, -1, FERMI_TWOD_A },
208 { -1, -1, FERMI_MEMORY_TO_MEMORY_FORMAT_A },
209 { -1, -1, FERMI_A, &gf100_fermi },
210 { -1, -1, FERMI_B, &gf100_fermi },
211 { -1, -1, FERMI_C, &gf100_fermi },
212 { -1, -1, FERMI_COMPUTE_A },
213 { -1, -1, FERMI_COMPUTE_B },
214 {}
215 }
216 };
217
218 static const struct gf100_gr_fwif
219 gf119_gr_fwif[] = {
220 { -1, gf100_gr_load, &gf119_gr },
221 { -1, gf100_gr_nofw, &gf119_gr },
222 {}
223 };
224
225 int
gf119_gr_new(struct nvkm_device * device,int index,struct nvkm_gr ** pgr)226 gf119_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
227 {
228 return gf100_gr_new_(gf119_gr_fwif, device, index, pgr);
229 }
230