1 #ifndef __NVKM_INSTMEM_H__
2 #define __NVKM_INSTMEM_H__
3 #include <core/subdev.h>
6 struct nvkm_object base;
13 static inline struct nvkm_instobj *
16 #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
17 if (unlikely(!nv_iclass(obj, NV_MEMOBJ_CLASS)))
18 nv_assert("BAD CAST -> NvMemObj, %08x", nv_hclass(obj));
24 struct nvkm_subdev base;
25 struct list_head list;
28 int (*alloc)(struct nvkm_instmem *, struct nvkm_object *,
29 u32 size, u32 align, struct nvkm_object **);
32 static inline struct nvkm_instmem *
33 nvkm_instmem(void *obj)
35 /* nv04/nv40 impls need to create objects in their constructor,
36 * which is before the subdev pointer is valid
38 if (nv_iclass(obj, NV_SUBDEV_CLASS) &&
39 nv_subidx(obj) == NVDEV_SUBDEV_INSTMEM)
42 return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_INSTMEM);
45 extern struct nvkm_oclass *nv04_instmem_oclass;
46 extern struct nvkm_oclass *nv40_instmem_oclass;
47 extern struct nvkm_oclass *nv50_instmem_oclass;
48 extern struct nvkm_oclass *gk20a_instmem_oclass;