patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / drivers / scsi / ata_piix.c
index d26ee03..a6588b0 100644 (file)
@@ -2,6 +2,10 @@
 
     ata_piix.c - Intel PATA/SATA controllers
 
+    Maintained by:  Jeff Garzik <jgarzik@pobox.com>
+                   Please ALWAYS copy linux-ide@vger.kernel.org
+                   on emails.
+
 
        Copyright 2003-2004 Red Hat Inc
        Copyright 2003-2004 Jeff Garzik
@@ -24,7 +28,7 @@
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #define DRV_NAME       "ata_piix"
@@ -132,6 +136,7 @@ static struct ata_port_operations piix_pata_ops = {
 
        .phy_reset              = piix_pata_phy_reset,
 
+       .bmdma_setup            = ata_bmdma_setup_pio,
        .bmdma_start            = ata_bmdma_start_pio,
        .fill_sg                = ata_fill_sg,
        .eng_timeout            = ata_eng_timeout,
@@ -154,6 +159,7 @@ static struct ata_port_operations piix_sata_ops = {
 
        .phy_reset              = piix_sata_phy_reset,
 
+       .bmdma_setup            = ata_bmdma_setup_pio,
        .bmdma_start            = ata_bmdma_start_pio,
        .fill_sg                = ata_fill_sg,
        .eng_timeout            = ata_eng_timeout,
@@ -266,7 +272,7 @@ static void piix_pata_phy_reset(struct ata_port *ap)
 
 /**
  *     piix_sata_probe - Probe PCI device for present SATA devices
- *     @pdev: PCI device to probe
+ *     @ap: Port associated with the PCI device we wish to probe
  *
  *     Reads SATA PCI device's PCI config register Port Configuration
  *     and Status (PCS) to determine port and device availability.
@@ -418,16 +424,15 @@ static void piix_set_udmamode (struct ata_port *ap, struct ata_device *adev,
        int w_flag              = 0x10 << drive_dn;
        int u_speed             = 0;
        int                     sitre;
-       u16                     reg4042, reg44, reg48, reg4a, reg54;
-       u8                      reg55;
+       u16                     reg4042, reg4a;
+       u8                      reg48, reg54, reg55;
 
        pci_read_config_word(dev, maslave, &reg4042);
        DPRINTK("reg4042 = 0x%04x\n", reg4042);
        sitre = (reg4042 & 0x4000) ? 1 : 0;
-       pci_read_config_word(dev, 0x44, &reg44);
-       pci_read_config_word(dev, 0x48, &reg48);
+       pci_read_config_byte(dev, 0x48, &reg48);
        pci_read_config_word(dev, 0x4a, &reg4a);
-       pci_read_config_word(dev, 0x54, &reg54);
+       pci_read_config_byte(dev, 0x54, &reg54);
        pci_read_config_byte(dev, 0x55, &reg55);
 
        switch(speed) {
@@ -444,23 +449,19 @@ static void piix_set_udmamode (struct ata_port *ap, struct ata_device *adev,
        }
 
        if (!(reg48 & u_flag))
-               pci_write_config_word(dev, 0x48, reg48|u_flag);
+               pci_write_config_byte(dev, 0x48, reg48 | u_flag);
        if (speed == XFER_UDMA_5) {
                pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag);
        } else {
                pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
        }
-       if (!(reg4a & u_speed)) {
-               pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
-               pci_write_config_word(dev, 0x4a, reg4a|u_speed);
-       }
+       if ((reg4a & a_speed) != u_speed)
+               pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
        if (speed > XFER_UDMA_2) {
-               if (!(reg54 & v_flag)) {
-                       pci_write_config_word(dev, 0x54, reg54|v_flag);
-               }
-       } else {
-               pci_write_config_word(dev, 0x54, reg54 & ~v_flag);
-       }
+               if (!(reg54 & v_flag))
+                       pci_write_config_byte(dev, 0x54, reg54 | v_flag);
+       } else
+               pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
 }
 
 /* move to PCI layer, integrate w/ MSI stuff */