pandora: update defconfig
[pandora-kernel.git] / drivers / ata / libata-core.c
index 200f49d..ddf8e48 100644 (file)
@@ -97,7 +97,6 @@ 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;
 
 struct workqueue_struct *ata_aux_wq;
 
@@ -161,6 +160,10 @@ int libata_allow_tpm = 0;
 module_param_named(allow_tpm, libata_allow_tpm, int, 0444);
 MODULE_PARM_DESC(allow_tpm, "Permit the use of TPM commands (0=off [default], 1=on)");
 
+static int atapi_an;
+module_param(atapi_an, int, 0444);
+MODULE_PARM_DESC(atapi_an, "Enable ATAPI AN media presence notification (0=0ff [default], 1=on)");
+
 MODULE_AUTHOR("Jeff Garzik");
 MODULE_DESCRIPTION("Library module for ATA devices");
 MODULE_LICENSE("GPL");
@@ -1686,52 +1689,6 @@ unsigned long ata_id_xfermask(const u16 *id)
        return ata_pack_xfermask(pio_mask, mwdma_mask, udma_mask);
 }
 
-/**
- *     ata_pio_queue_task - Queue port_task
- *     @ap: The ata_port to queue port_task for
- *     @data: data for @fn to use
- *     @delay: delay time in msecs for workqueue function
- *
- *     Schedule @fn(@data) for execution after @delay jiffies using
- *     port_task.  There is one port_task per port and it's the
- *     user(low level driver)'s responsibility to make sure that only
- *     one task is active at any given time.
- *
- *     libata core layer takes care of synchronization between
- *     port_task and EH.  ata_pio_queue_task() may be ignored for EH
- *     synchronization.
- *
- *     LOCKING:
- *     Inherited from caller.
- */
-void ata_pio_queue_task(struct ata_port *ap, void *data, unsigned long delay)
-{
-       ap->port_task_data = data;
-
-       /* may fail if ata_port_flush_task() in progress */
-       queue_delayed_work(ata_wq, &ap->port_task, msecs_to_jiffies(delay));
-}
-
-/**
- *     ata_port_flush_task - Flush port_task
- *     @ap: The ata_port to flush port_task for
- *
- *     After this function completes, port_task is guranteed not to
- *     be running or scheduled.
- *
- *     LOCKING:
- *     Kernel thread context (may sleep)
- */
-void ata_port_flush_task(struct ata_port *ap)
-{
-       DPRINTK("ENTER\n");
-
-       cancel_rearming_delayed_work(&ap->port_task);
-
-       if (ata_msg_ctl(ap))
-               ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __func__);
-}
-
 static void ata_qc_complete_internal(struct ata_queued_cmd *qc)
 {
        struct completion *waiting = qc->private_data;
@@ -1853,7 +1810,7 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
 
        rc = wait_for_completion_timeout(&wait, msecs_to_jiffies(timeout));
 
-       ata_port_flush_task(ap);
+       ata_sff_flush_pio_task(ap);
 
        if (!rc) {
                spin_lock_irqsave(ap->lock, flags);
@@ -2169,6 +2126,14 @@ retry:
                goto err_out;
        }
 
+       if (dev->horkage & ATA_HORKAGE_DUMP_ID) {
+               ata_dev_printk(dev, KERN_DEBUG, "dumping IDENTIFY data, "
+                              "class=%d may_fallback=%d tried_spinup=%d\n",
+                              class, may_fallback, tried_spinup);
+               print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET,
+                              16, 2, id, ATA_ID_WORDS * sizeof(*id), true);
+       }
+
        /* Falling back doesn't make sense if ID data was read
         * successfully at least once.
         */
@@ -2557,7 +2522,8 @@ int ata_dev_configure(struct ata_device *dev)
                 * to enable ATAPI AN to discern between PHY status
                 * changed notifications and ATAPI ANs.
                 */
-               if ((ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) &&
+               if (atapi_an &&
+                   (ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) &&
                    (!sata_pmp_attached(ap) ||
                     sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf) == 0)) {
                        unsigned int err_mask;
@@ -4153,9 +4119,8 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
            dev->n_sectors > n_sectors && dev->n_sectors == n_native_sectors) {
                ata_dev_printk(dev, KERN_WARNING,
                               "new n_sectors matches native, probably "
-                              "late HPA unlock, continuing\n");
-               /* keep using the old n_sectors */
-               dev->n_sectors = n_sectors;
+                              "late HPA unlock, n_sectors updated\n");
+               /* use the larger n_sectors */
                return 0;
        }
 
