libata: don't flush dcache on slab pages
[safe/jmp/linux-2.6] / drivers / ata / libata-sff.c
index e3877b6..c0a9054 100644 (file)
@@ -63,7 +63,6 @@ const struct ata_port_operations ata_sff_port_ops = {
        .sff_tf_read            = ata_sff_tf_read,
        .sff_exec_command       = ata_sff_exec_command,
        .sff_data_xfer          = ata_sff_data_xfer,
-       .sff_irq_on             = ata_sff_irq_on,
        .sff_irq_clear          = ata_sff_irq_clear,
 
        .lost_interrupt         = ata_sff_lost_interrupt,
@@ -446,6 +445,27 @@ int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline)
 EXPORT_SYMBOL_GPL(ata_sff_wait_ready);
 
 /**
+ *     ata_sff_set_devctl - Write device control reg
+ *     @ap: port where the device is
+ *     @ctl: value to write
+ *
+ *     Writes ATA taskfile device control register.
+ *
+ *     Note: may NOT be used as the sff_set_devctl() entry in
+ *     ata_port_operations.
+ *
+ *     LOCKING:
+ *     Inherited from caller.
+ */
+static void ata_sff_set_devctl(struct ata_port *ap, u8 ctl)
+{
+       if (ap->ops->sff_set_devctl)
+               ap->ops->sff_set_devctl(ap, ctl);
+       else
+               iowrite8(ctl, ap->ioaddr.ctl_addr);
+}
+
+/**
  *     ata_sff_dev_select - Select device 0/1 on ATA bus
  *     @ap: ATA channel to manipulate
  *     @device: ATA device (numbered from zero) to select
@@ -517,24 +537,29 @@ void ata_dev_select(struct ata_port *ap, unsigned int device,
  *     Enable interrupts on a legacy IDE device using MMIO or PIO,
  *     wait for idle, clear any pending interrupts.
  *
+ *     Note: may NOT be used as the sff_irq_on() entry in
+ *     ata_port_operations.
+ *
  *     LOCKING:
  *     Inherited from caller.
  */
-u8 ata_sff_irq_on(struct ata_port *ap)
+void ata_sff_irq_on(struct ata_port *ap)
 {
        struct ata_ioports *ioaddr = &ap->ioaddr;
-       u8 tmp;
+
+       if (ap->ops->sff_irq_on) {
+               ap->ops->sff_irq_on(ap);
+               return;
+       }
 
        ap->ctl &= ~ATA_NIEN;
        ap->last_ctl = ap->ctl;
 
-       if (ioaddr->ctl_addr)
-               iowrite8(ap->ctl, ioaddr->ctl_addr);
-       tmp = ata_wait_idle(ap);
+       if (ap->ops->sff_set_devctl || ioaddr->ctl_addr)
+               ata_sff_set_devctl(ap, ap->ctl);
+       ata_wait_idle(ap);
 
        ap->ops->sff_irq_clear(ap);
-
-       return tmp;
 }
 EXPORT_SYMBOL_GPL(ata_sff_irq_on);
 
@@ -894,7 +919,7 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
                                       do_write);
        }
 
-       if (!do_write)
+       if (!do_write && !PageSlab(page))
                flush_dcache_page(page);
 
        qc->curbytes += qc->sect_size;
@@ -1165,7 +1190,7 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
                        qc = ata_qc_from_tag(ap, qc->tag);
                        if (qc) {
                                if (likely(!(qc->err_mask & AC_ERR_HSM))) {
-                                       ap->ops->sff_irq_on(ap);
+                                       ata_sff_irq_on(ap);
                                        ata_qc_complete(qc);
                                } else
                                        ata_port_freeze(ap);
@@ -1181,7 +1206,7 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
        } else {
                if (in_wq) {
                        spin_lock_irqsave(ap->lock, flags);
-                       ap->ops->sff_irq_on(ap);
+                       ata_sff_irq_on(ap);
                        ata_qc_complete(qc);
                        spin_unlock_irqrestore(ap->lock, flags);
                } else
@@ -1895,13 +1920,11 @@ EXPORT_SYMBOL_GPL(ata_sff_lost_interrupt);
  */
 void ata_sff_freeze(struct ata_port *ap)
 {
-       struct ata_ioports *ioaddr = &ap->ioaddr;
-
        ap->ctl |= ATA_NIEN;
        ap->last_ctl = ap->ctl;
 
-       if (ioaddr->ctl_addr)
-               iowrite8(ap->ctl, ioaddr->ctl_addr);
+       if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr)
+               ata_sff_set_devctl(ap, ap->ctl);
 
        /* Under certain circumstances, some controllers raise IRQ on
         * ATA_NIEN manipulation.  Also, many controllers fail to mask
@@ -1927,7 +1950,7 @@ void ata_sff_thaw(struct ata_port *ap)
        /* clear & re-enable interrupts */
        ap->ops->sff_check_status(ap);
        ap->ops->sff_irq_clear(ap);
-       ap->ops->sff_irq_on(ap);
+       ata_sff_irq_on(ap);
 }
 EXPORT_SYMBOL_GPL(ata_sff_thaw);
 
