1 /* $NetBSD: nouveau_nvkm_engine_fifo_gk208.c,v 1.3 2021/12/18 23:45:35 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
25 */
26 #include <sys/cdefs.h>
27 __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_fifo_gk208.c,v 1.3 2021/12/18 23:45:35 riastradh Exp $");
28
29 #include "gk104.h"
30 #include "changk104.h"
31
32 #include <nvif/class.h>
33
34 void
gk208_fifo_pbdma_init_timeout(struct gk104_fifo * fifo)35 gk208_fifo_pbdma_init_timeout(struct gk104_fifo *fifo)
36 {
37 struct nvkm_device *device = fifo->base.engine.subdev.device;
38 int i;
39
40 for (i = 0; i < fifo->pbdma_nr; i++)
41 nvkm_wr32(device, 0x04012c + (i * 0x2000), 0x0000ffff);
42 }
43
44 const struct gk104_fifo_pbdma_func
45 gk208_fifo_pbdma = {
46 .nr = gk104_fifo_pbdma_nr,
47 .init = gk104_fifo_pbdma_init,
48 .init_timeout = gk208_fifo_pbdma_init_timeout,
49 };
50
51 static const struct gk104_fifo_func
52 gk208_fifo = {
53 .intr.fault = gf100_fifo_intr_fault,
54 .pbdma = &gk208_fifo_pbdma,
55 .fault.access = gk104_fifo_fault_access,
56 .fault.engine = gk104_fifo_fault_engine,
57 .fault.reason = gk104_fifo_fault_reason,
58 .fault.hubclient = gk104_fifo_fault_hubclient,
59 .fault.gpcclient = gk104_fifo_fault_gpcclient,
60 .runlist = &gk110_fifo_runlist,
61 .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
62 };
63
64 int
gk208_fifo_new(struct nvkm_device * device,int index,struct nvkm_fifo ** pfifo)65 gk208_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo)
66 {
67 return gk104_fifo_new_(&gk208_fifo, device, index, 1024, pfifo);
68 }
69