]>
Commit | Line | Data |
---|---|---|
b8bf04e1 BS |
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_GR_H__ | |
26 | #define __NVC0_GR_H__ | |
27 | ||
28 | #include <core/client.h> | |
9e79a853 | 29 | #include <core/device.h> |
b8bf04e1 BS |
30 | #include <core/handle.h> |
31 | #include <core/gpuobj.h> | |
32 | #include <core/option.h> | |
33 | ||
34 | #include <nvif/unpack.h> | |
35 | #include <nvif/class.h> | |
36 | ||
37 | #include <subdev/fb.h> | |
38 | #include <subdev/mmu.h> | |
39 | #include <subdev/bar.h> | |
40 | #include <subdev/timer.h> | |
41 | #include <subdev/mc.h> | |
42 | #include <subdev/ltc.h> | |
43 | ||
44 | #include <engine/fifo.h> | |
45 | #include <engine/gr.h> | |
46 | ||
47 | #include "fuc/os.h" | |
48 | ||
49 | #define GPC_MAX 32 | |
50 | #define TPC_MAX (GPC_MAX * 8) | |
51 | ||
52 | #define ROP_BCAST(r) (0x408800 + (r)) | |
53 | #define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r)) | |
54 | #define GPC_BCAST(r) (0x418000 + (r)) | |
55 | #define GPC_UNIT(t, r) (0x500000 + (t) * 0x8000 + (r)) | |
56 | #define PPC_UNIT(t, m, r) (0x503000 + (t) * 0x8000 + (m) * 0x200 + (r)) | |
57 | #define TPC_UNIT(t, m, r) (0x504000 + (t) * 0x8000 + (m) * 0x800 + (r)) | |
58 | ||
59 | struct nvc0_gr_data { | |
60 | u32 size; | |
61 | u32 align; | |
62 | u32 access; | |
63 | }; | |
64 | ||
65 | struct nvc0_gr_mmio { | |
66 | u32 addr; | |
67 | u32 data; | |
68 | u32 shift; | |
69 | int buffer; | |
70 | }; | |
71 | ||
72 | struct nvc0_gr_fuc { | |
73 | u32 *data; | |
74 | u32 size; | |
75 | }; | |
76 | ||
77 | struct nvc0_gr_zbc_color { | |
78 | u32 format; | |
79 | u32 ds[4]; | |
80 | u32 l2[4]; | |
81 | }; | |
82 | ||
83 | struct nvc0_gr_zbc_depth { | |
84 | u32 format; | |
85 | u32 ds; | |
86 | u32 l2; | |
87 | }; | |
88 | ||
89 | struct nvc0_gr_priv { | |
90 | struct nouveau_gr base; | |
91 | ||
92 | struct nvc0_gr_fuc fuc409c; | |
93 | struct nvc0_gr_fuc fuc409d; | |
94 | struct nvc0_gr_fuc fuc41ac; | |
95 | struct nvc0_gr_fuc fuc41ad; | |
96 | bool firmware; | |
97 | ||
2799bba6 BS |
98 | struct nvc0_gr_zbc_color zbc_color[NVKM_LTC_MAX_ZBC_CNT]; |
99 | struct nvc0_gr_zbc_depth zbc_depth[NVKM_LTC_MAX_ZBC_CNT]; | |
b8bf04e1 BS |
100 | |
101 | u8 rop_nr; | |
102 | u8 gpc_nr; | |
103 | u8 tpc_nr[GPC_MAX]; | |
104 | u8 tpc_total; | |
105 | u8 ppc_nr[GPC_MAX]; | |
106 | u8 ppc_tpc_nr[GPC_MAX][4]; | |
107 | ||
108 | struct nouveau_gpuobj *unk4188b4; | |
109 | struct nouveau_gpuobj *unk4188b8; | |
110 | ||
111 | struct nvc0_gr_data mmio_data[4]; | |
112 | struct nvc0_gr_mmio mmio_list[4096/8]; | |
113 | u32 size; | |
114 | u32 *data; | |
115 | ||
116 | u8 magic_not_rop_nr; | |
117 | }; | |
118 | ||
119 | struct nvc0_gr_chan { | |
120 | struct nouveau_gr_chan base; | |
121 | ||
122 | struct nouveau_gpuobj *mmio; | |
123 | struct nouveau_vma mmio_vma; | |
124 | int mmio_nr; | |
125 | struct { | |
126 | struct nouveau_gpuobj *mem; | |
127 | struct nouveau_vma vma; | |
128 | } data[4]; | |
129 | }; | |
130 | ||
131 | int nvc0_gr_context_ctor(struct nouveau_object *, struct nouveau_object *, | |
132 | struct nouveau_oclass *, void *, u32, | |
133 | struct nouveau_object **); | |
134 | void nvc0_gr_context_dtor(struct nouveau_object *); | |
135 | ||
136 | void nvc0_gr_ctxctl_debug(struct nvc0_gr_priv *); | |
137 | ||
138 | u64 nvc0_gr_units(struct nouveau_gr *); | |
139 | int nvc0_gr_ctor(struct nouveau_object *, struct nouveau_object *, | |
140 | struct nouveau_oclass *, void *data, u32 size, | |
141 | struct nouveau_object **); | |
142 | void nvc0_gr_dtor(struct nouveau_object *); | |
143 | int nvc0_gr_init(struct nouveau_object *); | |
144 | void nvc0_gr_zbc_init(struct nvc0_gr_priv *); | |
145 | ||
146 | int nve4_gr_fini(struct nouveau_object *, bool); | |
147 | int nve4_gr_init(struct nouveau_object *); | |
148 | ||
149 | int nvf0_gr_fini(struct nouveau_object *, bool); | |
150 | ||
151 | extern struct nouveau_ofuncs nvc0_fermi_ofuncs; | |
152 | ||
153 | extern struct nouveau_oclass nvc0_gr_sclass[]; | |
154 | extern struct nouveau_omthds nvc0_gr_9097_omthds[]; | |
155 | extern struct nouveau_omthds nvc0_gr_90c0_omthds[]; | |
156 | extern struct nouveau_oclass nvc8_gr_sclass[]; | |
157 | extern struct nouveau_oclass nvf0_gr_sclass[]; | |
158 | ||
159 | struct nvc0_gr_init { | |
160 | u32 addr; | |
161 | u8 count; | |
162 | u8 pitch; | |
163 | u32 data; | |
164 | }; | |
165 | ||
166 | struct nvc0_gr_pack { | |
167 | const struct nvc0_gr_init *init; | |
168 | u32 type; | |
169 | }; | |
170 | ||
171 | #define pack_for_each_init(init, pack, head) \ | |
172 | for (pack = head; pack && pack->init; pack++) \ | |
173 | for (init = pack->init; init && init->count; init++) | |
174 | ||
175 | struct nvc0_gr_ucode { | |
176 | struct nvc0_gr_fuc code; | |
177 | struct nvc0_gr_fuc data; | |
178 | }; | |
179 | ||
180 | extern struct nvc0_gr_ucode nvc0_gr_fecs_ucode; | |
181 | extern struct nvc0_gr_ucode nvc0_gr_gpccs_ucode; | |
182 | ||
183 | extern struct nvc0_gr_ucode nvf0_gr_fecs_ucode; | |
184 | extern struct nvc0_gr_ucode nvf0_gr_gpccs_ucode; | |
185 | ||
186 | struct nvc0_gr_oclass { | |
187 | struct nouveau_oclass base; | |
188 | struct nouveau_oclass **cclass; | |
189 | struct nouveau_oclass *sclass; | |
190 | const struct nvc0_gr_pack *mmio; | |
191 | struct { | |
192 | struct nvc0_gr_ucode *ucode; | |
193 | } fecs; | |
194 | struct { | |
195 | struct nvc0_gr_ucode *ucode; | |
196 | } gpccs; | |
197 | int ppc_nr; | |
198 | }; | |
199 | ||
200 | void nvc0_gr_mmio(struct nvc0_gr_priv *, const struct nvc0_gr_pack *); | |
201 | void nvc0_gr_icmd(struct nvc0_gr_priv *, const struct nvc0_gr_pack *); | |
202 | void nvc0_gr_mthd(struct nvc0_gr_priv *, const struct nvc0_gr_pack *); | |
203 | int nvc0_gr_init_ctxctl(struct nvc0_gr_priv *); | |
204 | ||
205 | /* register init value lists */ | |
206 | ||
207 | extern const struct nvc0_gr_init nvc0_gr_init_main_0[]; | |
208 | extern const struct nvc0_gr_init nvc0_gr_init_fe_0[]; | |
209 | extern const struct nvc0_gr_init nvc0_gr_init_pri_0[]; | |
210 | extern const struct nvc0_gr_init nvc0_gr_init_rstr2d_0[]; | |
211 | extern const struct nvc0_gr_init nvc0_gr_init_pd_0[]; | |
212 | extern const struct nvc0_gr_init nvc0_gr_init_ds_0[]; | |
213 | extern const struct nvc0_gr_init nvc0_gr_init_scc_0[]; | |
214 | extern const struct nvc0_gr_init nvc0_gr_init_prop_0[]; | |
215 | extern const struct nvc0_gr_init nvc0_gr_init_gpc_unk_0[]; | |
216 | extern const struct nvc0_gr_init nvc0_gr_init_setup_0[]; | |
217 | extern const struct nvc0_gr_init nvc0_gr_init_crstr_0[]; | |
218 | extern const struct nvc0_gr_init nvc0_gr_init_setup_1[]; | |
219 | extern const struct nvc0_gr_init nvc0_gr_init_zcull_0[]; | |
220 | extern const struct nvc0_gr_init nvc0_gr_init_gpm_0[]; | |
221 | extern const struct nvc0_gr_init nvc0_gr_init_gpc_unk_1[]; | |
222 | extern const struct nvc0_gr_init nvc0_gr_init_gcc_0[]; | |
223 | extern const struct nvc0_gr_init nvc0_gr_init_tpccs_0[]; | |
224 | extern const struct nvc0_gr_init nvc0_gr_init_tex_0[]; | |
225 | extern const struct nvc0_gr_init nvc0_gr_init_pe_0[]; | |
226 | extern const struct nvc0_gr_init nvc0_gr_init_l1c_0[]; | |
227 | extern const struct nvc0_gr_init nvc0_gr_init_wwdx_0[]; | |
228 | extern const struct nvc0_gr_init nvc0_gr_init_tpccs_1[]; | |
229 | extern const struct nvc0_gr_init nvc0_gr_init_mpc_0[]; | |
230 | extern const struct nvc0_gr_init nvc0_gr_init_be_0[]; | |
231 | extern const struct nvc0_gr_init nvc0_gr_init_fe_1[]; | |
232 | extern const struct nvc0_gr_init nvc0_gr_init_pe_1[]; | |
233 | ||
234 | extern const struct nvc0_gr_init nvc4_gr_init_ds_0[]; | |
235 | extern const struct nvc0_gr_init nvc4_gr_init_tex_0[]; | |
236 | extern const struct nvc0_gr_init nvc4_gr_init_sm_0[]; | |
237 | ||
238 | extern const struct nvc0_gr_init nvc1_gr_init_gpc_unk_0[]; | |
239 | extern const struct nvc0_gr_init nvc1_gr_init_setup_1[]; | |
240 | ||
241 | extern const struct nvc0_gr_init nvd9_gr_init_pd_0[]; | |
242 | extern const struct nvc0_gr_init nvd9_gr_init_ds_0[]; | |
243 | extern const struct nvc0_gr_init nvd9_gr_init_prop_0[]; | |
244 | extern const struct nvc0_gr_init nvd9_gr_init_gpm_0[]; | |
245 | extern const struct nvc0_gr_init nvd9_gr_init_gpc_unk_1[]; | |
246 | extern const struct nvc0_gr_init nvd9_gr_init_tex_0[]; | |
247 | extern const struct nvc0_gr_init nvd9_gr_init_sm_0[]; | |
248 | extern const struct nvc0_gr_init nvd9_gr_init_fe_1[]; | |
249 | ||
250 | extern const struct nvc0_gr_init nvd7_gr_init_pes_0[]; | |
251 | extern const struct nvc0_gr_init nvd7_gr_init_wwdx_0[]; | |
252 | extern const struct nvc0_gr_init nvd7_gr_init_cbm_0[]; | |
253 | ||
254 | extern const struct nvc0_gr_init nve4_gr_init_main_0[]; | |
255 | extern const struct nvc0_gr_init nve4_gr_init_tpccs_0[]; | |
256 | extern const struct nvc0_gr_init nve4_gr_init_pe_0[]; | |
257 | extern const struct nvc0_gr_init nve4_gr_init_be_0[]; | |
258 | extern const struct nvc0_gr_pack nve4_gr_pack_mmio[]; | |
259 | ||
260 | extern const struct nvc0_gr_init nvf0_gr_init_fe_0[]; | |
261 | extern const struct nvc0_gr_init nvf0_gr_init_ds_0[]; | |
262 | extern const struct nvc0_gr_init nvf0_gr_init_sked_0[]; | |
263 | extern const struct nvc0_gr_init nvf0_gr_init_cwd_0[]; | |
264 | extern const struct nvc0_gr_init nvf0_gr_init_gpc_unk_1[]; | |
265 | extern const struct nvc0_gr_init nvf0_gr_init_tex_0[]; | |
266 | extern const struct nvc0_gr_init nvf0_gr_init_sm_0[]; | |
267 | ||
268 | extern const struct nvc0_gr_init nv108_gr_init_gpc_unk_0[]; | |
269 | ||
270 | ||
271 | #endif |