drm/gk110b/gr: initvals differ from gk110
[deliverable/linux.git] / drivers / gpu / drm / nouveau / core / engine / graph / nvc0.h
1 /*
2 * Copyright 2010 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
23 */
24
25 #ifndef __NVC0_GRAPH_H__
26 #define __NVC0_GRAPH_H__
27
28 #include <core/client.h>
29 #include <core/handle.h>
30 #include <core/gpuobj.h>
31 #include <core/option.h>
32
33 #include <subdev/fb.h>
34 #include <subdev/vm.h>
35 #include <subdev/bar.h>
36 #include <subdev/timer.h>
37
38 #include <engine/fifo.h>
39 #include <engine/graph.h>
40
41 #include "fuc/os.h"
42
43 #define GPC_MAX 32
44 #define TPC_MAX (GPC_MAX * 8)
45
46 #define ROP_BCAST(r) (0x408800 + (r))
47 #define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r))
48 #define GPC_BCAST(r) (0x418000 + (r))
49 #define GPC_UNIT(t, r) (0x500000 + (t) * 0x8000 + (r))
50 #define PPC_UNIT(t, m, r) (0x503000 + (t) * 0x8000 + (m) * 0x200 + (r))
51 #define TPC_UNIT(t, m, r) (0x504000 + (t) * 0x8000 + (m) * 0x800 + (r))
52
53 struct nvc0_graph_data {
54 u32 size;
55 u32 align;
56 u32 access;
57 };
58
59 struct nvc0_graph_mmio {
60 u32 addr;
61 u32 data;
62 u32 shift;
63 u32 buffer;
64 };
65
66 struct nvc0_graph_fuc {
67 u32 *data;
68 u32 size;
69 };
70
71 struct nvc0_graph_priv {
72 struct nouveau_graph base;
73
74 struct nvc0_graph_fuc fuc409c;
75 struct nvc0_graph_fuc fuc409d;
76 struct nvc0_graph_fuc fuc41ac;
77 struct nvc0_graph_fuc fuc41ad;
78 bool firmware;
79
80 u8 rop_nr;
81 u8 gpc_nr;
82 u8 tpc_nr[GPC_MAX];
83 u8 tpc_total;
84
85 struct nouveau_gpuobj *unk4188b4;
86 struct nouveau_gpuobj *unk4188b8;
87
88 struct nvc0_graph_data mmio_data[4];
89 struct nvc0_graph_mmio mmio_list[4096/8];
90 u32 size;
91 u32 *data;
92
93 u8 magic_not_rop_nr;
94 };
95
96 struct nvc0_graph_chan {
97 struct nouveau_graph_chan base;
98
99 struct nouveau_gpuobj *mmio;
100 struct nouveau_vma mmio_vma;
101 int mmio_nr;
102 struct {
103 struct nouveau_gpuobj *mem;
104 struct nouveau_vma vma;
105 } data[4];
106 };
107
108 int nvc0_graph_context_ctor(struct nouveau_object *, struct nouveau_object *,
109 struct nouveau_oclass *, void *, u32,
110 struct nouveau_object **);
111 void nvc0_graph_context_dtor(struct nouveau_object *);
112
113 void nvc0_graph_ctxctl_debug(struct nvc0_graph_priv *);
114
115 u64 nvc0_graph_units(struct nouveau_graph *);
116 int nvc0_graph_ctor(struct nouveau_object *, struct nouveau_object *,
117 struct nouveau_oclass *, void *data, u32 size,
118 struct nouveau_object **);
119 void nvc0_graph_dtor(struct nouveau_object *);
120 int nvc0_graph_init(struct nouveau_object *);
121 int nve4_graph_fini(struct nouveau_object *, bool);
122 int nve4_graph_init(struct nouveau_object *);
123
124 int nvf0_graph_fini(struct nouveau_object *, bool);
125
126 extern struct nouveau_oclass nvc0_graph_sclass[];
127 extern struct nouveau_oclass nvc8_graph_sclass[];
128 extern struct nouveau_oclass nvf0_graph_sclass[];
129
130 struct nvc0_graph_init {
131 u32 addr;
132 u8 count;
133 u8 pitch;
134 u32 data;
135 };
136
137 struct nvc0_graph_pack {
138 const struct nvc0_graph_init *init;
139 u32 type;
140 };
141
142 #define pack_for_each_init(init, pack, head) \
143 for (pack = head; pack && pack->init; pack++) \
144 for (init = pack->init; init && init->count; init++)
145
146 struct nvc0_graph_ucode {
147 struct nvc0_graph_fuc code;
148 struct nvc0_graph_fuc data;
149 };
150
151 extern struct nvc0_graph_ucode nvc0_graph_fecs_ucode;
152 extern struct nvc0_graph_ucode nvc0_graph_gpccs_ucode;
153
154 extern struct nvc0_graph_ucode nvf0_graph_fecs_ucode;
155 extern struct nvc0_graph_ucode nvf0_graph_gpccs_ucode;
156
157 struct nvc0_graph_oclass {
158 struct nouveau_oclass base;
159 struct nouveau_oclass **cclass;
160 struct nouveau_oclass *sclass;
161 const struct nvc0_graph_pack *mmio;
162 struct {
163 struct nvc0_graph_ucode *ucode;
164 } fecs;
165 struct {
166 struct nvc0_graph_ucode *ucode;
167 } gpccs;
168 };
169
170 void nvc0_graph_mmio(struct nvc0_graph_priv *, const struct nvc0_graph_pack *);
171 void nvc0_graph_icmd(struct nvc0_graph_priv *, const struct nvc0_graph_pack *);
172 void nvc0_graph_mthd(struct nvc0_graph_priv *, const struct nvc0_graph_pack *);
173 int nvc0_graph_init_ctxctl(struct nvc0_graph_priv *);
174
175 /* register init value lists */
176
177 extern const struct nvc0_graph_init nvc0_graph_init_main_0[];
178 extern const struct nvc0_graph_init nvc0_graph_init_fe_0[];
179 extern const struct nvc0_graph_init nvc0_graph_init_pri_0[];
180 extern const struct nvc0_graph_init nvc0_graph_init_rstr2d_0[];
181 extern const struct nvc0_graph_init nvc0_graph_init_pd_0[];
182 extern const struct nvc0_graph_init nvc0_graph_init_ds_0[];
183 extern const struct nvc0_graph_init nvc0_graph_init_scc_0[];
184 extern const struct nvc0_graph_init nvc0_graph_init_prop_0[];
185 extern const struct nvc0_graph_init nvc0_graph_init_gpc_unk_0[];
186 extern const struct nvc0_graph_init nvc0_graph_init_setup_0[];
187 extern const struct nvc0_graph_init nvc0_graph_init_crstr_0[];
188 extern const struct nvc0_graph_init nvc0_graph_init_setup_1[];
189 extern const struct nvc0_graph_init nvc0_graph_init_zcull_0[];
190 extern const struct nvc0_graph_init nvc0_graph_init_gpm_0[];
191 extern const struct nvc0_graph_init nvc0_graph_init_gpc_unk_1[];
192 extern const struct nvc0_graph_init nvc0_graph_init_gcc_0[];
193 extern const struct nvc0_graph_init nvc0_graph_init_tpccs_0[];
194 extern const struct nvc0_graph_init nvc0_graph_init_tex_0[];
195 extern const struct nvc0_graph_init nvc0_graph_init_pe_0[];
196 extern const struct nvc0_graph_init nvc0_graph_init_l1c_0[];
197 extern const struct nvc0_graph_init nvc0_graph_init_wwdx_0[];
198 extern const struct nvc0_graph_init nvc0_graph_init_tpccs_1[];
199 extern const struct nvc0_graph_init nvc0_graph_init_mpc_0[];
200 extern const struct nvc0_graph_init nvc0_graph_init_be_0[];
201 extern const struct nvc0_graph_init nvc0_graph_init_fe_1[];
202 extern const struct nvc0_graph_init nvc0_graph_init_pe_1[];
203
204 extern const struct nvc0_graph_init nvc4_graph_init_ds_0[];
205 extern const struct nvc0_graph_init nvc4_graph_init_tex_0[];
206 extern const struct nvc0_graph_init nvc4_graph_init_sm_0[];
207
208 extern const struct nvc0_graph_init nvc1_graph_init_gpc_unk_0[];
209 extern const struct nvc0_graph_init nvc1_graph_init_setup_1[];
210
211 extern const struct nvc0_graph_init nvd9_graph_init_pd_0[];
212 extern const struct nvc0_graph_init nvd9_graph_init_ds_0[];
213 extern const struct nvc0_graph_init nvd9_graph_init_prop_0[];
214 extern const struct nvc0_graph_init nvd9_graph_init_gpm_0[];
215 extern const struct nvc0_graph_init nvd9_graph_init_gpc_unk_1[];
216 extern const struct nvc0_graph_init nvd9_graph_init_tex_0[];
217 extern const struct nvc0_graph_init nvd9_graph_init_sm_0[];
218 extern const struct nvc0_graph_init nvd9_graph_init_fe_1[];
219
220 extern const struct nvc0_graph_init nvd7_graph_init_pes_0[];
221 extern const struct nvc0_graph_init nvd7_graph_init_wwdx_0[];
222 extern const struct nvc0_graph_init nvd7_graph_init_cbm_0[];
223
224 extern const struct nvc0_graph_init nve4_graph_init_main_0[];
225 extern const struct nvc0_graph_init nve4_graph_init_tpccs_0[];
226 extern const struct nvc0_graph_init nve4_graph_init_pe_0[];
227 extern const struct nvc0_graph_init nve4_graph_init_be_0[];
228 extern const struct nvc0_graph_pack nve4_graph_pack_mmio[];
229
230 extern const struct nvc0_graph_init nvf0_graph_init_fe_0[];
231 extern const struct nvc0_graph_init nvf0_graph_init_ds_0[];
232 extern const struct nvc0_graph_init nvf0_graph_init_sked_0[];
233 extern const struct nvc0_graph_init nvf0_graph_init_cwd_0[];
234 extern const struct nvc0_graph_init nvf0_graph_init_gpc_unk_1[];
235 extern const struct nvc0_graph_init nvf0_graph_init_tex_0[];
236 extern const struct nvc0_graph_init nvf0_graph_init_sm_0[];
237
238 extern const struct nvc0_graph_init nv108_graph_init_gpc_unk_0[];
239
240
241 #endif
This page took 0.036093 seconds and 5 git commands to generate.