Date: Sat, 5 Sep 2009 08:56:55 -0700 (PDT) From: Matthew Dillon <dillon@apollo.backplane.com> To: Alexander Motin <mav@FreeBSD.org>, Scott Long <scottl@samsco.org>, Ryan Rogers <webmaster@doghouserepair.com>, current@FreeBSD.org Subject: Re: non aligned DMA transfer attempted Message-ID: <200909051556.n85Futap080958@apollo.backplane.com> References: <h7p0a3$k3m$1@FreeBSD.cs.nctu.edu.tw> <4AA03346.5010608@FreeBSD.org> <200909032210.n83MA67F059073@apollo.backplane.com> <A1B223C6-7291-4F86-B8AC-4EB5EF12F409@samsco.org> <200909042314.n84NEMAS072077@apollo.backplane.com> <4AA1FA41.1030804@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909051556.n85Futap080958>
