]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/gpu/drm/nouveau/core/engine/graph/nvf0.c
Merge tag 'staging-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[karo-tx-linux.git] / drivers / gpu / drm / nouveau / core / engine / graph / nvf0.c
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"
26
27 /*******************************************************************************
28  * Graphics object classes
29  ******************************************************************************/
30
31 static struct nouveau_oclass
32 nvf0_graph_sclass[] = {
33         { 0x902d, &nouveau_object_ofuncs },
34         { 0xa140, &nouveau_object_ofuncs },
35         { 0xa197, &nouveau_object_ofuncs },
36         { 0xa1c0, &nouveau_object_ofuncs },
37         {}
38 };
39
40 /*******************************************************************************
41  * PGRAPH engine/subdev functions
42  ******************************************************************************/
43
44 struct nvc0_graph_init
45 nvf0_graph_init_unk40xx[] = {
46         { 0x40415c,   1, 0x04, 0x00000000 },
47         { 0x404170,   1, 0x04, 0x00000000 },
48         { 0x4041b4,   1, 0x04, 0x00000000 },
49         {}
50 };
51
52 static struct nvc0_graph_init
53 nvf0_graph_init_unk58xx[] = {
54         { 0x405844,   1, 0x04, 0x00ffffff },
55         { 0x405850,   1, 0x04, 0x00000000 },
56         { 0x405900,   1, 0x04, 0x0000ff00 },
57         { 0x405908,   1, 0x04, 0x00000000 },
58         { 0x405928,   1, 0x04, 0x00000000 },
59         { 0x40592c,   1, 0x04, 0x00000000 },
60         {}
61 };
62
63 struct nvc0_graph_init
64 nvf0_graph_init_unk70xx[] = {
65         { 0x407010,   1, 0x04, 0x00000000 },
66         { 0x407040,   1, 0x04, 0x80440424 },
67         { 0x407048,   1, 0x04, 0x0000000a },
68         {}
69 };
70
71 struct nvc0_graph_init
72 nvf0_graph_init_unk5bxx[] = {
73         { 0x405b44,   1, 0x04, 0x00000000 },
74         { 0x405b50,   1, 0x04, 0x00000000 },
75         {}
76 };
77
78 static struct nvc0_graph_init
79 nvf0_graph_init_gpc[] = {
80         { 0x418408,   1, 0x04, 0x00000000 },
81         { 0x4184a0,   1, 0x04, 0x00000000 },
82         { 0x4184a4,   2, 0x04, 0x00000000 },
83         { 0x418604,   1, 0x04, 0x00000000 },
84         { 0x418680,   1, 0x04, 0x00000000 },
85         { 0x418714,   1, 0x04, 0x00000000 },
86         { 0x418384,   1, 0x04, 0x00000000 },
87         { 0x418814,   3, 0x04, 0x00000000 },
88         { 0x418b04,   1, 0x04, 0x00000000 },
89         { 0x4188c8,   2, 0x04, 0x00000000 },
90         { 0x4188d0,   1, 0x04, 0x00010000 },
91         { 0x4188d4,   1, 0x04, 0x00000001 },
92         { 0x418910,   1, 0x04, 0x00010001 },
93         { 0x418914,   1, 0x04, 0x00000301 },
94         { 0x418918,   1, 0x04, 0x00800000 },
95         { 0x418980,   1, 0x04, 0x77777770 },
96         { 0x418984,   3, 0x04, 0x77777777 },
97         { 0x418c04,   1, 0x04, 0x00000000 },
98         { 0x418c64,   1, 0x04, 0x00000000 },
99         { 0x418c68,   1, 0x04, 0x00000000 },
100         { 0x418c88,   1, 0x04, 0x00000000 },
101         { 0x418cb4,   2, 0x04, 0x00000000 },
102         { 0x418d00,   1, 0x04, 0x00000000 },
103         { 0x418d28,   1, 0x04, 0x00000000 },
104         { 0x418d2c,   1, 0x04, 0x00000000 },
105         { 0x418f00,   1, 0x04, 0x00000400 },
106         { 0x418f08,   1, 0x04, 0x00000000 },
107         { 0x418f20,   1, 0x04, 0x00000000 },
108         { 0x418f24,   1, 0x04, 0x00000000 },
109         { 0x418e00,   1, 0x04, 0x00000000 },
110         { 0x418e08,   1, 0x04, 0x00000000 },
111         { 0x418e1c,   2, 0x04, 0x00000000 },
112         { 0x41900c,   1, 0x04, 0x00000000 },
113         { 0x419018,   1, 0x04, 0x00000000 },
114         {}
115 };
116
117 struct nvc0_graph_init
118 nvf0_graph_init_tpc[] = {
119         { 0x419d0c,   1, 0x04, 0x00000000 },
120         { 0x419d10,   1, 0x04, 0x00000014 },
121         { 0x419ab0,   1, 0x04, 0x00000000 },
122         { 0x419ac8,   1, 0x04, 0x00000000 },
123         { 0x419ab8,   1, 0x04, 0x000000e7 },
124         { 0x419aec,   1, 0x04, 0x00000000 },
125         { 0x419abc,   2, 0x04, 0x00000000 },
126         { 0x419ab4,   1, 0x04, 0x00000000 },
127         { 0x419aa8,   2, 0x04, 0x00000000 },
128         { 0x41980c,   1, 0x04, 0x00000010 },
129         { 0x419844,   1, 0x04, 0x00000000 },
130         { 0x419850,   1, 0x04, 0x00000004 },
131         { 0x419854,   2, 0x04, 0x00000000 },
132         { 0x419c98,   1, 0x04, 0x00000000 },
133         { 0x419ca8,   1, 0x04, 0x00000000 },
134         { 0x419cb0,   1, 0x04, 0x01000000 },
135         { 0x419cb4,   1, 0x04, 0x00000000 },
136         { 0x419cb8,   1, 0x04, 0x00b08bea },
137         { 0x419c84,   1, 0x04, 0x00010384 },
138         { 0x419cbc,   1, 0x04, 0x281b3646 },
139         { 0x419cc0,   2, 0x04, 0x00000000 },
140         { 0x419c80,   1, 0x04, 0x00020230 },
141         { 0x419ccc,   2, 0x04, 0x00000000 },
142         { 0x419c0c,   1, 0x04, 0x00000000 },
143         { 0x419e00,   1, 0x04, 0x00000080 },
144         { 0x419ea0,   1, 0x04, 0x00000000 },
145         { 0x419ee4,   1, 0x04, 0x00000000 },
146         { 0x419ea4,   1, 0x04, 0x00000100 },
147         { 0x419ea8,   1, 0x04, 0x00000000 },
148         { 0x419eb4,   1, 0x04, 0x00000000 },
149         { 0x419ebc,   2, 0x04, 0x00000000 },
150         { 0x419edc,   1, 0x04, 0x00000000 },
151         { 0x419f00,   1, 0x04, 0x00000000 },
152         { 0x419ed0,   1, 0x04, 0x00003234 },
153         { 0x419f74,   1, 0x04, 0x00015555 },
154         { 0x419f80,   4, 0x04, 0x00000000 },
155         {}
156 };
157
158 static int
159 nvf0_graph_fini(struct nouveau_object *object, bool suspend)
160 {
161         struct nvc0_graph_priv *priv = (void *)object;
162         static const struct {
163                 u32 addr;
164                 u32 data;
165         } magic[] = {
166                 { 0x020520, 0xfffffffc },
167                 { 0x020524, 0xfffffffe },
168                 { 0x020524, 0xfffffffc },
169                 { 0x020524, 0xfffffff8 },
170                 { 0x020524, 0xffffffe0 },
171                 { 0x020530, 0xfffffffe },
172                 { 0x02052c, 0xfffffffa },
173                 { 0x02052c, 0xfffffff0 },
174                 { 0x02052c, 0xffffffc0 },
175                 { 0x02052c, 0xffffff00 },
176                 { 0x02052c, 0xfffffc00 },
177                 { 0x02052c, 0xfffcfc00 },
178                 { 0x02052c, 0xfff0fc00 },
179                 { 0x02052c, 0xff80fc00 },
180                 { 0x020528, 0xfffffffe },
181                 { 0x020528, 0xfffffffc },
182         };
183         int i;
184
185         nv_mask(priv, 0x000200, 0x08001000, 0x00000000);
186         nv_mask(priv, 0x0206b4, 0x00000000, 0x00000000);
187         for (i = 0; i < ARRAY_SIZE(magic); i++) {
188                 nv_wr32(priv, magic[i].addr, magic[i].data);
189                 nv_wait(priv, magic[i].addr, 0x80000000, 0x00000000);
190         }
191
192         return nouveau_graph_fini(&priv->base, suspend);
193 }
194
195 static struct nvc0_graph_init *
196 nvf0_graph_init_mmio[] = {
197         nve4_graph_init_regs,
198         nvf0_graph_init_unk40xx,
199         nvc0_graph_init_unk44xx,
200         nvc0_graph_init_unk78xx,
201         nvc0_graph_init_unk60xx,
202         nvd9_graph_init_unk64xx,
203         nvf0_graph_init_unk58xx,
204         nvc0_graph_init_unk80xx,
205         nvf0_graph_init_unk70xx,
206         nvf0_graph_init_unk5bxx,
207         nvf0_graph_init_gpc,
208         nvf0_graph_init_tpc,
209         nve4_graph_init_unk,
210         nve4_graph_init_unk88xx,
211         NULL
212 };
213
214 #include "fuc/hubnvf0.fuc.h"
215
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),
222 };
223
224 #include "fuc/gpcnvf0.fuc.h"
225
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),
232 };
233
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,
242         },
243         .cclass = &nvf0_grctx_oclass,
244         .sclass =  nvf0_graph_sclass,
245         .mmio = nvf0_graph_init_mmio,
246         .fecs.ucode = &nvf0_graph_fecs_ucode,
247         .gpccs.ucode = &nvf0_graph_gpccs_ucode,
248 }.base;