busdma_machdep-v4.c (244473) | busdma_machdep-v4.c (244575) |
---|---|
1/*- 2 * Copyright (c) 2012 Ian Lepore 3 * Copyright (c) 2004 Olivier Houchard 4 * Copyright (c) 2002 Peter Grehan 5 * Copyright (c) 1997, 1998 Justin T. Gibbs. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * From i386/busdma_machdep.c,v 1.26 2002/04/19 22:58:09 alfred 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2012 Ian Lepore 3 * Copyright (c) 2004 Olivier Houchard 4 * Copyright (c) 2002 Peter Grehan 5 * Copyright (c) 1997, 1998 Justin T. Gibbs. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * From i386/busdma_machdep.c,v 1.26 2002/04/19 22:58:09 alfred 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/arm/arm/busdma_machdep.c 244473 2012-12-20 00:50:04Z cognet $"); | 33__FBSDID("$FreeBSD: head/sys/arm/arm/busdma_machdep.c 244575 2012-12-22 01:04:29Z cognet $"); |
34 35/* 36 * ARM bus dma support routines. 37 * 38 * XXX Things to investigate / fix some day... 39 * - What is the earliest that this API can be called? Could there be any 40 * fallout from changing the SYSINIT() order from SI_SUB_VM to SI_SUB_KMEM? 41 * - The manpage mentions the BUS_DMA_NOWAIT flag only in the context of the --- 520 unchanged lines hidden (view full) --- 562 * address space into bus device space. 563 */ 564int 565bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) 566{ 567 bus_dmamap_t map; 568 int error = 0; 569 | 34 35/* 36 * ARM bus dma support routines. 37 * 38 * XXX Things to investigate / fix some day... 39 * - What is the earliest that this API can be called? Could there be any 40 * fallout from changing the SYSINIT() order from SI_SUB_VM to SI_SUB_KMEM? 41 * - The manpage mentions the BUS_DMA_NOWAIT flag only in the context of the --- 520 unchanged lines hidden (view full) --- 562 * address space into bus device space. 563 */ 564int 565bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) 566{ 567 bus_dmamap_t map; 568 int error = 0; 569 |
570 map = uma_zalloc_arg(dmamap_zone, dmat, M_WAITOK); | 570 map = uma_zalloc_arg(dmamap_zone, dmat, M_NOWAIT); |
571 *mapp = map; | 571 *mapp = map; |
572 if (map == NULL) 573 return (ENOMEM); |
|
572 573 /* 574 * If the tag's segments haven't been allocated yet we need to do it 575 * now, because we can't sleep for resources at map load time. 576 */ | 574 575 /* 576 * If the tag's segments haven't been allocated yet we need to do it 577 * now, because we can't sleep for resources at map load time. 578 */ |
577 if (dmat->segments == NULL) | 579 if (dmat->segments == NULL) { |
578 dmat->segments = malloc(dmat->nsegments * | 580 dmat->segments = malloc(dmat->nsegments * |
579 sizeof(*dmat->segments), M_DEVBUF, M_WAITOK); | 581 sizeof(*dmat->segments), M_DEVBUF, M_NOWAIT); 582 if (dmat->segments == NULL) { 583 uma_zfree(dmamap_zone, map); 584 *mapp = NULL; 585 return (ENOMEM); 586 } 587 } |
580 581 /* 582 * Bouncing might be required if the driver asks for an active 583 * exclusion region, a data alignment that is stricter than 1, and/or 584 * an active address boundary. 585 */ 586 if (dmat->flags & BUS_DMA_COULD_BOUNCE) { 587 --- 1017 unchanged lines hidden --- | 588 589 /* 590 * Bouncing might be required if the driver asks for an active 591 * exclusion region, a data alignment that is stricter than 1, and/or 592 * an active address boundary. 593 */ 594 if (dmat->flags & BUS_DMA_COULD_BOUNCE) { 595 --- 1017 unchanged lines hidden --- |