d104c1aac807f1cd37e7dbd92bf5c073c7f80106
[deliverable/linux.git] / drivers / gpu / drm / nouveau / include / nvkm / subdev / instmem.h
1 #ifndef __NVKM_INSTMEM_H__
2 #define __NVKM_INSTMEM_H__
3 #include <core/subdev.h>
4
5 struct nvkm_instobj {
6 struct nvkm_object base;
7 struct list_head head;
8 u32 *suspend;
9 u64 addr;
10 u32 size;
11 };
12
13 static inline struct nvkm_instobj *
14 nv_memobj(void *obj)
15 {
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));
19 #endif
20 return obj;
21 }
22
23 struct nvkm_instmem {
24 struct nvkm_subdev base;
25 struct list_head list;
26
27 u32 reserved;
28 int (*alloc)(struct nvkm_instmem *, struct nvkm_object *,
29 u32 size, u32 align, struct nvkm_object **);
30 };
31
32 static inline struct nvkm_instmem *
33 nvkm_instmem(void *obj)
34 {
35 /* nv04/nv40 impls need to create objects in their constructor,
36 * which is before the subdev pointer is valid
37 */
38 if (nv_iclass(obj, NV_SUBDEV_CLASS) &&
39 nv_subidx(obj) == NVDEV_SUBDEV_INSTMEM)
40 return obj;
41
42 return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_INSTMEM);
43 }
44
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 #endif
This page took 0.032194 seconds and 4 git commands to generate.