136108Sjb/* 250472Speter * Copyright 2013 Red Hat Inc. 336108Sjb * 436108Sjb * Permission is hereby granted, free of charge, to any person obtaining a 543818Swes * copy of this software and associated documentation files (the "Software"), 643818Swes * to deal in the Software without restriction, including without limitation 750177Shoek * the rights to use, copy, modify, merge, publish, distribute, sublicense, 843818Swes * and/or sell copies of the Software, and to permit persons to whom the 943818Swes * Software is furnished to do so, subject to the following conditions: 1043818Swes * 1143818Swes * The above copyright notice and this permission notice shall be included in 1243818Swes * all copies or substantial portions of the Software. 1350177Shoek * 1443818Swes * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1543818Swes * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1643818Swes * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1750177Shoek * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1850177Shoek * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1950177Shoek * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2050177Shoek * OTHER DEALINGS IN THE SOFTWARE. 2150177Shoek * 2243818Swes * Authors: Ben Skeggs <bskeggs@redhat.com> 2343818Swes */ 2450177Shoek#include "gf100.h" 2550177Shoek#include "ctxgf100.h" 2643818Swes 2736108Sjb#include <nvif/class.h> 2836108Sjb 2950177Shoek/******************************************************************************* 3050177Shoek * PGRAPH register lists 3136108Sjb ******************************************************************************/ 3236108Sjb 3336108Sjbconst struct gf100_gr_init 3436108Sjbgf108_gr_init_gpc_unk_0[] = { 3536108Sjb { 0x418604, 1, 0x04, 0x00000000 }, 3636108Sjb { 0x418680, 1, 0x04, 0x00000000 }, 3748558Sdes { 0x418714, 1, 0x04, 0x00000000 }, 3848558Sdes { 0x418384, 1, 0x04, 0x00000000 }, 3948558Sdes {} 4048558Sdes}; 4148558Sdes 4248558Sdesconst struct gf100_gr_init 4336108Sjbgf108_gr_init_setup_1[] = { 4436108Sjb { 0x4188c8, 2, 0x04, 0x00000000 }, 4536108Sjb { 0x4188d0, 1, 0x04, 0x00010000 }, 4636108Sjb { 0x4188d4, 1, 0x04, 0x00000001 }, 4736108Sjb {} 4836108Sjb}; 4936108Sjb 5036108Sjbstatic const struct gf100_gr_init 5136108Sjbgf108_gr_init_gpc_unk_1[] = { 5236108Sjb { 0x418d00, 1, 0x04, 0x00000000 }, 5336108Sjb { 0x418f08, 1, 0x04, 0x00000000 }, 5436108Sjb { 0x418e00, 1, 0x04, 0x00000003 }, 5536108Sjb { 0x418e08, 1, 0x04, 0x00000000 }, 5636108Sjb {} 5736108Sjb}; 5836108Sjb 5936108Sjbstatic const struct gf100_gr_init 6036108Sjbgf108_gr_init_pe_0[] = { 6136108Sjb { 0x41980c, 1, 0x04, 0x00000010 }, 6236108Sjb { 0x419810, 1, 0x04, 0x00000000 }, 6336108Sjb { 0x419814, 1, 0x04, 0x00000004 }, 6436108Sjb { 0x419844, 1, 0x04, 0x00000000 }, 6536108Sjb { 0x41984c, 1, 0x04, 0x00005bc5 }, 6636108Sjb { 0x419850, 4, 0x04, 0x00000000 }, 6736108Sjb { 0x419880, 1, 0x04, 0x00000002 }, 6836108Sjb {} 6936108Sjb}; 7036108Sjb 7136108Sjbstatic const struct gf100_gr_pack 7236108Sjbgf108_gr_pack_mmio[] = { 7336108Sjb { gf100_gr_init_main_0 }, 7436108Sjb { gf100_gr_init_fe_0 }, 7536108Sjb { gf100_gr_init_pri_0 }, 7636108Sjb { gf100_gr_init_rstr2d_0 }, 7736108Sjb { gf100_gr_init_pd_0 }, 7836108Sjb { gf104_gr_init_ds_0 }, 7936108Sjb { gf100_gr_init_scc_0 }, 8036108Sjb { gf100_gr_init_prop_0 }, 8136108Sjb { gf108_gr_init_gpc_unk_0 }, 8236108Sjb { gf100_gr_init_setup_0 }, 8336108Sjb { gf100_gr_init_crstr_0 }, 8436108Sjb { gf108_gr_init_setup_1 }, 8536108Sjb { gf100_gr_init_zcull_0 }, 8636108Sjb { gf100_gr_init_gpm_0 }, 8736108Sjb { gf108_gr_init_gpc_unk_1 }, 8836108Sjb { gf100_gr_init_gcc_0 }, 8936108Sjb { gf100_gr_init_tpccs_0 }, 9036108Sjb { gf104_gr_init_tex_0 }, 9136108Sjb { gf108_gr_init_pe_0 }, 9236108Sjb { gf100_gr_init_l1c_0 }, 9336108Sjb { gf100_gr_init_wwdx_0 }, 9436108Sjb { gf100_gr_init_tpccs_1 }, 9536108Sjb { gf100_gr_init_mpc_0 }, 9636108Sjb { gf104_gr_init_sm_0 }, 9736108Sjb { gf100_gr_init_be_0 }, 9836108Sjb { gf100_gr_init_fe_1 }, 9936108Sjb {} 10036108Sjb}; 10136108Sjb 10236108Sjb/******************************************************************************* 10336108Sjb * PGRAPH engine/subdev functions 10436108Sjb ******************************************************************************/ 10536108Sjb 10636108Sjbstatic void 10736108Sjbgf108_gr_init_r405a14(struct gf100_gr *gr) 10836108Sjb{ 10936108Sjb nvkm_wr32(gr->base.engine.subdev.device, 0x405a14, 0x80000000); 11036108Sjb} 11136108Sjb 11236108Sjbstatic const struct gf100_gr_func 11336108Sjbgf108_gr = { 11436108Sjb .oneinit_tiles = gf100_gr_oneinit_tiles, 11536108Sjb .oneinit_sm_id = gf100_gr_oneinit_sm_id, 11636108Sjb .init = gf100_gr_init, 11736108Sjb .init_gpc_mmu = gf100_gr_init_gpc_mmu, 11836108Sjb .init_r405a14 = gf108_gr_init_r405a14, 11936108Sjb .init_vsc_stream_master = gf100_gr_init_vsc_stream_master, 12036108Sjb .init_zcull = gf100_gr_init_zcull, 12136108Sjb .init_num_active_ltcs = gf100_gr_init_num_active_ltcs, 12236108Sjb .init_fecs_exceptions = gf100_gr_init_fecs_exceptions, 12336108Sjb .init_40601c = gf100_gr_init_40601c, 12436108Sjb .init_419cc0 = gf100_gr_init_419cc0, 12536108Sjb .init_419eb4 = gf100_gr_init_419eb4, 12636108Sjb .init_tex_hww_esr = gf100_gr_init_tex_hww_esr, 12736108Sjb .init_shader_exceptions = gf100_gr_init_shader_exceptions, 12836108Sjb .init_rop_exceptions = gf100_gr_init_rop_exceptions, 12936108Sjb .init_exception2 = gf100_gr_init_exception2, 13036108Sjb .init_400054 = gf100_gr_init_400054, 13136108Sjb .trap_mp = gf100_gr_trap_mp, 13236108Sjb .mmio = gf108_gr_pack_mmio, 13336108Sjb .fecs.ucode = &gf100_gr_fecs_ucode, 13436108Sjb .fecs.reset = gf100_gr_fecs_reset, 13536108Sjb .gpccs.ucode = &gf100_gr_gpccs_ucode, 13636108Sjb .rops = gf100_gr_rops, 13736108Sjb .grctx = &gf108_grctx, 13836108Sjb .zbc = &gf100_gr_zbc, 13936108Sjb .sclass = { 14036108Sjb { -1, -1, FERMI_TWOD_A }, 14136108Sjb { -1, -1, FERMI_MEMORY_TO_MEMORY_FORMAT_A }, 14236108Sjb { -1, -1, FERMI_A, &gf100_fermi }, 14336108Sjb { -1, -1, FERMI_B, &gf100_fermi }, 14436108Sjb { -1, -1, FERMI_COMPUTE_A }, 14536108Sjb {} 14636108Sjb } 14736108Sjb}; 14836108Sjb 14936108Sjbstatic const struct gf100_gr_fwif 15036108Sjbgf108_gr_fwif[] = { 15136108Sjb { -1, gf100_gr_load, &gf108_gr }, 15236108Sjb { -1, gf100_gr_nofw, &gf108_gr }, 15336108Sjb {} 15436108Sjb}; 15536108Sjb 15636108Sjbint 15736108Sjbgf108_gr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_gr **pgr) 15836108Sjb{ 15936108Sjb return gf100_gr_new_(gf108_gr_fwif, device, type, inst, pgr); 16036108Sjb} 16136108Sjb