--- 02_pdc_long/drivers/scsi/pata_pdc2027x.c 2005-08-12 11:39:32.000000000 +0800 +++ 03_pdc_lost_irq/drivers/scsi/pata_pdc2027x.c 2005-08-12 15:04:09.000000000 +0800 @@ -29,7 +29,7 @@ #include #define DRV_NAME "pata_pdc2027x" -#define DRV_VERSION "0.71" +#define DRV_VERSION "0.72" #undef PDC_DEBUG #ifdef PDC_DEBUG @@ -467,11 +467,30 @@ static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc) { struct scsi_cmnd *cmd = qc->scsicmd; - int rc = 0; + u8 *scsicmd = cmd->cmnd; + int rc = 1; /* atapi dma off by default */ - /* pdc2027x can only do ATAPI DMA for specific buffer size */ - if (cmd->request_bufflen % 256) - rc = 1; + /* + * This workaround is from Promise's GPL driver. + * If ATAPI DMA is used for commands not in the + * following white list, say MODE_SENSE and REQUEST_SENSE, + * pdc2027x might hit the irq lost problem. + */ + switch (scsicmd[0]) { + case READ_10: + case WRITE_10: + case READ_12: + case WRITE_12: + case READ_6: + case WRITE_6: + case 0xad: /* READ_DVD_STRUCTURE */ + case 0xbe: /* READ_CD */ + /* ATAPI DMA is ok */ + rc = 0; + break; + default: + ; + } return rc; }