1 #ifndef __NVKM_GRCTX_NVC0_H__ 2 #define __NVKM_GRCTX_NVC0_H__ 3 #include "gf100.h" 4 5 struct gf100_grctx { 6 struct gf100_gr *gr; 7 struct gf100_gr_data *data; 8 struct gf100_gr_mmio *mmio; 9 int buffer_nr; 10 u64 buffer[4]; 11 u64 addr; 12 }; 13 14 int gf100_grctx_mmio_data(struct gf100_grctx *, u32 size, u32 align, u32 access); 15 void gf100_grctx_mmio_item(struct gf100_grctx *, u32 addr, u32 data, int s, int); 16 17 #define mmio_vram(a,b,c,d) gf100_grctx_mmio_data((a), (b), (c), (d)) 18 #define mmio_refn(a,b,c,d,e) gf100_grctx_mmio_item((a), (b), (c), (d), (e)) 19 #define mmio_skip(a,b,c) mmio_refn((a), (b), (c), -1, -1) 20 #define mmio_wr32(a,b,c) mmio_refn((a), (b), (c), 0, -1) 21 22 struct gf100_grctx_func { 23 /* main context generation function */ 24 void (*main)(struct gf100_gr *, struct gf100_grctx *); 25 /* context-specific modify-on-first-load list generation function */ 26 void (*unkn)(struct gf100_gr *); 27 /* mmio context data */ 28 const struct gf100_gr_pack *hub; 29 const struct gf100_gr_pack *gpc; 30 const struct gf100_gr_pack *zcull; 31 const struct gf100_gr_pack *tpc; 32 const struct gf100_gr_pack *ppc; 33 /* indirect context data, generated with icmds/mthds */ 34 const struct gf100_gr_pack *icmd; 35 const struct gf100_gr_pack *mthd; 36 /* bundle circular buffer */ 37 void (*bundle)(struct gf100_grctx *); 38 u32 bundle_size; 39 u32 bundle_min_gpm_fifo_depth; 40 u32 bundle_token_limit; 41 /* pagepool */ 42 void (*pagepool)(struct gf100_grctx *); 43 u32 pagepool_size; 44 /* attribute(/alpha) circular buffer */ 45 void (*attrib)(struct gf100_grctx *); 46 u32 attrib_nr_max; 47 u32 attrib_nr; 48 u32 alpha_nr_max; 49 u32 alpha_nr; 50 }; 51 52 extern const struct gf100_grctx_func gf100_grctx; 53 int gf100_grctx_generate(struct gf100_gr *); 54 void gf100_grctx_generate_main(struct gf100_gr *, struct gf100_grctx *); 55 void gf100_grctx_generate_bundle(struct gf100_grctx *); 56 void gf100_grctx_generate_pagepool(struct gf100_grctx *); 57 void gf100_grctx_generate_attrib(struct gf100_grctx *); 58 void gf100_grctx_generate_unkn(struct gf100_gr *); 59 void gf100_grctx_generate_tpcid(struct gf100_gr *); 60 void gf100_grctx_generate_r406028(struct gf100_gr *); 61 void gf100_grctx_generate_r4060a8(struct gf100_gr *); 62 void gf100_grctx_generate_r418bb8(struct gf100_gr *); 63 void gf100_grctx_generate_r406800(struct gf100_gr *); 64 65 extern const struct gf100_grctx_func gf108_grctx; 66 void gf108_grctx_generate_attrib(struct gf100_grctx *); 67 void gf108_grctx_generate_unkn(struct gf100_gr *); 68 69 extern const struct gf100_grctx_func gf104_grctx; 70 extern const struct gf100_grctx_func gf110_grctx; 71 72 extern const struct gf100_grctx_func gf117_grctx; 73 void gf117_grctx_generate_attrib(struct gf100_grctx *); 74 75 extern const struct gf100_grctx_func gf119_grctx; 76 77 extern const struct gf100_grctx_func gk104_grctx; 78 extern const struct gf100_grctx_func gk20a_grctx; 79 void gk104_grctx_generate_main(struct gf100_gr *, struct gf100_grctx *); 80 void gk104_grctx_generate_bundle(struct gf100_grctx *); 81 void gk104_grctx_generate_pagepool(struct gf100_grctx *); 82 void gk104_grctx_generate_unkn(struct gf100_gr *); 83 void gk104_grctx_generate_r418bb8(struct gf100_gr *); 84 85 void gm107_grctx_generate_bundle(struct gf100_grctx *); 86 void gm107_grctx_generate_pagepool(struct gf100_grctx *); 87 void gm107_grctx_generate_attrib(struct gf100_grctx *); 88 89 extern const struct gf100_grctx_func gk110_grctx; 90 extern const struct gf100_grctx_func gk110b_grctx; 91 extern const struct gf100_grctx_func gk208_grctx; 92 93 extern const struct gf100_grctx_func gm107_grctx; 94 void gm107_grctx_generate_bundle(struct gf100_grctx *); 95 void gm107_grctx_generate_pagepool(struct gf100_grctx *); 96 void gm107_grctx_generate_attrib(struct gf100_grctx *); 97 98 extern const struct gf100_grctx_func gm200_grctx; 99 void gm200_grctx_generate_tpcid(struct gf100_gr *); 100 void gm200_grctx_generate_405b60(struct gf100_gr *); 101 102 extern const struct gf100_grctx_func gm20b_grctx; 103 104 extern const struct gf100_grctx_func gp100_grctx; 105 void gp100_grctx_generate_main(struct gf100_gr *, struct gf100_grctx *); 106 void gp100_grctx_generate_pagepool(struct gf100_grctx *); 107 108 extern const struct gf100_grctx_func gp102_grctx; 109 void gp102_grctx_generate_attrib(struct gf100_grctx *); 110 111 extern const struct gf100_grctx_func gp107_grctx; 112 113 /* context init value lists */ 114 115 extern const struct gf100_gr_pack gf100_grctx_pack_icmd[]; 116 117 extern const struct gf100_gr_pack gf100_grctx_pack_mthd[]; 118 extern const struct gf100_gr_init gf100_grctx_init_902d_0[]; 119 extern const struct gf100_gr_init gf100_grctx_init_9039_0[]; 120 extern const struct gf100_gr_init gf100_grctx_init_90c0_0[]; 121 122 extern const struct gf100_gr_pack gf100_grctx_pack_hub[]; 123 extern const struct gf100_gr_init gf100_grctx_init_main_0[]; 124 extern const struct gf100_gr_init gf100_grctx_init_fe_0[]; 125 extern const struct gf100_gr_init gf100_grctx_init_pri_0[]; 126 extern const struct gf100_gr_init gf100_grctx_init_memfmt_0[]; 127 extern const struct gf100_gr_init gf100_grctx_init_rstr2d_0[]; 128 extern const struct gf100_gr_init gf100_grctx_init_scc_0[]; 129 130 extern const struct gf100_gr_pack gf100_grctx_pack_gpc[]; 131 extern const struct gf100_gr_init gf100_grctx_init_gpc_unk_0[]; 132 extern const struct gf100_gr_init gf100_grctx_init_prop_0[]; 133 extern const struct gf100_gr_init gf100_grctx_init_gpc_unk_1[]; 134 extern const struct gf100_gr_init gf100_grctx_init_zcull_0[]; 135 extern const struct gf100_gr_init gf100_grctx_init_crstr_0[]; 136 extern const struct gf100_gr_init gf100_grctx_init_gpm_0[]; 137 extern const struct gf100_gr_init gf100_grctx_init_gcc_0[]; 138 139 extern const struct gf100_gr_pack gf100_grctx_pack_zcull[]; 140 141 extern const struct gf100_gr_pack gf100_grctx_pack_tpc[]; 142 extern const struct gf100_gr_init gf100_grctx_init_pe_0[]; 143 extern const struct gf100_gr_init gf100_grctx_init_wwdx_0[]; 144 extern const struct gf100_gr_init gf100_grctx_init_mpc_0[]; 145 extern const struct gf100_gr_init gf100_grctx_init_tpccs_0[]; 146 147 extern const struct gf100_gr_init gf104_grctx_init_tex_0[]; 148 extern const struct gf100_gr_init gf104_grctx_init_l1c_0[]; 149 extern const struct gf100_gr_init gf104_grctx_init_sm_0[]; 150 151 extern const struct gf100_gr_init gf108_grctx_init_9097_0[]; 152 153 extern const struct gf100_gr_init gf108_grctx_init_gpm_0[]; 154 155 extern const struct gf100_gr_init gf108_grctx_init_pe_0[]; 156 extern const struct gf100_gr_init gf108_grctx_init_wwdx_0[]; 157 extern const struct gf100_gr_init gf108_grctx_init_tpccs_0[]; 158 159 extern const struct gf100_gr_init gf110_grctx_init_9197_0[]; 160 extern const struct gf100_gr_init gf110_grctx_init_9297_0[]; 161 162 extern const struct gf100_gr_pack gf119_grctx_pack_icmd[]; 163 164 extern const struct gf100_gr_pack gf119_grctx_pack_mthd[]; 165 166 extern const struct gf100_gr_init gf119_grctx_init_fe_0[]; 167 extern const struct gf100_gr_init gf119_grctx_init_be_0[]; 168 169 extern const struct gf100_gr_init gf119_grctx_init_prop_0[]; 170 extern const struct gf100_gr_init gf119_grctx_init_gpc_unk_1[]; 171 extern const struct gf100_gr_init gf119_grctx_init_crstr_0[]; 172 173 extern const struct gf100_gr_init gf119_grctx_init_sm_0[]; 174 175 extern const struct gf100_gr_init gf117_grctx_init_pe_0[]; 176 177 extern const struct gf100_gr_init gf117_grctx_init_wwdx_0[]; 178 179 extern const struct gf100_gr_init gk104_grctx_init_memfmt_0[]; 180 extern const struct gf100_gr_init gk104_grctx_init_ds_0[]; 181 extern const struct gf100_gr_init gk104_grctx_init_scc_0[]; 182 183 extern const struct gf100_gr_init gk104_grctx_init_gpm_0[]; 184 185 extern const struct gf100_gr_init gk104_grctx_init_pes_0[]; 186 187 extern const struct gf100_gr_pack gk104_grctx_pack_hub[]; 188 extern const struct gf100_gr_pack gk104_grctx_pack_gpc[]; 189 extern const struct gf100_gr_pack gk104_grctx_pack_tpc[]; 190 extern const struct gf100_gr_pack gk104_grctx_pack_ppc[]; 191 extern const struct gf100_gr_pack gk104_grctx_pack_icmd[]; 192 extern const struct gf100_gr_init gk104_grctx_init_a097_0[]; 193 194 extern const struct gf100_gr_pack gk110_grctx_pack_icmd[]; 195 196 extern const struct gf100_gr_pack gk110_grctx_pack_mthd[]; 197 198 extern const struct gf100_gr_pack gk110_grctx_pack_hub[]; 199 extern const struct gf100_gr_init gk110_grctx_init_pri_0[]; 200 extern const struct gf100_gr_init gk110_grctx_init_cwd_0[]; 201 202 extern const struct gf100_gr_pack gk110_grctx_pack_gpc[]; 203 extern const struct gf100_gr_init gk110_grctx_init_gpc_unk_2[]; 204 205 extern const struct gf100_gr_init gk110_grctx_init_tex_0[]; 206 extern const struct gf100_gr_init gk110_grctx_init_mpc_0[]; 207 extern const struct gf100_gr_init gk110_grctx_init_l1c_0[]; 208 209 extern const struct gf100_gr_pack gk110_grctx_pack_ppc[]; 210 211 extern const struct gf100_gr_init gk208_grctx_init_rstr2d_0[]; 212 213 extern const struct gf100_gr_init gk208_grctx_init_prop_0[]; 214 extern const struct gf100_gr_init gk208_grctx_init_crstr_0[]; 215 216 extern const struct gf100_gr_init gm107_grctx_init_gpc_unk_0[]; 217 extern const struct gf100_gr_init gm107_grctx_init_wwdx_0[]; 218 #endif 219