xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/priv.h (revision a460513ed4b6994bfeb7bd86f72853140bc1ac12)
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 	bool zero;
16 };
17 
18 void nvkm_instmem_ctor(const struct nvkm_instmem_func *, struct nvkm_device *,
19 		       enum nvkm_subdev_type, int, struct nvkm_instmem *);
20 void nvkm_instmem_boot(struct nvkm_instmem *);
21 
22 #include <core/memory.h>
23 
24 struct nvkm_instobj {
25 	struct nvkm_memory memory;
26 	struct list_head head;
27 	u32 *suspend;
28 };
29 
30 void nvkm_instobj_ctor(const struct nvkm_memory_func *func,
31 		       struct nvkm_instmem *, struct nvkm_instobj *);
32 void nvkm_instobj_dtor(struct nvkm_instmem *, struct nvkm_instobj *);
33 #endif
34