Loading...
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
7struct nvkm_instmem_func {
8 void *(*dtor)(struct nvkm_instmem *);
9 int (*oneinit)(struct nvkm_instmem *);
10 int (*suspend)(struct nvkm_instmem *);
11 void (*resume)(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 int (*memory_wrap)(struct nvkm_instmem *, struct nvkm_memory *, struct nvkm_memory **);
18 bool zero;
19};
20
21int nv50_instmem_new_(const struct nvkm_instmem_func *, struct nvkm_device *,
22 enum nvkm_subdev_type, int, struct nvkm_instmem **);
23
24void nvkm_instmem_ctor(const struct nvkm_instmem_func *, struct nvkm_device *,
25 enum nvkm_subdev_type, int, struct nvkm_instmem *);
26void nvkm_instmem_boot(struct nvkm_instmem *);
27
28int nv04_instmem_suspend(struct nvkm_instmem *);
29void nv04_instmem_resume(struct nvkm_instmem *);
30
31int r535_instmem_new(const struct nvkm_instmem_func *,
32 struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_instmem **);
33
34#include <core/memory.h>
35
36struct nvkm_instobj {
37 struct nvkm_memory memory;
38 struct list_head head;
39 bool preserve;
40 u32 *suspend;
41};
42
43void nvkm_instobj_ctor(const struct nvkm_memory_func *func,
44 struct nvkm_instmem *, struct nvkm_instobj *);
45void nvkm_instobj_dtor(struct nvkm_instmem *, struct nvkm_instobj *);
46int nvkm_instobj_save(struct nvkm_instobj *);
47void nvkm_instobj_load(struct nvkm_instobj *);
48#endif