diff options
author | ian <ian@FreeBSD.org> | 2015-10-24 21:27:09 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2015-10-24 21:27:09 +0000 |
commit | 3f5c029ee2b51f1b504d5f4a569ee04a78d05f3b (patch) | |
tree | 7ef883f449995ca89bece42313fd32712cbccf93 /sys/arm | |
parent | 03b570601478816d8eedc84a5ded69eccd27e36b (diff) | |
download | FreeBSD-src-3f5c029ee2b51f1b504d5f4a569ee04a78d05f3b.zip FreeBSD-src-3f5c029ee2b51f1b504d5f4a569ee04a78d05f3b.tar.gz |
Define a couple macros to access cacheline size/mask in an arch-dependent
way. This code should now work for all arm versions v4 thru v7.
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/arm/busdma_machdep-v6.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/arm/arm/busdma_machdep-v6.c b/sys/arm/arm/busdma_machdep-v6.c index 297b129..d62522e 100644 --- a/sys/arm/arm/busdma_machdep-v6.c +++ b/sys/arm/arm/busdma_machdep-v6.c @@ -61,6 +61,14 @@ __FBSDID("$FreeBSD$"); #include <machine/cpu-v6.h> #include <machine/md_var.h> +#if __ARM_ARCH < 6 +#define BUSDMA_DCACHE_ALIGN arm_dcache_align +#define BUSDMA_DCACHE_MASK arm_dcache_align_mask +#else +#define BUSDMA_DCACHE_ALIGN cpuinfo.dcache_line_size +#define BUSDMA_DCACHE_MASK cpuinfo.dcache_line_mask +#endif + #define MAX_BPAGES 64 #define MAX_DMA_SEGMENTS 4096 #define BUS_DMA_EXCL_BOUNCE BUS_DMA_BUS2 @@ -234,7 +242,7 @@ busdma_init(void *dummy) /* Create a cache of buffers in standard (cacheable) memory. */ standard_allocator = busdma_bufalloc_create("buffer", - arm_dcache_align, /* minimum_alignment */ + BUSDMA_DCACHE_ALIGN,/* minimum_alignment */ NULL, /* uma_alloc func */ NULL, /* uma_free func */ uma_flags); /* uma_zcreate_flags */ @@ -253,7 +261,7 @@ busdma_init(void *dummy) * BUS_DMA_COHERENT (and potentially BUS_DMA_NOCACHE) flag. */ coherent_allocator = busdma_bufalloc_create("coherent", - arm_dcache_align, /* minimum_alignment */ + BUSDMA_DCACHE_ALIGN,/* minimum_alignment */ busdma_bufalloc_alloc_uncacheable, busdma_bufalloc_free_uncacheable, uma_flags); /* uma_zcreate_flags */ @@ -1279,9 +1287,9 @@ dma_preread_safe(vm_offset_t va, vm_paddr_t pa, vm_size_t size) * as dcache_wb_poc() will do the rounding for us and works * at cacheline granularity. */ - if (va & cpuinfo.dcache_line_mask) + if (va & BUSDMA_DCACHE_MASK) dcache_wb_poc(va, pa, 1); - if ((va + size) & cpuinfo.dcache_line_mask) + if ((va + size) & BUSDMA_DCACHE_MASK) dcache_wb_poc(va + size, pa + size, 1); dcache_inv_poc_dma(va, pa, size); |