Deleted Added
full compact
busdma_machdep-v6.c (314506) busdma_machdep-v6.c (318976)
1/*-
2 * Copyright (c) 2012-2015 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-2015 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: stable/11/sys/arm/arm/busdma_machdep-v6.c 314506 2017-03-01 19:55:04Z ian $");
34__FBSDID("$FreeBSD: stable/11/sys/arm/arm/busdma_machdep-v6.c 318976 2017-05-27 07:47:52Z hselasky $");
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/malloc.h>
39#include <sys/bus.h>
40#include <sys/busdma_bufalloc.h>
41#include <sys/counter.h>
42#include <sys/interrupt.h>

--- 731 unchanged lines hidden (view full) ---

774
775 /*
776 * Allocate the buffer from the uma(9) allocator if...
777 * - It's small enough to be in the allocator (bufzone not NULL).
778 * - The alignment constraint isn't larger than the allocation size
779 * (the allocator aligns buffers to their size boundaries).
780 * - There's no need to handle lowaddr/highaddr exclusion zones.
781 * else allocate non-contiguous pages if...
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/malloc.h>
39#include <sys/bus.h>
40#include <sys/busdma_bufalloc.h>
41#include <sys/counter.h>
42#include <sys/interrupt.h>

--- 731 unchanged lines hidden (view full) ---

774
775 /*
776 * Allocate the buffer from the uma(9) allocator if...
777 * - It's small enough to be in the allocator (bufzone not NULL).
778 * - The alignment constraint isn't larger than the allocation size
779 * (the allocator aligns buffers to their size boundaries).
780 * - There's no need to handle lowaddr/highaddr exclusion zones.
781 * else allocate non-contiguous pages if...
782 * - The page count that could get allocated doesn't exceed nsegments.
782 * - The page count that could get allocated doesn't exceed
783 * nsegments also when the maximum segment size is less
784 * than PAGE_SIZE.
783 * - The alignment constraint isn't larger than a page boundary.
784 * - There are no boundary-crossing constraints.
785 * else allocate a block of contiguous pages because one or more of the
786 * constraints is something that only the contig allocator can fulfill.
787 */
788 if (bufzone != NULL && dmat->alignment <= bufzone->size &&
789 !exclusion_bounce(dmat)) {
790 *vaddr = uma_zalloc(bufzone->umazone, mflags);
785 * - The alignment constraint isn't larger than a page boundary.
786 * - There are no boundary-crossing constraints.
787 * else allocate a block of contiguous pages because one or more of the
788 * constraints is something that only the contig allocator can fulfill.
789 */
790 if (bufzone != NULL && dmat->alignment <= bufzone->size &&
791 !exclusion_bounce(dmat)) {
792 *vaddr = uma_zalloc(bufzone->umazone, mflags);
791 } else if (dmat->nsegments >= btoc(dmat->maxsize) &&
792 dmat->alignment <= PAGE_SIZE && dmat->boundary == 0) {
793 } else if (dmat->nsegments >=
794 howmany(dmat->maxsize, MIN(dmat->maxsegsz, PAGE_SIZE)) &&
795 dmat->alignment <= PAGE_SIZE &&
796 (dmat->boundary % PAGE_SIZE) == 0) {
793 *vaddr = (void *)kmem_alloc_attr(kernel_arena, dmat->maxsize,
794 mflags, 0, dmat->lowaddr, memattr);
795 } else {
796 *vaddr = (void *)kmem_alloc_contig(kernel_arena, dmat->maxsize,
797 mflags, 0, dmat->lowaddr, dmat->alignment, dmat->boundary,
798 memattr);
799 }
800 if (*vaddr == NULL) {

--- 893 unchanged lines hidden ---
797 *vaddr = (void *)kmem_alloc_attr(kernel_arena, dmat->maxsize,
798 mflags, 0, dmat->lowaddr, memattr);
799 } else {
800 *vaddr = (void *)kmem_alloc_contig(kernel_arena, dmat->maxsize,
801 mflags, 0, dmat->lowaddr, dmat->alignment, dmat->boundary,
802 memattr);
803 }
804 if (*vaddr == NULL) {

--- 893 unchanged lines hidden ---