1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_SW_CHAN_H__
3 #define __NVKM_SW_CHAN_H__
4 #define nvkm_sw_chan(p) container_of((p), struct nvkm_sw_chan, object)
5 #include <core/object.h>
6 #include <core/event.h>
7 
8 #include "priv.h"
9 
10 struct nvkm_sw_chan {
11 	const struct nvkm_sw_chan_func *func;
12 	struct nvkm_object object;
13 	struct nvkm_sw *sw;
14 	struct nvkm_fifo_chan *fifo;
15 	struct list_head head;
16 
17 	struct nvkm_event event;
18 };
19 
20 struct nvkm_sw_chan_func {
21 	void *(*dtor)(struct nvkm_sw_chan *);
22 	bool (*mthd)(struct nvkm_sw_chan *, int subc, u32 mthd, u32 data);
23 };
24 
25 int nvkm_sw_chan_ctor(const struct nvkm_sw_chan_func *, struct nvkm_sw *,
26 		      struct nvkm_fifo_chan *, const struct nvkm_oclass *,
27 		      struct nvkm_sw_chan *);
28 bool nvkm_sw_chan_mthd(struct nvkm_sw_chan *, int subc, u32 mthd, u32 data);
29 #endif
30