Merge branch 'v3.10/topic/misc' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / nouveau / core / include / subdev / mc.h
1 #ifndef __NOUVEAU_MC_H__
2 #define __NOUVEAU_MC_H__
3
4 #include <core/subdev.h>
5 #include <core/device.h>
6
7 struct nouveau_mc_intr {
8         u32 stat;
9         u32 unit;
10 };
11
12 struct nouveau_mc {
13         struct nouveau_subdev base;
14         const struct nouveau_mc_intr *intr_map;
15 };
16
17 static inline struct nouveau_mc *
18 nouveau_mc(void *obj)
19 {
20         return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_MC];
21 }
22
23 #define nouveau_mc_create(p,e,o,m,d)                                           \
24         nouveau_mc_create_((p), (e), (o), (m), sizeof(**d), (void **)d)
25 #define nouveau_mc_destroy(p) ({                                               \
26         struct nouveau_mc *pmc = (p); _nouveau_mc_dtor(nv_object(pmc));        \
27 })
28 #define nouveau_mc_init(p) ({                                                  \
29         struct nouveau_mc *pmc = (p); _nouveau_mc_init(nv_object(pmc));        \
30 })
31 #define nouveau_mc_fini(p,s) ({                                                \
32         struct nouveau_mc *pmc = (p); _nouveau_mc_fini(nv_object(pmc), (s));   \
33 })
34
35 int  nouveau_mc_create_(struct nouveau_object *, struct nouveau_object *,
36                         struct nouveau_oclass *, const struct nouveau_mc_intr *,
37                         int, void **);
38 void _nouveau_mc_dtor(struct nouveau_object *);
39 int  _nouveau_mc_init(struct nouveau_object *);
40 int  _nouveau_mc_fini(struct nouveau_object *, bool);
41
42 extern struct nouveau_oclass nv04_mc_oclass;
43 extern struct nouveau_oclass nv44_mc_oclass;
44 extern struct nouveau_oclass nv50_mc_oclass;
45 extern struct nouveau_oclass nv98_mc_oclass;
46 extern struct nouveau_oclass nvc0_mc_oclass;
47
48 extern const struct nouveau_mc_intr nv04_mc_intr[];
49 int nv04_mc_init(struct nouveau_object *);
50 int nv50_mc_init(struct nouveau_object *);
51
52 #endif