xref: /openbmc/linux/drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h (revision 4da722ca19f30f7db250db808d1ab1703607a932)
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 	struct nvkm_event kevent; /* channel killed */
44 };
45 
46 void nvkm_fifo_pause(struct nvkm_fifo *, unsigned long *);
47 void nvkm_fifo_start(struct nvkm_fifo *, unsigned long *);
48 
49 void nvkm_fifo_chan_put(struct nvkm_fifo *, unsigned long flags,
50 			struct nvkm_fifo_chan **);
51 struct nvkm_fifo_chan *
52 nvkm_fifo_chan_inst(struct nvkm_fifo *, u64 inst, unsigned long *flags);
53 struct nvkm_fifo_chan *
54 nvkm_fifo_chan_chid(struct nvkm_fifo *, int chid, unsigned long *flags);
55 
56 int nv04_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
57 int nv10_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
58 int nv17_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
59 int nv40_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
60 int nv50_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
61 int g84_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
62 int gf100_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
63 int gk104_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
64 int gk110_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
65 int gk208_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
66 int gk20a_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
67 int gm107_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
68 int gm200_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
69 int gm20b_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
70 int gp100_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
71 int gp10b_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
72 #endif
73