xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/priv.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: priv.h,v 1.3 2021/12/18 23:45:40 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: MIT */
4 #ifndef __NVKM_INSTMEM_PRIV_H__
5 #define __NVKM_INSTMEM_PRIV_H__
6 #define nvkm_instmem(p) container_of((p), struct nvkm_instmem, subdev)
7 #include <subdev/instmem.h>
8 
9 struct nvkm_instmem_func {
10 	void *(*dtor)(struct nvkm_instmem *);
11 	int (*oneinit)(struct nvkm_instmem *);
12 	void (*fini)(struct nvkm_instmem *);
13 	u32  (*rd32)(struct nvkm_instmem *, u32 addr);
14 	void (*wr32)(struct nvkm_instmem *, u32 addr, u32 data);
15 	int (*memory_new)(struct nvkm_instmem *, u32 size, u32 align,
16 			  bool zero, struct nvkm_memory **);
17 	bool zero;
18 };
19 
20 void nvkm_instmem_ctor(const struct nvkm_instmem_func *, struct nvkm_device *,
21 		       int index, struct nvkm_instmem *);
22 void nvkm_instmem_boot(struct nvkm_instmem *);
23 
24 #include <core/memory.h>
25 
26 struct nvkm_instobj {
27 	struct nvkm_memory memory;
28 	struct list_head head;
29 	u32 *suspend;
30 };
31 
32 void nvkm_instobj_ctor(const struct nvkm_memory_func *func,
33 		       struct nvkm_instmem *, struct nvkm_instobj *);
34 void nvkm_instobj_dtor(struct nvkm_instmem *, struct nvkm_instobj *);
35 #endif
36