diff options
author | Jonathan Gray <jsg@jsg.id.au> | 2013-05-23 21:02:49 +1000 |
---|---|---|
committer | Jonathan Gray <jsg@jsg.id.au> | 2013-08-12 10:40:43 +1000 |
commit | 4d45bd9e798404797f96fc1d8ca46c00b9b9fe8b (patch) | |
tree | fcf477b46a4757708265b38b63eac330fad55696 /sys/dev/pci/drm/ttm | |
parent | b70b76abf156143c029c10634b238841517af7be (diff) |
add some kunmap and vunmap like functions
Diffstat (limited to 'sys/dev/pci/drm/ttm')
-rw-r--r-- | sys/dev/pci/drm/ttm/ttm_bo_util.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/ttm/ttm_bo_util.c b/sys/dev/pci/drm/ttm/ttm_bo_util.c index cc2faea5fd3..1ee96bda330 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_util.c +++ b/sys/dev/pci/drm/ttm/ttm_bo_util.c @@ -574,6 +574,18 @@ kmap(struct vm_page *pg) return (vaddr); } +void kunmap(vaddr_t va); + +void +kunmap(vaddr_t va) +{ +#if !defined(__HAVE_PMAP_DIRECT) + pmap_kremove(va, PAGE_SIZE); + uvm_km_free(kernel_map, va, PAGE_SIZE); + pmap_update(pmap_kernel()); +#endif +} + uint8_t * vmap(paddr_t pa, unsigned int count, unsigned long flags, vm_prot_t prot); uint8_t * @@ -592,6 +604,16 @@ vmap(paddr_t pa, unsigned int count, unsigned long flags, vm_prot_t prot) return (vaddr); } +void vunmap(vaddr_t, vsize_t); + +void +vunmap(vaddr_t va, vsize_t size) +{ + pmap_remove(pmap_kernel(), va, va + size); + uvm_km_free(kernel_map, va, size); + pmap_update(pmap_kernel()); +} + static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, unsigned long start_page, unsigned long num_pages, @@ -681,19 +703,16 @@ void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map) bus_space_unmap(bo->bdev->memt, bo->mem.bus.bsh, bo->mem.bus.size); break; -#ifdef notyet case ttm_bo_map_vmap: - vunmap(map->virtual); + vunmap((vaddr_t)map->virtual, bo->mem.bus.size); break; case ttm_bo_map_kmap: - kunmap(map->page); + kunmap((vaddr_t)map->virtual); break; -#endif case ttm_bo_map_premapped: break; default: - printf("%s partial stub type %d\n", __func__, map->bo_kmap_type); -// BUG(); + BUG(); } (void) ttm_mem_io_lock(man, false); ttm_mem_io_free(map->bo->bdev, &map->bo->mem); |