This source file includes following definitions.
- g84_fifo_gpfifo_new
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "channv50.h"
25
26 #include <core/client.h>
27 #include <core/ramht.h>
28
29 #include <nvif/class.h>
30 #include <nvif/cl826f.h>
31 #include <nvif/unpack.h>
32
33 static int
34 g84_fifo_gpfifo_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
35 void *data, u32 size, struct nvkm_object **pobject)
36 {
37 struct nvkm_object *parent = oclass->parent;
38 union {
39 struct g82_channel_gpfifo_v0 v0;
40 } *args = data;
41 struct nv50_fifo *fifo = nv50_fifo(base);
42 struct nv50_fifo_chan *chan;
43 u64 ioffset, ilength;
44 int ret = -ENOSYS;
45
46 nvif_ioctl(parent, "create channel gpfifo size %d\n", size);
47 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
48 nvif_ioctl(parent, "create channel gpfifo vers %d vmm %llx "
49 "pushbuf %llx ioffset %016llx "
50 "ilength %08x\n",
51 args->v0.version, args->v0.vmm, args->v0.pushbuf,
52 args->v0.ioffset, args->v0.ilength);
53 if (!args->v0.pushbuf)
54 return -EINVAL;
55 } else
56 return ret;
57
58 if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL)))
59 return -ENOMEM;
60 *pobject = &chan->base.object;
61
62 ret = g84_fifo_chan_ctor(fifo, args->v0.vmm, args->v0.pushbuf,
63 oclass, chan);
64 if (ret)
65 return ret;
66
67 args->v0.chid = chan->base.chid;
68 ioffset = args->v0.ioffset;
69 ilength = order_base_2(args->v0.ilength / 8);
70
71 nvkm_kmap(chan->ramfc);
72 nvkm_wo32(chan->ramfc, 0x3c, 0x403f6078);
73 nvkm_wo32(chan->ramfc, 0x44, 0x01003fff);
74 nvkm_wo32(chan->ramfc, 0x48, chan->base.push->node->offset >> 4);
75 nvkm_wo32(chan->ramfc, 0x50, lower_32_bits(ioffset));
76 nvkm_wo32(chan->ramfc, 0x54, upper_32_bits(ioffset) | (ilength << 16));
77 nvkm_wo32(chan->ramfc, 0x60, 0x7fffffff);
78 nvkm_wo32(chan->ramfc, 0x78, 0x00000000);
79 nvkm_wo32(chan->ramfc, 0x7c, 0x30000001);
80 nvkm_wo32(chan->ramfc, 0x80, ((chan->ramht->bits - 9) << 27) |
81 (4 << 24) |
82 (chan->ramht->gpuobj->node->offset >> 4));
83 nvkm_wo32(chan->ramfc, 0x88, chan->cache->addr >> 10);
84 nvkm_wo32(chan->ramfc, 0x98, chan->base.inst->addr >> 12);
85 nvkm_done(chan->ramfc);
86 return 0;
87 }
88
89 const struct nvkm_fifo_chan_oclass
90 g84_fifo_gpfifo_oclass = {
91 .base.oclass = G82_CHANNEL_GPFIFO,
92 .base.minver = 0,
93 .base.maxver = 0,
94 .ctor = g84_fifo_gpfifo_new,
95 };