Merge branch 'linus' into cpus4096
[pandora-kernel.git] / drivers / ata / sata_svw.c
index 840d1c4..fb13b82 100644 (file)
@@ -233,7 +233,7 @@ static void k2_bmdma_setup_mmio(struct ata_queued_cmd *qc)
 
        /* issue r/w command if this is not a ATA DMA command*/
        if (qc->tf.protocol != ATA_PROT_DMA)
-               ap->ops->exec_command(ap, &qc->tf);
+               ap->ops->sff_exec_command(ap, &qc->tf);
 }
 
 /**
@@ -253,23 +253,31 @@ static void k2_bmdma_start_mmio(struct ata_queued_cmd *qc)
        /* start host DMA transaction */
        dmactl = readb(mmio + ATA_DMA_CMD);
        writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD);
-       /* There is a race condition in certain SATA controllers that can
-          be seen when the r/w command is given to the controller before the
-          host DMA is started. On a Read command, the controller would initiate
-          the command to the drive even before it sees the DMA start. When there
-          are very fast drives connected to the controller, or when the data request
-          hits in the drive cache, there is the possibility that the drive returns a part
-          or all of the requested data to the controller before the DMA start is issued.
-          In this case, the controller would become confused as to what to do with the data.
-          In the worst case when all the data is returned back to the controller, the
-          controller could hang. In other cases it could return partial data returning
-          in data corruption. This problem has been seen in PPC systems and can also appear
-          on an system with very fast disks, where the SATA controller is sitting behind a
-          number of bridges, and hence there is significant latency between the r/w command
-          and the start command. */
-       /* issue r/w command if the access is to ATA*/
+       /* This works around possible data corruption.
+
+          On certain SATA controllers that can be seen when the r/w
+          command is given to the controller before the host DMA is
+          started.
+
+          On a Read command, the controller would initiate the
+          command to the drive even before it sees the DMA
+          start. When there are very fast drives connected to the
+          controller, or when the data request hits in the drive
+          cache, there is the possibility that the drive returns a
+          part or all of the requested data to the controller before
+          the DMA start is issued.  In this case, the controller
+          would become confused as to what to do with the data.  In
+          the worst case when all the data is returned back to the
+          controller, the controller could hang. In other cases it
+          could return partial data returning in data
+          corruption. This problem has been seen in PPC systems and
+          can also appear on an system with very fast disks, where
+          the SATA controller is sitting behind a number of bridges,
+          and hence there is significant latency between the r/w
+          command and the start command. */
+       /* issue r/w command if the access is to ATA */
        if (qc->tf.protocol == ATA_PROT_DMA)
-               ap->ops->exec_command(ap, &qc->tf);
+               ap->ops->sff_exec_command(ap, &qc->tf);
 }
 
 
@@ -327,50 +335,23 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
 
 
 static struct scsi_host_template k2_sata_sht = {
-       .module                 = THIS_MODULE,
-       .name                   = DRV_NAME,
-       .ioctl                  = ata_scsi_ioctl,
-       .queuecommand           = ata_scsi_queuecmd,
-       .can_queue              = ATA_DEF_QUEUE,
-       .this_id                = ATA_SHT_THIS_ID,
-       .sg_tablesize           = LIBATA_MAX_PRD,
-       .cmd_per_lun            = ATA_SHT_CMD_PER_LUN,
-       .emulated               = ATA_SHT_EMULATED,
-       .use_clustering         = ATA_SHT_USE_CLUSTERING,
-       .proc_name              = DRV_NAME,
-       .dma_boundary           = ATA_DMA_BOUNDARY,
-       .slave_configure        = ata_scsi_slave_config,
-       .slave_destroy          = ata_scsi_slave_destroy,
+       ATA_BMDMA_SHT(DRV_NAME),
 #ifdef CONFIG_PPC_OF
        .proc_info              = k2_sata_proc_info,
 #endif
-       .bios_param             = ata_std_bios_param,
 };
 
 
-static const struct ata_port_operations k2_sata_ops = {
-       .tf_load                = k2_sata_tf_load,
-       .tf_read                = k2_sata_tf_read,
-       .check_status           = k2_stat_check_status,
-       .exec_command           = ata_exec_command,
-       .dev_select             = ata_std_dev_select,
+static struct ata_port_operations k2_sata_ops = {
+       .inherits               = &ata_bmdma_port_ops,
+       .sff_tf_load            = k2_sata_tf_load,
+       .sff_tf_read            = k2_sata_tf_read,
+       .sff_check_status       = k2_stat_check_status,
        .check_atapi_dma        = k2_sata_check_atapi_dma,
        .bmdma_setup            = k2_bmdma_setup_mmio,
        .bmdma_start            = k2_bmdma_start_mmio,
-       .bmdma_stop             = ata_bmdma_stop,
-       .bmdma_status           = ata_bmdma_status,
-       .qc_prep                = ata_qc_prep,
-       .qc_issue               = ata_qc_issue_prot,
-       .data_xfer              = ata_data_xfer,
-       .freeze                 = ata_bmdma_freeze,
-       .thaw                   = ata_bmdma_thaw,
-       .error_handler          = ata_bmdma_error_handler,
-       .post_internal_cmd      = ata_bmdma_post_internal_cmd,
-       .irq_clear              = ata_bmdma_irq_clear,
-       .irq_on                 = ata_irq_on,
        .scr_read               = k2_sata_scr_read,
        .scr_write              = k2_sata_scr_write,
-       .port_start             = ata_port_start,
 };
 
 static const struct ata_port_info k2_port_info[] = {
@@ -519,8 +500,8 @@ static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *en
        writel(0x0, mmio_base + K2_SATA_SIM_OFFSET);
 
        pci_set_master(pdev);
-       return ata_host_activate(host, pdev->irq, ata_interrupt, IRQF_SHARED,
-                                &k2_sata_sht);
+       return ata_host_activate(host, pdev->irq, ata_sff_interrupt,
+                                IRQF_SHARED, &k2_sata_sht);
 }
 
 /* 0x240 is device ID for Apple K2 device
@@ -531,8 +512,8 @@ static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *en
  * */
 static const struct pci_device_id k2_sata_pci_tbl[] = {
        { PCI_VDEVICE(SERVERWORKS, 0x0240), chip_svw4 },
-       { PCI_VDEVICE(SERVERWORKS, 0x0241), chip_svw4 },
-       { PCI_VDEVICE(SERVERWORKS, 0x0242), chip_svw8 },
+       { PCI_VDEVICE(SERVERWORKS, 0x0241), chip_svw8 },
+       { PCI_VDEVICE(SERVERWORKS, 0x0242), chip_svw4 },
        { PCI_VDEVICE(SERVERWORKS, 0x024a), chip_svw4 },
        { PCI_VDEVICE(SERVERWORKS, 0x024b), chip_svw4 },
        { PCI_VDEVICE(SERVERWORKS, 0x0410), chip_svw42 },