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