Re: non aligned DMA transfer attempted

From: Matthew Dillon <dillon_at_apollo.backplane.com>
Date: Sat, 5 Sep 2009 08:56:55 -0700 (PDT)
    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
Received on Sat Sep 05 2009 - 13:56:59 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:54 UTC