1#ifndef __NVKM_GRCTX_NVC0_H__
2#define __NVKM_GRCTX_NVC0_H__
3
4#include "nvc0.h"
5
6struct nvc0_grctx {
7 struct nvc0_graph_priv *priv;
8 struct nvc0_graph_data *data;
9 struct nvc0_graph_mmio *mmio;
10 int buffer_nr;
11 u64 buffer[4];
12 u64 addr;
13};
14
15struct nvc0_grctx_oclass {
16 struct nouveau_oclass base;
17 /* main context generation function */
18 void (*main)(struct nvc0_graph_priv *, struct nvc0_grctx *);
19 /* context-specific modify-on-first-load list generation function */
20 void (*mods)(struct nvc0_graph_priv *, struct nvc0_grctx *);
21 void (*unkn)(struct nvc0_graph_priv *);
22 /* mmio context data */
23 const struct nvc0_graph_pack *hub;
24 const struct nvc0_graph_pack *gpc;
25 const struct nvc0_graph_pack *zcull;
26 const struct nvc0_graph_pack *tpc;
27 const struct nvc0_graph_pack *ppc;
28 /* indirect context data, generated with icmds/mthds */
29 const struct nvc0_graph_pack *icmd;
30 const struct nvc0_graph_pack *mthd;
31};
32
33#define mmio_data(s,a,p) do { \
34 info->buffer[info->buffer_nr] = round_up(info->addr, (a)); \
35 info->addr = info->buffer[info->buffer_nr++] + (s); \
36 info->data->size = (s); \
37 info->data->align = (a); \
38 info->data->access = (p); \
39 info->data++; \
40} while(0)
41
42#define mmio_list(r,d,s,b) do { \
43 info->mmio->addr = (r); \
44 info->mmio->data = (d); \
45 info->mmio->shift = (s); \
46 info->mmio->buffer = (b); \
47 info->mmio++; \
48 nv_wr32(priv, (r), (d) | ((s) ? (info->buffer[(b)] >> (s)) : 0)); \
49} while(0)
50
51extern struct nouveau_oclass *nvc0_grctx_oclass;
52int nvc0_grctx_generate(struct nvc0_graph_priv *);
53void nvc0_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *);
54void nvc0_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *);
55void nvc0_grctx_generate_unkn(struct nvc0_graph_priv *);
56void nvc0_grctx_generate_tpcid(struct nvc0_graph_priv *);
57void nvc0_grctx_generate_r406028(struct nvc0_graph_priv *);
58void nvc0_grctx_generate_r4060a8(struct nvc0_graph_priv *);
59void nvc0_grctx_generate_r418bb8(struct nvc0_graph_priv *);
60void nvc0_grctx_generate_r406800(struct nvc0_graph_priv *);
61
62extern struct nouveau_oclass *nvc1_grctx_oclass;
63void nvc1_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *);
64void nvc1_grctx_generate_unkn(struct nvc0_graph_priv *);
65
66extern struct nouveau_oclass *nvc4_grctx_oclass;
67extern struct nouveau_oclass *nvc8_grctx_oclass;
68extern struct nouveau_oclass *nvd7_grctx_oclass;
69extern struct nouveau_oclass *nvd9_grctx_oclass;
70
71extern struct nouveau_oclass *nve4_grctx_oclass;
72extern struct nouveau_oclass *gk20a_grctx_oclass;
73void nve4_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *);
74void nve4_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *);
75void nve4_grctx_generate_unkn(struct nvc0_graph_priv *);
76void nve4_grctx_generate_r418bb8(struct nvc0_graph_priv *);
77
78extern struct nouveau_oclass *nvf0_grctx_oclass;
79extern struct nouveau_oclass *nv108_grctx_oclass;
80extern struct nouveau_oclass *gm107_grctx_oclass;
81
82/* context init value lists */
83
84extern const struct nvc0_graph_pack nvc0_grctx_pack_icmd[];
85
86extern const struct nvc0_graph_pack nvc0_grctx_pack_mthd[];
87extern const struct nvc0_graph_init nvc0_grctx_init_902d_0[];
88extern const struct nvc0_graph_init nvc0_grctx_init_9039_0[];
89extern const struct nvc0_graph_init nvc0_grctx_init_90c0_0[];
90
91extern const struct nvc0_graph_pack nvc0_grctx_pack_hub[];
92extern const struct nvc0_graph_init nvc0_grctx_init_main_0[];
93extern const struct nvc0_graph_init nvc0_grctx_init_fe_0[];
94extern const struct nvc0_graph_init nvc0_grctx_init_pri_0[];
95extern const struct nvc0_graph_init nvc0_grctx_init_memfmt_0[];
96extern const struct nvc0_graph_init nvc0_grctx_init_rstr2d_0[];
97extern const struct nvc0_graph_init nvc0_grctx_init_scc_0[];
98
99extern const struct nvc0_graph_pack nvc0_grctx_pack_gpc[];
100extern const struct nvc0_graph_init nvc0_grctx_init_gpc_unk_0[];
101extern const struct nvc0_graph_init nvc0_grctx_init_prop_0[];
102extern const struct nvc0_graph_init nvc0_grctx_init_gpc_unk_1[];
103extern const struct nvc0_graph_init nvc0_grctx_init_zcull_0[];
104extern const struct nvc0_graph_init nvc0_grctx_init_crstr_0[];
105extern const struct nvc0_graph_init nvc0_grctx_init_gpm_0[];
106extern const struct nvc0_graph_init nvc0_grctx_init_gcc_0[];
107
108extern const struct nvc0_graph_pack nvc0_grctx_pack_zcull[];
109
110extern const struct nvc0_graph_pack nvc0_grctx_pack_tpc[];
111extern const struct nvc0_graph_init nvc0_grctx_init_pe_0[];
112extern const struct nvc0_graph_init nvc0_grctx_init_wwdx_0[];
113extern const struct nvc0_graph_init nvc0_grctx_init_mpc_0[];
114extern const struct nvc0_graph_init nvc0_grctx_init_tpccs_0[];
115
116extern const struct nvc0_graph_init nvc4_grctx_init_tex_0[];
117extern const struct nvc0_graph_init nvc4_grctx_init_l1c_0[];
118extern const struct nvc0_graph_init nvc4_grctx_init_sm_0[];
119
120extern const struct nvc0_graph_init nvc1_grctx_init_9097_0[];
121
122extern const struct nvc0_graph_init nvc1_grctx_init_gpm_0[];
123
124extern const struct nvc0_graph_init nvc1_grctx_init_pe_0[];
125extern const struct nvc0_graph_init nvc1_grctx_init_wwdx_0[];
126extern const struct nvc0_graph_init nvc1_grctx_init_tpccs_0[];
127
128extern const struct nvc0_graph_init nvc8_grctx_init_9197_0[];
129extern const struct nvc0_graph_init nvc8_grctx_init_9297_0[];
130
131extern const struct nvc0_graph_pack nvd9_grctx_pack_icmd[];
132
133extern const struct nvc0_graph_pack nvd9_grctx_pack_mthd[];
134
135extern const struct nvc0_graph_init nvd9_grctx_init_fe_0[];
136extern const struct nvc0_graph_init nvd9_grctx_init_be_0[];
137
138extern const struct nvc0_graph_init nvd9_grctx_init_prop_0[];
139extern const struct nvc0_graph_init nvd9_grctx_init_gpc_unk_1[];
140extern const struct nvc0_graph_init nvd9_grctx_init_crstr_0[];
141
142extern const struct nvc0_graph_init nvd9_grctx_init_sm_0[];
143
144extern const struct nvc0_graph_init nvd7_grctx_init_pe_0[];
145
146extern const struct nvc0_graph_init nvd7_grctx_init_wwdx_0[];
147
148extern const struct nvc0_graph_init nve4_grctx_init_memfmt_0[];
149extern const struct nvc0_graph_init nve4_grctx_init_ds_0[];
150extern const struct nvc0_graph_init nve4_grctx_init_scc_0[];
151
152extern const struct nvc0_graph_init nve4_grctx_init_gpm_0[];
153
154extern const struct nvc0_graph_init nve4_grctx_init_pes_0[];
155
156extern const struct nvc0_graph_pack nve4_grctx_pack_hub[];
157extern const struct nvc0_graph_pack nve4_grctx_pack_gpc[];
158extern const struct nvc0_graph_pack nve4_grctx_pack_tpc[];
159extern const struct nvc0_graph_pack nve4_grctx_pack_ppc[];
160extern const struct nvc0_graph_pack nve4_grctx_pack_icmd[];
161extern const struct nvc0_graph_init nve4_grctx_init_a097_0[];
162
163extern const struct nvc0_graph_pack nvf0_grctx_pack_mthd[];
164
165extern const struct nvc0_graph_init nvf0_grctx_init_pri_0[];
166extern const struct nvc0_graph_init nvf0_grctx_init_cwd_0[];
167
168extern const struct nvc0_graph_init nvf0_grctx_init_gpc_unk_2[];
169
170extern const struct nvc0_graph_init nvf0_grctx_init_mpc_0[];
171extern const struct nvc0_graph_init nvf0_grctx_init_l1c_0[];
172
173extern const struct nvc0_graph_init nv108_grctx_init_rstr2d_0[];
174
175extern const struct nvc0_graph_init nv108_grctx_init_prop_0[];
176extern const struct nvc0_graph_init nv108_grctx_init_crstr_0[];
177
178
179#endif
180