gk104.h 1.8 KB
Newer Older
1 2
#ifndef __GK104_FIFO_H__
#define __GK104_FIFO_H__
3
#define gk104_fifo(p) container_of((p), struct gk104_fifo, base)
4
#include "priv.h"
5

6 7
#include <subdev/mmu.h>

8
struct gk104_fifo_chan;
9 10 11
struct gk104_fifo {
	struct nvkm_fifo base;

12 13
	struct {
		struct work_struct work;
14 15
		u32 engm;
		u32 runm;
16
	} recover;
17

18 19
	int pbdma_nr;

20 21 22 23 24 25 26
	struct {
		struct nvkm_engine *engine;
		int runl;
		int pbid;
	} engine[16];
	int engine_nr;

27 28 29 30 31
	struct {
		struct nvkm_memory *mem[2];
		int next;
		wait_queue_head_t wait;
		struct list_head chan;
32 33 34
		u32 engm;
	} runlist[16];
	int runlist_nr;
35

36 37 38 39 40
	struct {
		struct nvkm_memory *mem;
		struct nvkm_vma bar;
	} user;
};
41

42 43 44 45 46 47 48 49 50
int gk104_fifo_new_(const struct nvkm_fifo_func *, struct nvkm_device *,
		    int index, int nr, struct nvkm_fifo **);
void *gk104_fifo_dtor(struct nvkm_fifo *);
int gk104_fifo_oneinit(struct nvkm_fifo *);
void gk104_fifo_init(struct nvkm_fifo *);
void gk104_fifo_fini(struct nvkm_fifo *);
void gk104_fifo_intr(struct nvkm_fifo *);
void gk104_fifo_uevent_init(struct nvkm_fifo *);
void gk104_fifo_uevent_fini(struct nvkm_fifo *);
51 52
void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *);
void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *);
53
void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl);
54

55 56 57 58
static inline u64
gk104_fifo_engine_subdev(int engine)
{
	switch (engine) {
59 60 61 62 63 64 65 66 67
	case 0: return (1ULL << NVKM_ENGINE_GR) |
		       (1ULL << NVKM_ENGINE_SW) |
		       (1ULL << NVKM_ENGINE_CE2);
	case 1: return (1ULL << NVKM_ENGINE_MSPDEC);
	case 2: return (1ULL << NVKM_ENGINE_MSPPP);
	case 3: return (1ULL << NVKM_ENGINE_MSVLD);
	case 4: return (1ULL << NVKM_ENGINE_CE0);
	case 5: return (1ULL << NVKM_ENGINE_CE1);
	case 6: return (1ULL << NVKM_ENGINE_MSENC);
68 69 70 71 72
	default:
		WARN_ON(1);
		return 0;
	}
}
73
#endif