Home | History | Annotate | Line # | Download | only in gr
      1 /*	$NetBSD: nouveau_nvkm_engine_gr_gk110b.c,v 1.3 2021/12/18 23:45:36 riastradh Exp $	*/
      2 
      3 /*
      4  * Copyright 2013 Red Hat Inc.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the "Software"),
      8  * to deal in the Software without restriction, including without limitation
      9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  * and/or sell copies of the Software, and to permit persons to whom the
     11  * Software is furnished to do so, subject to the following conditions:
     12  *
     13  * The above copyright notice and this permission notice shall be included in
     14  * all copies or substantial portions of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  * OTHER DEALINGS IN THE SOFTWARE.
     23  *
     24  * Authors: Ben Skeggs <bskeggs (at) redhat.com>
     25  */
     26 #include <sys/cdefs.h>
     27 __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_gr_gk110b.c,v 1.3 2021/12/18 23:45:36 riastradh Exp $");
     28 
     29 #include "gf100.h"
     30 #include "ctxgf100.h"
     31 
     32 #include <nvif/class.h>
     33 
     34 /*******************************************************************************
     35  * PGRAPH register lists
     36  ******************************************************************************/
     37 
     38 static const struct gf100_gr_init
     39 gk110b_gr_init_l1c_0[] = {
     40 	{ 0x419c98,   1, 0x04, 0x00000000 },
     41 	{ 0x419ca8,   1, 0x04, 0x00000000 },
     42 	{ 0x419cb0,   1, 0x04, 0x09000000 },
     43 	{ 0x419cb4,   1, 0x04, 0x00000000 },
     44 	{ 0x419cb8,   1, 0x04, 0x00b08bea },
     45 	{ 0x419c84,   1, 0x04, 0x00010384 },
     46 	{ 0x419cbc,   1, 0x04, 0x281b3646 },
     47 	{ 0x419cc0,   2, 0x04, 0x00000000 },
     48 	{ 0x419c80,   1, 0x04, 0x00020230 },
     49 	{ 0x419ccc,   2, 0x04, 0x00000000 },
     50 	{}
     51 };
     52 
     53 static const struct gf100_gr_init
     54 gk110b_gr_init_sm_0[] = {
     55 	{ 0x419e00,   1, 0x04, 0x00000080 },
     56 	{ 0x419ea0,   1, 0x04, 0x00000000 },
     57 	{ 0x419ee4,   1, 0x04, 0x00000000 },
     58 	{ 0x419ea4,   1, 0x04, 0x00000100 },
     59 	{ 0x419ea8,   1, 0x04, 0x00000000 },
     60 	{ 0x419eb4,   1, 0x04, 0x00000000 },
     61 	{ 0x419ebc,   2, 0x04, 0x00000000 },
     62 	{ 0x419edc,   1, 0x04, 0x00000000 },
     63 	{ 0x419f00,   1, 0x04, 0x00000000 },
     64 	{ 0x419ed0,   1, 0x04, 0x00002616 },
     65 	{ 0x419f74,   1, 0x04, 0x00015555 },
     66 	{ 0x419f80,   4, 0x04, 0x00000000 },
     67 	{}
     68 };
     69 
     70 static const struct gf100_gr_pack
     71 gk110b_gr_pack_mmio[] = {
     72 	{ gk104_gr_init_main_0 },
     73 	{ gk110_gr_init_fe_0 },
     74 	{ gf100_gr_init_pri_0 },
     75 	{ gf100_gr_init_rstr2d_0 },
     76 	{ gf119_gr_init_pd_0 },
     77 	{ gk110_gr_init_ds_0 },
     78 	{ gf100_gr_init_scc_0 },
     79 	{ gk110_gr_init_sked_0 },
     80 	{ gk110_gr_init_cwd_0 },
     81 	{ gf119_gr_init_prop_0 },
     82 	{ gf108_gr_init_gpc_unk_0 },
     83 	{ gf100_gr_init_setup_0 },
     84 	{ gf100_gr_init_crstr_0 },
     85 	{ gf108_gr_init_setup_1 },
     86 	{ gf100_gr_init_zcull_0 },
     87 	{ gf119_gr_init_gpm_0 },
     88 	{ gk110_gr_init_gpc_unk_1 },
     89 	{ gf100_gr_init_gcc_0 },
     90 	{ gk104_gr_init_gpc_unk_2 },
     91 	{ gk104_gr_init_tpccs_0 },
     92 	{ gk110_gr_init_tex_0 },
     93 	{ gk104_gr_init_pe_0 },
     94 	{ gk110b_gr_init_l1c_0 },
     95 	{ gf100_gr_init_mpc_0 },
     96 	{ gk110b_gr_init_sm_0 },
     97 	{ gf117_gr_init_pes_0 },
     98 	{ gf117_gr_init_wwdx_0 },
     99 	{ gf117_gr_init_cbm_0 },
    100 	{ gk104_gr_init_be_0 },
    101 	{ gf100_gr_init_fe_1 },
    102 	{}
    103 };
    104 
    105 /*******************************************************************************
    106  * PGRAPH engine/subdev functions
    107  ******************************************************************************/
    108 
    109 static const struct gf100_gr_func
    110 gk110b_gr = {
    111 	.oneinit_tiles = gf100_gr_oneinit_tiles,
    112 	.oneinit_sm_id = gf100_gr_oneinit_sm_id,
    113 	.init = gf100_gr_init,
    114 	.init_gpc_mmu = gf100_gr_init_gpc_mmu,
    115 	.init_vsc_stream_master = gk104_gr_init_vsc_stream_master,
    116 	.init_zcull = gf117_gr_init_zcull,
    117 	.init_num_active_ltcs = gf100_gr_init_num_active_ltcs,
    118 	.init_rop_active_fbps = gk104_gr_init_rop_active_fbps,
    119 	.init_fecs_exceptions = gf100_gr_init_fecs_exceptions,
    120 	.init_sked_hww_esr = gk104_gr_init_sked_hww_esr,
    121 	.init_419cc0 = gf100_gr_init_419cc0,
    122 	.init_419eb4 = gk110_gr_init_419eb4,
    123 	.init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
    124 	.init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
    125 	.init_shader_exceptions = gf100_gr_init_shader_exceptions,
    126 	.init_400054 = gf100_gr_init_400054,
    127 	.trap_mp = gf100_gr_trap_mp,
    128 	.mmio = gk110b_gr_pack_mmio,
    129 	.fecs.ucode = &gk110_gr_fecs_ucode,
    130 	.gpccs.ucode = &gk110_gr_gpccs_ucode,
    131 	.rops = gf100_gr_rops,
    132 	.ppc_nr = 2,
    133 	.grctx = &gk110b_grctx,
    134 	.zbc = &gf100_gr_zbc,
    135 	.sclass = {
    136 		{ -1, -1, FERMI_TWOD_A },
    137 		{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
    138 		{ -1, -1, KEPLER_B, &gf100_fermi },
    139 		{ -1, -1, KEPLER_COMPUTE_B },
    140 		{}
    141 	}
    142 };
    143 
    144 static const struct gf100_gr_fwif
    145 gk110b_gr_fwif[] = {
    146 	{ -1, gf100_gr_load, &gk110b_gr },
    147 	{ -1, gf100_gr_nofw, &gk110b_gr },
    148 	{}
    149 };
    150 
    151 int
    152 gk110b_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
    153 {
    154 	return gf100_gr_new_(gk110b_gr_fwif, device, index, pgr);
    155 }
    156