Jeff,

  pdc2027x: pdc2027x ATAPI DMA fix.
The previous (request_bufflen % 256) ATAPI DMA rule still fails and causes 
timeout in some case.

Changes:
- Only turn on pdc2027x ATAPI DMA for READ/WRITE and (request_bufflen % 1024 == 
0) for safty.

Attached please find the patch against the libata-dev-2.6 tree for your review. 
Thanks.

Albert
--- libata-dev-2.6-pll-fix/drivers/scsi/pata_pdc2027x.c 2005-04-11 
15:05:42.000000000 +0800
+++ libata-dev-2.6-dma_fix/drivers/scsi/pata_pdc2027x.c 2005-04-16 
08:59:34.000000000 +0800
@@ -29,7 +29,7 @@
 #include <asm/io.h>
 
 #define DRV_NAME       "pata_pdc2027x"
-#define DRV_VERSION    "0.60"
+#define DRV_VERSION    "0.61"
 #undef PDC_DEBUG
 
 #ifdef PDC_DEBUG
@@ -445,11 +445,26 @@
 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;
+       switch (scsicmd[0]) {
+       case READ_6:
+       case READ_10:
+       case READ_12:
+       case READ_16:
+
+       case WRITE_6:
+       case WRITE_10:
+       case WRITE_12:
+       case WRITE_16:
+               /* pdc2027x can only do ATAPI DMA for specific buffer size */
+               if (cmd->request_bufflen % 1024 == 0)
+                       rc = 0;
+               break;
+       default:
+               ;
+       }
 
        return rc;
 }

Reply via email to