2015-01-14 13:05:26 +08:00
|
|
|
#ifndef __NVKM_INSTMEM_H__
|
|
|
|
#define __NVKM_INSTMEM_H__
|
2012-07-14 17:09:17 +08:00
|
|
|
#include <core/subdev.h>
|
|
|
|
|
2015-01-14 13:05:26 +08:00
|
|
|
struct nvkm_instobj {
|
|
|
|
struct nvkm_object base;
|
2012-07-14 17:09:17 +08:00
|
|
|
struct list_head head;
|
|
|
|
u32 *suspend;
|
|
|
|
u64 addr;
|
|
|
|
u32 size;
|
|
|
|
};
|
|
|
|
|
2015-01-14 13:05:26 +08:00
|
|
|
static inline struct nvkm_instobj *
|
2012-07-14 17:09:17 +08:00
|
|
|
nv_memobj(void *obj)
|
|
|
|
{
|
|
|
|
#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
|
|
|
|
if (unlikely(!nv_iclass(obj, NV_MEMOBJ_CLASS)))
|
|
|
|
nv_assert("BAD CAST -> NvMemObj, %08x", nv_hclass(obj));
|
|
|
|
#endif
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2015-01-14 13:05:26 +08:00
|
|
|
struct nvkm_instmem {
|
|
|
|
struct nvkm_subdev base;
|
2012-07-14 17:09:17 +08:00
|
|
|
struct list_head list;
|
|
|
|
|
|
|
|
u32 reserved;
|
2015-01-14 13:05:26 +08:00
|
|
|
int (*alloc)(struct nvkm_instmem *, struct nvkm_object *,
|
|
|
|
u32 size, u32 align, struct nvkm_object **);
|
2012-07-14 17:09:17 +08:00
|
|
|
};
|
|
|
|
|
2015-01-14 13:05:26 +08:00
|
|
|
static inline struct nvkm_instmem *
|
|
|
|
nvkm_instmem(void *obj)
|
2012-07-14 17:09:17 +08:00
|
|
|
{
|
2014-01-14 12:56:22 +08:00
|
|
|
/* nv04/nv40 impls need to create objects in their constructor,
|
|
|
|
* which is before the subdev pointer is valid
|
|
|
|
*/
|
|
|
|
if (nv_iclass(obj, NV_SUBDEV_CLASS) &&
|
|
|
|
nv_subidx(obj) == NVDEV_SUBDEV_INSTMEM)
|
|
|
|
return obj;
|
|
|
|
|
2015-01-14 13:05:26 +08:00
|
|
|
return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_INSTMEM);
|
2012-07-14 17:09:17 +08:00
|
|
|
}
|
|
|
|
|
2015-01-14 13:05:26 +08:00
|
|
|
extern struct nvkm_oclass *nv04_instmem_oclass;
|
|
|
|
extern struct nvkm_oclass *nv40_instmem_oclass;
|
|
|
|
extern struct nvkm_oclass *nv50_instmem_oclass;
|
2015-02-20 17:23:00 +08:00
|
|
|
extern struct nvkm_oclass *gk20a_instmem_oclass;
|
2012-07-14 17:09:17 +08:00
|
|
|
#endif
|