diff options
author | Mark Kettenis <kettenis@openbsd.org> | 2013-08-08 14:19:25 +0200 |
---|---|---|
committer | Jonathan Gray <jsg@jsg.id.au> | 2013-08-12 10:47:30 +1000 |
commit | 705c5be5a429bf6a6bdfbd4942524a0b98d622b3 (patch) | |
tree | d0336ab8201525f356727a637ef08397cd98ab38 | |
parent | df633d8ee45d024a903979468b3aeda731c93edd (diff) |
use uvm_km_valloc instead of uvm_km_alloc to implements vmap; clean things up
-rw-r--r-- | sys/dev/pci/drm/ttm/ttm_bo_util.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/ttm/ttm_bo_util.c b/sys/dev/pci/drm/ttm/ttm_bo_util.c index 6394048c9fb..f9b0c58aae2 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_util.c +++ b/sys/dev/pci/drm/ttm/ttm_bo_util.c @@ -541,8 +541,8 @@ kunmap(void *addr) pmap_unmap_direct(va); #else pmap_kremove(va, PAGE_SIZE); - uvm_km_free(kernel_map, va, PAGE_SIZE); pmap_update(pmap_kernel()); + uvm_km_free(kernel_map, va, PAGE_SIZE); #endif } @@ -554,11 +554,13 @@ vmap(struct vm_page **pages, unsigned int npages, unsigned long flags, paddr_t pa; int i; - va = uvm_km_alloc(kernel_map, PAGE_SIZE * npages); + va = uvm_km_valloc(kernel_map, PAGE_SIZE * npages); + if (va == 0) + return NULL; for (i = 0; i < npages; i++) { pa = VM_PAGE_TO_PHYS(pages[i]) | prot; pmap_enter(pmap_kernel(), va + (i * PAGE_SIZE), pa, - prot | VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); pmap_update(pmap_kernel()); } @@ -572,8 +574,8 @@ vunmap(void *addr, size_t size) vaddr_t va = (vaddr_t)addr; pmap_remove(pmap_kernel(), va, va + size); - uvm_km_free(kernel_map, va, size); pmap_update(pmap_kernel()); + uvm_km_free(kernel_map, va, size); } static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, |