@@ -2301,8 +2324,8 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes)
        }
 
        /* set up device control */
-       if (ap->ioaddr.ctl_addr) {
-               iowrite8(ap->ctl, ap->ioaddr.ctl_addr);
+       if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr) {
+               ata_sff_set_devctl(ap, ap->ctl);
                ap->last_ctl = ap->ctl;
        }
 }
@@ -2631,100 +2654,6 @@ u8 ata_bmdma_status(struct ata_port *ap)
 }
 EXPORT_SYMBOL_GPL(ata_bmdma_status);
 
-/**
- *     ata_bus_reset - reset host port and associated ATA channel
- *     @ap: port to reset
- *
- *     This is typically the first time we actually start issuing
- *     commands to the ATA channel.  We wait for BSY to clear, then
- *     issue EXECUTE DEVICE DIAGNOSTIC command, polling for its
- *     result.  Determine what devices, if any, are on the channel
- *     by looking at the device 0/1 error register.  Look at the signature
- *     stored in each device's taskfile registers, to determine if
- *     the device is ATA or ATAPI.
- *
- *     LOCKING:
- *     PCI/etc. bus probe sem.
- *     Obtains host lock.
- *
- *     SIDE EFFECTS:
- *     Sets ATA_FLAG_DISABLED if bus reset fails.
- *
- *     DEPRECATED:
- *     This function is only for drivers which still use old EH and
- *     will be removed soon.
- */
-void ata_bus_reset(struct ata_port *ap)
-{
-       struct ata_device *device = ap->link.device;
-       struct ata_ioports *ioaddr = &ap->ioaddr;
-       unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
-       u8 err;
-       unsigned int dev0, dev1 = 0, devmask = 0;
-       int rc;
-
-       DPRINTK("ENTER, host %u, port %u\n", ap->print_id, ap->port_no);
-
-       /* determine if device 0/1 are present */
-       if (ap->flags & ATA_FLAG_SATA_RESET)
-               dev0 = 1;
-       else {
-               dev0 = ata_devchk(ap, 0);
-               if (slave_possible)
-                       dev1 = ata_devchk(ap, 1);
-       }
-
-       if (dev0)
-               devmask |= (1 << 0);
-       if (dev1)
-               devmask |= (1 << 1);
-
-       /* select device 0 again */
-       ap->ops->sff_dev_select(ap, 0);
-
-       /* issue bus reset */
-       if (ap->flags & ATA_FLAG_SRST) {
-               rc = ata_bus_softreset(ap, devmask,
-                                      ata_deadline(jiffies, 40000));
-               if (rc && rc != -ENODEV)
-                       goto err_out;
-       }
-
-       /*
-        * determine by signature whether we have ATA or ATAPI devices
-        */
-       device[0].class = ata_sff_dev_classify(&device[0], dev0, &err);
-       if ((slave_possible) && (err != 0x81))
-               device[1].class = ata_sff_dev_classify(&device[1], dev1, &err);
-
-       /* is double-select really necessary? */
-       if (device[1].class != ATA_DEV_NONE)
-               ap->ops->sff_dev_select(ap, 1);
-       if (device[0].class != ATA_DEV_NONE)
-               ap->ops->sff_dev_select(ap, 0);
-
-       /* if no devices were detected, disable this port */
-       if ((device[0].class == ATA_DEV_NONE) &&
-           (device[1].class == ATA_DEV_NONE))
-               goto err_out;
-
-       if (ap->flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST)) {
-               /* set up device control for ATA_FLAG_SATA_RESET */
-               iowrite8(ap->ctl, ioaddr->ctl_addr);
-               ap->last_ctl = ap->ctl;
-       }
-
-       DPRINTK("EXIT\n");
-       return;
-
-err_out:
-       ata_port_printk(ap, KERN_ERR, "disabling port\n");
-       ata_port_disable(ap);
-
-       DPRINTK("EXIT\n");
-}
-EXPORT_SYMBOL_GPL(ata_bus_reset);
-
 #ifdef CONFIG_PCI
 
 /**