Commit | Line | Data |
---|---|---|
05c7145d BS |
1 | #ifndef __NVKM_FIFO_H__ |
2 | #define __NVKM_FIFO_H__ | |
ebb945a9 | 3 | #include <core/namedb.h> |
c420b2dc | 4 | |
05c7145d BS |
5 | struct nvkm_fifo_chan { |
6 | struct nvkm_namedb namedb; | |
05c7145d | 7 | struct nvkm_gpuobj *pushgpu; |
ebb945a9 | 8 | void __iomem *user; |
6c6ae061 | 9 | u64 addr; |
ebb945a9 BS |
10 | u32 size; |
11 | u16 chid; | |
344c2d42 | 12 | u64 inst; |
ebb945a9 BS |
13 | }; |
14 | ||
05c7145d BS |
15 | static inline struct nvkm_fifo_chan * |
16 | nvkm_fifo_chan(void *obj) | |
ebb945a9 BS |
17 | { |
18 | return (void *)nv_namedb(obj); | |
19 | } | |
20 | ||
05c7145d BS |
21 | #include <core/gpuobj.h> |
22 | ||
23 | struct nvkm_fifo_base { | |
24 | struct nvkm_gpuobj gpuobj; | |
c420b2dc BS |
25 | }; |
26 | ||
05c7145d | 27 | #define nvkm_fifo_context_create(p,e,c,g,s,a,f,d) \ |
493f189d | 28 | nvkm_gpuobj_create((p), (e), (c), NV_ENGCTX_CLASS, (g), (s), (a), (f), (d)) |
05c7145d BS |
29 | #define nvkm_fifo_context_destroy(p) \ |
30 | nvkm_gpuobj_destroy(&(p)->gpuobj) | |
31 | #define nvkm_fifo_context_init(p) \ | |
32 | nvkm_gpuobj_init(&(p)->gpuobj) | |
33 | #define nvkm_fifo_context_fini(p,s) \ | |
34 | nvkm_gpuobj_fini(&(p)->gpuobj, (s)) | |
35 | ||
36 | #define _nvkm_fifo_context_dtor _nvkm_gpuobj_dtor | |
37 | #define _nvkm_fifo_context_init _nvkm_gpuobj_init | |
38 | #define _nvkm_fifo_context_fini _nvkm_gpuobj_fini | |
39 | #define _nvkm_fifo_context_rd32 _nvkm_gpuobj_rd32 | |
40 | #define _nvkm_fifo_context_wr32 _nvkm_gpuobj_wr32 | |
ebb945a9 | 41 | |
05c7145d BS |
42 | #include <core/engine.h> |
43 | #include <core/event.h> | |
ebb945a9 | 44 | |
05c7145d | 45 | struct nvkm_fifo { |
6189f1b0 | 46 | struct nvkm_engine engine; |
ebb945a9 | 47 | |
79ca2770 BS |
48 | struct nvkm_event cevent; /* channel creation event */ |
49 | struct nvkm_event uevent; /* async user trigger */ | |
9bd2ddba | 50 | |
05c7145d | 51 | struct nvkm_object **channel; |
ebb945a9 BS |
52 | spinlock_t lock; |
53 | u16 min; | |
54 | u16 max; | |
55 | ||
05c7145d BS |
56 | int (*chid)(struct nvkm_fifo *, struct nvkm_object *); |
57 | void (*pause)(struct nvkm_fifo *, unsigned long *); | |
58 | void (*start)(struct nvkm_fifo *, unsigned long *); | |
ebb945a9 BS |
59 | }; |
60 | ||
344c2d42 BS |
61 | void nvkm_fifo_chan_put(struct nvkm_fifo *, unsigned long flags, |
62 | struct nvkm_fifo_chan **); | |
63 | struct nvkm_fifo_chan * | |
64 | nvkm_fifo_chan_inst(struct nvkm_fifo *, u64 inst, unsigned long *flags); | |
65 | struct nvkm_fifo_chan * | |
66 | nvkm_fifo_chan_chid(struct nvkm_fifo *, int chid, unsigned long *flags); | |
67 | ||
05c7145d BS |
68 | static inline struct nvkm_fifo * |
69 | nvkm_fifo(void *obj) | |
ebb945a9 | 70 | { |
05c7145d | 71 | return (void *)nvkm_engine(obj, NVDEV_ENGINE_FIFO); |
ebb945a9 BS |
72 | } |
73 | ||
05c7145d BS |
74 | #define nvkm_fifo_create(o,e,c,fc,lc,d) \ |
75 | nvkm_fifo_create_((o), (e), (c), (fc), (lc), sizeof(**d), (void **)d) | |
76 | #define nvkm_fifo_init(p) \ | |
89c651e2 | 77 | nvkm_engine_init_old(&(p)->engine) |
05c7145d | 78 | #define nvkm_fifo_fini(p,s) \ |
89c651e2 | 79 | nvkm_engine_fini_old(&(p)->engine, (s)) |
ebb945a9 | 80 | |
05c7145d BS |
81 | int nvkm_fifo_create_(struct nvkm_object *, struct nvkm_object *, |
82 | struct nvkm_oclass *, int min, int max, | |
ebb945a9 | 83 | int size, void **); |
05c7145d | 84 | void nvkm_fifo_destroy(struct nvkm_fifo *); |
a2896ced | 85 | const char * |
05c7145d BS |
86 | nvkm_client_name_for_fifo_chid(struct nvkm_fifo *fifo, u32 chid); |
87 | ||
88 | #define _nvkm_fifo_init _nvkm_engine_init | |
89 | #define _nvkm_fifo_fini _nvkm_engine_fini | |
90 | ||
91 | extern struct nvkm_oclass *nv04_fifo_oclass; | |
92 | extern struct nvkm_oclass *nv10_fifo_oclass; | |
93 | extern struct nvkm_oclass *nv17_fifo_oclass; | |
94 | extern struct nvkm_oclass *nv40_fifo_oclass; | |
95 | extern struct nvkm_oclass *nv50_fifo_oclass; | |
96 | extern struct nvkm_oclass *g84_fifo_oclass; | |
97 | extern struct nvkm_oclass *gf100_fifo_oclass; | |
98 | extern struct nvkm_oclass *gk104_fifo_oclass; | |
99 | extern struct nvkm_oclass *gk20a_fifo_oclass; | |
100 | extern struct nvkm_oclass *gk208_fifo_oclass; | |
89025bd4 | 101 | extern struct nvkm_oclass *gm204_fifo_oclass; |
3326060a | 102 | extern struct nvkm_oclass *gm20b_fifo_oclass; |
05c7145d BS |
103 | |
104 | int nvkm_fifo_uevent_ctor(struct nvkm_object *, void *, u32, | |
105 | struct nvkm_notify *); | |
106 | void nvkm_fifo_uevent(struct nvkm_fifo *); | |
107 | ||
108 | void nv04_fifo_intr(struct nvkm_subdev *); | |
109 | int nv04_fifo_context_attach(struct nvkm_object *, struct nvkm_object *); | |
c420b2dc | 110 | #endif |