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 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 void (*set_bar0_window_addr)(struct nvkm_device *, u64 addr); 20 }; 21 22 int nv50_instmem_new_(const struct nvkm_instmem_func *, struct nvkm_device *, 23 enum nvkm_subdev_type, int, struct nvkm_instmem **); 24 void nv50_instmem_fini(struct nvkm_instmem *); 25 int nv50_instobj_new(struct nvkm_instmem *, u32 size, u32 align, bool zero, 26 struct nvkm_memory **); 27 int nv50_instobj_wrap(struct nvkm_instmem *, struct nvkm_memory *vram, 28 struct nvkm_memory **bar2); 29 30 void nvkm_instmem_ctor(const struct nvkm_instmem_func *, struct nvkm_device *, 31 enum nvkm_subdev_type, int, struct nvkm_instmem *); 32 void nvkm_instmem_boot(struct nvkm_instmem *); 33 34 int nv04_instmem_suspend(struct nvkm_instmem *); 35 void nv04_instmem_resume(struct nvkm_instmem *); 36 37 int r535_instmem_new(const struct nvkm_instmem_func *, 38 struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_instmem **); 39 40 #include <core/memory.h> 41 42 struct nvkm_instobj { 43 struct nvkm_memory memory; 44 struct list_head head; 45 bool preserve; 46 u32 *suspend; 47 }; 48 49 void nvkm_instobj_ctor(const struct nvkm_memory_func *func, 50 struct nvkm_instmem *, struct nvkm_instobj *); 51 void nvkm_instobj_dtor(struct nvkm_instmem *, struct nvkm_instobj *); 52 int nvkm_instobj_save(struct nvkm_instobj *); 53 void nvkm_instobj_load(struct nvkm_instobj *); 54 #endif 55