When the BUSDMA boundary is non-zero, as for AMD64 due to PCI_DMA_BOUNDARY and the BUSDMA lowaddr is equal to BUS_SPACE_MAXADDR, the bus_dmamem_alloc() function always fall back into using a contiguous allocation even when this is not needed.
This patch adds some more conditions where a page based allocation will work. The conditions added basically does the following:
If the boundary is divisible into the alignment and the alignment is divisible into the maximum segment size, it is not possible to get a segment which crosses the boundary.
Sponsored by: Mellanox Technologies
MFC after: 1 week