Commit | Line | Data |
---|---|---|
c420b2dc BS |
1 | #ifndef __NOUVEAU_FIFO_H__ |
2 | #define __NOUVEAU_FIFO_H__ | |
3 | ||
ebb945a9 BS |
4 | #include <core/namedb.h> |
5 | #include <core/gpuobj.h> | |
6 | #include <core/engine.h> | |
c420b2dc BS |
7 | |
8 | struct nouveau_fifo_chan { | |
ebb945a9 BS |
9 | struct nouveau_namedb base; |
10 | struct nouveau_dmaobj *pushdma; | |
11 | struct nouveau_gpuobj *pushgpu; | |
12 | void __iomem *user; | |
13 | u32 size; | |
14 | u16 chid; | |
15 | atomic_t refcnt; /* NV04_NVSW_SET_REF */ | |
16 | }; | |
17 | ||
18 | static inline struct nouveau_fifo_chan * | |
19 | nouveau_fifo_chan(void *obj) | |
20 | { | |
21 | return (void *)nv_namedb(obj); | |
22 | } | |
23 | ||
24 | #define nouveau_fifo_channel_create(p,e,c,b,a,s,n,m,d) \ | |
25 | nouveau_fifo_channel_create_((p), (e), (c), (b), (a), (s), (n), \ | |
26 | (m), sizeof(**d), (void **)d) | |
27 | #define nouveau_fifo_channel_init(p) \ | |
28 | nouveau_namedb_init(&(p)->base) | |
29 | #define nouveau_fifo_channel_fini(p,s) \ | |
30 | nouveau_namedb_fini(&(p)->base, (s)) | |
31 | ||
32 | int nouveau_fifo_channel_create_(struct nouveau_object *, | |
33 | struct nouveau_object *, | |
34 | struct nouveau_oclass *, | |
35 | int bar, u32 addr, u32 size, u32 push, | |
507ceb15 | 36 | u64 engmask, int len, void **); |
ebb945a9 BS |
37 | void nouveau_fifo_channel_destroy(struct nouveau_fifo_chan *); |
38 | ||
39 | #define _nouveau_fifo_channel_init _nouveau_namedb_init | |
40 | #define _nouveau_fifo_channel_fini _nouveau_namedb_fini | |
41 | ||
42 | void _nouveau_fifo_channel_dtor(struct nouveau_object *); | |
0a32241d BS |
43 | u32 _nouveau_fifo_channel_rd32(struct nouveau_object *, u64); |
44 | void _nouveau_fifo_channel_wr32(struct nouveau_object *, u64, u32); | |
ebb945a9 BS |
45 | |
46 | struct nouveau_fifo_base { | |
47 | struct nouveau_gpuobj base; | |
c420b2dc BS |
48 | }; |
49 | ||
ebb945a9 BS |
50 | #define nouveau_fifo_context_create(p,e,c,g,s,a,f,d) \ |
51 | nouveau_gpuobj_create((p), (e), (c), 0, (g), (s), (a), (f), (d)) | |
52 | #define nouveau_fifo_context_destroy(p) \ | |
53 | nouveau_gpuobj_destroy(&(p)->base) | |
54 | #define nouveau_fifo_context_init(p) \ | |
55 | nouveau_gpuobj_init(&(p)->base) | |
56 | #define nouveau_fifo_context_fini(p,s) \ | |
57 | nouveau_gpuobj_fini(&(p)->base, (s)) | |
58 | ||
59 | #define _nouveau_fifo_context_dtor _nouveau_gpuobj_dtor | |
60 | #define _nouveau_fifo_context_init _nouveau_gpuobj_init | |
61 | #define _nouveau_fifo_context_fini _nouveau_gpuobj_fini | |
62 | #define _nouveau_fifo_context_rd32 _nouveau_gpuobj_rd32 | |
63 | #define _nouveau_fifo_context_wr32 _nouveau_gpuobj_wr32 | |
64 | ||
65 | struct nouveau_fifo { | |
66 | struct nouveau_engine base; | |
67 | ||
893e90c5 BS |
68 | struct nouveau_event *cevent; /* channel creation event */ |
69 | struct nouveau_event *uevent; /* async user trigger */ | |
9bd2ddba | 70 | |
ebb945a9 BS |
71 | struct nouveau_object **channel; |
72 | spinlock_t lock; | |
73 | u16 min; | |
74 | u16 max; | |
75 | ||
0c5b8cec | 76 | int (*chid)(struct nouveau_fifo *, struct nouveau_object *); |
ebb945a9 BS |
77 | void (*pause)(struct nouveau_fifo *, unsigned long *); |
78 | void (*start)(struct nouveau_fifo *, unsigned long *); | |
79 | }; | |
80 | ||
81 | static inline struct nouveau_fifo * | |
82 | nouveau_fifo(void *obj) | |
83 | { | |
84 | return (void *)nv_device(obj)->subdev[NVDEV_ENGINE_FIFO]; | |
85 | } | |
86 | ||
87 | #define nouveau_fifo_create(o,e,c,fc,lc,d) \ | |
88 | nouveau_fifo_create_((o), (e), (c), (fc), (lc), sizeof(**d), (void **)d) | |
89 | #define nouveau_fifo_init(p) \ | |
90 | nouveau_engine_init(&(p)->base) | |
91 | #define nouveau_fifo_fini(p,s) \ | |
92 | nouveau_engine_fini(&(p)->base, (s)) | |
93 | ||
94 | int nouveau_fifo_create_(struct nouveau_object *, struct nouveau_object *, | |
95 | struct nouveau_oclass *, int min, int max, | |
96 | int size, void **); | |
97 | void nouveau_fifo_destroy(struct nouveau_fifo *); | |
a2896ced MS |
98 | const char * |
99 | nouveau_client_name_for_fifo_chid(struct nouveau_fifo *fifo, u32 chid); | |
ebb945a9 BS |
100 | |
101 | #define _nouveau_fifo_init _nouveau_engine_init | |
102 | #define _nouveau_fifo_fini _nouveau_engine_fini | |
103 | ||
16c4f227 BS |
104 | extern struct nouveau_oclass *nv04_fifo_oclass; |
105 | extern struct nouveau_oclass *nv10_fifo_oclass; | |
106 | extern struct nouveau_oclass *nv17_fifo_oclass; | |
107 | extern struct nouveau_oclass *nv40_fifo_oclass; | |
108 | extern struct nouveau_oclass *nv50_fifo_oclass; | |
109 | extern struct nouveau_oclass *nv84_fifo_oclass; | |
110 | extern struct nouveau_oclass *nvc0_fifo_oclass; | |
111 | extern struct nouveau_oclass *nve0_fifo_oclass; | |
86ebef72 | 112 | extern struct nouveau_oclass *gk20a_fifo_oclass; |
a763951a | 113 | extern struct nouveau_oclass *nv108_fifo_oclass; |
ebb945a9 BS |
114 | |
115 | void nv04_fifo_intr(struct nouveau_subdev *); | |
4c2d4222 | 116 | int nv04_fifo_context_attach(struct nouveau_object *, struct nouveau_object *); |
c420b2dc BS |
117 | |
118 | #endif |