1 #ifndef __NOUVEAU_FIFO_H__
2 #define __NOUVEAU_FIFO_H__
4 #include <core/namedb.h>
5 #include <core/gpuobj.h>
6 #include <core/engine.h>
8 struct nouveau_fifo_chan
{
9 struct nouveau_namedb base
;
10 struct nouveau_dmaobj
*pushdma
;
11 struct nouveau_gpuobj
*pushgpu
;
15 atomic_t refcnt
; /* NV04_NVSW_SET_REF */
18 static inline struct nouveau_fifo_chan
*
19 nouveau_fifo_chan(void *obj
)
21 return (void *)nv_namedb(obj
);
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))
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
,
36 u32 engmask
, int len
, void **);
37 void nouveau_fifo_channel_destroy(struct nouveau_fifo_chan
*);
39 #define _nouveau_fifo_channel_init _nouveau_namedb_init
40 #define _nouveau_fifo_channel_fini _nouveau_namedb_fini
42 void _nouveau_fifo_channel_dtor(struct nouveau_object
*);
43 u32
_nouveau_fifo_channel_rd32(struct nouveau_object
*, u32
);
44 void _nouveau_fifo_channel_wr32(struct nouveau_object
*, u32
, u32
);
46 struct nouveau_fifo_base
{
47 struct nouveau_gpuobj base
;
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))
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
66 struct nouveau_engine base
;
68 struct nouveau_object
**channel
;
73 void (*pause
)(struct nouveau_fifo
*, unsigned long *);
74 void (*start
)(struct nouveau_fifo
*, unsigned long *);
77 static inline struct nouveau_fifo
*
78 nouveau_fifo(void *obj
)
80 return (void *)nv_device(obj
)->subdev
[NVDEV_ENGINE_FIFO
];
83 #define nouveau_fifo_create(o,e,c,fc,lc,d) \
84 nouveau_fifo_create_((o), (e), (c), (fc), (lc), sizeof(**d), (void **)d)
85 #define nouveau_fifo_init(p) \
86 nouveau_engine_init(&(p)->base)
87 #define nouveau_fifo_fini(p,s) \
88 nouveau_engine_fini(&(p)->base, (s))
90 int nouveau_fifo_create_(struct nouveau_object
*, struct nouveau_object
*,
91 struct nouveau_oclass
*, int min
, int max
,
93 void nouveau_fifo_destroy(struct nouveau_fifo
*);
95 #define _nouveau_fifo_init _nouveau_engine_init
96 #define _nouveau_fifo_fini _nouveau_engine_fini
98 extern struct nouveau_oclass nv04_fifo_oclass
;
99 extern struct nouveau_oclass nv10_fifo_oclass
;
100 extern struct nouveau_oclass nv17_fifo_oclass
;
101 extern struct nouveau_oclass nv40_fifo_oclass
;
102 extern struct nouveau_oclass nv50_fifo_oclass
;
103 extern struct nouveau_oclass nv84_fifo_oclass
;
104 extern struct nouveau_oclass nvc0_fifo_oclass
;
105 extern struct nouveau_oclass nve0_fifo_oclass
;
107 void nv04_fifo_intr(struct nouveau_subdev
*);