libata: remove irq_on from ata_bus_reset() and ata_std_postreset()
[pandora-kernel.git] / drivers / ata / libata-core.c
index af62514..88e2dd0 100644 (file)
@@ -71,6 +71,7 @@ static unsigned int ata_dev_init_params(struct ata_device *dev,
                                        u16 heads, u16 sectors);
 static unsigned int ata_dev_set_xfermode(struct ata_device *dev);
 static void ata_dev_xfermask(struct ata_device *dev);
+static unsigned long ata_dev_blacklisted(const struct ata_device *dev);
 
 unsigned int ata_print_id = 1;
 static struct workqueue_struct *ata_wq;
@@ -600,8 +601,9 @@ static const char *sata_spd_string(unsigned int spd)
 
 void ata_dev_disable(struct ata_device *dev)
 {
-       if (ata_dev_enabled(dev) && ata_msg_drv(dev->ap)) {
-               ata_dev_printk(dev, KERN_WARNING, "disabled\n");
+       if (ata_dev_enabled(dev)) {
+               if (ata_msg_drv(dev->ap))
+                       ata_dev_printk(dev, KERN_WARNING, "disabled\n");
                ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 |
                                             ATA_DNXFER_QUIET);
                dev->class++;
@@ -983,11 +985,6 @@ static u64 ata_hpa_resize(struct ata_device *dev)
        else
                hpa_sectors = ata_read_native_max_address(dev);
 
-       /* if no hpa, both should be equal */
-       ata_dev_printk(dev, KERN_INFO, "%s 1: sectors = %lld, "
-                               "hpa_sectors = %lld\n",
-               __FUNCTION__, (long long)sectors, (long long)hpa_sectors);
-
        if (hpa_sectors > sectors) {
                ata_dev_printk(dev, KERN_INFO,
                        "Host Protected Area detected:\n"
@@ -1009,7 +1006,11 @@ static u64 ata_hpa_resize(struct ata_device *dev)
                                return hpa_sectors;
                        }
                }
-       }
+       } else if (hpa_sectors < sectors)
+               ata_dev_printk(dev, KERN_WARNING, "%s 1: hpa sectors (%lld) "
+                              "is smaller than sectors (%lld)\n", __FUNCTION__,
+                              (long long)hpa_sectors, (long long)sectors);
+
        return sectors;
 }
 
@@ -1283,18 +1284,11 @@ static unsigned int ata_id_xfermask(const u16 *id)
 void ata_port_queue_task(struct ata_port *ap, work_func_t fn, void *data,
                         unsigned long delay)
 {
-       int rc;
-
-       if (ap->pflags & ATA_PFLAG_FLUSH_PORT_TASK)
-               return;
-
        PREPARE_DELAYED_WORK(&ap->port_task, fn);
        ap->port_task_data = data;
 
-       rc = queue_delayed_work(ata_wq, &ap->port_task, delay);
-
-       /* rc == 0 means that another user is using port task */
-       WARN_ON(rc == 0);
+       /* may fail if ata_port_flush_task() in progress */
+       queue_delayed_work(ata_wq, &ap->port_task, delay);
 }
 
 /**
@@ -1309,32 +1303,9 @@ void ata_port_queue_task(struct ata_port *ap, work_func_t fn, void *data,
  */
 void ata_port_flush_task(struct ata_port *ap)
 {
-       unsigned long flags;
-
        DPRINTK("ENTER\n");
 
-       spin_lock_irqsave(ap->lock, flags);
-       ap->pflags |= ATA_PFLAG_FLUSH_PORT_TASK;
-       spin_unlock_irqrestore(ap->lock, flags);
-
-       DPRINTK("flush #1\n");
-       cancel_work_sync(&ap->port_task.work); /* akpm: seems unneeded */
-
-       /*
-        * At this point, if a task is running, it's guaranteed to see
-        * the FLUSH flag; thus, it will never queue pio tasks again.
-        * Cancel and flush.
-        */
-       if (!cancel_delayed_work(&ap->port_task)) {
-               if (ata_msg_ctl(ap))
-                       ata_port_printk(ap, KERN_DEBUG, "%s: flush #2\n",
-                                       __FUNCTION__);
-               cancel_work_sync(&ap->port_task.work);
-       }
-
-       spin_lock_irqsave(ap->lock, flags);
-       ap->pflags &= ~ATA_PFLAG_FLUSH_PORT_TASK;
-       spin_unlock_irqrestore(ap->lock, flags);
+       cancel_rearming_delayed_work(&ap->port_task);
 
        if (ata_msg_ctl(ap))
                ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __FUNCTION__);
