• Tejun Heo's avatar
    libata: fix ATAPI draining · 140b5e59
    Tejun Heo authored
    With ATAPI transfer chunk size properly programmed, libata PIO HSM
    should be able to handle full spurious data chunks.  Also, it's a good
    idea to suppress trailing data warning for misc ATAPI commands as
    there can be many of them per command - for example, if the chunk size
    is 16 and the drive tries to transfer 510 bytes, there can be 31
    trailing data messages.
    
    This patch makes the following updates to libata ATAPI PIO HSM
    implementation.
    
    * Make it drain full spurious chunks.
    
    * Suppress trailing data warning message for misc commands.
    
    * Put limit on how many bytes can be drained.
    
    * If odd, round up consumed bytes and the number of bytes to be
      drained.  This gets the number of bytes to drain right for drivers
      which do 16bit PIO.
    
    This patch is partial backport of improve-ATAPI-data-xfer patchset
    pending for #upstream.
    Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
    Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
    140b5e59
libata-core.c 192 KB