• Albert Lee's avatar
    [libata] verify ATAPI DMA for a given request is OK · a56bb4da
    Albert Lee authored
    After some testing, it seems that some PATA host adapter (ex. pdc20275) cannot 
    work reliably with specific request buffer sizes under ATAPI DMA mode.
    
    Detailed test result:
    4096, 2048, 1024, 512, 256: OK
    384, 257, 255, 128, 96, 64, 32:  failed (irq lost)
     
    It seems multiple of 256 bytes are the safe ATAPI DMA buffer sizes to use.
    
    Attached please find the patch to fix the pdc2027x ATAPI DMA problem.
    
    Changes:
    1. Add a callback function "check_atapi_dma()" to ata_port_operations such that libata core
    can ask the driver: "Can this command be processed in ATAPI DMA mode safely? " 
    when the the command is received.
    2. ATAPI DMA is off by default if the callback function is not provided by the driver
    
    If the callback function is not provided by the driver, the ATAPI DMA should be as is.
    The ATAPI DMA is already controlled by dev->flags.
    
    BTW, the patch isolates the ATAPI DMA workaround to the pdc20275 driver itself,
    not impacting libata core .
    Signed-off-by: default avatarAlbert Lee <albertcc@tw.ibm.com>
    a56bb4da
libata-scsi.c 38.5 KB