Rename _bus_dma_can_bounce(), add new inline routines.

DMA on arm can bounce for several reasons, and _bus_dma_can_bounce() only
checks for the lowaddr/highaddr exclusion ranges in the dma tag, so now
it's named exclusion_bounce().  The other reasons for bouncing are checked
by the new functions alignment_bounce() and cacheline_bounce().

Reviewed by:	cognet
The exclusion_bounce() routine compares unchanging values in the tag with
unchanging values in the phys_avail array, so do the comparisons just once
at tag creation time and set a flag to remember the result.

Reviewed by:	cognet
Correct the comparison logic when looking for intersections between
exclusion zones and phsyical memory.  The phys_avail[i] entries are the
address of the first byte of ram in the region, and phys_avail[i+1]
entries are the address of the first byte of ram in the next region
(i.e., they're not included in the region that starts at phys_avail[i]).

Reviewed by:	cognet
Reformat some continuation lines.  No functional changes.

Reviewed by:	cognet
Propagate any alignment restriction from the parent tag to a new tag,
keeping the more restrictive of the two values.

Reviewed by:	cognet
The run_filter() function doesn't just run dma tag exclusion filter
functions, it has evolved to make a variety of decisions about whether
the DMA needs to bounce, so rename it to must_bounce().  Rewrite it to
perform checks outside of the ancestor loop if they're based on information
that's wholly contained within the original tag.  Now the loop only checks
exclusion zones in ancestor tags.

Also, add a new function, might_bounce() which does a fast inline check
of flags within the tag and map to quickly eliminate the need to call
the more expensive must_bounce() for each page in the DMA operation.

Within the mapping loops, use map->pagesneeded != 0 as a proxy for all
the various checks on whether bouncing might be required.  If no pages
were reserved for bouncing during the checks before the mapping loop,
then there's no need to re-check any of the conditions that can lead
to bouncing -- all those checks already decided there would be no bouncing.

Reviewed by:	cognet
Memory belonging to an mbuf, or allocated by bus_dmamem_alloc(), never
triggers a need to bounce due to cacheline alignment.  These buffers
are always aligned to cacheline boundaries, and even when the DMA operation
starts at an offset within the buffer or doesn't extend to the end of the
buffer, it's safe to flush the complete cachelines that were only partially
involved in the DMA.  This is because there's a very strict rule on these
types of buffers that there will not be concurrent access by the CPU and
one or more DMA transfers within the buffer.

Reviewed by:	cognet
Don't clear the DMAMAP_DMAMEM_ALLOC flag set a few lines earlier.  Doh!

Reviewed by:	cognet
Replace a bunch of double-indirection with a local pointer var (that is,
(*mapp)->something becomes map->something).  No functional changes.

Reviewed by:	cognet
We never need bounce pages for memory we allocate.  We cleverly allocate
memory the matches all the constraints of the dma tag so that bouncing
will never be required.

Reviewed by:	cognet
A while back, the array of segments used for a load/mapping operation was
moved from the stack into the tag structure.  In retrospect that was a bad
idea, because nothing protects that array from concurrent access by
multiple threads.

This change moves the array to the map structure (actually it's allocated
following the structure, but all in a single malloc() call).

This also establishes a "sane" limit of 4096 segments per map.  This is
mostly to prevent trying to allocate all of memory if someone accidentally
uses a tag with nsegments set to BUS_SPACE_UNRESTRICTED.  If there's ever
a genuine need for more than 4096, don't hesitate to increase this (or
maybe make it tunable).

Reviewed by:	cognet
Export some new busdma stats via sysctl for armv6.  Added:

 hw.busdma.tags_total: 46
 hw.busdma.maps_total: 1302
 hw.busdma.maps_dmamem: 851
 hw.busdma.maps_coherent: 849
 hw.busdma.maploads_total: 1568812
 hw.busdma.maploads_bounced: 16750
 hw.busdma.maploads_coherent: 920
 hw.busdma.maploads_dmamem: 920
 hw.busdma.maploads_mbuf: 1542766
 hw.busdma.maploads_physmem: 0