1 /* $NetBSD: nouveau_nvkm_engine_fifo_gk110.c,v 1.2 2021/12/18 23:45:35 riastradh Exp $ */
2
3 /*
4 * Copyright 2016 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
25 */
26 #include <sys/cdefs.h>
27 __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_fifo_gk110.c,v 1.2 2021/12/18 23:45:35 riastradh Exp $");
28
29 #include "gk104.h"
30 #include "cgrp.h"
31 #include "changk104.h"
32
33 #include <core/memory.h>
34
35 #include <nvif/class.h>
36
37 void
gk110_fifo_runlist_cgrp(struct nvkm_fifo_cgrp * cgrp,struct nvkm_memory * memory,u32 offset)38 gk110_fifo_runlist_cgrp(struct nvkm_fifo_cgrp *cgrp,
39 struct nvkm_memory *memory, u32 offset)
40 {
41 nvkm_wo32(memory, offset + 0, (cgrp->chan_nr << 26) | (128 << 18) |
42 (3 << 14) | 0x00002000 | cgrp->id);
43 nvkm_wo32(memory, offset + 4, 0x00000000);
44 }
45
46 const struct gk104_fifo_runlist_func
47 gk110_fifo_runlist = {
48 .size = 8,
49 .cgrp = gk110_fifo_runlist_cgrp,
50 .chan = gk104_fifo_runlist_chan,
51 .commit = gk104_fifo_runlist_commit,
52 };
53
54 static const struct gk104_fifo_func
55 gk110_fifo = {
56 .intr.fault = gf100_fifo_intr_fault,
57 .pbdma = &gk104_fifo_pbdma,
58 .fault.access = gk104_fifo_fault_access,
59 .fault.engine = gk104_fifo_fault_engine,
60 .fault.reason = gk104_fifo_fault_reason,
61 .fault.hubclient = gk104_fifo_fault_hubclient,
62 .fault.gpcclient = gk104_fifo_fault_gpcclient,
63 .runlist = &gk110_fifo_runlist,
64 .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_B}, gk104_fifo_gpfifo_new },
65 };
66
67 int
gk110_fifo_new(struct nvkm_device * device,int index,struct nvkm_fifo ** pfifo)68 gk110_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo)
69 {
70 return gk104_fifo_new_(&gk110_fifo, device, index, 4096, pfifo);
71 }
72