[PATCH 3/5] sata_nv: Cleanup taskfile setup

2007-02-19 Thread Robert Hancock

This edits the taskfile setup to more closely match the way that libata
sends the taskfile for other controllers. This avoids putting taskfile writes
into the CPB buffer that are not needed according to the taskfile flags.

Signed-off-by: Robert Hancock <[EMAIL PROTECTED]>

--- linux-2.6.20-git6edit/drivers/ata/sata_nv.c 2007-02-15 22:36:02.0 
-0600
+++ linux-2.6.20-git6edit/drivers/ata/sata_nv.c.delayandfixes   2007-02-19 
17:00:14.0 -0600
@@ -662,29 +662,30 @@ static unsigned int nv_adma_tf_to_cpb(st
{
unsigned int idx = 0;

-   cpb[idx++] = cpu_to_le16((ATA_REG_DEVICE << 8) | tf->device | WNB);
-
-   if ((tf->flags & ATA_TFLAG_LBA48) == 0) {
-   cpb[idx++] = cpu_to_le16(IGN);
-   cpb[idx++] = cpu_to_le16(IGN);
-   cpb[idx++] = cpu_to_le16(IGN);
-   cpb[idx++] = cpu_to_le16(IGN);
-   cpb[idx++] = cpu_to_le16(IGN);
-   }
-   else {
-   cpb[idx++] = cpu_to_le16((ATA_REG_ERR   << 8) | 
tf->hob_feature);
-   cpb[idx++] = cpu_to_le16((ATA_REG_NSECT << 8) | tf->hob_nsect);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAL  << 8) | tf->hob_lbal);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAM  << 8) | tf->hob_lbam);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAH  << 8) | tf->hob_lbah);
-   }
-   cpb[idx++] = cpu_to_le16((ATA_REG_ERR<< 8) | tf->feature);
-   cpb[idx++] = cpu_to_le16((ATA_REG_NSECT  << 8) | tf->nsect);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAL   << 8) | tf->lbal);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAM   << 8) | tf->lbam);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAH   << 8) | tf->lbah);
+   if(tf->flags & ATA_TFLAG_ISADDR) {
+   if (tf->flags & ATA_TFLAG_LBA48) {
+   cpb[idx++] = cpu_to_le16((ATA_REG_ERR   << 8) | 
tf->hob_feature | WNB);
+   cpb[idx++] = cpu_to_le16((ATA_REG_NSECT << 8) | 
tf->hob_nsect);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAL  << 8) | 
tf->hob_lbal);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAM  << 8) | 
tf->hob_lbam);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAH  << 8) | 
tf->hob_lbah);
+   cpb[idx++] = cpu_to_le16((ATA_REG_ERR<< 8) | 
tf->feature);
+   } else
+   cpb[idx++] = cpu_to_le16((ATA_REG_ERR<< 8) | 
tf->feature | WNB);
+   
+   cpb[idx++] = cpu_to_le16((ATA_REG_NSECT  << 8) | tf->nsect);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAL   << 8) | tf->lbal);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAM   << 8) | tf->lbam);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAH   << 8) | tf->lbah);
+   }
+   
+   if(tf->flags & ATA_TFLAG_DEVICE)
+   cpb[idx++] = cpu_to_le16((ATA_REG_DEVICE << 8) | tf->device);

cpb[idx++] = cpu_to_le16((ATA_REG_CMD<< 8) | tf->command | CMDEND);
+   
+   while(idx < 12)
+   cpb[idx++] = cpu_to_le16(IGN);

return idx;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] sata_nv: Cleanup taskfile setup

2007-02-19 Thread Robert Hancock

This edits the taskfile setup to more closely match the way that libata
sends the taskfile for other controllers. This avoids putting taskfile writes
into the CPB buffer that are not needed according to the taskfile flags.

Signed-off-by: Robert Hancock [EMAIL PROTECTED]

--- linux-2.6.20-git6edit/drivers/ata/sata_nv.c 2007-02-15 22:36:02.0 
-0600
+++ linux-2.6.20-git6edit/drivers/ata/sata_nv.c.delayandfixes   2007-02-19 
17:00:14.0 -0600
@@ -662,29 +662,30 @@ static unsigned int nv_adma_tf_to_cpb(st
{
unsigned int idx = 0;

-   cpb[idx++] = cpu_to_le16((ATA_REG_DEVICE  8) | tf-device | WNB);
-
-   if ((tf-flags  ATA_TFLAG_LBA48) == 0) {
-   cpb[idx++] = cpu_to_le16(IGN);
-   cpb[idx++] = cpu_to_le16(IGN);
-   cpb[idx++] = cpu_to_le16(IGN);
-   cpb[idx++] = cpu_to_le16(IGN);
-   cpb[idx++] = cpu_to_le16(IGN);
-   }
-   else {
-   cpb[idx++] = cpu_to_le16((ATA_REG_ERR8) | 
tf-hob_feature);
-   cpb[idx++] = cpu_to_le16((ATA_REG_NSECT  8) | tf-hob_nsect);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAL   8) | tf-hob_lbal);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAM   8) | tf-hob_lbam);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAH   8) | tf-hob_lbah);
-   }
-   cpb[idx++] = cpu_to_le16((ATA_REG_ERR 8) | tf-feature);
-   cpb[idx++] = cpu_to_le16((ATA_REG_NSECT   8) | tf-nsect);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAL8) | tf-lbal);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAM8) | tf-lbam);
-   cpb[idx++] = cpu_to_le16((ATA_REG_LBAH8) | tf-lbah);
+   if(tf-flags  ATA_TFLAG_ISADDR) {
+   if (tf-flags  ATA_TFLAG_LBA48) {
+   cpb[idx++] = cpu_to_le16((ATA_REG_ERR8) | 
tf-hob_feature | WNB);
+   cpb[idx++] = cpu_to_le16((ATA_REG_NSECT  8) | 
tf-hob_nsect);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAL   8) | 
tf-hob_lbal);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAM   8) | 
tf-hob_lbam);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAH   8) | 
tf-hob_lbah);
+   cpb[idx++] = cpu_to_le16((ATA_REG_ERR 8) | 
tf-feature);
+   } else
+   cpb[idx++] = cpu_to_le16((ATA_REG_ERR 8) | 
tf-feature | WNB);
+   
+   cpb[idx++] = cpu_to_le16((ATA_REG_NSECT   8) | tf-nsect);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAL8) | tf-lbal);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAM8) | tf-lbam);
+   cpb[idx++] = cpu_to_le16((ATA_REG_LBAH8) | tf-lbah);
+   }
+   
+   if(tf-flags  ATA_TFLAG_DEVICE)
+   cpb[idx++] = cpu_to_le16((ATA_REG_DEVICE  8) | tf-device);

cpb[idx++] = cpu_to_le16((ATA_REG_CMD 8) | tf-command | CMDEND);
+   
+   while(idx  12)
+   cpb[idx++] = cpu_to_le16(IGN);

return idx;
}

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/