diff options
author | Ian Lepore <ian@FreeBSD.org> | 2015-04-10 13:26:35 +0000 |
---|---|---|
committer | Ian Lepore <ian@FreeBSD.org> | 2015-04-10 13:26:35 +0000 |
commit | 7669914f3268c13368347488e91271f0ba050482 (patch) | |
tree | a2fb3d304764a48fcd52b1ea4b3aae9698b2dfc5 /sys/arm/arm/devmap.c | |
parent | 78261920b0e1b4f91d3d6ac5c5bdf965a391ab08 (diff) | |
download | src-7669914f3268c13368347488e91271f0ba050482.tar.gz src-7669914f3268c13368347488e91271f0ba050482.zip |
Add a pmap_kremove_device() to undo mappings made with pmap_kenter_device().
Previously we used pmap_kremove(), but with ARM_NEW_PMAP it does the remove
in a way that isn't SMP-coherent (which is appropriate in some circumstances
such as mapping/unmapping sf buffers). With matching enter/remove routines
for device mappings, each low-level implementation can do the right thing.
Reviewed by: Svatopluk Kraus <onwahe@gmail.com>
Notes
Notes:
svn path=/head/; revision=281369
Diffstat (limited to 'sys/arm/arm/devmap.c')
-rw-r--r-- | sys/arm/arm/devmap.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/sys/arm/arm/devmap.c b/sys/arm/arm/devmap.c index 1c60a15f6e27..6ea28bff682e 100644 --- a/sys/arm/arm/devmap.c +++ b/sys/arm/arm/devmap.c @@ -246,7 +246,7 @@ arm_devmap_vtop(void * vpva, vm_size_t size) void * pmap_mapdev(vm_offset_t pa, vm_size_t size) { - vm_offset_t va, tmpva, offset; + vm_offset_t va, offset; void * rva; /* First look in the static mapping table. */ @@ -261,12 +261,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size) if (!va) panic("pmap_mapdev: Couldn't alloc kernel virtual memory"); - for (tmpva = va; size > 0;) { - pmap_kenter_device(tmpva, pa); - size -= PAGE_SIZE; - tmpva += PAGE_SIZE; - pa += PAGE_SIZE; - } + pmap_kenter_device(va, size, pa); return ((void *)(va + offset)); } @@ -277,25 +272,18 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size) void pmap_unmapdev(vm_offset_t va, vm_size_t size) { - vm_offset_t tmpva, offset; - vm_size_t origsize; + vm_offset_t offset; /* Nothing to do if we find the mapping in the static table. */ if (arm_devmap_vtop((void*)va, size) != DEVMAP_PADDR_NOTFOUND) return; - origsize = size; offset = va & PAGE_MASK; va = trunc_page(va); size = round_page(size + offset); - for (tmpva = va; size > 0;) { - pmap_kremove(tmpva); - size -= PAGE_SIZE; - tmpva += PAGE_SIZE; - } - - kva_free(va, origsize); + pmap_kremove_device(va, size); + kva_free(va, size); } #ifdef DDB |