xref: /openbmc/linux/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c (revision f48dd2936138882d7755cbbc5d9984015c75980c)
1 /*
2  * Copyright 2013 Red Hat Inc.
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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: Ben Skeggs
23  */
24 #include "runq.h"
25 #include "gk104.h"
26 #include "changk104.h"
27 
28 #include <nvif/class.h>
29 
30 void
31 gk208_runq_init(struct nvkm_runq *runq)
32 {
33 	gk104_runq_init(runq);
34 
35 	nvkm_wr32(runq->fifo->engine.subdev.device, 0x04012c + (runq->id * 0x2000), 0x000f4240);
36 }
37 
38 const struct nvkm_runq_func
39 gk208_runq = {
40 	.init = gk208_runq_init,
41 	.intr = gk104_runq_intr,
42 	.intr_0_names = gk104_runq_intr_0_names,
43 };
44 
45 static int
46 gk208_fifo_chid_nr(struct nvkm_fifo *fifo)
47 {
48 	return 1024;
49 }
50 
51 static const struct nvkm_fifo_func
52 gk208_fifo = {
53 	.dtor = gk104_fifo_dtor,
54 	.oneinit = gk104_fifo_oneinit,
55 	.chid_nr = gk208_fifo_chid_nr,
56 	.chid_ctor = gk110_fifo_chid_ctor,
57 	.runq_nr = gf100_fifo_runq_nr,
58 	.runl_ctor = gk104_fifo_runl_ctor,
59 	.init = gk104_fifo_init,
60 	.init_pbdmas = gk104_fifo_init_pbdmas,
61 	.fini = gk104_fifo_fini,
62 	.intr = gk104_fifo_intr,
63 	.intr_mmu_fault_unit = gf100_fifo_intr_mmu_fault_unit,
64 	.mmu_fault = &gk104_fifo_mmu_fault,
65 	.engine_id = gk104_fifo_engine_id,
66 	.recover_chan = gk104_fifo_recover_chan,
67 	.runlist = &gk110_fifo_runlist,
68 	.nonstall = &gf100_fifo_nonstall,
69 	.runl = &gk110_runl,
70 	.runq = &gk208_runq,
71 	.engn = &gk104_engn,
72 	.engn_ce = &gk104_engn_ce,
73 	.cgrp = {{ 0, 0, KEPLER_CHANNEL_GROUP_A  }, &gk110_cgrp },
74 	.chan = {{ 0, 0, KEPLER_CHANNEL_GPFIFO_A }, &gk110_chan, .ctor = &gk104_fifo_gpfifo_new },
75 };
76 
77 int
78 gk208_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
79 	       struct nvkm_fifo **pfifo)
80 {
81 	return gk104_fifo_new_(&gk208_fifo, device, type, inst, 0, pfifo);
82 }
83