1d94470e9SBen Skeggs /*
2d94470e9SBen Skeggs * Copyright 2021 Red Hat Inc.
3d94470e9SBen Skeggs *
4d94470e9SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a
5d94470e9SBen Skeggs * copy of this software and associated documentation files (the "Software"),
6d94470e9SBen Skeggs * to deal in the Software without restriction, including without limitation
7d94470e9SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8d94470e9SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the
9d94470e9SBen Skeggs * Software is furnished to do so, subject to the following conditions:
10d94470e9SBen Skeggs *
11d94470e9SBen Skeggs * The above copyright notice and this permission notice shall be included in
12d94470e9SBen Skeggs * all copies or substantial portions of the Software.
13d94470e9SBen Skeggs *
14d94470e9SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15d94470e9SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16d94470e9SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17d94470e9SBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18d94470e9SBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19d94470e9SBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20d94470e9SBen Skeggs * OTHER DEALINGS IN THE SOFTWARE.
21d94470e9SBen Skeggs */
22*06db7fdeSBen Skeggs #include "priv.h"
23d94470e9SBen Skeggs #include "chan.h"
24d94470e9SBen Skeggs #include "runl.h"
25d94470e9SBen Skeggs
26d94470e9SBen Skeggs #include <nvif/class.h>
27d94470e9SBen Skeggs
28d94470e9SBen Skeggs static int
g98_fifo_runl_ctor(struct nvkm_fifo * fifo)29d94470e9SBen Skeggs g98_fifo_runl_ctor(struct nvkm_fifo *fifo)
30d94470e9SBen Skeggs {
31d94470e9SBen Skeggs struct nvkm_runl *runl;
32d94470e9SBen Skeggs
33d94470e9SBen Skeggs runl = nvkm_runl_new(fifo, 0, 0, 0);
34d94470e9SBen Skeggs if (IS_ERR(runl))
35d94470e9SBen Skeggs return PTR_ERR(runl);
36d94470e9SBen Skeggs
37d94470e9SBen Skeggs nvkm_runl_add(runl, 0, fifo->func->engn_sw, NVKM_ENGINE_SW, 0);
38d94470e9SBen Skeggs nvkm_runl_add(runl, 0, fifo->func->engn_sw, NVKM_ENGINE_DMAOBJ, 0);
39d94470e9SBen Skeggs nvkm_runl_add(runl, 1, fifo->func->engn, NVKM_ENGINE_GR, 0);
40d94470e9SBen Skeggs nvkm_runl_add(runl, 2, fifo->func->engn, NVKM_ENGINE_MSPPP, 0);
41d94470e9SBen Skeggs nvkm_runl_add(runl, 3, fifo->func->engn, NVKM_ENGINE_CE, 0);
42d94470e9SBen Skeggs nvkm_runl_add(runl, 4, fifo->func->engn, NVKM_ENGINE_MSPDEC, 0);
43d94470e9SBen Skeggs nvkm_runl_add(runl, 5, fifo->func->engn, NVKM_ENGINE_SEC, 0);
44d94470e9SBen Skeggs nvkm_runl_add(runl, 6, fifo->func->engn, NVKM_ENGINE_MSVLD, 0);
45d94470e9SBen Skeggs return 0;
46d94470e9SBen Skeggs }
47d94470e9SBen Skeggs
48d94470e9SBen Skeggs static const struct nvkm_fifo_func
49d94470e9SBen Skeggs g98_fifo = {
50d94470e9SBen Skeggs .chid_nr = nv50_fifo_chid_nr,
51d94470e9SBen Skeggs .chid_ctor = nv50_fifo_chid_ctor,
52d94470e9SBen Skeggs .runl_ctor = g98_fifo_runl_ctor,
53d94470e9SBen Skeggs .init = nv50_fifo_init,
54d94470e9SBen Skeggs .intr = nv04_fifo_intr,
55d94470e9SBen Skeggs .pause = nv04_fifo_pause,
56d94470e9SBen Skeggs .start = nv04_fifo_start,
57d67f3b96SBen Skeggs .nonstall = &g84_fifo_nonstall,
58d94470e9SBen Skeggs .runl = &nv50_runl,
59d94470e9SBen Skeggs .engn = &g84_engn,
60d94470e9SBen Skeggs .engn_sw = &nv50_engn_sw,
61d94470e9SBen Skeggs .cgrp = {{ }, &nv04_cgrp },
62*06db7fdeSBen Skeggs .chan = {{ 0, 0, G82_CHANNEL_GPFIFO }, &g84_chan },
63d94470e9SBen Skeggs };
64d94470e9SBen Skeggs
65d94470e9SBen Skeggs int
g98_fifo_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_fifo ** pfifo)66d94470e9SBen Skeggs g98_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
67d94470e9SBen Skeggs struct nvkm_fifo **pfifo)
68d94470e9SBen Skeggs {
69*06db7fdeSBen Skeggs return nvkm_fifo_new_(&g98_fifo, device, type, inst, pfifo);
70d94470e9SBen Skeggs }
71