@@ -5634,10 +5599,8 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
        ap->pflags |= ATA_PFLAG_INITIALIZING;
        ap->lock = &host->lock;
        ap->print_id = -1;
-       ap->ctl = ATA_DEVCTL_OBS;
        ap->host = host;
        ap->dev = host->dev;
-       ap->last_ctl = 0xFF;
 
 #if defined(ATA_VERBOSE_DEBUG)
        /* turn on all debugging levels */
@@ -5648,11 +5611,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
        ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN;
 #endif
 
-#ifdef CONFIG_ATA_SFF
-       INIT_DELAYED_WORK(&ap->port_task, ata_pio_task);
-#else
-       INIT_DELAYED_WORK(&ap->port_task, NULL);
-#endif
        INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug);
        INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan);
        INIT_LIST_HEAD(&ap->eh_done_q);
@@ -6426,6 +6384,7 @@ static int __init ata_parse_force_one(char **cur,
                { "3.0Gbps",    .spd_limit      = 2 },
                { "noncq",      .horkage_on     = ATA_HORKAGE_NONCQ },
                { "ncq",        .horkage_off    = ATA_HORKAGE_NONCQ },
+               { "dump_id",    .horkage_on     = ATA_HORKAGE_DUMP_ID },
                { "pio0",       .xfer_mask      = 1 << (ATA_SHIFT_PIO + 0) },
                { "pio1",       .xfer_mask      = 1 << (ATA_SHIFT_PIO + 1) },
                { "pio2",       .xfer_mask      = 1 << (ATA_SHIFT_PIO + 2) },
@@ -6590,17 +6549,6 @@ static int __init ata_init(void)
 
        ata_parse_force_param();
 
-       /*
-        * FIXME: In UP case, there is only one workqueue thread and if you
-        * have more than one PIO device, latency is bloody awful, with
-        * occasional multi-second "hiccups" as one PIO device waits for
-        * another.  It's an ugly wart that users DO occasionally complain
-        * about; luckily most users have at most one PIO polled device.
-        */
-       ata_wq = create_workqueue("ata");
-       if (!ata_wq)
-               goto fail;
-
        ata_aux_wq = create_singlethread_workqueue("ata_aux");
        if (!ata_aux_wq)
                goto fail;
@@ -6614,8 +6562,6 @@ static int __init ata_init(void)
 
 fail:
        kfree(ata_force_tbl);
-       if (ata_wq)
-               destroy_workqueue(ata_wq);
        if (ata_aux_wq)
                destroy_workqueue(ata_aux_wq);
        return rc;
@@ -6625,7 +6571,6 @@ static void __exit ata_exit(void)
 {
        ata_sff_exit();
        kfree(ata_force_tbl);
-       destroy_workqueue(ata_wq);
        destroy_workqueue(ata_aux_wq);
 }
 
@@ -6723,6 +6668,7 @@ EXPORT_SYMBOL_GPL(ata_dummy_port_info);
 EXPORT_SYMBOL_GPL(ata_link_next);
 EXPORT_SYMBOL_GPL(ata_dev_next);
 EXPORT_SYMBOL_GPL(ata_std_bios_param);
+EXPORT_SYMBOL_GPL(ata_scsi_unlock_native_capacity);
 EXPORT_SYMBOL_GPL(ata_host_init);
 EXPORT_SYMBOL_GPL(ata_host_alloc);
 EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo);
@@ -6779,7 +6725,6 @@ EXPORT_SYMBOL_GPL(ata_id_c_string);
 EXPORT_SYMBOL_GPL(ata_do_dev_read_id);
 EXPORT_SYMBOL_GPL(ata_scsi_simulate);
 
-EXPORT_SYMBOL_GPL(ata_pio_queue_task);
 EXPORT_SYMBOL_GPL(ata_pio_need_iordy);
 EXPORT_SYMBOL_GPL(ata_timing_find_mode);
 EXPORT_SYMBOL_GPL(ata_timing_compute);