1 #ifndef __NVKM_FIFO_H__
2 #define __NVKM_FIFO_H__
3 #include <core/engine.h>
4 #include <core/event.h>
5 
6 #define NVKM_FIFO_CHID_NR 4096
7 
8 struct nvkm_fifo_engn {
9 	struct nvkm_object *object;
10 	int refcount;
11 	int usecount;
12 };
13 
14 struct nvkm_fifo_chan {
15 	const struct nvkm_fifo_chan_func *func;
16 	struct nvkm_fifo *fifo;
17 	u64 engines;
18 	struct nvkm_object object;
19 
20 	struct list_head head;
21 	u16 chid;
22 	struct nvkm_gpuobj *inst;
23 	struct nvkm_gpuobj *push;
24 	struct nvkm_vm *vm;
25 	void __iomem *user;
26 	u64 addr;
27 	u32 size;
28 
29 	struct nvkm_fifo_engn engn[NVKM_SUBDEV_NR];
30 };
31 
32 struct nvkm_fifo {
33 	const struct nvkm_fifo_func *func;
34 	struct nvkm_engine engine;
35 
36 	DECLARE_BITMAP(mask, NVKM_FIFO_CHID_NR);
37 	int nr;
38 	struct list_head chan;
39 	spinlock_t lock;
40 
41 	struct nvkm_event uevent; /* async user trigger */
42 	struct nvkm_event cevent; /* channel creation event */
43 };
44 
45 void nvkm_fifo_pause(struct nvkm_fifo *, unsigned long *);
46 void nvkm_fifo_start(struct nvkm_fifo *, unsigned long *);
47 
48 void nvkm_fifo_chan_put(struct nvkm_fifo *, unsigned long flags,
49 			struct nvkm_fifo_chan **);
50 struct nvkm_fifo_chan *
51 nvkm_fifo_chan_inst(struct nvkm_fifo *, u64 inst, unsigned long *flags);
52 struct nvkm_fifo_chan *
53 nvkm_fifo_chan_chid(struct nvkm_fifo *, int chid, unsigned long *flags);
54 
55 int nv04_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
56 int nv10_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
57 int nv17_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
58 int nv40_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
59 int nv50_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
60 int g84_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
61 int gf100_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
62 int gk104_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
63 int gk208_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
64 int gk20a_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
65 int gm204_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
66 int gm20b_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
67 #endif
68