1 1.1 riastrad /* $NetBSD: vmm.h,v 1.2 2021/12/18 23:45:33 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad #ifndef __NVIF_VMM_H__ 4 1.1 riastrad #define __NVIF_VMM_H__ 5 1.1 riastrad #include <nvif/object.h> 6 1.1 riastrad struct nvif_mem; 7 1.1 riastrad struct nvif_mmu; 8 1.1 riastrad 9 1.1 riastrad enum nvif_vmm_get { 10 1.1 riastrad ADDR, 11 1.1 riastrad PTES, 12 1.1 riastrad LAZY 13 1.1 riastrad }; 14 1.1 riastrad 15 1.1 riastrad struct nvif_vma { 16 1.1 riastrad u64 addr; 17 1.1 riastrad u64 size; 18 1.1 riastrad }; 19 1.1 riastrad 20 1.1 riastrad struct nvif_vmm { 21 1.1 riastrad struct nvif_object object; 22 1.1 riastrad u64 start; 23 1.1 riastrad u64 limit; 24 1.1 riastrad 25 1.1 riastrad struct { 26 1.1 riastrad u8 shift; 27 1.1 riastrad bool sparse:1; 28 1.1 riastrad bool vram:1; 29 1.1 riastrad bool host:1; 30 1.1 riastrad bool comp:1; 31 1.1 riastrad } *page; 32 1.1 riastrad int page_nr; 33 1.1 riastrad }; 34 1.1 riastrad 35 1.1 riastrad int nvif_vmm_init(struct nvif_mmu *, s32 oclass, bool managed, u64 addr, 36 1.1 riastrad u64 size, void *argv, u32 argc, struct nvif_vmm *); 37 1.1 riastrad void nvif_vmm_fini(struct nvif_vmm *); 38 1.1 riastrad int nvif_vmm_get(struct nvif_vmm *, enum nvif_vmm_get, bool sparse, 39 1.1 riastrad u8 page, u8 align, u64 size, struct nvif_vma *); 40 1.1 riastrad void nvif_vmm_put(struct nvif_vmm *, struct nvif_vma *); 41 1.1 riastrad int nvif_vmm_map(struct nvif_vmm *, u64 addr, u64 size, void *argv, u32 argc, 42 1.1 riastrad struct nvif_mem *, u64 offset); 43 1.1 riastrad int nvif_vmm_unmap(struct nvif_vmm *, u64); 44 1.1 riastrad #endif 45