]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
drm/nouveau/core/device: remove object include to prevent unnecessary rebuilds
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / nouveau / nvkm / engine / gr / gf100.h
CommitLineData
e3c71eb2
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 */
c85ee6ca
BS
24#ifndef __GF100_GR_H__
25#define __GF100_GR_H__
27f3d6cf
BS
26#define gf100_gr(p) container_of((p), struct gf100_gr, base)
27#include "priv.h"
e3c71eb2 28
27f3d6cf 29#include <core/gpuobj.h>
e3c71eb2 30#include <subdev/ltc.h>
27f3d6cf 31#include <subdev/mmu.h>
89cd6e20 32#include <engine/falcon.h>
e3c71eb2
BS
33
34#define GPC_MAX 32
06d4f26c
BS
35#define TPC_MAX_PER_GPC 8
36#define TPC_MAX (GPC_MAX * TPC_MAX_PER_GPC)
e3c71eb2
BS
37
38#define ROP_BCAST(r) (0x408800 + (r))
39#define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r))
40#define GPC_BCAST(r) (0x418000 + (r))
41#define GPC_UNIT(t, r) (0x500000 + (t) * 0x8000 + (r))
42#define PPC_UNIT(t, m, r) (0x503000 + (t) * 0x8000 + (m) * 0x200 + (r))
43#define TPC_UNIT(t, m, r) (0x504000 + (t) * 0x8000 + (m) * 0x800 + (r))
44
45struct gf100_gr_data {
46 u32 size;
47 u32 align;
48 u32 access;
49};
50
51struct gf100_gr_mmio {
52 u32 addr;
53 u32 data;
54 u32 shift;
55 int buffer;
56};
57
58struct gf100_gr_fuc {
59 u32 *data;
60 u32 size;
61};
62
63struct gf100_gr_zbc_color {
64 u32 format;
65 u32 ds[4];
66 u32 l2[4];
67};
68
69struct gf100_gr_zbc_depth {
70 u32 format;
71 u32 ds;
72 u32 l2;
73};
74
bfee3f3d 75struct gf100_gr {
27f3d6cf 76 const struct gf100_gr_func *func;
c85ee6ca 77 struct nvkm_gr base;
e3c71eb2 78
89cd6e20
AC
79 struct nvkm_falcon *fecs;
80 struct nvkm_falcon *gpccs;
e3c71eb2
BS
81 struct gf100_gr_fuc fuc409c;
82 struct gf100_gr_fuc fuc409d;
83 struct gf100_gr_fuc fuc41ac;
84 struct gf100_gr_fuc fuc41ad;
85 bool firmware;
86
c4d0f8f6
AC
87 /*
88 * Used if the register packs are loaded from NVIDIA fw instead of
336c4652 89 * using hardcoded arrays. To be allocated with vzalloc().
c4d0f8f6
AC
90 */
91 struct gf100_gr_pack *fuc_sw_nonctx;
92 struct gf100_gr_pack *fuc_sw_ctx;
93 struct gf100_gr_pack *fuc_bundle;
94 struct gf100_gr_pack *fuc_method;
95
e3c71eb2
BS
96 struct gf100_gr_zbc_color zbc_color[NVKM_LTC_MAX_ZBC_CNT];
97 struct gf100_gr_zbc_depth zbc_depth[NVKM_LTC_MAX_ZBC_CNT];
98
99 u8 rop_nr;
100 u8 gpc_nr;
101 u8 tpc_nr[GPC_MAX];
102 u8 tpc_total;
103 u8 ppc_nr[GPC_MAX];
2fb2b3c6 104 u8 ppc_mask[GPC_MAX];
e3c71eb2
BS
105 u8 ppc_tpc_nr[GPC_MAX][4];
106
e3c71eb2
BS
107 struct gf100_gr_data mmio_data[4];
108 struct gf100_gr_mmio mmio_list[4096/8];
109 u32 size;
110 u32 *data;
111
5ec3def7 112 u8 screen_tile_row_offset;
e3c71eb2
BS
113};
114
c85ee6ca
BS
115int gf100_gr_ctor(const struct gf100_gr_func *, struct nvkm_device *,
116 int, struct gf100_gr *);
117int gf100_gr_new_(const struct gf100_gr_func *, struct nvkm_device *,
118 int, struct nvkm_gr **);
119void *gf100_gr_dtor(struct nvkm_gr *);
120
27f3d6cf 121struct gf100_gr_func {
c85ee6ca
BS
122 void (*dtor)(struct gf100_gr *);
123 int (*init)(struct gf100_gr *);
124 void (*init_gpc_mmu)(struct gf100_gr *);
87ac331e 125 void (*init_rop_active_fbps)(struct gf100_gr *);
a00ecf22 126 void (*init_ppc_exceptions)(struct gf100_gr *);
424321be 127 void (*init_swdx_pes_mask)(struct gf100_gr *);
51751f7d 128 void (*init_num_active_ltcs)(struct gf100_gr *);
c85ee6ca
BS
129 void (*set_hww_esr_report_mask)(struct gf100_gr *);
130 const struct gf100_gr_pack *mmio;
131 struct {
132 struct gf100_gr_ucode *ucode;
133 } fecs;
134 struct {
135 struct gf100_gr_ucode *ucode;
136 } gpccs;
64cb5a31 137 int (*rops)(struct gf100_gr *);
c85ee6ca 138 int ppc_nr;
27f3d6cf
BS
139 const struct gf100_grctx_func *grctx;
140 struct nvkm_sclass sclass[];
141};
142
c85ee6ca 143int gf100_gr_init(struct gf100_gr *);
64cb5a31 144int gf100_gr_rops(struct gf100_gr *);
c85ee6ca
BS
145
146int gk104_gr_init(struct gf100_gr *);
87ac331e 147void gk104_gr_init_rop_active_fbps(struct gf100_gr *);
a00ecf22 148void gk104_gr_init_ppc_exceptions(struct gf100_gr *);
c85ee6ca 149
c85ee6ca
BS
150int gk20a_gr_init(struct gf100_gr *);
151
9ec28052 152int gm200_gr_init(struct gf100_gr *);
734a0aa6 153int gm200_gr_rops(struct gf100_gr *);
c85ee6ca 154
424321be
BS
155int gp100_gr_init(struct gf100_gr *);
156void gp100_gr_init_rop_active_fbps(struct gf100_gr *);
157
27f3d6cf 158#define gf100_gr_chan(p) container_of((p), struct gf100_gr_chan, object)
4246b92c 159#include <core/object.h>
27f3d6cf 160
e3c71eb2 161struct gf100_gr_chan {
27f3d6cf
BS
162 struct nvkm_object object;
163 struct gf100_gr *gr;
e3c71eb2 164
227c95d9 165 struct nvkm_memory *mmio;
e3c71eb2
BS
166 struct nvkm_vma mmio_vma;
167 int mmio_nr;
27f3d6cf 168
e3c71eb2 169 struct {
227c95d9 170 struct nvkm_memory *mem;
e3c71eb2
BS
171 struct nvkm_vma vma;
172 } data[4];
173};
174
bfee3f3d 175void gf100_gr_ctxctl_debug(struct gf100_gr *);
e3c71eb2 176
c4d0f8f6 177void gf100_gr_dtor_fw(struct gf100_gr_fuc *);
bfee3f3d 178int gf100_gr_ctor_fw(struct gf100_gr *, const char *,
c4d0f8f6 179 struct gf100_gr_fuc *);
e3c71eb2 180u64 gf100_gr_units(struct nvkm_gr *);
bfee3f3d 181void gf100_gr_zbc_init(struct gf100_gr *);
e3c71eb2 182
27f3d6cf 183extern const struct nvkm_object_func gf100_fermi;
e3c71eb2 184
e3c71eb2
BS
185struct gf100_gr_init {
186 u32 addr;
187 u8 count;
188 u8 pitch;
189 u32 data;
190};
191
192struct gf100_gr_pack {
193 const struct gf100_gr_init *init;
194 u32 type;
195};
196
197#define pack_for_each_init(init, pack, head) \
198 for (pack = head; pack && pack->init; pack++) \
199 for (init = pack->init; init && init->count; init++)
200
201struct gf100_gr_ucode {
202 struct gf100_gr_fuc code;
203 struct gf100_gr_fuc data;
204};
205
206extern struct gf100_gr_ucode gf100_gr_fecs_ucode;
207extern struct gf100_gr_ucode gf100_gr_gpccs_ucode;
208
209extern struct gf100_gr_ucode gk110_gr_fecs_ucode;
210extern struct gf100_gr_ucode gk110_gr_gpccs_ucode;
211
bfee3f3d
BS
212int gf100_gr_wait_idle(struct gf100_gr *);
213void gf100_gr_mmio(struct gf100_gr *, const struct gf100_gr_pack *);
214void gf100_gr_icmd(struct gf100_gr *, const struct gf100_gr_pack *);
215void gf100_gr_mthd(struct gf100_gr *, const struct gf100_gr_pack *);
216int gf100_gr_init_ctxctl(struct gf100_gr *);
e3c71eb2 217
2e404b0d
AC
218/* external bundles loading functions */
219int gk20a_gr_av_to_init(struct gf100_gr *, const char *,
220 struct gf100_gr_pack **);
221int gk20a_gr_aiv_to_init(struct gf100_gr *, const char *,
222 struct gf100_gr_pack **);
223int gk20a_gr_av_to_method(struct gf100_gr *, const char *,
224 struct gf100_gr_pack **);
225
f008d8c7
AC
226int gm200_gr_new_(const struct gf100_gr_func *, struct nvkm_device *, int,
227 struct nvkm_gr **);
228
e3c71eb2
BS
229/* register init value lists */
230
231extern const struct gf100_gr_init gf100_gr_init_main_0[];
232extern const struct gf100_gr_init gf100_gr_init_fe_0[];
233extern const struct gf100_gr_init gf100_gr_init_pri_0[];
234extern const struct gf100_gr_init gf100_gr_init_rstr2d_0[];
235extern const struct gf100_gr_init gf100_gr_init_pd_0[];
236extern const struct gf100_gr_init gf100_gr_init_ds_0[];
237extern const struct gf100_gr_init gf100_gr_init_scc_0[];
238extern const struct gf100_gr_init gf100_gr_init_prop_0[];
239extern const struct gf100_gr_init gf100_gr_init_gpc_unk_0[];
240extern const struct gf100_gr_init gf100_gr_init_setup_0[];
241extern const struct gf100_gr_init gf100_gr_init_crstr_0[];
242extern const struct gf100_gr_init gf100_gr_init_setup_1[];
243extern const struct gf100_gr_init gf100_gr_init_zcull_0[];
244extern const struct gf100_gr_init gf100_gr_init_gpm_0[];
245extern const struct gf100_gr_init gf100_gr_init_gpc_unk_1[];
246extern const struct gf100_gr_init gf100_gr_init_gcc_0[];
247extern const struct gf100_gr_init gf100_gr_init_tpccs_0[];
248extern const struct gf100_gr_init gf100_gr_init_tex_0[];
249extern const struct gf100_gr_init gf100_gr_init_pe_0[];
250extern const struct gf100_gr_init gf100_gr_init_l1c_0[];
251extern const struct gf100_gr_init gf100_gr_init_wwdx_0[];
252extern const struct gf100_gr_init gf100_gr_init_tpccs_1[];
253extern const struct gf100_gr_init gf100_gr_init_mpc_0[];
254extern const struct gf100_gr_init gf100_gr_init_be_0[];
255extern const struct gf100_gr_init gf100_gr_init_fe_1[];
256extern const struct gf100_gr_init gf100_gr_init_pe_1[];
257
258extern const struct gf100_gr_init gf104_gr_init_ds_0[];
259extern const struct gf100_gr_init gf104_gr_init_tex_0[];
260extern const struct gf100_gr_init gf104_gr_init_sm_0[];
261
262extern const struct gf100_gr_init gf108_gr_init_gpc_unk_0[];
263extern const struct gf100_gr_init gf108_gr_init_setup_1[];
264
265extern const struct gf100_gr_init gf119_gr_init_pd_0[];
266extern const struct gf100_gr_init gf119_gr_init_ds_0[];
267extern const struct gf100_gr_init gf119_gr_init_prop_0[];
268extern const struct gf100_gr_init gf119_gr_init_gpm_0[];
269extern const struct gf100_gr_init gf119_gr_init_gpc_unk_1[];
270extern const struct gf100_gr_init gf119_gr_init_tex_0[];
271extern const struct gf100_gr_init gf119_gr_init_sm_0[];
272extern const struct gf100_gr_init gf119_gr_init_fe_1[];
273
274extern const struct gf100_gr_init gf117_gr_init_pes_0[];
275extern const struct gf100_gr_init gf117_gr_init_wwdx_0[];
276extern const struct gf100_gr_init gf117_gr_init_cbm_0[];
277
278extern const struct gf100_gr_init gk104_gr_init_main_0[];
279extern const struct gf100_gr_init gk104_gr_init_tpccs_0[];
280extern const struct gf100_gr_init gk104_gr_init_pe_0[];
281extern const struct gf100_gr_init gk104_gr_init_be_0[];
282extern const struct gf100_gr_pack gk104_gr_pack_mmio[];
283
284extern const struct gf100_gr_init gk110_gr_init_fe_0[];
285extern const struct gf100_gr_init gk110_gr_init_ds_0[];
286extern const struct gf100_gr_init gk110_gr_init_sked_0[];
287extern const struct gf100_gr_init gk110_gr_init_cwd_0[];
288extern const struct gf100_gr_init gk110_gr_init_gpc_unk_1[];
289extern const struct gf100_gr_init gk110_gr_init_tex_0[];
290extern const struct gf100_gr_init gk110_gr_init_sm_0[];
291
292extern const struct gf100_gr_init gk208_gr_init_gpc_unk_0[];
3fed3ea9
BS
293
294extern const struct gf100_gr_init gm107_gr_init_scc_0[];
295extern const struct gf100_gr_init gm107_gr_init_prop_0[];
296extern const struct gf100_gr_init gm107_gr_init_setup_1[];
297extern const struct gf100_gr_init gm107_gr_init_zcull_0[];
298extern const struct gf100_gr_init gm107_gr_init_gpc_unk_1[];
299extern const struct gf100_gr_init gm107_gr_init_tex_0[];
300extern const struct gf100_gr_init gm107_gr_init_l1c_0[];
301extern const struct gf100_gr_init gm107_gr_init_wwdx_0[];
302extern const struct gf100_gr_init gm107_gr_init_cbm_0[];
bfee3f3d 303void gm107_gr_init_bios(struct gf100_gr *);
52fa0866
BS
304
305void gm200_gr_init_gpc_mmu(struct gf100_gr *);
51751f7d
AC
306
307void gp100_gr_init_num_active_ltcs(struct gf100_gr *gr);
308
b2c4ef70 309void gp102_gr_init_swdx_pes_mask(struct gf100_gr *);
e3c71eb2 310#endif