1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef __GF100_GR_H__
25#define __GF100_GR_H__
26#define gf100_gr(p) container_of((p), struct gf100_gr, base)
27#include "priv.h"
28
29#include <core/gpuobj.h>
30#include <subdev/ltc.h>
31#include <subdev/mmu.h>
32
33#define GPC_MAX 32
34#define TPC_MAX (GPC_MAX * 8)
35
36#define ROP_BCAST(r) (0x408800 + (r))
37#define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r))
38#define GPC_BCAST(r) (0x418000 + (r))
39#define GPC_UNIT(t, r) (0x500000 + (t) * 0x8000 + (r))
40#define PPC_UNIT(t, m, r) (0x503000 + (t) * 0x8000 + (m) * 0x200 + (r))
41#define TPC_UNIT(t, m, r) (0x504000 + (t) * 0x8000 + (m) * 0x800 + (r))
42
43struct gf100_gr_data {
44 u32 size;
45 u32 align;
46 u32 access;
47};
48
49struct gf100_gr_mmio {
50 u32 addr;
51 u32 data;
52 u32 shift;
53 int buffer;
54};
55
56struct gf100_gr_fuc {
57 u32 *data;
58 u32 size;
59};
60
61struct gf100_gr_zbc_color {
62 u32 format;
63 u32 ds[4];
64 u32 l2[4];
65};
66
67struct gf100_gr_zbc_depth {
68 u32 format;
69 u32 ds;
70 u32 l2;
71};
72
73struct gf100_gr {
74 const struct gf100_gr_func *func;
75 struct nvkm_gr base;
76
77 struct gf100_gr_fuc fuc409c;
78 struct gf100_gr_fuc fuc409d;
79 struct gf100_gr_fuc fuc41ac;
80 struct gf100_gr_fuc fuc41ad;
81 bool firmware;
82
83
84
85
86
87 struct gf100_gr_pack *fuc_sw_nonctx;
88 struct gf100_gr_pack *fuc_sw_ctx;
89 struct gf100_gr_pack *fuc_bundle;
90 struct gf100_gr_pack *fuc_method;
91
92 struct gf100_gr_zbc_color zbc_color[NVKM_LTC_MAX_ZBC_CNT];
93 struct gf100_gr_zbc_depth zbc_depth[NVKM_LTC_MAX_ZBC_CNT];
94
95 u8 rop_nr;
96 u8 gpc_nr;
97 u8 tpc_nr[GPC_MAX];
98 u8 tpc_total;
99 u8 ppc_nr[GPC_MAX];
100 u8 ppc_tpc_nr[GPC_MAX][4];
101
102 struct nvkm_memory *unk4188b4;
103 struct nvkm_memory *unk4188b8;
104
105 struct gf100_gr_data mmio_data[4];
106 struct gf100_gr_mmio mmio_list[4096/8];
107 u32 size;
108 u32 *data;
109
110 u8 magic_not_rop_nr;
111};
112
113int gf100_gr_ctor(const struct gf100_gr_func *, struct nvkm_device *,
114 int, struct gf100_gr *);
115int gf100_gr_new_(const struct gf100_gr_func *, struct nvkm_device *,
116 int, struct nvkm_gr **);
117void *gf100_gr_dtor(struct nvkm_gr *);
118
119struct gf100_gr_func {
120 void (*dtor)(struct gf100_gr *);
121 int (*init)(struct gf100_gr *);
122 void (*init_gpc_mmu)(struct gf100_gr *);
123 void (*set_hww_esr_report_mask)(struct gf100_gr *);
124 const struct gf100_gr_pack *mmio;
125 struct {
126 struct gf100_gr_ucode *ucode;
127 } fecs;
128 struct {
129 struct gf100_gr_ucode *ucode;
130 } gpccs;
131 int ppc_nr;
132 const struct gf100_grctx_func *grctx;
133 struct nvkm_sclass sclass[];
134};
135
136int gf100_gr_init(struct gf100_gr *);
137
138int gk104_gr_init(struct gf100_gr *);
139
140int gk20a_gr_new_(const struct gf100_gr_func *, struct nvkm_device *,
141 int, struct nvkm_gr **);
142void gk20a_gr_dtor(struct gf100_gr *);
143int gk20a_gr_init(struct gf100_gr *);
144
145int gm204_gr_init(struct gf100_gr *);
146
147#define gf100_gr_chan(p) container_of((p), struct gf100_gr_chan, object)
148
149struct gf100_gr_chan {
150 struct nvkm_object object;
151 struct gf100_gr *gr;
152
153 struct nvkm_memory *mmio;
154 struct nvkm_vma mmio_vma;
155 int mmio_nr;
156
157 struct {
158 struct nvkm_memory *mem;
159 struct nvkm_vma vma;
160 } data[4];
161};
162
163void gf100_gr_ctxctl_debug(struct gf100_gr *);
164
165void gf100_gr_dtor_fw(struct gf100_gr_fuc *);
166int gf100_gr_ctor_fw(struct gf100_gr *, const char *,
167 struct gf100_gr_fuc *);
168u64 gf100_gr_units(struct nvkm_gr *);
169void gf100_gr_zbc_init(struct gf100_gr *);
170
171extern const struct nvkm_object_func gf100_fermi;
172
173struct gf100_gr_init {
174 u32 addr;
175 u8 count;
176 u8 pitch;
177 u32 data;
178};
179
180struct gf100_gr_pack {
181 const struct gf100_gr_init *init;
182 u32 type;
183};
184
185#define pack_for_each_init(init, pack, head) \
186 for (pack = head; pack && pack->init; pack++) \
187 for (init = pack->init; init && init->count; init++)
188
189struct gf100_gr_ucode {
190 struct gf100_gr_fuc code;
191 struct gf100_gr_fuc data;
192};
193
194extern struct gf100_gr_ucode gf100_gr_fecs_ucode;
195extern struct gf100_gr_ucode gf100_gr_gpccs_ucode;
196
197extern struct gf100_gr_ucode gk110_gr_fecs_ucode;
198extern struct gf100_gr_ucode gk110_gr_gpccs_ucode;
199
200int gf100_gr_wait_idle(struct gf100_gr *);
201void gf100_gr_mmio(struct gf100_gr *, const struct gf100_gr_pack *);
202void gf100_gr_icmd(struct gf100_gr *, const struct gf100_gr_pack *);
203void gf100_gr_mthd(struct gf100_gr *, const struct gf100_gr_pack *);
204int gf100_gr_init_ctxctl(struct gf100_gr *);
205
206
207
208extern const struct gf100_gr_init gf100_gr_init_main_0[];
209extern const struct gf100_gr_init gf100_gr_init_fe_0[];
210extern const struct gf100_gr_init gf100_gr_init_pri_0[];
211extern const struct gf100_gr_init gf100_gr_init_rstr2d_0[];
212extern const struct gf100_gr_init gf100_gr_init_pd_0[];
213extern const struct gf100_gr_init gf100_gr_init_ds_0[];
214extern const struct gf100_gr_init gf100_gr_init_scc_0[];
215extern const struct gf100_gr_init gf100_gr_init_prop_0[];
216extern const struct gf100_gr_init gf100_gr_init_gpc_unk_0[];
217extern const struct gf100_gr_init gf100_gr_init_setup_0[];
218extern const struct gf100_gr_init gf100_gr_init_crstr_0[];
219extern const struct gf100_gr_init gf100_gr_init_setup_1[];
220extern const struct gf100_gr_init gf100_gr_init_zcull_0[];
221extern const struct gf100_gr_init gf100_gr_init_gpm_0[];
222extern const struct gf100_gr_init gf100_gr_init_gpc_unk_1[];
223extern const struct gf100_gr_init gf100_gr_init_gcc_0[];
224extern const struct gf100_gr_init gf100_gr_init_tpccs_0[];
225extern const struct gf100_gr_init gf100_gr_init_tex_0[];
226extern const struct gf100_gr_init gf100_gr_init_pe_0[];
227extern const struct gf100_gr_init gf100_gr_init_l1c_0[];
228extern const struct gf100_gr_init gf100_gr_init_wwdx_0[];
229extern const struct gf100_gr_init gf100_gr_init_tpccs_1[];
230extern const struct gf100_gr_init gf100_gr_init_mpc_0[];
231extern const struct gf100_gr_init gf100_gr_init_be_0[];
232extern const struct gf100_gr_init gf100_gr_init_fe_1[];
233extern const struct gf100_gr_init gf100_gr_init_pe_1[];
234
235extern const struct gf100_gr_init gf104_gr_init_ds_0[];
236extern const struct gf100_gr_init gf104_gr_init_tex_0[];
237extern const struct gf100_gr_init gf104_gr_init_sm_0[];
238
239extern const struct gf100_gr_init gf108_gr_init_gpc_unk_0[];
240extern const struct gf100_gr_init gf108_gr_init_setup_1[];
241
242extern const struct gf100_gr_init gf119_gr_init_pd_0[];
243extern const struct gf100_gr_init gf119_gr_init_ds_0[];
244extern const struct gf100_gr_init gf119_gr_init_prop_0[];
245extern const struct gf100_gr_init gf119_gr_init_gpm_0[];
246extern const struct gf100_gr_init gf119_gr_init_gpc_unk_1[];
247extern const struct gf100_gr_init gf119_gr_init_tex_0[];
248extern const struct gf100_gr_init gf119_gr_init_sm_0[];
249extern const struct gf100_gr_init gf119_gr_init_fe_1[];
250
251extern const struct gf100_gr_init gf117_gr_init_pes_0[];
252extern const struct gf100_gr_init gf117_gr_init_wwdx_0[];
253extern const struct gf100_gr_init gf117_gr_init_cbm_0[];
254
255extern const struct gf100_gr_init gk104_gr_init_main_0[];
256extern const struct gf100_gr_init gk104_gr_init_tpccs_0[];
257extern const struct gf100_gr_init gk104_gr_init_pe_0[];
258extern const struct gf100_gr_init gk104_gr_init_be_0[];
259extern const struct gf100_gr_pack gk104_gr_pack_mmio[];
260
261extern const struct gf100_gr_init gk110_gr_init_fe_0[];
262extern const struct gf100_gr_init gk110_gr_init_ds_0[];
263extern const struct gf100_gr_init gk110_gr_init_sked_0[];
264extern const struct gf100_gr_init gk110_gr_init_cwd_0[];
265extern const struct gf100_gr_init gk110_gr_init_gpc_unk_1[];
266extern const struct gf100_gr_init gk110_gr_init_tex_0[];
267extern const struct gf100_gr_init gk110_gr_init_sm_0[];
268
269extern const struct gf100_gr_init gk208_gr_init_gpc_unk_0[];
270
271extern const struct gf100_gr_init gm107_gr_init_scc_0[];
272extern const struct gf100_gr_init gm107_gr_init_prop_0[];
273extern const struct gf100_gr_init gm107_gr_init_setup_1[];
274extern const struct gf100_gr_init gm107_gr_init_zcull_0[];
275extern const struct gf100_gr_init gm107_gr_init_gpc_unk_1[];
276extern const struct gf100_gr_init gm107_gr_init_tex_0[];
277extern const struct gf100_gr_init gm107_gr_init_l1c_0[];
278extern const struct gf100_gr_init gm107_gr_init_wwdx_0[];
279extern const struct gf100_gr_init gm107_gr_init_cbm_0[];
280void gm107_gr_init_bios(struct gf100_gr *);
281
282extern const struct gf100_gr_pack gm204_gr_pack_mmio[];
283#endif
284