From owner-svn-src-all@freebsd.org Sat Oct 24 21:27:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86D51A1D25B; Sat, 24 Oct 2015 21:27:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39C67626; Sat, 24 Oct 2015 21:27:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9OLR9UI071195; Sat, 24 Oct 2015 21:27:09 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9OLR9dv071194; Sat, 24 Oct 2015 21:27:09 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201510242127.t9OLR9dv071194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Oct 2015 21:27:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289893 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Oct 2015 21:27:10 -0000 Author: ian Date: Sat Oct 24 21:27:09 2015 New Revision: 289893 URL: https://svnweb.freebsd.org/changeset/base/289893 Log: 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. Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Sat Oct 24 21:25:53 2015 (r289892) +++ head/sys/arm/arm/busdma_machdep-v6.c Sat Oct 24 21:27:09 2015 (r289893) @@ -61,6 +61,14 @@ __FBSDID("$FreeBSD$"); #include #include +#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_padd * 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);