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
{
49 void (*fault
)(struct nvkm_fifo
*, int unit
);
52 const struct gk104_fifo_pbdma_func
{
53 int (*nr
)(struct gk104_fifo
*);
54 void (*init
)(struct gk104_fifo
*);
55 void (*init_timeout
)(struct gk104_fifo
*);
59 const struct nvkm_enum
*access
;
60 const struct nvkm_enum
*engine
;
61 const struct nvkm_enum
*reason
;
62 const struct nvkm_enum
*hubclient
;
63 const struct nvkm_enum
*gpcclient
;
66 const struct gk104_fifo_runlist_func
{
68 void (*cgrp
)(struct nvkm_fifo_cgrp
*,
69 struct nvkm_memory
*, u32 offset
);
70 void (*chan
)(struct gk104_fifo_chan
*,
71 struct nvkm_memory
*, u32 offset
);
72 void (*commit
)(struct gk104_fifo
*, int runl
,
73 struct nvkm_memory
*, int entries
);
76 struct gk104_fifo_user_user
{
77 struct nvkm_sclass user
;
78 int (*ctor
)(const struct nvkm_oclass
*, void *, u32
,
79 struct nvkm_object
**);
82 struct gk104_fifo_chan_user
{
83 struct nvkm_sclass user
;
84 int (*ctor
)(struct gk104_fifo
*, const struct nvkm_oclass
*,
85 void *, u32
, struct nvkm_object
**);
90 int gk104_fifo_new_(const struct gk104_fifo_func
*, struct nvkm_device
*,
91 int index
, int nr
, struct nvkm_fifo
**);
92 void gk104_fifo_runlist_insert(struct gk104_fifo
*, struct gk104_fifo_chan
*);
93 void gk104_fifo_runlist_remove(struct gk104_fifo
*, struct gk104_fifo_chan
*);
94 void gk104_fifo_runlist_update(struct gk104_fifo
*, int runl
);
96 extern const struct gk104_fifo_pbdma_func gk104_fifo_pbdma
;
97 int gk104_fifo_pbdma_nr(struct gk104_fifo
*);
98 void gk104_fifo_pbdma_init(struct gk104_fifo
*);
99 extern const struct nvkm_enum gk104_fifo_fault_access
[];
100 extern const struct nvkm_enum gk104_fifo_fault_engine
[];
101 extern const struct nvkm_enum gk104_fifo_fault_reason
[];
102 extern const struct nvkm_enum gk104_fifo_fault_hubclient
[];
103 extern const struct nvkm_enum gk104_fifo_fault_gpcclient
[];
104 extern const struct gk104_fifo_runlist_func gk104_fifo_runlist
;
105 void gk104_fifo_runlist_chan(struct gk104_fifo_chan
*,
106 struct nvkm_memory
*, u32
);
107 void gk104_fifo_runlist_commit(struct gk104_fifo
*, int runl
,
108 struct nvkm_memory
*, int);
110 extern const struct gk104_fifo_runlist_func gk110_fifo_runlist
;
111 void gk110_fifo_runlist_cgrp(struct nvkm_fifo_cgrp
*,
112 struct nvkm_memory
*, u32
);
114 extern const struct gk104_fifo_pbdma_func gk208_fifo_pbdma
;
115 void gk208_fifo_pbdma_init_timeout(struct gk104_fifo
*);
117 void gm107_fifo_intr_fault(struct nvkm_fifo
*, int);
118 extern const struct nvkm_enum gm107_fifo_fault_engine
[];
119 extern const struct gk104_fifo_runlist_func gm107_fifo_runlist
;
121 extern const struct gk104_fifo_pbdma_func gm200_fifo_pbdma
;
122 int gm200_fifo_pbdma_nr(struct gk104_fifo
*);
124 void gp100_fifo_intr_fault(struct nvkm_fifo
*, int);
125 extern const struct nvkm_enum gp100_fifo_fault_engine
[];
127 extern const struct nvkm_enum gv100_fifo_fault_access
[];
128 extern const struct nvkm_enum gv100_fifo_fault_reason
[];
129 extern const struct nvkm_enum gv100_fifo_fault_hubclient
[];
130 extern const struct nvkm_enum gv100_fifo_fault_gpcclient
[];
131 void gv100_fifo_runlist_cgrp(struct nvkm_fifo_cgrp
*,
132 struct nvkm_memory
*, u32
);
133 void gv100_fifo_runlist_chan(struct gk104_fifo_chan
*,
134 struct nvkm_memory
*, u32
);