@@ -1727,7 +1698,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
 
        /* sanity check */
        rc = -EINVAL;
-       reason = "device reports illegal type";
+       reason = "device reports invalid type";
 
        if (class == ATA_DEV_ATA) {
                if (!ata_id_is_ata(id) && !ata_id_is_cfa(id))
@@ -1814,7 +1785,7 @@ static void ata_dev_config_ncq(struct ata_device *dev,
                desc[0] = '\0';
                return;
        }
-       if (ata_device_blacklisted(dev) & ATA_HORKAGE_NONCQ) {
+       if (dev->horkage & ATA_HORKAGE_NONCQ) {
                snprintf(desc, desc_sz, "NCQ (not used)");
                return;
        }
@@ -1845,7 +1816,8 @@ static void ata_dev_config_ncq(struct ata_device *dev,
 int ata_dev_configure(struct ata_device *dev)
 {
        struct ata_port *ap = dev->ap;
-       int print_info = ap->eh_context.i.flags & ATA_EHI_PRINTINFO;
+       struct ata_eh_context *ehc = &ap->eh_context;
+       int print_info = ehc->i.flags & ATA_EHI_PRINTINFO;
        const u16 *id = dev->id;
        unsigned int xfer_mask;
        char revbuf[7];         /* XYZ-99\0 */
@@ -1862,15 +1834,13 @@ int ata_dev_configure(struct ata_device *dev)
        if (ata_msg_probe(ap))
                ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__);
 
-       /* set _SDD */
-       rc = ata_acpi_push_id(dev);
-       if (rc) {
-               ata_dev_printk(dev, KERN_WARNING, "failed to set _SDD(%d)\n",
-                       rc);
-       }
+       /* set horkage */
+       dev->horkage |= ata_dev_blacklisted(dev);
 
-       /* retrieve and execute the ATA task file of _GTF */
-       ata_acpi_exec_tfs(ap);
+       /* let ACPI work its magic */
+       rc = ata_acpi_on_devcfg(dev);
+       if (rc)
+               return rc;
 
        /* print device capabilities */
        if (ata_msg_probe(ap))
@@ -1900,6 +1870,13 @@ int ata_dev_configure(struct ata_device *dev)
        if (ata_msg_probe(ap))
                ata_dump_id(id);
 
+       /* SCSI only uses 4-char revisions, dump full 8 chars from ATA */
+       ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV,
+                       sizeof(fwrevbuf));
+
+       ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD,
+                       sizeof(modelbuf));
+
        /* ATA-specific feature tests */
        if (dev->class == ATA_DEV_ATA) {
                if (ata_id_is_cfa(id)) {
@@ -1914,13 +1891,6 @@ int ata_dev_configure(struct ata_device *dev)
 
                dev->n_sectors = ata_id_n_sectors(id);
 
-               /* SCSI only uses 4-char revisions, dump full 8 chars from ATA */
-               ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV,
-                               sizeof(fwrevbuf));
-
-               ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD,
-                               sizeof(modelbuf));
-
                if (dev->id[59] & 0x100)
                        dev->multi_count = dev->id[59] & 0xff;
 
@@ -2009,7 +1979,9 @@ int ata_dev_configure(struct ata_device *dev)
 
                /* print device info to dmesg */
                if (ata_msg_drv(ap) && print_info)
-                       ata_dev_printk(dev, KERN_INFO, "ATAPI, max %s%s\n",
+                       ata_dev_printk(dev, KERN_INFO,
+                                      "ATAPI: %s, %s, max %s%s\n",
+                                      modelbuf, fwrevbuf,
                                       ata_mode_string(xfer_mask),
                                       cdb_intr_string);
        }
@@ -2040,14 +2012,10 @@ int ata_dev_configure(struct ata_device *dev)
                dev->max_sectors = ATA_MAX_SECTORS;
        }
 
-       if (ata_device_blacklisted(dev) & ATA_HORKAGE_MAX_SEC_128)
+       if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
                dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
                                         dev->max_sectors);
 
-       /* limit ATAPI DMA to R/W commands only */
-       if (ata_device_blacklisted(dev) & ATA_HORKAGE_DMA_RW_ONLY)
-               dev->horkage |= ATA_HORKAGE_DMA_RW_ONLY;
-
        if (ap->ops->dev_config)
                ap->ops->dev_config(dev);
 
