From: Alan Cox Still don't know why some people see problems with ATAPI devices specifically but here are some more small fixes done while searching for the root problem (some of these fixes are overconservative but that can be fixed *after* the thing works fully) Signed-off-by: Alan Cox Signed-off-by: Andrew Morton --- drivers/ata/pata_ali.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff -puN drivers/ata/pata_ali.c~pata_ali-more-work drivers/ata/pata_ali.c --- a/drivers/ata/pata_ali.c~pata_ali-more-work +++ a/drivers/ata/pata_ali.c @@ -346,6 +346,16 @@ static int ali_check_atapi_dma(struct at return 0; } +static int ali_check_atapi_dma_20(struct ata_queued_cmd *qc) +{ + if (qc->dma_dir == DMA_TO_DEVICE) + return -1; + /* Don't do DMA except for whole blocks */ + if (qc->nbytes & 511) + return -1; + return 0; +} + static struct scsi_host_template ali_sht = { .module = THIS_MODULE, .name = DRV_NAME, @@ -385,7 +395,6 @@ static struct ata_port_operations ali_ea .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, - .check_atapi_dma= ali_check_atapi_dma, .data_xfer = ata_data_xfer, @@ -428,7 +437,7 @@ static struct ata_port_operations ali_20 .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, - .check_atapi_dma= ali_check_atapi_dma, + .check_atapi_dma= ali_check_atapi_dma_20, .data_xfer = ata_data_xfer, @@ -625,22 +634,22 @@ static int ali_init_one(struct pci_dev * .udma_mask = 0x1f, .port_ops = &ali_c2_port_ops }; - /* Revision 0xC3 is UDMA100 */ + /* Revision 0xC3 is UDMA66 for now */ static const struct ata_port_info info_c3 = { .sht = &ali_sht, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_PIO_LBA48, .pio_mask = 0x1f, .mwdma_mask = 0x07, - .udma_mask = 0x3f, + .udma_mask = 0x1f, .port_ops = &ali_c2_port_ops }; - /* Revision 0xC4 is UDMA133 */ + /* Revision 0xC4 is UDMA100 */ static const struct ata_port_info info_c4 = { .sht = &ali_sht, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_PIO_LBA48, .pio_mask = 0x1f, .mwdma_mask = 0x07, - .udma_mask = 0x7f, + .udma_mask = 0x3f, .port_ops = &ali_c2_port_ops }; /* Revision 0xC5 is UDMA133 with LBA48 DMA */ _