From 6ea52c59b0262556edb01835eaf91b3bfcdcdd71 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 15 Jun 2018 09:25:01 -0700 Subject: gpu: nvgpu: Implement common nvgpu_mem_rd* functions nvgpu_mem_rd*() functions were implemented per OS. They also used nvgpu_pramin_access_batched() and implemented a big portion of logic for using PRAMIN in OS specific code. Make the implementation for the functions generic. Move all PRAMIN logic to PRAMIN and simplify the interface provided by PRAMIN. Change-Id: I1acb9e8d7d424325dc73314d5738cb2c9ebf7692 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1753708 Reviewed-by: Konsta Holtta GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/posix/posix-nvgpu_mem.c | 59 ------------------------ 1 file changed, 59 deletions(-) (limited to 'drivers/gpu/nvgpu/common/posix/posix-nvgpu_mem.c') diff --git a/drivers/gpu/nvgpu/common/posix/posix-nvgpu_mem.c b/drivers/gpu/nvgpu/common/posix/posix-nvgpu_mem.c index 7f3bf9f1..fa92a7c6 100644 --- a/drivers/gpu/nvgpu/common/posix/posix-nvgpu_mem.c +++ b/drivers/gpu/nvgpu/common/posix/posix-nvgpu_mem.c @@ -26,65 +26,6 @@ #include #include -/* - * DMA memory buffers - obviously we don't really have DMA in userspace but we - * can emulate a lot of the DMA mem functionality for unit testing purposes. - */ - -u32 nvgpu_mem_rd32(struct gk20a *g, struct nvgpu_mem *mem, u32 w) -{ - u32 *mem_ptr = (u32 *)mem->cpu_va; - - return mem_ptr[w]; -} - -u32 nvgpu_mem_rd(struct gk20a *g, struct nvgpu_mem *mem, u32 offset) -{ - if (offset & 0x3) - BUG(); - - return nvgpu_mem_rd32(g, mem, offset >> 2); -} - -void nvgpu_mem_rd_n(struct gk20a *g, struct nvgpu_mem *mem, u32 offset, - void *dest, u32 size) -{ - if (offset & 0x3 || size & 0x3) - BUG(); - - memcpy(dest, ((char *)mem->cpu_va) + offset, size); -} - -void nvgpu_mem_wr32(struct gk20a *g, struct nvgpu_mem *mem, u32 w, u32 data) -{ - u32 *mem_ptr = (u32 *)mem->cpu_va; - - mem_ptr[w] = data; -} - -void nvgpu_mem_wr(struct gk20a *g, struct nvgpu_mem *mem, u32 offset, u32 data) -{ - if (offset & 0x3) - BUG(); - - nvgpu_mem_wr32(g, mem, offset >> 2, data); -} - -void nvgpu_mem_wr_n(struct gk20a *g, struct nvgpu_mem *mem, u32 offset, - void *src, u32 size) -{ - if (offset & 0x3 || size & 0x3) - BUG(); - - memcpy(((char *)mem->cpu_va) + offset, src, size); -} - -void nvgpu_memset(struct gk20a *g, struct nvgpu_mem *mem, u32 offset, - u32 c, u32 size) -{ - memset(((char *)mem->cpu_va) + offset, c, size); -} - /* * These functions are somewhat meaningless. */ -- cgit v1.2.2