drm/nouveau: port all engines to new engine module format
[deliverable/linux.git] / drivers / gpu / drm / nouveau / core / include / subdev / instmem.h
1 #ifndef __NOUVEAU_INSTMEM_H__
2 #define __NOUVEAU_INSTMEM_H__
3
4 #include <core/subdev.h>
5 #include <core/device.h>
6 #include <core/mm.h>
7
8 struct nouveau_instobj {
9 struct nouveau_object base;
10 struct list_head head;
11 u32 *suspend;
12 u64 addr;
13 u32 size;
14 };
15
16 static inline struct nouveau_instobj *
17 nv_memobj(void *obj)
18 {
19 #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
20 if (unlikely(!nv_iclass(obj, NV_MEMOBJ_CLASS)))
21 nv_assert("BAD CAST -> NvMemObj, %08x", nv_hclass(obj));
22 #endif
23 return obj;
24 }
25
26 #define nouveau_instobj_create(p,e,o,d) \
27 nouveau_instobj_create_((p), (e), (o), sizeof(**d), (void **)d)
28 #define nouveau_instobj_init(p) \
29 nouveau_object_init(&(p)->base)
30 #define nouveau_instobj_fini(p,s) \
31 nouveau_object_fini(&(p)->base, (s))
32
33 int nouveau_instobj_create_(struct nouveau_object *, struct nouveau_object *,
34 struct nouveau_oclass *, int, void **);
35 void nouveau_instobj_destroy(struct nouveau_instobj *);
36
37 void _nouveau_instobj_dtor(struct nouveau_object *);
38 #define _nouveau_instobj_init nouveau_object_init
39 #define _nouveau_instobj_fini nouveau_object_fini
40
41 struct nouveau_instmem {
42 struct nouveau_subdev base;
43 struct list_head list;
44
45 u32 reserved;
46 int (*alloc)(struct nouveau_instmem *, struct nouveau_object *,
47 u32 size, u32 align, struct nouveau_object **);
48 };
49
50 static inline struct nouveau_instmem *
51 nouveau_instmem(void *obj)
52 {
53 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_INSTMEM];
54 }
55
56 #define nouveau_instmem_create(p,e,o,d) \
57 nouveau_instmem_create_((p), (e), (o), sizeof(**d), (void **)d)
58 #define nouveau_instmem_destroy(p) \
59 nouveau_subdev_destroy(&(p)->base)
60 int nouveau_instmem_create_(struct nouveau_object *, struct nouveau_object *,
61 struct nouveau_oclass *, int, void **);
62 int nouveau_instmem_init(struct nouveau_instmem *);
63 int nouveau_instmem_fini(struct nouveau_instmem *, bool);
64
65 #define _nouveau_instmem_dtor _nouveau_subdev_dtor
66 int _nouveau_instmem_init(struct nouveau_object *);
67 int _nouveau_instmem_fini(struct nouveau_object *, bool);
68
69 extern struct nouveau_oclass nv04_instmem_oclass;
70 extern struct nouveau_oclass nv40_instmem_oclass;
71 extern struct nouveau_oclass nv50_instmem_oclass;
72
73 #endif
This page took 0.042482 seconds and 5 git commands to generate.