@@ -3059,22 +3027,28 @@ static int ata_bus_post_reset(struct ata_port *ap, unsigned int devmask,
                }
        }
 
-       /* if device 1 was found in ata_devchk, wait for
-        * register access, then wait for BSY to clear
+       /* if device 1 was found in ata_devchk, wait for register
+        * access briefly, then wait for BSY to clear.
         */
-       while (dev1) {
-               u8 nsect, lbal;
+       if (dev1) {
+               int i;
 
                ap->ops->dev_select(ap, 1);
-               nsect = ioread8(ioaddr->nsect_addr);
-               lbal = ioread8(ioaddr->lbal_addr);
-               if ((nsect == 1) && (lbal == 1))
-                       break;
-               if (time_after(jiffies, deadline))
-                       return -EBUSY;
-               msleep(50);     /* give drive a breather */
-       }
-       if (dev1) {
+
+               /* Wait for register access.  Some ATAPI devices fail
+                * to set nsect/lbal after reset, so don't waste too
+                * much time on it.  We're gonna wait for !BSY anyway.
+                */
+               for (i = 0; i < 2; i++) {
+                       u8 nsect, lbal;
+
+                       nsect = ioread8(ioaddr->nsect_addr);
+                       lbal = ioread8(ioaddr->lbal_addr);
+                       if ((nsect == 1) && (lbal == 1))
+                               break;
+                       msleep(50);     /* give drive a breather */
+               }
+
                rc = ata_wait_ready(ap, deadline);
                if (rc) {
                        if (rc != -ENODEV)
@@ -3190,9 +3164,6 @@ void ata_bus_reset(struct ata_port *ap)
        if ((slave_possible) && (err != 0x81))
                ap->device[1].class = ata_dev_try_classify(ap, 1, &err);
 
-       /* re-enable interrupts */
-       ap->ops->irq_on(ap);
-
        /* is double-select really necessary? */
        if (ap->device[1].class != ATA_DEV_NONE)
                ap->ops->dev_select(ap, 1);
@@ -3355,7 +3326,7 @@ int ata_std_prereset(struct ata_port *ap, unsigned long deadline)
                return 0;
 
        /* if SATA, resume phy */
-       if (ap->cbl == ATA_CBL_SATA) {
+       if (ap->flags & ATA_FLAG_SATA) {
                rc = sata_phy_resume(ap, timing, deadline);
                /* whine about phy resume failure but proceed */
                if (rc && rc != -EOPNOTSUPP)
@@ -3577,10 +3548,6 @@ void ata_std_postreset(struct ata_port *ap, unsigned int *classes)
        if (sata_scr_read(ap, SCR_ERROR, &serror) == 0)
                sata_scr_write(ap, SCR_ERROR, serror);
 
-       /* re-enable interrupts */
-       if (!ap->ops->error_handler)
-               ap->ops->irq_on(ap);
-
        /* is double-select really necessary? */
        if (classes[0] != ATA_DEV_NONE)
                ap->ops->dev_select(ap, 1);
@@ -3651,7 +3618,7 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
 
 /**
  *     ata_dev_reread_id - Re-read IDENTIFY data
- *     @adev: target ATA device
+ *     @dev: target ATA device
  *     @readid_flags: read ID flags
  *
  *     Re-read IDENTIFY page and make sure @dev is still attached to
@@ -3769,10 +3736,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "_NEC DV5800A",       NULL,           ATA_HORKAGE_NODMA },
        { "SAMSUNG CD-ROM SN-124","N001",       ATA_HORKAGE_NODMA },
        { "Seagate STT20000A", NULL,            ATA_HORKAGE_NODMA },
+       { "IOMEGA  ZIP 250       ATAPI", NULL,  ATA_HORKAGE_NODMA }, /* temporary fix */
+       { "IOMEGA  ZIP 250       ATAPI       Floppy",
+                               NULL,           ATA_HORKAGE_NODMA },
 
        /* Weird ATAPI devices */
-       { "TORiSAN DVD-ROM DRD-N216", NULL,     ATA_HORKAGE_MAX_SEC_128 |
-                                               ATA_HORKAGE_DMA_RW_ONLY },
+       { "TORiSAN DVD-ROM DRD-N216", NULL,     ATA_HORKAGE_MAX_SEC_128 },
 
        /* Devices we expect to fail diagnostics */
 
@@ -3783,7 +3752,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "FUJITSU MHT2060BH",  NULL,           ATA_HORKAGE_NONCQ },
        /* NCQ is broken */
        { "Maxtor 6L250S0",     "BANC1G10",     ATA_HORKAGE_NONCQ },
+       { "Maxtor 6B200M0",     "BANC1BM0",     ATA_HORKAGE_NONCQ },
        { "Maxtor 6B200M0",     "BANC1B10",     ATA_HORKAGE_NONCQ },
+       { "HITACHI HDS7250SASUN500G 0621KTAWSD", "K2AOAJ0AHITACHI",
+        ATA_HORKAGE_NONCQ },
        /* NCQ hard hangs device under heavier load, needs hard power cycle */
        { "Maxtor 6B250S0",     "BANC1B70",     ATA_HORKAGE_NONCQ },
        /* Blacklist entries taken from Silicon Image 3124/3132
@@ -3791,6 +3763,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "HTS541060G9SA00",    "MB3OC60D",     ATA_HORKAGE_NONCQ, },
        { "HTS541080G9SA00",    "MB4OC60D",     ATA_HORKAGE_NONCQ, },
        { "HTS541010G9SA00",    "MBZOC60D",     ATA_HORKAGE_NONCQ, },
+       /* Drives which do spurious command completion */
+       { "HTS541680J9SA00",    "SB2IC7EP",     ATA_HORKAGE_NONCQ, },
+       { "HTS541612J9SA00",    "SBDIC7JP",     ATA_HORKAGE_NONCQ, },
+       { "Hitachi HTS541616J9SA00", "SB4OC70P", ATA_HORKAGE_NONCQ, },
+       { "WDC WD740ADFD-00NLR1", NULL,         ATA_HORKAGE_NONCQ, },
+       { "FUJITSU MHV2080BH",  "00840028",     ATA_HORKAGE_NONCQ, },
 
        /* Devices with NCQ limits */
 
@@ -3798,7 +3776,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { }
 };
 
-unsigned long ata_device_blacklisted(const struct ata_device *dev)
+static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
 {
        unsigned char model_num[ATA_ID_PROD_LEN + 1];
        unsigned char model_rev[ATA_ID_FW_REV_LEN + 1];
@@ -3828,7 +3806,7 @@ static int ata_dma_blacklisted(const struct ata_device *dev)
        if ((dev->ap->flags & ATA_FLAG_PIO_POLLING) &&
            (dev->flags & ATA_DFLAG_CDB_INTR))
                return 1;
-       return (ata_device_blacklisted(dev) & ATA_HORKAGE_NODMA) ? 1 : 0;
+       return (dev->horkage & ATA_HORKAGE_NODMA) ? 1 : 0;
 }
 
 /**
@@ -3933,10 +3911,13 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev)
        /* set up set-features taskfile */
        DPRINTK("set features - xfer mode\n");
 
+       /* Some controllers and ATAPI devices show flaky interrupt
+        * behavior after setting xfer mode.  Use polling instead.
+        */
        ata_tf_init(dev, &tf);
        tf.command = ATA_CMD_SET_FEATURES;
        tf.feature = SETFEATURES_XFER;
-       tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
+       tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_POLLING;
        tf.protocol = ATA_PROT_NODATA;
        tf.nsect = dev->xfer_mode;
 
@@ -4093,6 +4074,69 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
        if (idx)
                ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
 }
+
+/**
+ *     ata_fill_sg_dumb - Fill PCI IDE PRD table
+ *     @qc: Metadata associated with taskfile to be transferred
+ *
+ *     Fill PCI IDE PRD (scatter-gather) table with segments
+ *     associated with the current disk command. Perform the fill
+ *     so that we avoid writing any length 64K records for
+ *     controllers that don't follow the spec.
+ *
+ *     LOCKING:
+ *     spin_lock_irqsave(host lock)
+ *
+ */
+static void ata_fill_sg_dumb(struct ata_queued_cmd *qc)
+{
+       struct ata_port *ap = qc->ap;
+       struct scatterlist *sg;
+       unsigned int idx;
+
+       WARN_ON(qc->__sg == NULL);
+       WARN_ON(qc->n_elem == 0 && qc->pad_len == 0);
+
+       idx = 0;
+       ata_for_each_sg(sg, qc) {
+               u32 addr, offset;
+               u32 sg_len, len, blen;
+
+               /* determine if physical DMA addr spans 64K boundary.
+                * Note h/w doesn't support 64-bit, so we unconditionally
+                * truncate dma_addr_t to u32.
+                */
+               addr = (u32) sg_dma_address(sg);
+               sg_len = sg_dma_len(sg);
+
+               while (sg_len) {
+                       offset = addr & 0xffff;
+                       len = sg_len;
+                       if ((offset + sg_len) > 0x10000)
+                               len = 0x10000 - offset;
+
+                       blen = len & 0xffff;
+                       ap->prd[idx].addr = cpu_to_le32(addr);
+                       if (blen == 0) {
+                          /* Some PATA chipsets like the CS5530 can't
+                             cope with 0x0000 meaning 64K as the spec says */
+                               ap->prd[idx].flags_len = cpu_to_le32(0x8000);
+                               blen = 0x8000;
+                               ap->prd[++idx].addr = cpu_to_le32(addr + 0x8000);
+                       }
+                       ap->prd[idx].flags_len = cpu_to_le32(blen);
+                       VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
+
+                       idx++;
+                       sg_len -= len;
+                       addr += len;
+               }
+       }
+
+       if (idx)
+               ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
+}
+
 /**
  *     ata_check_atapi_dma - Check whether ATAPI DMA can be supported
  *     @qc: Metadata associated with taskfile to check
@@ -4110,33 +4154,19 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
 int ata_check_atapi_dma(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
-       int rc = 0; /* Assume ATAPI DMA is OK by default */
-
-       /* some drives can only do ATAPI DMA on read/write */
-       if (unlikely(qc->dev->horkage & ATA_HORKAGE_DMA_RW_ONLY)) {
-               struct scsi_cmnd *cmd = qc->scsicmd;
-               u8 *scsicmd = cmd->cmnd;
-
-               switch (scsicmd[0]) {
-               case READ_10:
-               case WRITE_10:
-               case READ_12:
-               case WRITE_12:
-               case READ_6:
-               case WRITE_6:
-                       /* atapi dma maybe ok */
-                       break;
-               default:
-                       /* turn off atapi dma */
-                       return 1;
-               }
-       }
+
+       /* Don't allow DMA if it isn't multiple of 16 bytes.  Quite a
+        * few ATAPI devices choke on such DMA requests.
+        */
+       if (unlikely(qc->nbytes & 15))
+               return 1;
 
        if (ap->ops->check_atapi_dma)
-               rc = ap->ops->check_atapi_dma(qc);
+               return ap->ops->check_atapi_dma(qc);
 
-       return rc;
+       return 0;
 }
+
 /**
  *     ata_qc_prep - Prepare taskfile for submission
  *     @qc: Metadata associated with taskfile to be prepared
@@ -4154,6 +4184,23 @@ void ata_qc_prep(struct ata_queued_cmd *qc)
        ata_fill_sg(qc);
 }
 
+/**
+ *     ata_dumb_qc_prep - Prepare taskfile for submission
+ *     @qc: Metadata associated with taskfile to be prepared
+ *
+ *     Prepare ATA taskfile for submission.
+ *
+ *     LOCKING:
+ *     spin_lock_irqsave(host lock)
+ */
+void ata_dumb_qc_prep(struct ata_queued_cmd *qc)
+{
+       if (!(qc->flags & ATA_QCFLAG_DMAMAP))
+               return;
+
+       ata_fill_sg_dumb(qc);
+}
+
 void ata_noop_qc_prep(struct ata_queued_cmd *qc) { }
 
 /**
@@ -4783,8 +4830,6 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
                } else
                        ata_qc_complete(qc);
        }
-
-       ata_altstatus(ap); /* flush */
 }
 
 /**
@@ -5414,14 +5459,6 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
                }
        }
 
-       /* Some controllers show flaky interrupt behavior after
-        * setting xfer mode.  Use polling instead.
-        */
-       if (unlikely(qc->tf.command == ATA_CMD_SET_FEATURES &&
-                    qc->tf.feature == SETFEATURES_XFER) &&
-           (ap->flags & ATA_FLAG_SETXFER_POLLING))
-               qc->tf.flags |= ATA_TFLAG_POLLING;
-
        /* select the device */
        ata_dev_select(ap, qc->dev->devno, 1, 0);
 
