Commit | Line | Data |
---|---|---|
96616b4c 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" |
96616b4c BS |
27 | |
28 | /******************************************************************************* | |
29 | * Graphics object classes | |
30 | ******************************************************************************/ | |
31 | ||
32 | static struct nouveau_oclass | |
33 | nv108_graph_sclass[] = { | |
34 | { 0x902d, &nouveau_object_ofuncs }, | |
35 | { 0xa140, &nouveau_object_ofuncs }, | |
36 | { 0xa197, &nouveau_object_ofuncs }, | |
37 | { 0xa1c0, &nouveau_object_ofuncs }, | |
38 | {} | |
39 | }; | |
40 | ||
41 | /******************************************************************************* | |
c33b1e8c | 42 | * PGRAPH register lists |
96616b4c BS |
43 | ******************************************************************************/ |
44 | ||
c33b1e8c BS |
45 | static const struct nvc0_graph_init |
46 | nv108_graph_init_main_0[] = { | |
96616b4c BS |
47 | { 0x400080, 1, 0x04, 0x003083c2 }, |
48 | { 0x400088, 1, 0x04, 0x0001bfe7 }, | |
49 | { 0x40008c, 1, 0x04, 0x00000000 }, | |
50 | { 0x400090, 1, 0x04, 0x00000030 }, | |
51 | { 0x40013c, 1, 0x04, 0x003901f7 }, | |
52 | { 0x400140, 1, 0x04, 0x00000100 }, | |
53 | { 0x400144, 1, 0x04, 0x00000000 }, | |
54 | { 0x400148, 1, 0x04, 0x00000110 }, | |
55 | { 0x400138, 1, 0x04, 0x00000000 }, | |
56 | { 0x400130, 2, 0x04, 0x00000000 }, | |
57 | { 0x400124, 1, 0x04, 0x00000002 }, | |
58 | {} | |
59 | }; | |
60 | ||
c33b1e8c BS |
61 | static const struct nvc0_graph_init |
62 | nv108_graph_init_ds_0[] = { | |
96616b4c BS |
63 | { 0x405844, 1, 0x04, 0x00ffffff }, |
64 | { 0x405850, 1, 0x04, 0x00000000 }, | |
65 | { 0x405900, 1, 0x04, 0x00000000 }, | |
66 | { 0x405908, 1, 0x04, 0x00000000 }, | |
c33b1e8c | 67 | { 0x405928, 2, 0x04, 0x00000000 }, |
96616b4c BS |
68 | {} |
69 | }; | |
70 | ||
6f1e9b99 | 71 | const struct nvc0_graph_init |
97af71fa | 72 | nv108_graph_init_gpc_unk_0[] = { |
96616b4c BS |
73 | { 0x418604, 1, 0x04, 0x00000000 }, |
74 | { 0x418680, 1, 0x04, 0x00000000 }, | |
75 | { 0x418714, 1, 0x04, 0x00000000 }, | |
76 | { 0x418384, 2, 0x04, 0x00000000 }, | |
97af71fa BS |
77 | {} |
78 | }; | |
79 | ||
80 | static const struct nvc0_graph_init | |
81 | nv108_graph_init_setup_1[] = { | |
96616b4c BS |
82 | { 0x4188c8, 2, 0x04, 0x00000000 }, |
83 | { 0x4188d0, 1, 0x04, 0x00010000 }, | |
84 | { 0x4188d4, 1, 0x04, 0x00000201 }, | |
96616b4c BS |
85 | {} |
86 | }; | |
87 | ||
c33b1e8c | 88 | static const struct nvc0_graph_init |
7e194533 | 89 | nv108_graph_init_tex_0[] = { |
96616b4c BS |
90 | { 0x419ab0, 1, 0x04, 0x00000000 }, |
91 | { 0x419ac8, 1, 0x04, 0x00000000 }, | |
92 | { 0x419ab8, 1, 0x04, 0x000000e7 }, | |
93 | { 0x419abc, 2, 0x04, 0x00000000 }, | |
94 | { 0x419ab4, 1, 0x04, 0x00000000 }, | |
95 | { 0x419aa8, 2, 0x04, 0x00000000 }, | |
7e194533 BS |
96 | {} |
97 | }; | |
98 | ||
99 | static const struct nvc0_graph_init | |
100 | nv108_graph_init_l1c_0[] = { | |
96616b4c BS |
101 | { 0x419c98, 1, 0x04, 0x00000000 }, |
102 | { 0x419ca8, 1, 0x04, 0x00000000 }, | |
103 | { 0x419cb0, 1, 0x04, 0x01000000 }, | |
104 | { 0x419cb4, 1, 0x04, 0x00000000 }, | |
105 | { 0x419cb8, 1, 0x04, 0x00b08bea }, | |
106 | { 0x419c84, 1, 0x04, 0x00010384 }, | |
107 | { 0x419cbc, 1, 0x04, 0x281b3646 }, | |
108 | { 0x419cc0, 2, 0x04, 0x00000000 }, | |
109 | { 0x419c80, 1, 0x04, 0x00000230 }, | |
110 | { 0x419ccc, 2, 0x04, 0x00000000 }, | |
96616b4c BS |
111 | {} |
112 | }; | |
113 | ||
c33b1e8c BS |
114 | static const struct nvc0_graph_pack |
115 | nv108_graph_pack_mmio[] = { | |
116 | { nv108_graph_init_main_0 }, | |
117 | { nvf0_graph_init_fe_0 }, | |
118 | { nvc0_graph_init_pri_0 }, | |
119 | { nvc0_graph_init_rstr2d_0 }, | |
120 | { nvd9_graph_init_pd_0 }, | |
121 | { nv108_graph_init_ds_0 }, | |
122 | { nvc0_graph_init_scc_0 }, | |
123 | { nvf0_graph_init_sked_0 }, | |
124 | { nvf0_graph_init_cwd_0 }, | |
97af71fa BS |
125 | { nvd9_graph_init_prop_0 }, |
126 | { nv108_graph_init_gpc_unk_0 }, | |
127 | { nvc0_graph_init_setup_0 }, | |
128 | { nvc0_graph_init_crstr_0 }, | |
129 | { nv108_graph_init_setup_1 }, | |
130 | { nvc0_graph_init_zcull_0 }, | |
131 | { nvd9_graph_init_gpm_0 }, | |
132 | { nvf0_graph_init_gpc_unk_1 }, | |
133 | { nvc0_graph_init_gcc_0 }, | |
7e194533 BS |
134 | { nve4_graph_init_tpccs_0 }, |
135 | { nv108_graph_init_tex_0 }, | |
136 | { nve4_graph_init_pe_0 }, | |
137 | { nv108_graph_init_l1c_0 }, | |
138 | { nvc0_graph_init_mpc_0 }, | |
139 | { nvf0_graph_init_sm_0 }, | |
88e98d49 BS |
140 | { nvd7_graph_init_pes_0 }, |
141 | { nvd7_graph_init_wwdx_0 }, | |
142 | { nvd7_graph_init_cbm_0 }, | |
c33b1e8c BS |
143 | { nve4_graph_init_be_0 }, |
144 | { nvc0_graph_init_fe_1 }, | |
145 | {} | |
146 | }; | |
147 | ||
148 | /******************************************************************************* | |
149 | * PGRAPH engine/subdev functions | |
150 | ******************************************************************************/ | |
151 | ||
96616b4c BS |
152 | static int |
153 | nv108_graph_fini(struct nouveau_object *object, bool suspend) | |
154 | { | |
155 | struct nvc0_graph_priv *priv = (void *)object; | |
156 | static const struct { | |
157 | u32 addr; | |
158 | u32 data; | |
159 | } magic[] = { | |
160 | { 0x020520, 0xfffffffc }, | |
161 | { 0x020524, 0xfffffffe }, | |
162 | { 0x020524, 0xfffffffc }, | |
163 | { 0x020524, 0xfffffff8 }, | |
164 | { 0x020524, 0xffffffe0 }, | |
165 | { 0x020530, 0xfffffffe }, | |
166 | { 0x02052c, 0xfffffffa }, | |
167 | { 0x02052c, 0xfffffff0 }, | |
168 | { 0x02052c, 0xffffffc0 }, | |
169 | { 0x02052c, 0xffffff00 }, | |
170 | { 0x02052c, 0xfffffc00 }, | |
171 | { 0x02052c, 0xfffcfc00 }, | |
172 | { 0x02052c, 0xfff0fc00 }, | |
173 | { 0x02052c, 0xff80fc00 }, | |
174 | { 0x020528, 0xfffffffe }, | |
175 | { 0x020528, 0xfffffffc }, | |
176 | }; | |
177 | int i; | |
178 | ||
179 | nv_mask(priv, 0x000200, 0x08001000, 0x00000000); | |
180 | nv_mask(priv, 0x0206b4, 0x00000000, 0x00000000); | |
181 | for (i = 0; i < ARRAY_SIZE(magic); i++) { | |
182 | nv_wr32(priv, magic[i].addr, magic[i].data); | |
183 | nv_wait(priv, magic[i].addr, 0x80000000, 0x00000000); | |
184 | } | |
185 | ||
186 | return nouveau_graph_fini(&priv->base, suspend); | |
187 | } | |
188 | ||
96616b4c BS |
189 | #include "fuc/hubnv108.fuc5.h" |
190 | ||
191 | static struct nvc0_graph_ucode | |
192 | nv108_graph_fecs_ucode = { | |
193 | .code.data = nv108_grhub_code, | |
194 | .code.size = sizeof(nv108_grhub_code), | |
195 | .data.data = nv108_grhub_data, | |
196 | .data.size = sizeof(nv108_grhub_data), | |
197 | }; | |
198 | ||
199 | #include "fuc/gpcnv108.fuc5.h" | |
200 | ||
201 | static struct nvc0_graph_ucode | |
202 | nv108_graph_gpccs_ucode = { | |
203 | .code.data = nv108_grgpc_code, | |
204 | .code.size = sizeof(nv108_grgpc_code), | |
205 | .data.data = nv108_grgpc_data, | |
206 | .data.size = sizeof(nv108_grgpc_data), | |
207 | }; | |
208 | ||
209 | struct nouveau_oclass * | |
210 | nv108_graph_oclass = &(struct nvc0_graph_oclass) { | |
211 | .base.handle = NV_ENGINE(GR, 0x08), | |
212 | .base.ofuncs = &(struct nouveau_ofuncs) { | |
213 | .ctor = nvc0_graph_ctor, | |
214 | .dtor = nvc0_graph_dtor, | |
215 | .init = nve4_graph_init, | |
216 | .fini = nv108_graph_fini, | |
217 | }, | |
218 | .cclass = &nv108_grctx_oclass, | |
219 | .sclass = nv108_graph_sclass, | |
c33b1e8c | 220 | .mmio = nv108_graph_pack_mmio, |
aa97cd31 | 221 | .fecs.ucode = &nv108_graph_fecs_ucode, |
96616b4c BS |
222 | .gpccs.ucode = &nv108_graph_gpccs_ucode, |
223 | }.base; |