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