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 widens the conditions for using kmem_alloc_attr() to also cover more cases where the boundary parameter is non-zero and less than lowaddr.
This patch also fixes the nsegments check for using kmem_alloc_attr() when the maximum segment size is less than PAGE_SIZE .
Sponsored by: Mellanox Technologies
MFC after: 1 week