non aligned DMA transfer attempted
Matthew Dillon
dillon at apollo.backplane.com
Sat Sep 5 15:56:59 UTC 2009
Ah, I found the code reference. This is something I had to throw
into DFly's version of the ATA driver:
/*
* Don't allow DMA for requests with length not multiple of 16 bytes.
* Some ATAPI devices don't like it.
*/
if ((softc->atadev[tid]->mode >= ATA_DMA) && len > 0 && !(len & 15))
request_flags |= ATA_R_DMA;
It turns out that for non-SATA (older) chipsets ATAPI command DMA is
speced to only run in multiples of 16 bytes. If an ATAPI request
buffer is not a multiple of 16 bytes the two choices are to
either (1) PAD the request buffer to 16 bytes or (2) Not use a DMA
transfer mode. I eventually chose (2).
The issue with (1) is that the busdma subsystem doesn't really have
a way to specify a length alignment requirement, only a base offset
alignment requirement, and buffer passed from userland might be
declared on the stack so unlike buffers passed by the kernel there may
not be any extra play in the buffer which allows one to simply DMA a
little bit more into it.
I'm fairly sure that SATA chipsets don't care, this seems to be an
issue with pre-SATA chipsets.
-Matt
More information about the freebsd-current
mailing list