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-08-20 12:54:17 +08:00
|
|
|
struct nvkm_memory;
|
2012-07-14 17:09:17 +08:00
|
|
|
|
2015-01-14 13:05:26 +08:00
|
|
|
struct nvkm_instmem {
|
2015-08-20 12:54:06 +08:00
|
|
|
struct nvkm_subdev subdev;
|
2012-07-14 17:09:17 +08:00
|
|
|
struct list_head list;
|
|
|
|
|
|
|
|
u32 reserved;
|
2015-08-20 12:54:17 +08:00
|
|
|
int (*alloc)(struct nvkm_instmem *, u32 size, u32 align, bool zero,
|
|
|
|
struct nvkm_memory **);
|
2015-08-20 12:54:13 +08:00
|
|
|
|
|
|
|
const struct nvkm_instmem_func *func;
|
2015-08-20 12:54:17 +08:00
|
|
|
|
2015-08-20 12:54:17 +08:00
|
|
|
struct nvkm_memory *vbios;
|
2015-08-20 12:54:17 +08:00
|
|
|
struct nvkm_ramht *ramht;
|
2015-08-20 12:54:17 +08:00
|
|
|
struct nvkm_memory *ramro;
|
|
|
|
struct nvkm_memory *ramfc;
|
2015-08-20 12:54:13 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nvkm_instmem_func {
|
|
|
|
u32 (*rd32)(struct nvkm_instmem *, u32 addr);
|
|
|
|
void (*wr32)(struct nvkm_instmem *, u32 addr, u32 data);
|
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
|