2 * Copyright 2010 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.
26 #include <engine/gr.h>
28 #include <subdev/ltc.h>
31 #define TPC_MAX (GPC_MAX * 8)
33 #define ROP_BCAST(r) (0x408800 + (r))
34 #define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r))
35 #define GPC_BCAST(r) (0x418000 + (r))
36 #define GPC_UNIT(t, r) (0x500000 + (t) * 0x8000 + (r))
37 #define PPC_UNIT(t, m, r) (0x503000 + (t) * 0x8000 + (m) * 0x200 + (r))
38 #define TPC_UNIT(t, m, r) (0x504000 + (t) * 0x8000 + (m) * 0x800 + (r))
40 struct gf100_gr_data {
46 struct gf100_gr_mmio {
58 struct gf100_gr_zbc_color {
64 struct gf100_gr_zbc_depth {
70 struct gf100_gr_priv {
73 struct gf100_gr_fuc fuc409c;
74 struct gf100_gr_fuc fuc409d;
75 struct gf100_gr_fuc fuc41ac;
76 struct gf100_gr_fuc fuc41ad;
79 struct gf100_gr_zbc_color zbc_color[NVKM_LTC_MAX_ZBC_CNT];
80 struct gf100_gr_zbc_depth zbc_depth[NVKM_LTC_MAX_ZBC_CNT];
87 u8 ppc_tpc_nr[GPC_MAX][4];
89 struct nvkm_gpuobj *unk4188b4;
90 struct nvkm_gpuobj *unk4188b8;
92 struct gf100_gr_data mmio_data[4];
93 struct gf100_gr_mmio mmio_list[4096/8];
100 struct gf100_gr_chan {
101 struct nvkm_gr_chan base;
103 struct nvkm_gpuobj *mmio;
104 struct nvkm_vma mmio_vma;
107 struct nvkm_gpuobj *mem;
112 int gf100_gr_context_ctor(struct nvkm_object *, struct nvkm_object *,
113 struct nvkm_oclass *, void *, u32,
114 struct nvkm_object **);
115 void gf100_gr_context_dtor(struct nvkm_object *);
117 void gf100_gr_ctxctl_debug(struct gf100_gr_priv *);
119 u64 gf100_gr_units(struct nvkm_gr *);
120 int gf100_gr_ctor(struct nvkm_object *, struct nvkm_object *,
121 struct nvkm_oclass *, void *data, u32 size,
122 struct nvkm_object **);
123 void gf100_gr_dtor(struct nvkm_object *);
124 int gf100_gr_init(struct nvkm_object *);
125 void gf100_gr_zbc_init(struct gf100_gr_priv *);
127 int gk104_gr_ctor(struct nvkm_object *, struct nvkm_object *,
128 struct nvkm_oclass *, void *data, u32 size,
129 struct nvkm_object **);
130 int gk104_gr_init(struct nvkm_object *);
132 int gm204_gr_init(struct nvkm_object *);
134 extern struct nvkm_ofuncs gf100_fermi_ofuncs;
136 extern struct nvkm_oclass gf100_gr_sclass[];
137 extern struct nvkm_omthds gf100_gr_9097_omthds[];
138 extern struct nvkm_omthds gf100_gr_90c0_omthds[];
139 extern struct nvkm_oclass gf110_gr_sclass[];
140 extern struct nvkm_oclass gk110_gr_sclass[];
141 extern struct nvkm_oclass gm204_gr_sclass[];
143 struct gf100_gr_init {
150 struct gf100_gr_pack {
151 const struct gf100_gr_init *init;
155 #define pack_for_each_init(init, pack, head) \
156 for (pack = head; pack && pack->init; pack++) \
157 for (init = pack->init; init && init->count; init++)
159 struct gf100_gr_ucode {
160 struct gf100_gr_fuc code;
161 struct gf100_gr_fuc data;
164 extern struct gf100_gr_ucode gf100_gr_fecs_ucode;
165 extern struct gf100_gr_ucode gf100_gr_gpccs_ucode;
167 extern struct gf100_gr_ucode gk110_gr_fecs_ucode;
168 extern struct gf100_gr_ucode gk110_gr_gpccs_ucode;
170 struct gf100_gr_oclass {
171 struct nvkm_oclass base;
172 struct nvkm_oclass **cclass;
173 struct nvkm_oclass *sclass;
174 const struct gf100_gr_pack *mmio;
176 struct gf100_gr_ucode *ucode;
179 struct gf100_gr_ucode *ucode;
184 int gf100_gr_wait_idle(struct gf100_gr_priv *);
185 void gf100_gr_mmio(struct gf100_gr_priv *, const struct gf100_gr_pack *);
186 void gf100_gr_icmd(struct gf100_gr_priv *, const struct gf100_gr_pack *);
187 void gf100_gr_mthd(struct gf100_gr_priv *, const struct gf100_gr_pack *);
188 int gf100_gr_init_ctxctl(struct gf100_gr_priv *);
190 /* register init value lists */
192 extern const struct gf100_gr_init gf100_gr_init_main_0[];
193 extern const struct gf100_gr_init gf100_gr_init_fe_0[];
194 extern const struct gf100_gr_init gf100_gr_init_pri_0[];
195 extern const struct gf100_gr_init gf100_gr_init_rstr2d_0[];
196 extern const struct gf100_gr_init gf100_gr_init_pd_0[];
197 extern const struct gf100_gr_init gf100_gr_init_ds_0[];
198 extern const struct gf100_gr_init gf100_gr_init_scc_0[];
199 extern const struct gf100_gr_init gf100_gr_init_prop_0[];
200 extern const struct gf100_gr_init gf100_gr_init_gpc_unk_0[];
201 extern const struct gf100_gr_init gf100_gr_init_setup_0[];
202 extern const struct gf100_gr_init gf100_gr_init_crstr_0[];
203 extern const struct gf100_gr_init gf100_gr_init_setup_1[];
204 extern const struct gf100_gr_init gf100_gr_init_zcull_0[];
205 extern const struct gf100_gr_init gf100_gr_init_gpm_0[];
206 extern const struct gf100_gr_init gf100_gr_init_gpc_unk_1[];
207 extern const struct gf100_gr_init gf100_gr_init_gcc_0[];
208 extern const struct gf100_gr_init gf100_gr_init_tpccs_0[];
209 extern const struct gf100_gr_init gf100_gr_init_tex_0[];
210 extern const struct gf100_gr_init gf100_gr_init_pe_0[];
211 extern const struct gf100_gr_init gf100_gr_init_l1c_0[];
212 extern const struct gf100_gr_init gf100_gr_init_wwdx_0[];
213 extern const struct gf100_gr_init gf100_gr_init_tpccs_1[];
214 extern const struct gf100_gr_init gf100_gr_init_mpc_0[];
215 extern const struct gf100_gr_init gf100_gr_init_be_0[];
216 extern const struct gf100_gr_init gf100_gr_init_fe_1[];
217 extern const struct gf100_gr_init gf100_gr_init_pe_1[];
219 extern const struct gf100_gr_init gf104_gr_init_ds_0[];
220 extern const struct gf100_gr_init gf104_gr_init_tex_0[];
221 extern const struct gf100_gr_init gf104_gr_init_sm_0[];
223 extern const struct gf100_gr_init gf108_gr_init_gpc_unk_0[];
224 extern const struct gf100_gr_init gf108_gr_init_setup_1[];
226 extern const struct gf100_gr_init gf119_gr_init_pd_0[];
227 extern const struct gf100_gr_init gf119_gr_init_ds_0[];
228 extern const struct gf100_gr_init gf119_gr_init_prop_0[];
229 extern const struct gf100_gr_init gf119_gr_init_gpm_0[];
230 extern const struct gf100_gr_init gf119_gr_init_gpc_unk_1[];
231 extern const struct gf100_gr_init gf119_gr_init_tex_0[];
232 extern const struct gf100_gr_init gf119_gr_init_sm_0[];
233 extern const struct gf100_gr_init gf119_gr_init_fe_1[];
235 extern const struct gf100_gr_init gf117_gr_init_pes_0[];
236 extern const struct gf100_gr_init gf117_gr_init_wwdx_0[];
237 extern const struct gf100_gr_init gf117_gr_init_cbm_0[];
239 extern const struct gf100_gr_init gk104_gr_init_main_0[];
240 extern const struct gf100_gr_init gk104_gr_init_tpccs_0[];
241 extern const struct gf100_gr_init gk104_gr_init_pe_0[];
242 extern const struct gf100_gr_init gk104_gr_init_be_0[];
243 extern const struct gf100_gr_pack gk104_gr_pack_mmio[];
245 extern const struct gf100_gr_init gk110_gr_init_fe_0[];
246 extern const struct gf100_gr_init gk110_gr_init_ds_0[];
247 extern const struct gf100_gr_init gk110_gr_init_sked_0[];
248 extern const struct gf100_gr_init gk110_gr_init_cwd_0[];
249 extern const struct gf100_gr_init gk110_gr_init_gpc_unk_1[];
250 extern const struct gf100_gr_init gk110_gr_init_tex_0[];
251 extern const struct gf100_gr_init gk110_gr_init_sm_0[];
253 extern const struct gf100_gr_init gk208_gr_init_gpc_unk_0[];
255 extern const struct gf100_gr_init gm107_gr_init_scc_0[];
256 extern const struct gf100_gr_init gm107_gr_init_prop_0[];
257 extern const struct gf100_gr_init gm107_gr_init_setup_1[];
258 extern const struct gf100_gr_init gm107_gr_init_zcull_0[];
259 extern const struct gf100_gr_init gm107_gr_init_gpc_unk_1[];
260 extern const struct gf100_gr_init gm107_gr_init_tex_0[];
261 extern const struct gf100_gr_init gm107_gr_init_l1c_0[];
262 extern const struct gf100_gr_init gm107_gr_init_wwdx_0[];
263 extern const struct gf100_gr_init gm107_gr_init_cbm_0[];
264 void gm107_gr_init_bios(struct gf100_gr_priv *);
266 extern const struct gf100_gr_pack gm204_gr_pack_mmio[];