]>
Commit | Line | Data |
---|---|---|
30f4e087 BS |
1 | /* |
2 | * Copyright 2013 Red Hat Inc. | |
3 | * | |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | |
5 | * copy of this software and associated documentation files (the "Software"), | |
6 | * to deal in the Software without restriction, including without limitation | |
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
8 | * and/or sell copies of the Software, and to permit persons to whom the | |
9 | * Software is furnished to do so, subject to the following conditions: | |
10 | * | |
11 | * The above copyright notice and this permission notice shall be included in | |
12 | * all copies or substantial portions of the Software. | |
13 | * | |
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
20 | * OTHER DEALINGS IN THE SOFTWARE. | |
21 | * | |
22 | * Authors: Ben Skeggs <bskeggs@redhat.com> | |
23 | */ | |
24 | ||
25 | #include "nvc0.h" | |
c33b1e8c | 26 | #include "ctxnvc0.h" |
30f4e087 | 27 | |
b054aadf BS |
28 | /******************************************************************************* |
29 | * Graphics object classes | |
30 | ******************************************************************************/ | |
31 | ||
32 | static struct nouveau_oclass | |
33 | nvf0_graph_sclass[] = { | |
9d1c4c51 BS |
34 | { 0x902d, &nouveau_object_ofuncs }, |
35 | { 0xa140, &nouveau_object_ofuncs }, | |
36 | { 0xa197, &nouveau_object_ofuncs }, | |
37 | { 0xa1c0, &nouveau_object_ofuncs }, | |
b054aadf BS |
38 | {} |
39 | }; | |
40 | ||
30f4e087 | 41 | /******************************************************************************* |
c33b1e8c | 42 | * PGRAPH register lists |
30f4e087 BS |
43 | ******************************************************************************/ |
44 | ||
c33b1e8c BS |
45 | const struct nvc0_graph_init |
46 | nvf0_graph_init_fe_0[] = { | |
30f4e087 BS |
47 | { 0x40415c, 1, 0x04, 0x00000000 }, |
48 | { 0x404170, 1, 0x04, 0x00000000 }, | |
49 | { 0x4041b4, 1, 0x04, 0x00000000 }, | |
50 | {} | |
51 | }; | |
52 | ||
c33b1e8c BS |
53 | static const struct nvc0_graph_init |
54 | nvf0_graph_init_ds_0[] = { | |
30f4e087 BS |
55 | { 0x405844, 1, 0x04, 0x00ffffff }, |
56 | { 0x405850, 1, 0x04, 0x00000000 }, | |
57 | { 0x405900, 1, 0x04, 0x0000ff00 }, | |
58 | { 0x405908, 1, 0x04, 0x00000000 }, | |
c33b1e8c | 59 | { 0x405928, 2, 0x04, 0x00000000 }, |
30f4e087 BS |
60 | {} |
61 | }; | |
62 | ||
c33b1e8c BS |
63 | const struct nvc0_graph_init |
64 | nvf0_graph_init_sked_0[] = { | |
30f4e087 BS |
65 | { 0x407010, 1, 0x04, 0x00000000 }, |
66 | { 0x407040, 1, 0x04, 0x80440424 }, | |
67 | { 0x407048, 1, 0x04, 0x0000000a }, | |
68 | {} | |
69 | }; | |
70 | ||
c33b1e8c BS |
71 | const struct nvc0_graph_init |
72 | nvf0_graph_init_cwd_0[] = { | |
30f4e087 BS |
73 | { 0x405b44, 1, 0x04, 0x00000000 }, |
74 | { 0x405b50, 1, 0x04, 0x00000000 }, | |
75 | {} | |
76 | }; | |
77 | ||
97af71fa BS |
78 | const struct nvc0_graph_init |
79 | nvf0_graph_init_gpc_unk_1[] = { | |
30f4e087 | 80 | { 0x418d00, 1, 0x04, 0x00000000 }, |
c33b1e8c | 81 | { 0x418d28, 2, 0x04, 0x00000000 }, |
30f4e087 BS |
82 | { 0x418f00, 1, 0x04, 0x00000400 }, |
83 | { 0x418f08, 1, 0x04, 0x00000000 }, | |
c33b1e8c | 84 | { 0x418f20, 2, 0x04, 0x00000000 }, |
30f4e087 BS |
85 | { 0x418e00, 1, 0x04, 0x00000000 }, |
86 | { 0x418e08, 1, 0x04, 0x00000000 }, | |
87 | { 0x418e1c, 2, 0x04, 0x00000000 }, | |
30f4e087 BS |
88 | {} |
89 | }; | |
90 | ||
c33b1e8c | 91 | static const struct nvc0_graph_init |
7e194533 | 92 | nvf0_graph_init_tex_0[] = { |
30f4e087 BS |
93 | { 0x419ab0, 1, 0x04, 0x00000000 }, |
94 | { 0x419ac8, 1, 0x04, 0x00000000 }, | |
95 | { 0x419ab8, 1, 0x04, 0x000000e7 }, | |
96 | { 0x419aec, 1, 0x04, 0x00000000 }, | |
97 | { 0x419abc, 2, 0x04, 0x00000000 }, | |
98 | { 0x419ab4, 1, 0x04, 0x00000000 }, | |
99 | { 0x419aa8, 2, 0x04, 0x00000000 }, | |
7e194533 BS |
100 | {} |
101 | }; | |
102 | ||
103 | static const struct nvc0_graph_init | |
104 | nvf0_graph_init_l1c_0[] = { | |
30f4e087 BS |
105 | { 0x419c98, 1, 0x04, 0x00000000 }, |
106 | { 0x419ca8, 1, 0x04, 0x00000000 }, | |
107 | { 0x419cb0, 1, 0x04, 0x01000000 }, | |
108 | { 0x419cb4, 1, 0x04, 0x00000000 }, | |
109 | { 0x419cb8, 1, 0x04, 0x00b08bea }, | |
110 | { 0x419c84, 1, 0x04, 0x00010384 }, | |
111 | { 0x419cbc, 1, 0x04, 0x281b3646 }, | |
112 | { 0x419cc0, 2, 0x04, 0x00000000 }, | |
113 | { 0x419c80, 1, 0x04, 0x00020230 }, | |
114 | { 0x419ccc, 2, 0x04, 0x00000000 }, | |
7e194533 BS |
115 | {} |
116 | }; | |
117 | ||
118 | const struct nvc0_graph_init | |
119 | nvf0_graph_init_sm_0[] = { | |
30f4e087 BS |
120 | { 0x419e00, 1, 0x04, 0x00000080 }, |
121 | { 0x419ea0, 1, 0x04, 0x00000000 }, | |
122 | { 0x419ee4, 1, 0x04, 0x00000000 }, | |
123 | { 0x419ea4, 1, 0x04, 0x00000100 }, | |
124 | { 0x419ea8, 1, 0x04, 0x00000000 }, | |
125 | { 0x419eb4, 1, 0x04, 0x00000000 }, | |
126 | { 0x419ebc, 2, 0x04, 0x00000000 }, | |
127 | { 0x419edc, 1, 0x04, 0x00000000 }, | |
128 | { 0x419f00, 1, 0x04, 0x00000000 }, | |
129 | { 0x419ed0, 1, 0x04, 0x00003234 }, | |
130 | { 0x419f74, 1, 0x04, 0x00015555 }, | |
131 | { 0x419f80, 4, 0x04, 0x00000000 }, | |
132 | {} | |
133 | }; | |
134 | ||
c33b1e8c BS |
135 | static const struct nvc0_graph_pack |
136 | nvf0_graph_pack_mmio[] = { | |
137 | { nve4_graph_init_main_0 }, | |
138 | { nvf0_graph_init_fe_0 }, | |
139 | { nvc0_graph_init_pri_0 }, | |
140 | { nvc0_graph_init_rstr2d_0 }, | |
141 | { nvd9_graph_init_pd_0 }, | |
142 | { nvf0_graph_init_ds_0 }, | |
143 | { nvc0_graph_init_scc_0 }, | |
144 | { nvf0_graph_init_sked_0 }, | |
145 | { nvf0_graph_init_cwd_0 }, | |
97af71fa BS |
146 | { nvd9_graph_init_prop_0 }, |
147 | { nvc1_graph_init_gpc_unk_0 }, | |
148 | { nvc0_graph_init_setup_0 }, | |
149 | { nvc0_graph_init_crstr_0 }, | |
150 | { nvc1_graph_init_setup_1 }, | |
151 | { nvc0_graph_init_zcull_0 }, | |
152 | { nvd9_graph_init_gpm_0 }, | |
153 | { nvf0_graph_init_gpc_unk_1 }, | |
154 | { nvc0_graph_init_gcc_0 }, | |
7e194533 BS |
155 | { nve4_graph_init_tpccs_0 }, |
156 | { nvf0_graph_init_tex_0 }, | |
157 | { nve4_graph_init_pe_0 }, | |
158 | { nvf0_graph_init_l1c_0 }, | |
159 | { nvc0_graph_init_mpc_0 }, | |
160 | { nvf0_graph_init_sm_0 }, | |
88e98d49 BS |
161 | { nvd7_graph_init_pes_0 }, |
162 | { nvd7_graph_init_wwdx_0 }, | |
163 | { nvd7_graph_init_cbm_0 }, | |
c33b1e8c BS |
164 | { nve4_graph_init_be_0 }, |
165 | { nvc0_graph_init_fe_1 }, | |
166 | {} | |
167 | }; | |
168 | ||
169 | /******************************************************************************* | |
170 | * PGRAPH engine/subdev functions | |
171 | ******************************************************************************/ | |
172 | ||
b054aadf BS |
173 | static int |
174 | nvf0_graph_fini(struct nouveau_object *object, bool suspend) | |
175 | { | |
176 | struct nvc0_graph_priv *priv = (void *)object; | |
177 | static const struct { | |
178 | u32 addr; | |
179 | u32 data; | |
180 | } magic[] = { | |
181 | { 0x020520, 0xfffffffc }, | |
182 | { 0x020524, 0xfffffffe }, | |
183 | { 0x020524, 0xfffffffc }, | |
184 | { 0x020524, 0xfffffff8 }, | |
185 | { 0x020524, 0xffffffe0 }, | |
186 | { 0x020530, 0xfffffffe }, | |
187 | { 0x02052c, 0xfffffffa }, | |
188 | { 0x02052c, 0xfffffff0 }, | |
189 | { 0x02052c, 0xffffffc0 }, | |
190 | { 0x02052c, 0xffffff00 }, | |
191 | { 0x02052c, 0xfffffc00 }, | |
192 | { 0x02052c, 0xfffcfc00 }, | |
193 | { 0x02052c, 0xfff0fc00 }, | |
194 | { 0x02052c, 0xff80fc00 }, | |
195 | { 0x020528, 0xfffffffe }, | |
196 | { 0x020528, 0xfffffffc }, | |
197 | }; | |
198 | int i; | |
199 | ||
200 | nv_mask(priv, 0x000200, 0x08001000, 0x00000000); | |
201 | nv_mask(priv, 0x0206b4, 0x00000000, 0x00000000); | |
202 | for (i = 0; i < ARRAY_SIZE(magic); i++) { | |
203 | nv_wr32(priv, magic[i].addr, magic[i].data); | |
204 | nv_wait(priv, magic[i].addr, 0x80000000, 0x00000000); | |
205 | } | |
206 | ||
207 | return nouveau_graph_fini(&priv->base, suspend); | |
208 | } | |
209 | ||
8f6fe267 BS |
210 | #include "fuc/hubnvf0.fuc.h" |
211 | ||
212 | static struct nvc0_graph_ucode | |
213 | nvf0_graph_fecs_ucode = { | |
214 | .code.data = nvf0_grhub_code, | |
215 | .code.size = sizeof(nvf0_grhub_code), | |
216 | .data.data = nvf0_grhub_data, | |
217 | .data.size = sizeof(nvf0_grhub_data), | |
218 | }; | |
219 | ||
220 | #include "fuc/gpcnvf0.fuc.h" | |
221 | ||
222 | static struct nvc0_graph_ucode | |
223 | nvf0_graph_gpccs_ucode = { | |
224 | .code.data = nvf0_grgpc_code, | |
225 | .code.size = sizeof(nvf0_grgpc_code), | |
226 | .data.data = nvf0_grgpc_data, | |
227 | .data.size = sizeof(nvf0_grgpc_data), | |
228 | }; | |
229 | ||
30f4e087 BS |
230 | struct nouveau_oclass * |
231 | nvf0_graph_oclass = &(struct nvc0_graph_oclass) { | |
232 | .base.handle = NV_ENGINE(GR, 0xf0), | |
233 | .base.ofuncs = &(struct nouveau_ofuncs) { | |
234 | .ctor = nvc0_graph_ctor, | |
235 | .dtor = nvc0_graph_dtor, | |
236 | .init = nve4_graph_init, | |
b054aadf | 237 | .fini = nvf0_graph_fini, |
30f4e087 BS |
238 | }, |
239 | .cclass = &nvf0_grctx_oclass, | |
b054aadf | 240 | .sclass = nvf0_graph_sclass, |
c33b1e8c | 241 | .mmio = nvf0_graph_pack_mmio, |
f76dd80f | 242 | .fecs.ucode = &nvf0_graph_fecs_ucode, |
8f6fe267 | 243 | .gpccs.ucode = &nvf0_graph_gpccs_ucode, |
30f4e087 | 244 | }.base; |