@@ -5671,7 +5708,7 @@ irqreturn_t ata_interrupt (int irq, void *dev_instance)
  */
 int sata_scr_valid(struct ata_port *ap)
 {
-       return ap->cbl == ATA_CBL_SATA && ap->ops->scr_read;
+       return (ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read;
 }
 
 /**
@@ -6304,6 +6341,9 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
        if (rc)
                return rc;
 
+       /* associate with ACPI nodes */
+       ata_acpi_associate(host);
+
        /* set cable, sata_spd_limit and report */
        for (i = 0; i < host->n_ports; i++) {
                struct ata_port *ap = host->ports[i];
@@ -6318,7 +6358,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
                /* init sata_spd_limit to the current value */
                if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) {
                        int spd = (scontrol >> 4) & 0xf;
-                       ap->hw_sata_spd_limit &= (1 << spd) - 1;
+                       if (spd)
+                               ap->hw_sata_spd_limit &= (1 << spd) - 1;
                }
                ap->sata_spd_limit = ap->hw_sata_spd_limit;
 
@@ -6334,7 +6375,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
                if (!ata_port_is_dummy(ap))
                        ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%p "
                                        "ctl 0x%p bmdma 0x%p irq %d\n",
-                                       ap->cbl == ATA_CBL_SATA ? 'S' : 'P',
+                                       (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P',
                                        ata_mode_string(xfer_mask),
                                        ap->ioaddr.cmd_addr,
                                        ap->ioaddr.ctl_addr,
@@ -6433,6 +6474,9 @@ int ata_host_activate(struct ata_host *host, int irq,
        if (rc)
                return rc;
 
+       /* Used to print device info at probe */
+       host->irq = irq;
+
        rc = ata_host_register(host, sht);
        /* if failed, just free the IRQ and leave ports alone */
        if (rc)
@@ -6486,13 +6530,7 @@ void ata_port_detach(struct ata_port *ap)
        spin_unlock_irqrestore(ap->lock, flags);
 
        ata_port_wait_eh(ap);
-
-       /* Flush hotplug task.  The sequence is similar to
-        * ata_port_flush_task().
-        */
-       cancel_work_sync(&ap->hotplug_task.work); /* akpm: why? */
-       cancel_delayed_work(&ap->hotplug_task);
-       cancel_work_sync(&ap->hotplug_task.work);
+       cancel_rearming_delayed_work(&ap->hotplug_task);
 
  skip_eh:
        /* remove the associated SCSI host */
@@ -6823,11 +6861,13 @@ EXPORT_SYMBOL_GPL(ata_check_status);
 EXPORT_SYMBOL_GPL(ata_altstatus);
 EXPORT_SYMBOL_GPL(ata_exec_command);
 EXPORT_SYMBOL_GPL(ata_port_start);
+EXPORT_SYMBOL_GPL(ata_sff_port_start);
 EXPORT_SYMBOL_GPL(ata_interrupt);
 EXPORT_SYMBOL_GPL(ata_do_set_mode);
 EXPORT_SYMBOL_GPL(ata_data_xfer);
 EXPORT_SYMBOL_GPL(ata_data_xfer_noirq);
 EXPORT_SYMBOL_GPL(ata_qc_prep);
+EXPORT_SYMBOL_GPL(ata_dumb_qc_prep);
 EXPORT_SYMBOL_GPL(ata_noop_qc_prep);
 EXPORT_SYMBOL_GPL(ata_bmdma_setup);
 EXPORT_SYMBOL_GPL(ata_bmdma_start);
@@ -6879,7 +6919,6 @@ EXPORT_SYMBOL_GPL(ata_host_resume);
 EXPORT_SYMBOL_GPL(ata_id_string);
 EXPORT_SYMBOL_GPL(ata_id_c_string);
 EXPORT_SYMBOL_GPL(ata_id_to_dma_mode);
-EXPORT_SYMBOL_GPL(ata_device_blacklisted);
 EXPORT_SYMBOL_GPL(ata_scsi_simulate);
 
 EXPORT_SYMBOL_GPL(ata_pio_need_iordy);
@@ -6888,9 +6927,9 @@ EXPORT_SYMBOL_GPL(ata_timing_merge);
 
 #ifdef CONFIG_PCI
 EXPORT_SYMBOL_GPL(pci_test_config_bits);
-EXPORT_SYMBOL_GPL(ata_pci_init_native_host);
+EXPORT_SYMBOL_GPL(ata_pci_init_sff_host);
 EXPORT_SYMBOL_GPL(ata_pci_init_bmdma);
-EXPORT_SYMBOL_GPL(ata_pci_prepare_native_host);
+EXPORT_SYMBOL_GPL(ata_pci_prepare_sff_host);
 EXPORT_SYMBOL_GPL(ata_pci_init_one);
 EXPORT_SYMBOL_GPL(ata_pci_remove_one);
 #ifdef CONFIG_PM