1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_INSTMEM_PRIV_H__
3 #define __NVKM_INSTMEM_PRIV_H__
4 #define nvkm_instmem(p) container_of((p), struct nvkm_instmem, subdev)
5 #include <subdev/instmem.h>
6 
7 struct nvkm_instmem_func {
8 	void *(*dtor)(struct nvkm_instmem *);
9 	int (*oneinit)(struct nvkm_instmem *);
10 	void (*fini)(struct nvkm_instmem *);
11 	u32  (*rd32)(struct nvkm_instmem *, u32 addr);
12 	void (*wr32)(struct nvkm_instmem *, u32 addr, u32 data);
13 	int (*memory_new)(struct nvkm_instmem *, u32 size, u32 align,
14 			  bool zero, struct nvkm_memory **);
15 	int (*memory_wrap)(struct nvkm_instmem *, struct nvkm_memory *, struct nvkm_memory **);
16 	bool zero;
17 };
18 
19 void nvkm_instmem_ctor(const struct nvkm_instmem_func *, struct nvkm_device *,
20 		       enum nvkm_subdev_type, int, struct nvkm_instmem *);
21 void nvkm_instmem_boot(struct nvkm_instmem *);
22 
23 #include <core/memory.h>
24 
25 struct nvkm_instobj {
26 	struct nvkm_memory memory;
27 	struct list_head head;
28 	u32 *suspend;
29 };
30 
31 void nvkm_instobj_ctor(const struct nvkm_memory_func *func,
32 		       struct nvkm_instmem *, struct nvkm_instobj *);
33 void nvkm_instobj_dtor(struct nvkm_instmem *, struct nvkm_instobj *);
34 #endif
35