drm/nouveau/gr: convert to new-style nvkm_engine
[deliverable/linux.git] / drivers / gpu / drm / nouveau / nvkm / engine / gr / ctxgk20a.c
CommitLineData
a4d4bbf1 1/*
c4d0f8f6 2 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
a4d4bbf1
AC
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
e3c71eb2 22#include "ctxgf100.h"
c85ee6ca 23#include "gf100.h"
c4d0f8f6
AC
24
25#include <subdev/mc.h>
26
27static void
bfee3f3d 28gk20a_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info)
c4d0f8f6 29{
276836d4 30 struct nvkm_device *device = gr->base.engine.subdev.device;
27f3d6cf 31 const struct gf100_grctx_func *grctx = gr->func->grctx;
c4d0f8f6
AC
32 int idle_timeout_save;
33 int i;
34
bfee3f3d 35 gf100_gr_mmio(gr, gr->fuc_sw_ctx);
c4d0f8f6 36
bfee3f3d 37 gf100_gr_wait_idle(gr);
c4d0f8f6 38
276836d4
BS
39 idle_timeout_save = nvkm_rd32(device, 0x404154);
40 nvkm_wr32(device, 0x404154, 0x00000000);
c4d0f8f6 41
27f3d6cf 42 grctx->attrib(info);
c4d0f8f6 43
27f3d6cf 44 grctx->unkn(gr);
c4d0f8f6 45
bfee3f3d
BS
46 gf100_grctx_generate_tpcid(gr);
47 gf100_grctx_generate_r406028(gr);
48 gk104_grctx_generate_r418bb8(gr);
49 gf100_grctx_generate_r406800(gr);
c4d0f8f6
AC
50
51 for (i = 0; i < 8; i++)
276836d4 52 nvkm_wr32(device, 0x4064d0 + (i * 0x04), 0x00000000);
c4d0f8f6 53
276836d4 54 nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr);
c4d0f8f6 55
bfee3f3d 56 gk104_grctx_generate_rop_active_fbps(gr);
c4d0f8f6 57
276836d4 58 nvkm_mask(device, 0x5044b0, 0x8000000, 0x8000000);
c4d0f8f6 59
bfee3f3d 60 gf100_gr_wait_idle(gr);
c4d0f8f6 61
276836d4 62 nvkm_wr32(device, 0x404154, idle_timeout_save);
bfee3f3d 63 gf100_gr_wait_idle(gr);
c4d0f8f6 64
bfee3f3d
BS
65 gf100_gr_mthd(gr, gr->fuc_method);
66 gf100_gr_wait_idle(gr);
a4d4bbf1 67
bfee3f3d 68 gf100_gr_icmd(gr, gr->fuc_bundle);
27f3d6cf
BS
69 grctx->pagepool(info);
70 grctx->bundle(info);
c4d0f8f6 71}
a4d4bbf1 72
27f3d6cf
BS
73const struct gf100_grctx_func
74gk20a_grctx = {
c4d0f8f6 75 .main = gk20a_grctx_generate_main,
e3c71eb2 76 .unkn = gk104_grctx_generate_unkn,
e3c71eb2 77 .bundle = gk104_grctx_generate_bundle,
aa2d58c3
BS
78 .bundle_size = 0x1800,
79 .bundle_min_gpm_fifo_depth = 0x62,
80 .bundle_token_limit = 0x100,
e3c71eb2 81 .pagepool = gk104_grctx_generate_pagepool,
f331a15f 82 .pagepool_size = 0x8000,
e3c71eb2 83 .attrib = gf117_grctx_generate_attrib,
67cfbfdf
BS
84 .attrib_nr_max = 0x240,
85 .attrib_nr = 0x240,
86 .alpha_nr_max = 0x648 + (0x648 / 2),
87 .alpha_nr = 0x648,
27f3d6cf 88};
This page took 0.158904 seconds and 5 git commands to generate.