Linux-libre 3.16.41-gnu
[librecmc/linux-libre.git] / drivers / gpu / drm / nouveau / core / subdev / instmem / priv.h
1 #ifndef __NVKM_INSTMEM_PRIV_H__
2 #define __NVKM_INSTMEM_PRIV_H__
3
4 #include <subdev/instmem.h>
5
6 struct nouveau_instobj_impl {
7         struct nouveau_oclass base;
8 };
9
10 struct nouveau_instobj_args {
11         u32 size;
12         u32 align;
13 };
14
15 #define nouveau_instobj_create(p,e,o,d)                                        \
16         nouveau_instobj_create_((p), (e), (o), sizeof(**d), (void **)d)
17 #define nouveau_instobj_destroy(p) ({                                          \
18         struct nouveau_instobj *iobj = (p);                                    \
19         _nouveau_instobj_dtor(nv_object(iobj));                                \
20 })
21 #define nouveau_instobj_init(p)                                                \
22         nouveau_object_init(&(p)->base)
23 #define nouveau_instobj_fini(p,s)                                              \
24         nouveau_object_fini(&(p)->base, (s))
25
26 int  nouveau_instobj_create_(struct nouveau_object *, struct nouveau_object *,
27                              struct nouveau_oclass *, int, void **);
28 void _nouveau_instobj_dtor(struct nouveau_object *);
29 #define _nouveau_instobj_init nouveau_object_init
30 #define _nouveau_instobj_fini nouveau_object_fini
31
32 struct nouveau_instmem_impl {
33         struct nouveau_oclass base;
34         struct nouveau_oclass *instobj;
35 };
36
37 #define nouveau_instmem_create(p,e,o,d)                                        \
38         nouveau_instmem_create_((p), (e), (o), sizeof(**d), (void **)d)
39 #define nouveau_instmem_destroy(p)                                             \
40         nouveau_subdev_destroy(&(p)->base)
41 #define nouveau_instmem_init(p) ({                                             \
42         struct nouveau_instmem *imem = (p);                                    \
43         _nouveau_instmem_init(nv_object(imem));                                \
44 })
45 #define nouveau_instmem_fini(p,s) ({                                           \
46         struct nouveau_instmem *imem = (p);                                    \
47         _nouveau_instmem_fini(nv_object(imem), (s));                           \
48 })
49
50 int nouveau_instmem_create_(struct nouveau_object *, struct nouveau_object *,
51                             struct nouveau_oclass *, int, void **);
52 #define _nouveau_instmem_dtor _nouveau_subdev_dtor
53 int _nouveau_instmem_init(struct nouveau_object *);
54 int _nouveau_instmem_fini(struct nouveau_object *, bool);
55
56 #endif