1 #ifndef __NOUVEAU_INSTMEM_H__
2 #define __NOUVEAU_INSTMEM_H__
4 #include <core/subdev.h>
5 #include <core/device.h>
8 struct nouveau_instobj
{
9 struct nouveau_object base
;
10 struct list_head head
;
16 static inline struct nouveau_instobj
*
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
));
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))
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
*);
37 void _nouveau_instobj_dtor(struct nouveau_object
*);
38 #define _nouveau_instobj_init nouveau_object_init
39 #define _nouveau_instobj_fini nouveau_object_fini
41 struct nouveau_instmem
{
42 struct nouveau_subdev base
;
43 struct list_head list
;
46 int (*alloc
)(struct nouveau_instmem
*, struct nouveau_object
*,
47 u32 size
, u32 align
, struct nouveau_object
**);
50 static inline struct nouveau_instmem
*
51 nouveau_instmem(void *obj
)
53 return (void *)nv_device(obj
)->subdev
[NVDEV_SUBDEV_INSTMEM
];
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);
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);
69 extern struct nouveau_oclass nv04_instmem_oclass
;
70 extern struct nouveau_oclass nv40_instmem_oclass
;
71 extern struct nouveau_oclass nv50_instmem_oclass
;