Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 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 | |
Ben Skeggs | 694c6ca | 2014-08-10 04:10:29 +1000 | [diff] [blame] | 15 | int nvc0_grctx_mmio_data(struct nvc0_grctx *, u32 size, u32 align, u32 access); |
| 16 | void nvc0_grctx_mmio_item(struct nvc0_grctx *, u32 addr, u32 data, int s, int); |
| 17 | |
| 18 | #define mmio_data(a,b,c) nvc0_grctx_mmio_data(info, (a), (b), (c)) |
| 19 | #define mmio_list(a,b,c,d) nvc0_grctx_mmio_item(info, (a), (b), (c), (d)) |
| 20 | |
| 21 | #define mmio_vram(a,b,c,d) nvc0_grctx_mmio_data((a), (b), (c), (d)) |
| 22 | #define mmio_refn(a,b,c,d,e) nvc0_grctx_mmio_item((a), (b), (c), (d), (e)) |
| 23 | #define mmio_skip(a,b,c) mmio_refn((a), (b), (c), -1, -1) |
| 24 | #define mmio_wr32(a,b,c) mmio_refn((a), (b), (c), 0, -1) |
| 25 | |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 26 | struct nvc0_grctx_oclass { |
| 27 | struct nouveau_oclass base; |
| 28 | /* main context generation function */ |
| 29 | void (*main)(struct nvc0_graph_priv *, struct nvc0_grctx *); |
| 30 | /* context-specific modify-on-first-load list generation function */ |
| 31 | void (*mods)(struct nvc0_graph_priv *, struct nvc0_grctx *); |
| 32 | void (*unkn)(struct nvc0_graph_priv *); |
| 33 | /* mmio context data */ |
| 34 | const struct nvc0_graph_pack *hub; |
| 35 | const struct nvc0_graph_pack *gpc; |
| 36 | const struct nvc0_graph_pack *zcull; |
| 37 | const struct nvc0_graph_pack *tpc; |
| 38 | const struct nvc0_graph_pack *ppc; |
| 39 | /* indirect context data, generated with icmds/mthds */ |
| 40 | const struct nvc0_graph_pack *icmd; |
| 41 | const struct nvc0_graph_pack *mthd; |
Ben Skeggs | aa2d58c | 2014-08-10 04:10:29 +1000 | [diff] [blame] | 42 | /* bundle circular buffer */ |
| 43 | void (*bundle)(struct nvc0_grctx *); |
| 44 | u32 bundle_size; |
| 45 | u32 bundle_min_gpm_fifo_depth; |
| 46 | u32 bundle_token_limit; |
Ben Skeggs | f331a15 | 2014-08-10 04:10:29 +1000 | [diff] [blame] | 47 | /* pagepool */ |
| 48 | void (*pagepool)(struct nvc0_grctx *); |
| 49 | u32 pagepool_size; |
Ben Skeggs | 67cfbfd | 2014-08-10 04:10:30 +1000 | [diff] [blame^] | 50 | /* attribute(/alpha) circular buffer */ |
| 51 | void (*attrib)(struct nvc0_grctx *); |
| 52 | u32 attrib_nr_max; |
| 53 | u32 attrib_nr; |
| 54 | u32 alpha_nr_max; |
| 55 | u32 alpha_nr; |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 56 | }; |
| 57 | |
Ben Skeggs | aa2d58c | 2014-08-10 04:10:29 +1000 | [diff] [blame] | 58 | static inline const struct nvc0_grctx_oclass * |
| 59 | nvc0_grctx_impl(struct nvc0_graph_priv *priv) |
| 60 | { |
| 61 | return (void *)nv_engine(priv)->cclass; |
| 62 | } |
| 63 | |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 64 | extern struct nouveau_oclass *nvc0_grctx_oclass; |
| 65 | int nvc0_grctx_generate(struct nvc0_graph_priv *); |
| 66 | void nvc0_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *); |
Ben Skeggs | aa2d58c | 2014-08-10 04:10:29 +1000 | [diff] [blame] | 67 | void nvc0_grctx_generate_bundle(struct nvc0_grctx *); |
Ben Skeggs | f331a15 | 2014-08-10 04:10:29 +1000 | [diff] [blame] | 68 | void nvc0_grctx_generate_pagepool(struct nvc0_grctx *); |
Ben Skeggs | 67cfbfd | 2014-08-10 04:10:30 +1000 | [diff] [blame^] | 69 | void nvc0_grctx_generate_attrib(struct nvc0_grctx *); |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 70 | void nvc0_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *); |
| 71 | void nvc0_grctx_generate_unkn(struct nvc0_graph_priv *); |
| 72 | void nvc0_grctx_generate_tpcid(struct nvc0_graph_priv *); |
| 73 | void nvc0_grctx_generate_r406028(struct nvc0_graph_priv *); |
| 74 | void nvc0_grctx_generate_r4060a8(struct nvc0_graph_priv *); |
| 75 | void nvc0_grctx_generate_r418bb8(struct nvc0_graph_priv *); |
| 76 | void nvc0_grctx_generate_r406800(struct nvc0_graph_priv *); |
| 77 | |
| 78 | extern struct nouveau_oclass *nvc1_grctx_oclass; |
Ben Skeggs | 67cfbfd | 2014-08-10 04:10:30 +1000 | [diff] [blame^] | 79 | void nvc1_grctx_generate_attrib(struct nvc0_grctx *); |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 80 | void nvc1_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *); |
| 81 | void nvc1_grctx_generate_unkn(struct nvc0_graph_priv *); |
| 82 | |
| 83 | extern struct nouveau_oclass *nvc4_grctx_oclass; |
| 84 | extern struct nouveau_oclass *nvc8_grctx_oclass; |
Ben Skeggs | 67cfbfd | 2014-08-10 04:10:30 +1000 | [diff] [blame^] | 85 | |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 86 | extern struct nouveau_oclass *nvd7_grctx_oclass; |
Ben Skeggs | 67cfbfd | 2014-08-10 04:10:30 +1000 | [diff] [blame^] | 87 | void nvd7_grctx_generate_attrib(struct nvc0_grctx *); |
| 88 | |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 89 | extern struct nouveau_oclass *nvd9_grctx_oclass; |
| 90 | |
| 91 | extern struct nouveau_oclass *nve4_grctx_oclass; |
Alexandre Courbot | a4d4bbf | 2014-05-02 18:32:41 +0900 | [diff] [blame] | 92 | extern struct nouveau_oclass *gk20a_grctx_oclass; |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 93 | void nve4_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *); |
Ben Skeggs | aa2d58c | 2014-08-10 04:10:29 +1000 | [diff] [blame] | 94 | void nve4_grctx_generate_bundle(struct nvc0_grctx *); |
Ben Skeggs | f331a15 | 2014-08-10 04:10:29 +1000 | [diff] [blame] | 95 | void nve4_grctx_generate_pagepool(struct nvc0_grctx *); |
Alexandre Courbot | a4d4bbf | 2014-05-02 18:32:41 +0900 | [diff] [blame] | 96 | void nve4_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *); |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 97 | void nve4_grctx_generate_unkn(struct nvc0_graph_priv *); |
| 98 | void nve4_grctx_generate_r418bb8(struct nvc0_graph_priv *); |
| 99 | |
| 100 | extern struct nouveau_oclass *nvf0_grctx_oclass; |
Ben Skeggs | 579b7f3 | 2014-06-12 21:22:32 +1000 | [diff] [blame] | 101 | extern struct nouveau_oclass *gk110b_grctx_oclass; |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 102 | extern struct nouveau_oclass *nv108_grctx_oclass; |
Ben Skeggs | 6f1e9b9 | 2014-03-04 11:00:41 +1000 | [diff] [blame] | 103 | extern struct nouveau_oclass *gm107_grctx_oclass; |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 104 | |
| 105 | /* context init value lists */ |
| 106 | |
| 107 | extern const struct nvc0_graph_pack nvc0_grctx_pack_icmd[]; |
| 108 | |
| 109 | extern const struct nvc0_graph_pack nvc0_grctx_pack_mthd[]; |
| 110 | extern const struct nvc0_graph_init nvc0_grctx_init_902d_0[]; |
| 111 | extern const struct nvc0_graph_init nvc0_grctx_init_9039_0[]; |
| 112 | extern const struct nvc0_graph_init nvc0_grctx_init_90c0_0[]; |
| 113 | |
| 114 | extern const struct nvc0_graph_pack nvc0_grctx_pack_hub[]; |
| 115 | extern const struct nvc0_graph_init nvc0_grctx_init_main_0[]; |
| 116 | extern const struct nvc0_graph_init nvc0_grctx_init_fe_0[]; |
| 117 | extern const struct nvc0_graph_init nvc0_grctx_init_pri_0[]; |
| 118 | extern const struct nvc0_graph_init nvc0_grctx_init_memfmt_0[]; |
| 119 | extern const struct nvc0_graph_init nvc0_grctx_init_rstr2d_0[]; |
| 120 | extern const struct nvc0_graph_init nvc0_grctx_init_scc_0[]; |
| 121 | |
| 122 | extern const struct nvc0_graph_pack nvc0_grctx_pack_gpc[]; |
Ben Skeggs | 97af71f | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 123 | extern const struct nvc0_graph_init nvc0_grctx_init_gpc_unk_0[]; |
| 124 | extern const struct nvc0_graph_init nvc0_grctx_init_prop_0[]; |
| 125 | extern const struct nvc0_graph_init nvc0_grctx_init_gpc_unk_1[]; |
| 126 | extern const struct nvc0_graph_init nvc0_grctx_init_zcull_0[]; |
| 127 | extern const struct nvc0_graph_init nvc0_grctx_init_crstr_0[]; |
| 128 | extern const struct nvc0_graph_init nvc0_grctx_init_gpm_0[]; |
| 129 | extern const struct nvc0_graph_init nvc0_grctx_init_gcc_0[]; |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 130 | |
| 131 | extern const struct nvc0_graph_pack nvc0_grctx_pack_zcull[]; |
| 132 | |
| 133 | extern const struct nvc0_graph_pack nvc0_grctx_pack_tpc[]; |
Ben Skeggs | 7e19453 | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 134 | extern const struct nvc0_graph_init nvc0_grctx_init_pe_0[]; |
| 135 | extern const struct nvc0_graph_init nvc0_grctx_init_wwdx_0[]; |
| 136 | extern const struct nvc0_graph_init nvc0_grctx_init_mpc_0[]; |
| 137 | extern const struct nvc0_graph_init nvc0_grctx_init_tpccs_0[]; |
| 138 | |
| 139 | extern const struct nvc0_graph_init nvc4_grctx_init_tex_0[]; |
| 140 | extern const struct nvc0_graph_init nvc4_grctx_init_l1c_0[]; |
| 141 | extern const struct nvc0_graph_init nvc4_grctx_init_sm_0[]; |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 142 | |
| 143 | extern const struct nvc0_graph_init nvc1_grctx_init_9097_0[]; |
| 144 | |
Ben Skeggs | 97af71f | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 145 | extern const struct nvc0_graph_init nvc1_grctx_init_gpm_0[]; |
| 146 | |
Ben Skeggs | 7e19453 | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 147 | extern const struct nvc0_graph_init nvc1_grctx_init_pe_0[]; |
| 148 | extern const struct nvc0_graph_init nvc1_grctx_init_wwdx_0[]; |
| 149 | extern const struct nvc0_graph_init nvc1_grctx_init_tpccs_0[]; |
| 150 | |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 151 | extern const struct nvc0_graph_init nvc8_grctx_init_9197_0[]; |
| 152 | extern const struct nvc0_graph_init nvc8_grctx_init_9297_0[]; |
| 153 | |
| 154 | extern const struct nvc0_graph_pack nvd9_grctx_pack_icmd[]; |
| 155 | |
| 156 | extern const struct nvc0_graph_pack nvd9_grctx_pack_mthd[]; |
| 157 | |
| 158 | extern const struct nvc0_graph_init nvd9_grctx_init_fe_0[]; |
| 159 | extern const struct nvc0_graph_init nvd9_grctx_init_be_0[]; |
| 160 | |
Ben Skeggs | 97af71f | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 161 | extern const struct nvc0_graph_init nvd9_grctx_init_prop_0[]; |
| 162 | extern const struct nvc0_graph_init nvd9_grctx_init_gpc_unk_1[]; |
| 163 | extern const struct nvc0_graph_init nvd9_grctx_init_crstr_0[]; |
| 164 | |
Ben Skeggs | 7e19453 | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 165 | extern const struct nvc0_graph_init nvd9_grctx_init_sm_0[]; |
| 166 | |
| 167 | extern const struct nvc0_graph_init nvd7_grctx_init_pe_0[]; |
| 168 | |
Ben Skeggs | 88e98d4 | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 169 | extern const struct nvc0_graph_init nvd7_grctx_init_wwdx_0[]; |
| 170 | |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 171 | extern const struct nvc0_graph_init nve4_grctx_init_memfmt_0[]; |
| 172 | extern const struct nvc0_graph_init nve4_grctx_init_ds_0[]; |
| 173 | extern const struct nvc0_graph_init nve4_grctx_init_scc_0[]; |
| 174 | |
Ben Skeggs | 97af71f | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 175 | extern const struct nvc0_graph_init nve4_grctx_init_gpm_0[]; |
| 176 | |
Ben Skeggs | 88e98d4 | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 177 | extern const struct nvc0_graph_init nve4_grctx_init_pes_0[]; |
| 178 | |
Alexandre Courbot | a4d4bbf | 2014-05-02 18:32:41 +0900 | [diff] [blame] | 179 | extern const struct nvc0_graph_pack nve4_grctx_pack_hub[]; |
| 180 | extern const struct nvc0_graph_pack nve4_grctx_pack_gpc[]; |
| 181 | extern const struct nvc0_graph_pack nve4_grctx_pack_tpc[]; |
| 182 | extern const struct nvc0_graph_pack nve4_grctx_pack_ppc[]; |
| 183 | extern const struct nvc0_graph_pack nve4_grctx_pack_icmd[]; |
| 184 | extern const struct nvc0_graph_init nve4_grctx_init_a097_0[]; |
| 185 | |
Ben Skeggs | 579b7f3 | 2014-06-12 21:22:32 +1000 | [diff] [blame] | 186 | extern const struct nvc0_graph_pack nvf0_grctx_pack_icmd[]; |
| 187 | |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 188 | extern const struct nvc0_graph_pack nvf0_grctx_pack_mthd[]; |
| 189 | |
Ben Skeggs | 579b7f3 | 2014-06-12 21:22:32 +1000 | [diff] [blame] | 190 | extern const struct nvc0_graph_pack nvf0_grctx_pack_hub[]; |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 191 | extern const struct nvc0_graph_init nvf0_grctx_init_pri_0[]; |
| 192 | extern const struct nvc0_graph_init nvf0_grctx_init_cwd_0[]; |
| 193 | |
Ben Skeggs | 579b7f3 | 2014-06-12 21:22:32 +1000 | [diff] [blame] | 194 | extern const struct nvc0_graph_pack nvf0_grctx_pack_gpc[]; |
Ben Skeggs | 97af71f | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 195 | extern const struct nvc0_graph_init nvf0_grctx_init_gpc_unk_2[]; |
| 196 | |
Ben Skeggs | 579b7f3 | 2014-06-12 21:22:32 +1000 | [diff] [blame] | 197 | extern const struct nvc0_graph_init nvf0_grctx_init_tex_0[]; |
Ben Skeggs | 7e19453 | 2014-03-03 16:18:56 +1000 | [diff] [blame] | 198 | extern const struct nvc0_graph_init nvf0_grctx_init_mpc_0[]; |
| 199 | extern const struct nvc0_graph_init nvf0_grctx_init_l1c_0[]; |
| 200 | |
Ben Skeggs | 579b7f3 | 2014-06-12 21:22:32 +1000 | [diff] [blame] | 201 | extern const struct nvc0_graph_pack nvf0_grctx_pack_ppc[]; |
| 202 | |
Ben Skeggs | 6f1e9b9 | 2014-03-04 11:00:41 +1000 | [diff] [blame] | 203 | extern const struct nvc0_graph_init nv108_grctx_init_rstr2d_0[]; |
| 204 | |
| 205 | extern const struct nvc0_graph_init nv108_grctx_init_prop_0[]; |
| 206 | extern const struct nvc0_graph_init nv108_grctx_init_crstr_0[]; |
| 207 | |
Ben Skeggs | c33b1e8 | 2014-03-03 16:18:55 +1000 | [diff] [blame] | 208 | |
| 209 | #endif |