drm/gf100-/gr: tidy reg/ctx initval lists, mostly by giving them names
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / nouveau / core / engine / graph / ctxnvc0.h
1 #ifndef __NVKM_GRCTX_NVC0_H__
2 #define __NVKM_GRCTX_NVC0_H__
3
4 #include "nvc0.h"
5
6 struct 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
15 struct 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
51 extern struct nouveau_oclass *nvc0_grctx_oclass;
52 int  nvc0_grctx_generate(struct nvc0_graph_priv *);
53 void nvc0_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *);
54 void nvc0_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *);
55 void nvc0_grctx_generate_unkn(struct nvc0_graph_priv *);
56 void nvc0_grctx_generate_tpcid(struct nvc0_graph_priv *);
57 void nvc0_grctx_generate_r406028(struct nvc0_graph_priv *);
58 void nvc0_grctx_generate_r4060a8(struct nvc0_graph_priv *);
59 void nvc0_grctx_generate_r418bb8(struct nvc0_graph_priv *);
60 void nvc0_grctx_generate_r406800(struct nvc0_graph_priv *);
61
62 extern struct nouveau_oclass *nvc1_grctx_oclass;
63 void nvc1_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *);
64 void nvc1_grctx_generate_unkn(struct nvc0_graph_priv *);
65
66 extern struct nouveau_oclass *nvc4_grctx_oclass;
67 extern struct nouveau_oclass *nvc8_grctx_oclass;
68 extern struct nouveau_oclass *nvd7_grctx_oclass;
69 extern struct nouveau_oclass *nvd9_grctx_oclass;
70
71 extern struct nouveau_oclass *nve4_grctx_oclass;
72 void nve4_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *);
73 void nve4_grctx_generate_unkn(struct nvc0_graph_priv *);
74 void nve4_grctx_generate_r418bb8(struct nvc0_graph_priv *);
75
76 extern struct nouveau_oclass *nvf0_grctx_oclass;
77 extern struct nouveau_oclass *nv108_grctx_oclass;
78
79 /* context init value lists */
80
81 extern const struct nvc0_graph_pack nvc0_grctx_pack_icmd[];
82
83 extern const struct nvc0_graph_pack nvc0_grctx_pack_mthd[];
84 extern const struct nvc0_graph_init nvc0_grctx_init_902d_0[];
85 extern const struct nvc0_graph_init nvc0_grctx_init_9039_0[];
86 extern const struct nvc0_graph_init nvc0_grctx_init_90c0_0[];
87
88 extern const struct nvc0_graph_pack nvc0_grctx_pack_hub[];
89 extern const struct nvc0_graph_init nvc0_grctx_init_main_0[];
90 extern const struct nvc0_graph_init nvc0_grctx_init_fe_0[];
91 extern const struct nvc0_graph_init nvc0_grctx_init_pri_0[];
92 extern const struct nvc0_graph_init nvc0_grctx_init_memfmt_0[];
93 extern const struct nvc0_graph_init nvc0_grctx_init_rstr2d_0[];
94 extern const struct nvc0_graph_init nvc0_grctx_init_scc_0[];
95
96 extern const struct nvc0_graph_pack nvc0_grctx_pack_gpc[];
97
98 extern const struct nvc0_graph_pack nvc0_grctx_pack_zcull[];
99
100 extern const struct nvc0_graph_pack nvc0_grctx_pack_tpc[];
101
102 extern const struct nvc0_graph_init nvc1_grctx_init_9097_0[];
103
104 extern const struct nvc0_graph_init nvc8_grctx_init_9197_0[];
105 extern const struct nvc0_graph_init nvc8_grctx_init_9297_0[];
106
107 extern const struct nvc0_graph_pack nvd9_grctx_pack_icmd[];
108
109 extern const struct nvc0_graph_pack nvd9_grctx_pack_mthd[];
110
111 extern const struct nvc0_graph_init nvd9_grctx_init_fe_0[];
112 extern const struct nvc0_graph_init nvd9_grctx_init_be_0[];
113
114 extern const struct nvc0_graph_init nve4_grctx_init_memfmt_0[];
115 extern const struct nvc0_graph_init nve4_grctx_init_ds_0[];
116 extern const struct nvc0_graph_init nve4_grctx_init_scc_0[];
117
118 extern const struct nvc0_graph_pack nvf0_grctx_pack_mthd[];
119
120 extern const struct nvc0_graph_init nvf0_grctx_init_pri_0[];
121 extern const struct nvc0_graph_init nvf0_grctx_init_cwd_0[];
122
123
124 #endif