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 struct nouveau_instmem {
27 struct nouveau_subdev base;
28 struct list_head list;
31 int (*alloc)(struct nouveau_instmem *, struct nouveau_object *,
32 u32 size, u32 align, struct nouveau_object **);
35 static inline struct nouveau_instmem *
36 nouveau_instmem(void *obj)
38 /* nv04/nv40 impls need to create objects in their constructor,
39 * which is before the subdev pointer is valid
41 if (nv_iclass(obj, NV_SUBDEV_CLASS) &&
42 nv_subidx(obj) == NVDEV_SUBDEV_INSTMEM)
45 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_INSTMEM];
48 extern struct nouveau_oclass *nv04_instmem_oclass;
49 extern struct nouveau_oclass *nv40_instmem_oclass;
50 extern struct nouveau_oclass *nv50_instmem_oclass;