Home | History | Annotate | Line # | Download | only in gr
      1 /*	$NetBSD: ctxgf100.h,v 1.3 2021/12/18 23:45:36 riastradh Exp $	*/
      2 
      3 /* SPDX-License-Identifier: MIT */
      4 #ifndef __NVKM_GRCTX_NVC0_H__
      5 #define __NVKM_GRCTX_NVC0_H__
      6 #include "gf100.h"
      7 
      8 struct gf100_grctx {
      9 	struct gf100_gr *gr;
     10 	struct gf100_gr_data *data;
     11 	struct gf100_gr_mmio *mmio;
     12 	int buffer_nr;
     13 	u64 buffer[4];
     14 	u64 addr;
     15 };
     16 
     17 int  gf100_grctx_mmio_data(struct gf100_grctx *, u32 size, u32 align, bool priv);
     18 void gf100_grctx_mmio_item(struct gf100_grctx *, u32 addr, u32 data, int s, int);
     19 
     20 #define mmio_vram(a,b,c,d) gf100_grctx_mmio_data((a), (b), (c), (d))
     21 #define mmio_refn(a,b,c,d,e) gf100_grctx_mmio_item((a), (b), (c), (d), (e))
     22 #define mmio_skip(a,b,c) mmio_refn((a), (b), (c), -1, -1)
     23 #define mmio_wr32(a,b,c) mmio_refn((a), (b), (c),  0, -1)
     24 
     25 struct gf100_grctx_func {
     26 	void (*unkn88c)(struct gf100_gr *, bool on);
     27 	/* main context generation function */
     28 	void  (*main)(struct gf100_gr *, struct gf100_grctx *);
     29 	/* context-specific modify-on-first-load list generation function */
     30 	void  (*unkn)(struct gf100_gr *);
     31 	/* mmio context data */
     32 	const struct gf100_gr_pack *hub;
     33 	const struct gf100_gr_pack *gpc_0;
     34 	const struct gf100_gr_pack *gpc_1;
     35 	const struct gf100_gr_pack *zcull;
     36 	const struct gf100_gr_pack *tpc;
     37 	const struct gf100_gr_pack *ppc;
     38 	/* indirect context data, generated with icmds/mthds */
     39 	const struct gf100_gr_pack *icmd;
     40 	const struct gf100_gr_pack *mthd;
     41 	const struct gf100_gr_pack *sw_veid_bundle_init;
     42 	/* bundle circular buffer */
     43 	void (*bundle)(struct gf100_grctx *);
     44 	u32 bundle_size;
     45 	u32 bundle_min_gpm_fifo_depth;
     46 	u32 bundle_token_limit;
     47 	/* pagepool */
     48 	void (*pagepool)(struct gf100_grctx *);
     49 	u32 pagepool_size;
     50 	/* attribute(/alpha) circular buffer */
     51 	void (*attrib)(struct gf100_grctx *);
     52 	u32 attrib_nr_max;
     53 	u32 attrib_nr;
     54 	u32 alpha_nr_max;
     55 	u32 alpha_nr;
     56 	u32 gfxp_nr;
     57 	/* other patch buffer stuff */
     58 	void (*patch_ltc)(struct gf100_grctx *);
     59 	/* floorsweeping */
     60 	void (*sm_id)(struct gf100_gr *, int gpc, int tpc, int sm);
     61 	void (*tpc_nr)(struct gf100_gr *, int gpc);
     62 	bool skip_pd_num_tpc_per_gpc;
     63 	void (*r4060a8)(struct gf100_gr *);
     64 	void (*rop_mapping)(struct gf100_gr *);
     65 	void (*alpha_beta_tables)(struct gf100_gr *);
     66 	void (*max_ways_evict)(struct gf100_gr *);
     67 	void (*dist_skip_table)(struct gf100_gr *);
     68 	void (*r406500)(struct gf100_gr *);
     69 	void (*gpc_tpc_nr)(struct gf100_gr *);
     70 	void (*r419f78)(struct gf100_gr *);
     71 	void (*tpc_mask)(struct gf100_gr *);
     72 	void (*smid_config)(struct gf100_gr *);
     73 	/* misc other things */
     74 	void (*r400088)(struct gf100_gr *, bool);
     75 	void (*r419cb8)(struct gf100_gr *);
     76 	void (*r418800)(struct gf100_gr *);
     77 	void (*r419eb0)(struct gf100_gr *);
     78 	void (*r419e00)(struct gf100_gr *);
     79 	void (*r418e94)(struct gf100_gr *);
     80 	void (*r419a3c)(struct gf100_gr *);
     81 	void (*r408840)(struct gf100_gr *);
     82 	void (*r419c0c)(struct gf100_gr *);
     83 };
     84 
     85 extern const struct gf100_grctx_func gf100_grctx;
     86 int  gf100_grctx_generate(struct gf100_gr *);
     87 void gf100_grctx_generate_main(struct gf100_gr *, struct gf100_grctx *);
     88 void gf100_grctx_generate_bundle(struct gf100_grctx *);
     89 void gf100_grctx_generate_pagepool(struct gf100_grctx *);
     90 void gf100_grctx_generate_attrib(struct gf100_grctx *);
     91 void gf100_grctx_generate_unkn(struct gf100_gr *);
     92 void gf100_grctx_generate_floorsweep(struct gf100_gr *);
     93 void gf100_grctx_generate_sm_id(struct gf100_gr *, int, int, int);
     94 void gf100_grctx_generate_tpc_nr(struct gf100_gr *, int);
     95 void gf100_grctx_generate_r4060a8(struct gf100_gr *);
     96 void gf100_grctx_generate_rop_mapping(struct gf100_gr *);
     97 void gf100_grctx_generate_alpha_beta_tables(struct gf100_gr *);
     98 void gf100_grctx_generate_max_ways_evict(struct gf100_gr *);
     99 void gf100_grctx_generate_r419cb8(struct gf100_gr *);
    100 
    101 extern const struct gf100_grctx_func gf108_grctx;
    102 void gf108_grctx_generate_attrib(struct gf100_grctx *);
    103 void gf108_grctx_generate_unkn(struct gf100_gr *);
    104 
    105 extern const struct gf100_grctx_func gf104_grctx;
    106 extern const struct gf100_grctx_func gf110_grctx;
    107 
    108 extern const struct gf100_grctx_func gf117_grctx;
    109 void gf117_grctx_generate_attrib(struct gf100_grctx *);
    110 void gf117_grctx_generate_rop_mapping(struct gf100_gr *);
    111 void gf117_grctx_generate_dist_skip_table(struct gf100_gr *);
    112 
    113 extern const struct gf100_grctx_func gf119_grctx;
    114 
    115 extern const struct gf100_grctx_func gk104_grctx;
    116 void gk104_grctx_generate_alpha_beta_tables(struct gf100_gr *);
    117 void gk104_grctx_generate_gpc_tpc_nr(struct gf100_gr *);
    118 
    119 extern const struct gf100_grctx_func gk20a_grctx;
    120 void gk104_grctx_generate_bundle(struct gf100_grctx *);
    121 void gk104_grctx_generate_pagepool(struct gf100_grctx *);
    122 void gk104_grctx_generate_patch_ltc(struct gf100_grctx *);
    123 void gk104_grctx_generate_unkn(struct gf100_gr *);
    124 void gk104_grctx_generate_r418800(struct gf100_gr *);
    125 
    126 extern const struct gf100_grctx_func gk110_grctx;
    127 void gk110_grctx_generate_r419eb0(struct gf100_gr *);
    128 
    129 extern const struct gf100_grctx_func gk110b_grctx;
    130 extern const struct gf100_grctx_func gk208_grctx;
    131 
    132 extern const struct gf100_grctx_func gm107_grctx;
    133 void gm107_grctx_generate_bundle(struct gf100_grctx *);
    134 void gm107_grctx_generate_pagepool(struct gf100_grctx *);
    135 void gm107_grctx_generate_attrib(struct gf100_grctx *);
    136 void gm107_grctx_generate_sm_id(struct gf100_gr *, int, int, int);
    137 
    138 extern const struct gf100_grctx_func gm200_grctx;
    139 void gm200_grctx_generate_dist_skip_table(struct gf100_gr *);
    140 void gm200_grctx_generate_r406500(struct gf100_gr *);
    141 void gm200_grctx_generate_tpc_mask(struct gf100_gr *);
    142 void gm200_grctx_generate_smid_config(struct gf100_gr *);
    143 void gm200_grctx_generate_r419a3c(struct gf100_gr *);
    144 
    145 extern const struct gf100_grctx_func gm20b_grctx;
    146 
    147 extern const struct gf100_grctx_func gp100_grctx;
    148 void gp100_grctx_generate_pagepool(struct gf100_grctx *);
    149 void gp100_grctx_generate_smid_config(struct gf100_gr *);
    150 
    151 extern const struct gf100_grctx_func gp102_grctx;
    152 void gp102_grctx_generate_attrib(struct gf100_grctx *);
    153 
    154 extern const struct gf100_grctx_func gp104_grctx;
    155 
    156 extern const struct gf100_grctx_func gp107_grctx;
    157 
    158 extern const struct gf100_grctx_func gv100_grctx;
    159 
    160 extern const struct gf100_grctx_func tu102_grctx;
    161 void gv100_grctx_unkn88c(struct gf100_gr *, bool);
    162 void gv100_grctx_generate_unkn(struct gf100_gr *);
    163 extern const struct gf100_gr_init gv100_grctx_init_sw_veid_bundle_init_0[];
    164 void gv100_grctx_generate_attrib(struct gf100_grctx *);
    165 void gv100_grctx_generate_rop_mapping(struct gf100_gr *);
    166 void gv100_grctx_generate_r400088(struct gf100_gr *, bool);
    167 
    168 /* context init value lists */
    169 
    170 extern const struct gf100_gr_pack gf100_grctx_pack_icmd[];
    171 
    172 extern const struct gf100_gr_pack gf100_grctx_pack_mthd[];
    173 extern const struct gf100_gr_init gf100_grctx_init_902d_0[];
    174 extern const struct gf100_gr_init gf100_grctx_init_9039_0[];
    175 extern const struct gf100_gr_init gf100_grctx_init_90c0_0[];
    176 
    177 extern const struct gf100_gr_pack gf100_grctx_pack_hub[];
    178 extern const struct gf100_gr_init gf100_grctx_init_main_0[];
    179 extern const struct gf100_gr_init gf100_grctx_init_fe_0[];
    180 extern const struct gf100_gr_init gf100_grctx_init_pri_0[];
    181 extern const struct gf100_gr_init gf100_grctx_init_memfmt_0[];
    182 extern const struct gf100_gr_init gf100_grctx_init_rstr2d_0[];
    183 extern const struct gf100_gr_init gf100_grctx_init_scc_0[];
    184 
    185 extern const struct gf100_gr_pack gf100_grctx_pack_gpc_0[];
    186 extern const struct gf100_gr_pack gf100_grctx_pack_gpc_1[];
    187 extern const struct gf100_gr_init gf100_grctx_init_gpc_unk_0[];
    188 extern const struct gf100_gr_init gf100_grctx_init_prop_0[];
    189 extern const struct gf100_gr_init gf100_grctx_init_gpc_unk_1[];
    190 extern const struct gf100_gr_init gf100_grctx_init_zcull_0[];
    191 extern const struct gf100_gr_init gf100_grctx_init_crstr_0[];
    192 extern const struct gf100_gr_init gf100_grctx_init_gpm_0[];
    193 extern const struct gf100_gr_init gf100_grctx_init_gcc_0[];
    194 
    195 extern const struct gf100_gr_pack gf100_grctx_pack_zcull[];
    196 
    197 extern const struct gf100_gr_pack gf100_grctx_pack_tpc[];
    198 extern const struct gf100_gr_init gf100_grctx_init_pe_0[];
    199 extern const struct gf100_gr_init gf100_grctx_init_wwdx_0[];
    200 extern const struct gf100_gr_init gf100_grctx_init_mpc_0[];
    201 extern const struct gf100_gr_init gf100_grctx_init_tpccs_0[];
    202 
    203 extern const struct gf100_gr_init gf104_grctx_init_tex_0[];
    204 extern const struct gf100_gr_init gf104_grctx_init_l1c_0[];
    205 extern const struct gf100_gr_init gf104_grctx_init_sm_0[];
    206 
    207 extern const struct gf100_gr_init gf108_grctx_init_9097_0[];
    208 
    209 extern const struct gf100_gr_init gf108_grctx_init_gpm_0[];
    210 
    211 extern const struct gf100_gr_init gf108_grctx_init_pe_0[];
    212 extern const struct gf100_gr_init gf108_grctx_init_wwdx_0[];
    213 extern const struct gf100_gr_init gf108_grctx_init_tpccs_0[];
    214 
    215 extern const struct gf100_gr_init gf110_grctx_init_9197_0[];
    216 extern const struct gf100_gr_init gf110_grctx_init_9297_0[];
    217 
    218 extern const struct gf100_gr_pack gf119_grctx_pack_icmd[];
    219 
    220 extern const struct gf100_gr_pack gf119_grctx_pack_mthd[];
    221 
    222 extern const struct gf100_gr_init gf119_grctx_init_fe_0[];
    223 extern const struct gf100_gr_init gf119_grctx_init_be_0[];
    224 
    225 extern const struct gf100_gr_init gf119_grctx_init_prop_0[];
    226 extern const struct gf100_gr_init gf119_grctx_init_gpc_unk_1[];
    227 extern const struct gf100_gr_init gf119_grctx_init_crstr_0[];
    228 
    229 extern const struct gf100_gr_init gf119_grctx_init_sm_0[];
    230 
    231 extern const struct gf100_gr_init gf117_grctx_init_pe_0[];
    232 
    233 extern const struct gf100_gr_init gf117_grctx_init_wwdx_0[];
    234 
    235 extern const struct gf100_gr_pack gf117_grctx_pack_gpc_1[];
    236 
    237 extern const struct gf100_gr_init gk104_grctx_init_memfmt_0[];
    238 extern const struct gf100_gr_init gk104_grctx_init_ds_0[];
    239 extern const struct gf100_gr_init gk104_grctx_init_scc_0[];
    240 
    241 extern const struct gf100_gr_init gk104_grctx_init_gpm_0[];
    242 
    243 extern const struct gf100_gr_init gk104_grctx_init_pes_0[];
    244 
    245 extern const struct gf100_gr_pack gk104_grctx_pack_hub[];
    246 extern const struct gf100_gr_pack gk104_grctx_pack_tpc[];
    247 extern const struct gf100_gr_pack gk104_grctx_pack_ppc[];
    248 extern const struct gf100_gr_pack gk104_grctx_pack_icmd[];
    249 extern const struct gf100_gr_init gk104_grctx_init_a097_0[];
    250 
    251 extern const struct gf100_gr_pack gk110_grctx_pack_icmd[];
    252 
    253 extern const struct gf100_gr_pack gk110_grctx_pack_mthd[];
    254 
    255 extern const struct gf100_gr_pack gk110_grctx_pack_hub[];
    256 extern const struct gf100_gr_init gk110_grctx_init_pri_0[];
    257 extern const struct gf100_gr_init gk110_grctx_init_cwd_0[];
    258 
    259 extern const struct gf100_gr_pack gk110_grctx_pack_gpc_0[];
    260 extern const struct gf100_gr_pack gk110_grctx_pack_gpc_1[];
    261 extern const struct gf100_gr_init gk110_grctx_init_gpc_unk_2[];
    262 
    263 extern const struct gf100_gr_init gk110_grctx_init_tex_0[];
    264 extern const struct gf100_gr_init gk110_grctx_init_mpc_0[];
    265 extern const struct gf100_gr_init gk110_grctx_init_l1c_0[];
    266 
    267 extern const struct gf100_gr_pack gk110_grctx_pack_ppc[];
    268 
    269 extern const struct gf100_gr_init gk208_grctx_init_rstr2d_0[];
    270 
    271 extern const struct gf100_gr_init gk208_grctx_init_prop_0[];
    272 extern const struct gf100_gr_init gk208_grctx_init_crstr_0[];
    273 
    274 extern const struct gf100_gr_init gm107_grctx_init_gpc_unk_0[];
    275 extern const struct gf100_gr_init gm107_grctx_init_wwdx_0[];
    276 #endif
    277