1 /* SPDX-License-Identifier: MIT */
2 #ifndef __GK104_FIFO_H__
3 #define __GK104_FIFO_H__
4 #define gk104_fifo(p) container_of((p), struct gk104_fifo, base)
9 #include <subdev/mmu.h>
11 struct gk104_fifo_chan;
13 const struct gk104_fifo_func *func;
14 struct nvkm_fifo base;
17 struct work_struct work;
25 struct nvkm_engine *engine;
32 struct nvkm_memory *mem[2];
34 wait_queue_head_t wait;
35 struct list_head cgrp;
36 struct list_head chan;
42 struct nvkm_memory *mem;
47 struct gk104_fifo_func {
48 const struct gk104_fifo_pbdma_func {
49 int (*nr)(struct gk104_fifo *);
50 void (*init)(struct gk104_fifo *);
51 void (*init_timeout)(struct gk104_fifo *);
55 const struct nvkm_enum *access;
56 const struct nvkm_enum *engine;
57 const struct nvkm_enum *reason;
58 const struct nvkm_enum *hubclient;
59 const struct nvkm_enum *gpcclient;
62 const struct gk104_fifo_runlist_func {
64 void (*cgrp)(struct nvkm_fifo_cgrp *,
65 struct nvkm_memory *, u32 offset);
66 void (*chan)(struct gk104_fifo_chan *,
67 struct nvkm_memory *, u32 offset);
68 void (*commit)(struct gk104_fifo *, int runl,
69 struct nvkm_memory *, int entries);
72 struct gk104_fifo_user_user {
73 struct nvkm_sclass user;
74 int (*ctor)(const struct nvkm_oclass *, void *, u32,
75 struct nvkm_object **);
78 struct gk104_fifo_chan_user {
79 struct nvkm_sclass user;
80 int (*ctor)(struct gk104_fifo *, const struct nvkm_oclass *,
81 void *, u32, struct nvkm_object **);
86 int gk104_fifo_new_(const struct gk104_fifo_func *, struct nvkm_device *,
87 int index, int nr, struct nvkm_fifo **);
88 void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *);
89 void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *);
90 void gk104_fifo_runlist_update(struct gk104_fifo *, int runl);
92 extern const struct gk104_fifo_pbdma_func gk104_fifo_pbdma;
93 int gk104_fifo_pbdma_nr(struct gk104_fifo *);
94 void gk104_fifo_pbdma_init(struct gk104_fifo *);
95 extern const struct nvkm_enum gk104_fifo_fault_access[];
96 extern const struct nvkm_enum gk104_fifo_fault_engine[];
97 extern const struct nvkm_enum gk104_fifo_fault_reason[];
98 extern const struct nvkm_enum gk104_fifo_fault_hubclient[];
99 extern const struct nvkm_enum gk104_fifo_fault_gpcclient[];
100 extern const struct gk104_fifo_runlist_func gk104_fifo_runlist;
101 void gk104_fifo_runlist_chan(struct gk104_fifo_chan *,
102 struct nvkm_memory *, u32);
103 void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl,
104 struct nvkm_memory *, int);
106 extern const struct gk104_fifo_runlist_func gk110_fifo_runlist;
107 void gk110_fifo_runlist_cgrp(struct nvkm_fifo_cgrp *,
108 struct nvkm_memory *, u32);
110 extern const struct gk104_fifo_pbdma_func gk208_fifo_pbdma;
111 void gk208_fifo_pbdma_init_timeout(struct gk104_fifo *);
113 extern const struct nvkm_enum gm107_fifo_fault_engine[];
114 extern const struct gk104_fifo_runlist_func gm107_fifo_runlist;
116 extern const struct gk104_fifo_pbdma_func gm200_fifo_pbdma;
117 int gm200_fifo_pbdma_nr(struct gk104_fifo *);
119 extern const struct nvkm_enum gp100_fifo_fault_engine[];
121 extern const struct nvkm_enum gv100_fifo_fault_access[];
122 extern const struct nvkm_enum gv100_fifo_fault_reason[];
123 extern const struct nvkm_enum gv100_fifo_fault_hubclient[];
124 extern const struct nvkm_enum gv100_fifo_fault_gpcclient[];
125 void gv100_fifo_runlist_cgrp(struct nvkm_fifo_cgrp *,
126 struct nvkm_memory *, u32);
127 void gv100_fifo_runlist_chan(struct gk104_fifo_chan *,
128 struct nvkm_memory *, u32);