2 * Copyright 2013 Red Hat Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
22 * Authors: Ben Skeggs <bskeggs@redhat.com>
28 /*******************************************************************************
29 * Graphics object classes
30 ******************************************************************************/
32 static struct nouveau_oclass
33 nvf0_graph_sclass[] = {
34 { 0x902d, &nouveau_object_ofuncs },
35 { 0xa140, &nouveau_object_ofuncs },
36 { 0xa197, &nouveau_object_ofuncs },
37 { 0xa1c0, &nouveau_object_ofuncs },
41 /*******************************************************************************
42 * PGRAPH register lists
43 ******************************************************************************/
45 const struct nvc0_graph_init
46 nvf0_graph_init_fe_0[] = {
47 { 0x40415c, 1, 0x04, 0x00000000 },
48 { 0x404170, 1, 0x04, 0x00000000 },
49 { 0x4041b4, 1, 0x04, 0x00000000 },
53 static const struct nvc0_graph_init
54 nvf0_graph_init_ds_0[] = {
55 { 0x405844, 1, 0x04, 0x00ffffff },
56 { 0x405850, 1, 0x04, 0x00000000 },
57 { 0x405900, 1, 0x04, 0x0000ff00 },
58 { 0x405908, 1, 0x04, 0x00000000 },
59 { 0x405928, 2, 0x04, 0x00000000 },
63 const struct nvc0_graph_init
64 nvf0_graph_init_sked_0[] = {
65 { 0x407010, 1, 0x04, 0x00000000 },
66 { 0x407040, 1, 0x04, 0x80440424 },
67 { 0x407048, 1, 0x04, 0x0000000a },
71 const struct nvc0_graph_init
72 nvf0_graph_init_cwd_0[] = {
73 { 0x405b44, 1, 0x04, 0x00000000 },
74 { 0x405b50, 1, 0x04, 0x00000000 },
78 static const struct nvc0_graph_init
79 nvf0_graph_init_gpc_0[] = {
80 { 0x418408, 1, 0x04, 0x00000000 },
81 { 0x4184a0, 3, 0x04, 0x00000000 },
82 { 0x418604, 1, 0x04, 0x00000000 },
83 { 0x418680, 1, 0x04, 0x00000000 },
84 { 0x418714, 1, 0x04, 0x00000000 },
85 { 0x418384, 1, 0x04, 0x00000000 },
86 { 0x418814, 3, 0x04, 0x00000000 },
87 { 0x418b04, 1, 0x04, 0x00000000 },
88 { 0x4188c8, 2, 0x04, 0x00000000 },
89 { 0x4188d0, 1, 0x04, 0x00010000 },
90 { 0x4188d4, 1, 0x04, 0x00000001 },
91 { 0x418910, 1, 0x04, 0x00010001 },
92 { 0x418914, 1, 0x04, 0x00000301 },
93 { 0x418918, 1, 0x04, 0x00800000 },
94 { 0x418980, 1, 0x04, 0x77777770 },
95 { 0x418984, 3, 0x04, 0x77777777 },
96 { 0x418c04, 1, 0x04, 0x00000000 },
97 { 0x418c64, 2, 0x04, 0x00000000 },
98 { 0x418c88, 1, 0x04, 0x00000000 },
99 { 0x418cb4, 2, 0x04, 0x00000000 },
100 { 0x418d00, 1, 0x04, 0x00000000 },
101 { 0x418d28, 2, 0x04, 0x00000000 },
102 { 0x418f00, 1, 0x04, 0x00000400 },
103 { 0x418f08, 1, 0x04, 0x00000000 },
104 { 0x418f20, 2, 0x04, 0x00000000 },
105 { 0x418e00, 1, 0x04, 0x00000000 },
106 { 0x418e08, 1, 0x04, 0x00000000 },
107 { 0x418e1c, 2, 0x04, 0x00000000 },
108 { 0x41900c, 1, 0x04, 0x00000000 },
109 { 0x419018, 1, 0x04, 0x00000000 },
113 static const struct nvc0_graph_init
114 nvf0_graph_init_tpc_0[] = {
115 { 0x419d0c, 1, 0x04, 0x00000000 },
116 { 0x419d10, 1, 0x04, 0x00000014 },
117 { 0x419ab0, 1, 0x04, 0x00000000 },
118 { 0x419ac8, 1, 0x04, 0x00000000 },
119 { 0x419ab8, 1, 0x04, 0x000000e7 },
120 { 0x419aec, 1, 0x04, 0x00000000 },
121 { 0x419abc, 2, 0x04, 0x00000000 },
122 { 0x419ab4, 1, 0x04, 0x00000000 },
123 { 0x419aa8, 2, 0x04, 0x00000000 },
124 { 0x41980c, 1, 0x04, 0x00000010 },
125 { 0x419844, 1, 0x04, 0x00000000 },
126 { 0x419850, 1, 0x04, 0x00000004 },
127 { 0x419854, 2, 0x04, 0x00000000 },
128 { 0x419c98, 1, 0x04, 0x00000000 },
129 { 0x419ca8, 1, 0x04, 0x00000000 },
130 { 0x419cb0, 1, 0x04, 0x01000000 },
131 { 0x419cb4, 1, 0x04, 0x00000000 },
132 { 0x419cb8, 1, 0x04, 0x00b08bea },
133 { 0x419c84, 1, 0x04, 0x00010384 },
134 { 0x419cbc, 1, 0x04, 0x281b3646 },
135 { 0x419cc0, 2, 0x04, 0x00000000 },
136 { 0x419c80, 1, 0x04, 0x00020230 },
137 { 0x419ccc, 2, 0x04, 0x00000000 },
138 { 0x419c0c, 1, 0x04, 0x00000000 },
139 { 0x419e00, 1, 0x04, 0x00000080 },
140 { 0x419ea0, 1, 0x04, 0x00000000 },
141 { 0x419ee4, 1, 0x04, 0x00000000 },
142 { 0x419ea4, 1, 0x04, 0x00000100 },
143 { 0x419ea8, 1, 0x04, 0x00000000 },
144 { 0x419eb4, 1, 0x04, 0x00000000 },
145 { 0x419ebc, 2, 0x04, 0x00000000 },
146 { 0x419edc, 1, 0x04, 0x00000000 },
147 { 0x419f00, 1, 0x04, 0x00000000 },
148 { 0x419ed0, 1, 0x04, 0x00003234 },
149 { 0x419f74, 1, 0x04, 0x00015555 },
150 { 0x419f80, 4, 0x04, 0x00000000 },
154 static const struct nvc0_graph_pack
155 nvf0_graph_pack_mmio[] = {
156 { nve4_graph_init_main_0 },
157 { nvf0_graph_init_fe_0 },
158 { nvc0_graph_init_pri_0 },
159 { nvc0_graph_init_rstr2d_0 },
160 { nvd9_graph_init_pd_0 },
161 { nvf0_graph_init_ds_0 },
162 { nvc0_graph_init_scc_0 },
163 { nvf0_graph_init_sked_0 },
164 { nvf0_graph_init_cwd_0 },
165 { nvf0_graph_init_gpc_0 },
166 { nvf0_graph_init_tpc_0 },
167 { nvd7_graph_init_ppc_0 },
168 { nve4_graph_init_be_0 },
169 { nvc0_graph_init_fe_1 },
173 /*******************************************************************************
174 * PGRAPH engine/subdev functions
175 ******************************************************************************/
178 nvf0_graph_fini(struct nouveau_object *object, bool suspend)
180 struct nvc0_graph_priv *priv = (void *)object;
181 static const struct {
185 { 0x020520, 0xfffffffc },
186 { 0x020524, 0xfffffffe },
187 { 0x020524, 0xfffffffc },
188 { 0x020524, 0xfffffff8 },
189 { 0x020524, 0xffffffe0 },
190 { 0x020530, 0xfffffffe },
191 { 0x02052c, 0xfffffffa },
192 { 0x02052c, 0xfffffff0 },
193 { 0x02052c, 0xffffffc0 },
194 { 0x02052c, 0xffffff00 },
195 { 0x02052c, 0xfffffc00 },
196 { 0x02052c, 0xfffcfc00 },
197 { 0x02052c, 0xfff0fc00 },
198 { 0x02052c, 0xff80fc00 },
199 { 0x020528, 0xfffffffe },
200 { 0x020528, 0xfffffffc },
204 nv_mask(priv, 0x000200, 0x08001000, 0x00000000);
205 nv_mask(priv, 0x0206b4, 0x00000000, 0x00000000);
206 for (i = 0; i < ARRAY_SIZE(magic); i++) {
207 nv_wr32(priv, magic[i].addr, magic[i].data);
208 nv_wait(priv, magic[i].addr, 0x80000000, 0x00000000);
211 return nouveau_graph_fini(&priv->base, suspend);
214 #include "fuc/hubnvf0.fuc.h"
216 static struct nvc0_graph_ucode
217 nvf0_graph_fecs_ucode = {
218 .code.data = nvf0_grhub_code,
219 .code.size = sizeof(nvf0_grhub_code),
220 .data.data = nvf0_grhub_data,
221 .data.size = sizeof(nvf0_grhub_data),
224 #include "fuc/gpcnvf0.fuc.h"
226 static struct nvc0_graph_ucode
227 nvf0_graph_gpccs_ucode = {
228 .code.data = nvf0_grgpc_code,
229 .code.size = sizeof(nvf0_grgpc_code),
230 .data.data = nvf0_grgpc_data,
231 .data.size = sizeof(nvf0_grgpc_data),
234 struct nouveau_oclass *
235 nvf0_graph_oclass = &(struct nvc0_graph_oclass) {
236 .base.handle = NV_ENGINE(GR, 0xf0),
237 .base.ofuncs = &(struct nouveau_ofuncs) {
238 .ctor = nvc0_graph_ctor,
239 .dtor = nvc0_graph_dtor,
240 .init = nve4_graph_init,
241 .fini = nvf0_graph_fini,
243 .cclass = &nvf0_grctx_oclass,
244 .sclass = nvf0_graph_sclass,
245 .mmio = nvf0_graph_pack_mmio,
246 .fecs.ucode = &nvf0_graph_fecs_ucode,
247 .gpccs.ucode = &nvf0_graph_gpccs_ucode,