]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ata/libata-core.c
libata: kill ata_ehi_schedule_probe()
[linux-2.6-omap-h63xx.git] / drivers / ata / libata-core.c
index c4248b37ff645c71422d67f1c67802458d020a72..4dc429fd00560172b0a6f17eb9b08aa21132cef6 100644 (file)
@@ -325,6 +325,44 @@ static void ata_force_horkage(struct ata_device *dev)
        }
 }
 
+/**
+ *     atapi_cmd_type - Determine ATAPI command type from SCSI opcode
+ *     @opcode: SCSI opcode
+ *
+ *     Determine ATAPI command type from @opcode.
+ *
+ *     LOCKING:
+ *     None.
+ *
+ *     RETURNS:
+ *     ATAPI_{READ|WRITE|READ_CD|PASS_THRU|MISC}
+ */
+int atapi_cmd_type(u8 opcode)
+{
+       switch (opcode) {
+       case GPCMD_READ_10:
+       case GPCMD_READ_12:
+               return ATAPI_READ;
+
+       case GPCMD_WRITE_10:
+       case GPCMD_WRITE_12:
+       case GPCMD_WRITE_AND_VERIFY_10:
+               return ATAPI_WRITE;
+
+       case GPCMD_READ_CD:
+       case GPCMD_READ_CD_MSF:
+               return ATAPI_READ_CD;
+
+       case ATA_16:
+       case ATA_12:
+               if (atapi_passthru16)
+                       return ATAPI_PASS_THRU;
+               /* fall thru */
+       default:
+               return ATAPI_MISC;
+       }
+}
+
 /**
  *     ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure
  *     @tf: Taskfile to convert
@@ -972,7 +1010,7 @@ static void ata_dev_disable_pm(struct ata_device *dev)
 void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy)
 {
        ap->pm_policy = policy;
-       ap->link.eh_info.action |= ATA_EHI_LPM;
+       ap->link.eh_info.action |= ATA_EH_LPM;
        ap->link.eh_info.flags |= ATA_EHI_NO_AUTOPSY;
        ata_port_schedule_eh(ap);
 }
@@ -2660,7 +2698,7 @@ int ata_bus_probe(struct ata_port *ap)
           specific sequence bass-ackwards so that PDIAG- is released by
           the slave device */
 
-       ata_link_for_each_dev(dev, &ap->link) {
+       ata_link_for_each_dev_reverse(dev, &ap->link) {
                if (tries[dev->devno])
                        dev->class = classes[dev->devno];
 
@@ -3911,17 +3949,6 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
        const unsigned long *timing = sata_ehc_deb_timing(ehc);
        int rc;
 
-       /* handle link resume */
-       if ((ehc->i.flags & ATA_EHI_RESUME_LINK) &&
-           (link->flags & ATA_LFLAG_HRST_TO_RESUME))
-               ehc->i.action |= ATA_EH_HARDRESET;
-
-       /* Some PMPs don't work with only SRST, force hardreset if PMP
-        * is supported.
-        */
-       if (ap->flags & ATA_FLAG_PMP)
-               ehc->i.action |= ATA_EH_HARDRESET;
-
        /* if we're about to do hardreset, nothing more to do */
        if (ehc->i.action & ATA_EH_HARDRESET)
                return 0;
@@ -3935,10 +3962,8 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
                                        "link for reset (errno=%d)\n", rc);
        }
 
-       /* Wait for !BSY if the controller can wait for the first D2H
-        * Reg FIS and we don't know that no device is attached.
-        */
-       if (!(link->flags & ATA_LFLAG_SKIP_D2H_BSY) && !ata_link_offline(link)) {
+       /* wait for !BSY if we don't know that no device is attached */
+       if (!ata_link_offline(link)) {
                rc = ata_wait_ready(ap, deadline);
                if (rc && rc != -ENODEV) {
                        ata_link_printk(link, KERN_WARNING, "device not ready "
@@ -6017,9 +6042,9 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
                if (ata_sg_setup(qc))
                        goto sg_err;
 
-       /* if device is sleeping, schedule softreset and abort the link */
+       /* if device is sleeping, schedule reset and abort the link */
        if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) {
-               link->eh_info.action |= ATA_EH_SOFTRESET;
+               link->eh_info.action |= ATA_EH_RESET;
                ata_ehi_push_desc(&link->eh_info, "waking up from sleep");
                ata_link_abort(link);
                return;
@@ -6596,7 +6621,7 @@ int ata_host_suspend(struct ata_host *host, pm_message_t mesg)
  */
 void ata_host_resume(struct ata_host *host)
 {
-       ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET,
+       ata_host_request_pm(host, PMSG_ON, ATA_EH_RESET,
                            ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0);
        host->dev->power.power_state = PMSG_ON;
 
@@ -7131,9 +7156,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
                        /* kick EH for boot probing */
                        spin_lock_irqsave(ap->lock, flags);
 
-                       ehi->probe_mask =
-                               (1 << ata_link_max_devices(&ap->link)) - 1;
-                       ehi->action |= ATA_EH_SOFTRESET;
+                       ehi->probe_mask |= ATA_ALL_DEVICES;
+                       ehi->action |= ATA_EH_RESET;
                        ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET;
 
                        ap->pflags &= ~ATA_PFLAG_INITIALIZING;
@@ -7774,6 +7798,7 @@ EXPORT_SYMBOL_GPL(ata_tf_read);
 EXPORT_SYMBOL_GPL(ata_noop_dev_select);
 EXPORT_SYMBOL_GPL(ata_std_dev_select);
 EXPORT_SYMBOL_GPL(sata_print_link_status);
+EXPORT_SYMBOL_GPL(atapi_cmd_type);
 EXPORT_SYMBOL_GPL(ata_tf_to_fis);
 EXPORT_SYMBOL_GPL(ata_tf_from_fis);
 EXPORT_SYMBOL_GPL(ata_pack_xfermask);