busdma_machdep-v6.c (273599) | busdma_machdep-v6.c (274191) |
---|---|
1/*- 2 * Copyright (c) 2012 Ian Lepore 3 * Copyright (c) 2010 Mark Tinguely 4 * Copyright (c) 2004 Olivier Houchard 5 * Copyright (c) 2002 Peter Grehan 6 * Copyright (c) 1997, 1998 Justin T. Gibbs. 7 * All rights reserved. 8 * --- 17 unchanged lines hidden (view full) --- 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * From i386/busdma_machdep.c 191438 2009-04-23 20:24:19Z jhb 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2012 Ian Lepore 3 * Copyright (c) 2010 Mark Tinguely 4 * Copyright (c) 2004 Olivier Houchard 5 * Copyright (c) 2002 Peter Grehan 6 * Copyright (c) 1997, 1998 Justin T. Gibbs. 7 * All rights reserved. 8 * --- 17 unchanged lines hidden (view full) --- 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * From i386/busdma_machdep.c 191438 2009-04-23 20:24:19Z jhb 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/arm/arm/busdma_machdep-v6.c 273599 2014-10-24 19:18:39Z loos $"); | 34__FBSDID("$FreeBSD: head/sys/arm/arm/busdma_machdep-v6.c 274191 2014-11-06 19:14:58Z ian $"); |
35 36#define _ARM32_BUS_DMA_PRIVATE 37#include <sys/param.h> 38#include <sys/kdb.h> 39#include <ddb/ddb.h> 40#include <ddb/db_output.h> 41#include <sys/systm.h> 42#include <sys/malloc.h> --- 16 unchanged lines hidden (view full) --- 59#include <vm/vm_extern.h> 60#include <vm/vm_kern.h> 61 62#include <machine/atomic.h> 63#include <machine/bus.h> 64#include <machine/cpufunc.h> 65#include <machine/md_var.h> 66 | 35 36#define _ARM32_BUS_DMA_PRIVATE 37#include <sys/param.h> 38#include <sys/kdb.h> 39#include <ddb/ddb.h> 40#include <ddb/db_output.h> 41#include <sys/systm.h> 42#include <sys/malloc.h> --- 16 unchanged lines hidden (view full) --- 59#include <vm/vm_extern.h> 60#include <vm/vm_kern.h> 61 62#include <machine/atomic.h> 63#include <machine/bus.h> 64#include <machine/cpufunc.h> 65#include <machine/md_var.h> 66 |
67#define IS_POWER_OF_2(val) (((val) & ((val) - 1)) == 0) 68 |
|
67#define MAX_BPAGES 64 68#define MAX_DMA_SEGMENTS 4096 69#define BUS_DMA_EXCL_BOUNCE BUS_DMA_BUS2 70#define BUS_DMA_ALIGN_BOUNCE BUS_DMA_BUS3 71#define BUS_DMA_COULD_BOUNCE (BUS_DMA_EXCL_BOUNCE | BUS_DMA_ALIGN_BOUNCE) 72#define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 73 74struct bounce_zone; --- 386 unchanged lines hidden (view full) --- 461 bus_dma_tag_t newtag; 462 int error = 0; 463 464#if 0 465 if (!parent) 466 parent = arm_root_dma_tag; 467#endif 468 | 69#define MAX_BPAGES 64 70#define MAX_DMA_SEGMENTS 4096 71#define BUS_DMA_EXCL_BOUNCE BUS_DMA_BUS2 72#define BUS_DMA_ALIGN_BOUNCE BUS_DMA_BUS3 73#define BUS_DMA_COULD_BOUNCE (BUS_DMA_EXCL_BOUNCE | BUS_DMA_ALIGN_BOUNCE) 74#define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 75 76struct bounce_zone; --- 386 unchanged lines hidden (view full) --- 463 bus_dma_tag_t newtag; 464 int error = 0; 465 466#if 0 467 if (!parent) 468 parent = arm_root_dma_tag; 469#endif 470 |
469 /* Basic sanity checking */ 470 if (boundary != 0 && boundary < maxsegsz) 471 maxsegsz = boundary; | 471 /* Basic sanity checking. */ 472 KASSERT(boundary == 0 || IS_POWER_OF_2(boundary), 473 ("dma tag boundary %lu, must be a power of 2", boundary)); 474 KASSERT(boundary == 0 || boundary >= maxsegsz, 475 ("dma tag boundary %lu is < maxsegsz %lu\n", boundary, maxsegsz)); 476 KASSERT(alignment != 0 && IS_POWER_OF_2(alignment), 477 ("dma tag alignment %lu, must be non-zero power of 2", alignment)); 478 KASSERT(maxsegsz != 0, ("dma tag maxsegsz must not be zero")); |
472 473 /* Return a NULL tag on failure */ 474 *dmat = NULL; 475 | 479 480 /* Return a NULL tag on failure */ 481 *dmat = NULL; 482 |
476 if (maxsegsz == 0) { 477 return (EINVAL); 478 } 479 | |
480 newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, 481 M_ZERO | M_NOWAIT); 482 if (newtag == NULL) { 483 CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d", 484 __func__, newtag, 0, error); 485 return (ENOMEM); 486 } 487 --- 1200 unchanged lines hidden --- | 483 newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, 484 M_ZERO | M_NOWAIT); 485 if (newtag == NULL) { 486 CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d", 487 __func__, newtag, 0, error); 488 return (ENOMEM); 489 } 490 --- 1200 unchanged lines hidden --- |