freebsd11_network: Fix alignment check and print more information on failure.

We don't care what the virtual address is aligned to, only what the physical
one is. This now matches what FreeBSD does here.
This commit is contained in:
Augustin Cavalier
2018-07-02 22:16:11 -04:00
parent c9af3dafd5
commit c6992970cd
@@ -528,8 +528,9 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
__func__, dmat, dmat->flags, ENOMEM); __func__, dmat, dmat->flags, ENOMEM);
return (ENOMEM); return (ENOMEM);
} else if ((uintptr_t)*vaddr & (dmat->alignment - 1)) { } else if (vtophys(*vaddr) & (dmat->alignment - 1)) {
printf("bus_dmamem_alloc failed to align memory properly.\n"); printf("bus_dmamem_alloc failed to align memory: wanted %#x, got %#x\n",
dmat->alignment, vtophys(vaddr));
} }
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
__func__, dmat, dmat->flags, 0); __func__, dmat, dmat->flags, 0);