diff options
author | ian <ian@FreeBSD.org> | 2015-01-21 01:06:08 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2015-01-21 01:06:08 +0000 |
commit | c25b839fb87a16beaf55843df79865bc1ec5cae0 (patch) | |
tree | 3ca2071ba877fa738001c7bbd1987b50baa34d23 /sys/arm/at91 | |
parent | bb3fec85f3e1707e781d798d53ae711a5269082a (diff) | |
download | FreeBSD-src-c25b839fb87a16beaf55843df79865bc1ec5cae0.zip FreeBSD-src-c25b839fb87a16beaf55843df79865bc1ec5cae0.tar.gz |
Revise the arm bus_space implementation to avoid dereferencing the tag on
every operation to retrieve the bs_cookie value almost nothing actually uses.
The bus_space struct contains a private data pointer (poorly named bs_cookie,
now renamed to bs_privdata) which is used only by a few old armv4 xscale
implementations. The bus_space functions were all defined to take this
value as the first parameter instead of the bus_space_tag_t, requiring all
the inline macro and function expansions to dereference the tag to pass it
to another function, which never uses it. Now all the functions take the tag
as the first parameter and retrieve the privdata if they need it.
Also fix a couple bus_space_unmap() implementations that were calling
kva_free() instead of pmap_unmapdev().
Discussed with: cognet
Diffstat (limited to 'sys/arm/at91')
-rw-r--r-- | sys/arm/at91/at91.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/arm/at91/at91.c b/sys/arm/at91/at91.c index 1942389..a8a1f5e 100644 --- a/sys/arm/at91/at91.c +++ b/sys/arm/at91/at91.c @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); uint32_t at91_master_clock; static int -at91_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags, +at91_bs_map(bus_space_tag_t tag, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp) { vm_paddr_t pa, endpa; @@ -77,23 +77,18 @@ at91_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags, } static void -at91_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size) +at91_bs_unmap(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t size) { - vm_offset_t va, endva; + vm_offset_t va; - if (t == 0) - return; - va = trunc_page((vm_offset_t)t); + va = (vm_offset_t)h; if (va >= AT91_BASE && va <= AT91_BASE + 0xff00000) return; - endva = round_page((vm_offset_t)t + size); - - /* Free the kernel virtual mapping. */ - kva_free(va, endva - va); + pmap_unmapdev(va, size); } static int -at91_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, +at91_bs_subregion(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp) { @@ -102,7 +97,7 @@ at91_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, } static void -at91_barrier(void *t, bus_space_handle_t bsh, bus_size_t size, bus_size_t b, +at91_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size, bus_size_t b, int a) { } |