Pull ata fixes from Damien Le Moal: - Fix PCI resource initialization in the sata_mv driver to keep legacy Marvell boards functional (Rosen) - Fix ahci_ceva driver initialization error path (Radhey) - Fix libata header file to remove a kernel doc compilation warning (Randy) - Increase the timeout for the STANDBY IMMEDIATE command to avoid suspend failures with drives that are slow to respond to this command (Matt) - Fixes for the handling of timed out commands in the presence of deferred non-NCQ commands, to avoid excessive delays in executing the error handler (me) - Disable link power management for a couple of WD drives that have been identified as not functioning properly when power management is used (Niklas) - Fix the device iteration loop when checking for link power management support to correctly handle port multiplier setups (Niklas) * tag 'ata-7.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux: ata: libata-sata: fix ata_scsi_lpm_supported() iteration ata: libata-core: Disable LPM on WD Green 2.5 480GB ata: libata-core: Disable LPM on some WD drives scsi: libsas: terminate deferred commands on time out ata: libata-scsi: schedule deferred atapi command ata: libata-scsi: terminate deferred commands on time out ata: libata-eh: Increase STANDBY IMMEDIATE timeout ata: libata: avoid kernel-doc warnings ata: ahci_ceva: fix error paths in ceva_ahci_platform_enable_resources() ata: sata_mv: accept 1 or 2 resources in platform probe
Unified · Split
| @@ -211,7 +211,7 @@ static int ceva_ahci_platform_enable_resources(struct ahci_host_priv *hpriv) · 210 unmodified lines | |||
| 211 | 211 | ||
| 212 | rc = phy_init(hpriv->phys[i]); | 212 | rc = phy_init(hpriv->phys[i]); |
| 213 | if (rc) | 213 | if (rc) |
| 214 | goto disable_rsts; | 214 | goto exit_phys; |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | /* De-assert the controller reset */ | 217 | /* De-assert the controller reset */ |
| @@ -230,14 +230,24 @@ static int ceva_ahci_platform_enable_resources(struct ahci_host_priv *hpriv) · 12 unmodified lines | |||
| 230 | 230 | ||
| 231 | return 0; | 231 | return 0; |
| 232 | 232 | ||
| 233 | disable_rsts: | ||
| 234 | ahci_platform_deassert_rsts(hpriv); | ||
| 235 | |||
| 236 | disable_phys: | 233 | disable_phys: |
| 237 | while (--i >= 0) { | 234 | while (--i >= 0) { |
| 235 | if (ahci_ignore_port(hpriv, i)) | ||
| 236 | continue; | ||
| 237 | |||
| 238 | phy_power_off(hpriv->phys[i]); | 238 | phy_power_off(hpriv->phys[i]); |
| 239 | phy_exit(hpriv->phys[i]); | 239 | phy_exit(hpriv->phys[i]); |
| 240 | } | 240 | } |
| 241 | ahci_platform_assert_rsts(hpriv); | ||
| 242 | goto disable_clks; | ||
| 243 | |||
| 244 | exit_phys: | ||
| 245 | while (--i >= 0) { | ||
| 246 | if (ahci_ignore_port(hpriv, i)) | ||
| 247 | continue; | ||
| 248 | |||
| 249 | phy_exit(hpriv->phys[i]); | ||
| 250 | } | ||
| 241 | 251 | ||
| 242 | disable_clks: | 252 | disable_clks: |
| 243 | ahci_platform_disable_clks(hpriv); | 253 | ahci_platform_disable_clks(hpriv); |
| @@ -4413,6 +4413,15 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = { · 4412 unmodified lines | |||
| 4413 | { "WDC WD3000JD-*", NULL, ATA_QUIRK_WD_BROKEN_LPM }, | 4413 | { "WDC WD3000JD-*", NULL, ATA_QUIRK_WD_BROKEN_LPM }, |
| 4414 | { "WDC WD3200JD-*", NULL, ATA_QUIRK_WD_BROKEN_LPM }, | 4414 | { "WDC WD3200JD-*", NULL, ATA_QUIRK_WD_BROKEN_LPM }, |
| 4415 | 4415 | ||
| 4416 | /* | ||
| 4417 | * WD drives with LPM issues (irrespective of supported SATA speeds). | ||
| 4418 | * (Unlike ATA_QUIRK_WD_BROKEN_LPM, which is only applied if the drive | ||
| 4419 | * exposes SATA Gen1 speed support, and SATA Gen1 speed support only.) | ||
| 4420 | */ | ||
| 4421 | { "WDC WD100EFGX-68CPLN0", NULL, ATA_QUIRK_NOLPM }, | ||
| 4422 | { "WDC WD102KFBX-68M95N0", NULL, ATA_QUIRK_NOLPM }, | ||
| 4423 | { "WD Green 2.5 480GB", NULL, ATA_QUIRK_NOLPM }, | ||
| 4424 | |||
| 4416 | /* | 4425 | /* |
| 4417 | * This sata dom device goes on a walkabout when the ATA_LOG_DIRECTORY | 4426 | * This sata dom device goes on a walkabout when the ATA_LOG_DIRECTORY |
| 4418 | * log page is accessed. Ensure we never ask for this log page with | 4427 | * log page is accessed. Ensure we never ask for this log page with |
| @@ -106,6 +106,12 @@ static const unsigned int ata_eh_flush_timeouts[] = { · 105 unmodified lines | |||
| 106 | UINT_MAX, | 106 | UINT_MAX, |
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | static const unsigned int ata_eh_standby_timeouts[] = { | ||
| 110 | 15000, /* Some drives may be slow to standby */ | ||
| 111 | /* but don't hold up a suspend too long waiting for them */ | ||
| 112 | UINT_MAX, | ||
| 113 | }; | ||
| 114 | |||
| 109 | static const unsigned int ata_eh_other_timeouts[] = { | 115 | static const unsigned int ata_eh_other_timeouts[] = { |
| 110 | 5000, /* same rationale as identify timeout */ | 116 | 5000, /* same rationale as identify timeout */ |
| 111 | 10000, /* ditto */ | 117 | 10000, /* ditto */ |
| @@ -147,6 +153,8 @@ ata_eh_cmd_timeout_table[ATA_EH_CMD_TIMEOUT_TABLE_SIZE] = { · 35 unmodified lines | |||
| 147 | .timeouts = ata_eh_other_timeouts, }, | 153 | .timeouts = ata_eh_other_timeouts, }, |
| 148 | { .commands = CMDS(ATA_CMD_FLUSH, ATA_CMD_FLUSH_EXT), | 154 | { .commands = CMDS(ATA_CMD_FLUSH, ATA_CMD_FLUSH_EXT), |
| 149 | .timeouts = ata_eh_flush_timeouts }, | 155 | .timeouts = ata_eh_flush_timeouts }, |
| 156 | { .commands = CMDS(ATA_CMD_STANDBYNOW1), | ||
| 157 | .timeouts = ata_eh_standby_timeouts }, | ||
| 150 | { .commands = CMDS(ATA_CMD_VERIFY), | 158 | { .commands = CMDS(ATA_CMD_VERIFY), |
| 151 | .timeouts = ata_eh_reset_timeouts }, | 159 | .timeouts = ata_eh_reset_timeouts }, |
| 152 | }; | 160 | }; |
| @@ -650,29 +658,12 @@ int ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, · 497 unmodified lines | |||
| 650 | set_host_byte(scmd, DID_OK); | 658 | set_host_byte(scmd, DID_OK); |
| 651 | 659 | ||
| 652 | ata_qc_for_each_raw(ap, qc, i) { | 660 | ata_qc_for_each_raw(ap, qc, i) { |
| 653 | if (qc->scsicmd != scmd) | 661 | if (qc->scsicmd == scmd && |
| 654 | continue; | 662 | qc->flags & ATA_QCFLAG_ACTIVE) |
| 655 | if ((qc->flags & ATA_QCFLAG_ACTIVE) || | ||
| 656 | qc == qc->dev->link->deferred_qc) | ||
| 657 | break; | 663 | break; |
| 658 | } | 664 | } |
| 659 | 665 | ||
| 660 | if (i < ATA_MAX_QUEUE && qc == qc->dev->link->deferred_qc) { | 666 | if (i < ATA_MAX_QUEUE) { |
| 661 | /* | ||
| 662 | * This is a deferred command that timed out while | ||
| 663 | * waiting for the command queue to drain. Since the qc | ||
| 664 | * is not active yet (deferred_qc is still set, so the | ||
| 665 | * deferred qc work has not issued the command yet), | ||
| 666 | * simply signal the timeout by finishing the SCSI | ||
| 667 | * command and clear the deferred qc to prevent the | ||
| 668 | * deferred qc work from issuing this qc. | ||
| 669 | */ | ||
| 670 | WARN_ON_ONCE(qc->flags & ATA_QCFLAG_ACTIVE); | ||
| 671 | qc->dev->link->deferred_qc = NULL; | ||
| 672 | cancel_work(&qc->dev->link->deferred_qc_work); | ||
| 673 | set_host_byte(scmd, DID_TIME_OUT); | ||
| 674 | scsi_eh_finish_cmd(scmd, &ap->eh_done_q); | ||
| 675 | } else if (i < ATA_MAX_QUEUE) { | ||
| 676 | /* the scmd has an associated qc */ | 667 | /* the scmd has an associated qc */ |
| 677 | if (!(qc->flags & ATA_QCFLAG_EH)) { | 668 | if (!(qc->flags & ATA_QCFLAG_EH)) { |
| 678 | /* which hasn't failed yet, timeout */ | 669 | /* which hasn't failed yet, timeout */ |
| @@ -948,10 +939,10 @@ static void ata_eh_set_pending(struct ata_port *ap, bool fastdrain) · 269 unmodified lines | |||
| 948 | ap->pflags |= ATA_PFLAG_EH_PENDING; | 939 | ap->pflags |= ATA_PFLAG_EH_PENDING; |
| 949 | 940 | ||
| 950 | /* | 941 | /* |
| 951 | * If we have a deferred qc, requeue it so that it is retried once EH | 942 | * If we have deferred QCs, requeue them so that the SCSI EH task can |
| 952 | * completes. | 943 | * run. |
| 953 | */ | 944 | */ |
| 954 | ata_scsi_requeue_deferred_qc(ap); | 945 | ata_scsi_requeue_deferred_qc(ap, NULL); |
| 955 | 946 | ||
| 956 | if (!fastdrain) | 947 | if (!fastdrain) |
| 957 | return; | 948 | return; |
| @@ -913,7 +913,7 @@ static bool ata_scsi_lpm_supported(struct ata_port *ap) · 912 unmodified lines | |||
| 913 | return false; | 913 | return false; |
| 914 | 914 | ||
| 915 | ata_for_each_link(link, ap, EDGE) { | 915 | ata_for_each_link(link, ap, EDGE) { |
| 916 | ata_for_each_dev(dev, &ap->link, ENABLED) { | 916 | ata_for_each_dev(dev, link, ENABLED) { |
| 917 | if (dev->quirks & ATA_QUIRK_NOLPM) | 917 | if (dev->quirks & ATA_QUIRK_NOLPM) |
| 918 | return false; | 918 | return false; |
| 919 | } | 919 | } |
| @@ -1685,26 +1685,80 @@ void ata_scsi_deferred_qc_work(struct work_struct *work) · 1684 unmodified lines | |||
| 1685 | spin_unlock_irqrestore(ap->lock, flags); | 1685 | spin_unlock_irqrestore(ap->lock, flags); |
| 1686 | } | 1686 | } |
| 1687 | 1687 | ||
| 1688 | void ata_scsi_requeue_deferred_qc(struct ata_port *ap) | 1688 | enum scsi_timeout_action ata_scsi_requeue_deferred_qc(struct ata_port *ap, |
| 1689 | struct scsi_cmnd *timedout_scmd) | ||
| 1689 | { | 1690 | { |
| 1691 | enum scsi_timeout_action action = SCSI_EH_NOT_HANDLED; | ||
| 1692 | struct ata_queued_cmd *qc; | ||
| 1690 | struct ata_link *link; | 1693 | struct ata_link *link; |
| 1694 | u32 host_byte; | ||
| 1691 | 1695 | ||
| 1692 | lockdep_assert_held(ap->lock); | 1696 | lockdep_assert_held(ap->lock); |
| 1693 | 1697 | ||
| 1694 | /* | 1698 | /* |
| 1695 | * If we have a deferred qc when a reset occurs or NCQ commands fail, | 1699 | * If we have deferred QCs when a reset, a timeout or an NCQ command |
| 1696 | * do not try to be smart about what to do with this deferred command | 1700 | * fails, do not try to be smart about what to do with the deferred |
| 1697 | * and simply requeue it by completing it with DID_REQUEUE. | 1701 | * commands and simply terminate them and let the SCSI layer decide |
| 1702 | * what to do. | ||
| 1698 | */ | 1703 | */ |
| 1699 | ata_for_each_link(link, ap, PMP_FIRST) { | 1704 | ata_for_each_link(link, ap, PMP_FIRST) { |
| 1700 | struct ata_queued_cmd *qc = link->deferred_qc; | 1705 | qc = link->deferred_qc; |
| 1706 | if (!qc) | ||
| 1707 | continue; | ||
| 1701 | 1708 | ||
| 1702 | if (qc) { | 1709 | /* |
| 1703 | link->deferred_qc = NULL; | 1710 | * Clear the deferred QC so that the deferred work does not try |
| 1704 | cancel_work(&link->deferred_qc_work); | 1711 | * to issue it. |
| 1705 | ata_scsi_qc_done(qc, true, DID_REQUEUE << 16); | 1712 | */ |
| 1713 | link->deferred_qc = NULL; | ||
| 1714 | cancel_work(&link->deferred_qc_work); | ||
| 1715 | |||
| 1716 | /* | ||
| 1717 | * We are going to complete some scsi command, either with | ||
| 1718 | * DID_TIME_OUT if the command timed out while waiting for being | ||
| 1719 | * issued, or with DID_REQUEUE if another command timed out or | ||
| 1720 | * we had a failed command. However, the block layer may re-issue | ||
| 1721 | * these commands immediately, keeping the scsi host busy and | ||
| 1722 | * thus preventing the SCSI EH task from running. | ||
| 1723 | * So schedule EH on the port to prevent accepting new commands | ||
| 1724 | * until everything is sorted out with the error or timeout that | ||
| 1725 | * got us here in the first place. Note that we set EH pending | ||
| 1726 | * on the port before calling ata_port_schedule_eh() so that we | ||
| 1727 | * do not reenter this function from ata_eh_set_pending() with | ||
| 1728 | * timedout_scmd being NULL and erroneously retry deferred QCs | ||
| 1729 | * that have timed out on other links. | ||
| 1730 | */ | ||
| 1731 | if (!ata_port_eh_scheduled(ap)) { | ||
| 1732 | ap->pflags |= ATA_PFLAG_EH_PENDING; | ||
| 1733 | ata_port_schedule_eh(ap); | ||
| 1706 | } | 1734 | } |
| 1735 | |||
| 1736 | /* | ||
| 1737 | * If we are being called from scsi_timeout(), then we have a | ||
| 1738 | * non-NULL timedout_scmd. If the timed out command is for a | ||
| 1739 | * deferred QC, terminate that deferred QC with DID_TIME_OUT and | ||
| 1740 | * requeue all other deferred QCs. In this case we need to | ||
| 1741 | * return SCSI_EH_DONE, because the timed out command was | ||
| 1742 | * handled. | ||
| 1743 | * If the timed out command is not for a deferred QC, we need to | ||
| 1744 | * requeue all deferred QCs, and return SCSI_EH_NOT_HANDLED so | ||
| 1745 | * that the timed out command gets added to the EH work queue | ||
| 1746 | * with scsi_eh_scmd_add(), for later handling with libata EH | ||
| 1747 | * ata_scsi_cmd_error_handler(). | ||
| 1748 | * If timedout_scmd is NULL, we simply need to requeue all | ||
| 1749 | * deferred QCs and the return value does not matter as we were | ||
| 1750 | * not called from scsi_timeout(). | ||
| 1751 | */ | ||
| 1752 | if (timedout_scmd && qc->scsicmd == timedout_scmd) { | ||
| 1753 | host_byte = DID_TIME_OUT; | ||
| 1754 | action = SCSI_EH_DONE; | ||
| 1755 | } else { | ||
| 1756 | host_byte = DID_REQUEUE; | ||
| 1757 | } | ||
| 1758 | ata_scsi_qc_done(qc, true, host_byte << 16); | ||
| 1707 | } | 1759 | } |
| 1760 | |||
| 1761 | return action; | ||
| 1708 | } | 1762 | } |
| 1709 | 1763 | ||
| 1710 | static void ata_scsi_schedule_deferred_qc(struct ata_link *link) | 1764 | static void ata_scsi_schedule_deferred_qc(struct ata_link *link) |
| @@ -1723,13 +1777,42 @@ static void ata_scsi_schedule_deferred_qc(struct ata_link *link) · 12 unmodified lines | |||
| 1723 | return; | 1777 | return; |
| 1724 | 1778 | ||
| 1725 | if (ata_port_eh_scheduled(ap)) { | 1779 | if (ata_port_eh_scheduled(ap)) { |
| 1726 | ata_scsi_requeue_deferred_qc(ap); | 1780 | ata_scsi_requeue_deferred_qc(ap, NULL); |
| 1727 | return; | 1781 | return; |
| 1728 | } | 1782 | } |
| 1729 | if (!ap->ops->qc_defer(qc)) | 1783 | if (!ap->ops->qc_defer(qc)) |
| 1730 | queue_work(system_highpri_wq, &link->deferred_qc_work); | 1784 | queue_work(system_highpri_wq, &link->deferred_qc_work); |
| 1731 | } | 1785 | } |
| 1732 | 1786 | ||
| 1787 | enum scsi_timeout_action ata_scsi_retry_deferred_qc(struct ata_port *ap, | ||
| 1788 | struct scsi_cmnd *scmd) | ||
| 1789 | { | ||
| 1790 | enum scsi_timeout_action action; | ||
| 1791 | unsigned long flags; | ||
| 1792 | |||
| 1793 | spin_lock_irqsave(ap->lock, flags); | ||
| 1794 | action = ata_scsi_requeue_deferred_qc(ap, scmd); | ||
| 1795 | spin_unlock_irqrestore(ap->lock, flags); | ||
| 1796 | |||
| 1797 | return action; | ||
| 1798 | } | ||
| 1799 | EXPORT_SYMBOL_GPL(ata_scsi_retry_deferred_qc); | ||
| 1800 | |||
| 1801 | enum scsi_timeout_action ata_scsi_eh_timed_out(struct scsi_cmnd *scmd) | ||
| 1802 | { | ||
| 1803 | struct ata_port *ap = ata_shost_to_port(scmd->device->host); | ||
| 1804 | |||
| 1805 | /* | ||
| 1806 | * ata_scsi_cmd_error_handler() takes care of commands that timed out | ||
| 1807 | * while executing. However, if we have deferred QCs while a timeout | ||
| 1808 | * triggers, we must requeue these commands for retry so that we do not | ||
| 1809 | * unnecessarily delay starting the SCSI EH task until these deferred | ||
| 1810 | * commands also time out. | ||
| 1811 | */ | ||
| 1812 | return ata_scsi_retry_deferred_qc(ap, scmd); | ||
| 1813 | } | ||
| 1814 | EXPORT_SYMBOL_GPL(ata_scsi_eh_timed_out); | ||
| 1815 | |||
| 1733 | static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) | 1816 | static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) |
| 1734 | { | 1817 | { |
| 1735 | struct ata_link *link = qc->dev->link; | 1818 | struct ata_link *link = qc->dev->link; |
| @@ -2911,6 +2994,7 @@ static void atapi_fixup_inquiry(struct scsi_cmnd *cmd) · 1175 unmodified lines | |||
| 2911 | 2994 | ||
| 2912 | static void atapi_qc_complete(struct ata_queued_cmd *qc) | 2995 | static void atapi_qc_complete(struct ata_queued_cmd *qc) |
| 2913 | { | 2996 | { |
| 2997 | struct ata_link *link = qc->dev->link; | ||
| 2914 | struct scsi_cmnd *cmd = qc->scsicmd; | 2998 | struct scsi_cmnd *cmd = qc->scsicmd; |
| 2915 | unsigned int err_mask = qc->err_mask; | 2999 | unsigned int err_mask = qc->err_mask; |
| 2916 | 3000 | ||
| @@ -2936,8 +3020,16 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) · 19 unmodified lines | |||
| 2936 | if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev) | 3020 | if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev) |
| 2937 | qc->dev->sdev->locked = 0; | 3021 | qc->dev->sdev->locked = 0; |
| 2938 | 3022 | ||
| 2939 | ata_scsi_qc_done(qc, true, SAM_STAT_CHECK_CONDITION); | 3023 | if (cmd->result) |
| 2940 | return; | 3024 | ata_scsi_qc_done(qc, false, 0); |
| 3025 | else | ||
| 3026 | ata_scsi_qc_done(qc, true, SAM_STAT_CHECK_CONDITION); | ||
| 3027 | goto schedule_deferred; | ||
| 3028 | } | ||
| 3029 | |||
| 3030 | if (cmd->result) { | ||
| 3031 | ata_scsi_qc_done(qc, false, 0); | ||
| 3032 | goto schedule_deferred; | ||
| 2941 | } | 3033 | } |
| 2942 | 3034 | ||
| 2943 | /* successful completion path */ | 3035 | /* successful completion path */ |
| @@ -2945,6 +3037,9 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) · 1 unmodified line | |||
| 2945 | atapi_fixup_inquiry(cmd); | 3037 | atapi_fixup_inquiry(cmd); |
| 2946 | 3038 | ||
| 2947 | ata_scsi_qc_done(qc, true, SAM_STAT_GOOD); | 3039 | ata_scsi_qc_done(qc, true, SAM_STAT_GOOD); |
| 3040 | |||
| 3041 | schedule_deferred: | ||
| 3042 | ata_scsi_schedule_deferred_qc(link); | ||
| 2948 | } | 3043 | } |
| 2949 | /** | 3044 | /** |
| 2950 | * atapi_xlat - Initialize PACKET taskfile | 3045 | * atapi_xlat - Initialize PACKET taskfile |
| @@ -180,7 +180,8 @@ enum scsi_qc_status __ata_scsi_queuecmd(struct scsi_cmnd *scmd, · 179 unmodified lines | |||
| 180 | struct ata_port *ap) | 180 | struct ata_port *ap) |
| 181 | __must_hold(ap->lock); | 181 | __must_hold(ap->lock); |
| 182 | void ata_scsi_deferred_qc_work(struct work_struct *work); | 182 | void ata_scsi_deferred_qc_work(struct work_struct *work); |
| 183 | void ata_scsi_requeue_deferred_qc(struct ata_port *ap); | 183 | enum scsi_timeout_action ata_scsi_requeue_deferred_qc(struct ata_port *ap, |
| 184 | struct scsi_cmnd *scmd); | ||
| 184 | 185 | ||
| 185 | /* libata-eh.c */ | 186 | /* libata-eh.c */ |
| 186 | extern unsigned int ata_internal_cmd_timeout(struct ata_device *dev, u8 cmd); | 187 | extern unsigned int ata_internal_cmd_timeout(struct ata_device *dev, u8 cmd); |
| @@ -4027,7 +4027,7 @@ static int mv_platform_probe(struct platform_device *pdev) · 4026 unmodified lines | |||
| 4027 | /* | 4027 | /* |
| 4028 | * Simple resource validation .. | 4028 | * Simple resource validation .. |
| 4029 | */ | 4029 | */ |
| 4030 | if (unlikely(pdev->num_resources != 1)) { | 4030 | if (unlikely(pdev->num_resources != 1 && pdev->num_resources != 2)) { |
| 4031 | dev_err(&pdev->dev, "invalid number of resources\n"); | 4031 | dev_err(&pdev->dev, "invalid number of resources\n"); |
| 4032 | return -EINVAL; | 4032 | return -EINVAL; |
| 4033 | } | 4033 | } |
| @@ -502,6 +502,21 @@ int sas_eh_target_reset_handler(struct scsi_cmnd *cmd) · 501 unmodified lines | |||
| 502 | } | 502 | } |
| 503 | EXPORT_SYMBOL_GPL(sas_eh_target_reset_handler); | 503 | EXPORT_SYMBOL_GPL(sas_eh_target_reset_handler); |
| 504 | 504 | ||
| 505 | /* | ||
| 506 | * Handle deferred QCs in case of a command timeout. | ||
| 507 | * See ata_scsi_eh_timed_out() for details. | ||
| 508 | */ | ||
| 509 | enum scsi_timeout_action sas_eh_timed_out(struct scsi_cmnd *cmd) | ||
| 510 | { | ||
| 511 | struct domain_device *dev = cmd_to_domain_dev(cmd); | ||
| 512 | |||
| 513 | if (dev_is_sata(dev)) | ||
| 514 | return ata_scsi_retry_deferred_qc(dev->sata_dev.ap, cmd); | ||
| 515 | |||
| 516 | return SCSI_EH_NOT_HANDLED; | ||
| 517 | } | ||
| 518 | EXPORT_SYMBOL_GPL(sas_eh_timed_out); | ||
| 519 | |||
| 505 | /* Try to reset a device */ | 520 | /* Try to reset a device */ |
| 506 | static int try_to_reset_cmd_device(struct scsi_cmnd *cmd) | 521 | static int try_to_reset_cmd_device(struct scsi_cmnd *cmd) |
| 507 | { | 522 | { |
| @@ -762,8 +762,7 @@ static inline bool ata_id_sense_reporting_enabled(const u16 *id) · 761 unmodified lines | |||
| 762 | return id[ATA_ID_COMMAND_SET_4] & BIT(6); | 762 | return id[ATA_ID_COMMAND_SET_4] & BIT(6); |
| 763 | } | 763 | } |
| 764 | 764 | ||
| 765 | /** | 765 | /* |
| 766 | * | ||
| 767 | * Word: 206 - SCT Command Transport | 766 | * Word: 206 - SCT Command Transport |
| 768 | * 15:12 - Vendor Specific | 767 | * 15:12 - Vendor Specific |
| 769 | * 11:6 - Reserved | 768 | * 11:6 - Reserved |
| @@ -810,8 +809,9 @@ static inline bool ata_id_sct_supported(const u16 *id) · 40 unmodified lines | |||
| 810 | * | 809 | * |
| 811 | * The practical impact of this is that ata_id_major_version cannot | 810 | * The practical impact of this is that ata_id_major_version cannot |
| 812 | * reliably report on drives below ATA3. | 811 | * reliably report on drives below ATA3. |
| 812 | * | ||
| 813 | * Returns: major version of ATA drive level or %0 if unknown | ||
| 813 | */ | 814 | */ |
| 814 | |||
| 815 | static inline unsigned int ata_id_major_version(const u16 *id) | 815 | static inline unsigned int ata_id_major_version(const u16 *id) |
| 816 | { | 816 | { |
| 817 | unsigned int mver; | 817 | unsigned int mver; |
| @@ -425,7 +425,7 @@ enum { · 424 unmodified lines | |||
| 425 | /* This should match the actual table size of | 425 | /* This should match the actual table size of |
| 426 | * ata_eh_cmd_timeout_table in libata-eh.c. | 426 | * ata_eh_cmd_timeout_table in libata-eh.c. |
| 427 | */ | 427 | */ |
| 428 | ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 8, | 428 | ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 9, |
| 429 | 429 | ||
| 430 | /* User visible DMA mask for DMA control. DO NOT renumber. */ | 430 | /* User visible DMA mask for DMA control. DO NOT renumber. */ |
| 431 | ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */ | 431 | ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */ |
| @@ -1153,6 +1153,9 @@ extern int ata_scsi_ioctl(struct scsi_device *dev, unsigned int cmd, · 721 unmodified lines | |||
| 1153 | #endif | 1153 | #endif |
| 1154 | extern enum scsi_qc_status ata_scsi_queuecmd(struct Scsi_Host *h, | 1154 | extern enum scsi_qc_status ata_scsi_queuecmd(struct Scsi_Host *h, |
| 1155 | struct scsi_cmnd *cmd); | 1155 | struct scsi_cmnd *cmd); |
| 1156 | enum scsi_timeout_action ata_scsi_retry_deferred_qc(struct ata_port *ap, | ||
| 1157 | struct scsi_cmnd *scmd); | ||
| 1158 | enum scsi_timeout_action ata_scsi_eh_timed_out(struct scsi_cmnd *cmd); | ||
| 1156 | #if IS_REACHABLE(CONFIG_ATA) | 1159 | #if IS_REACHABLE(CONFIG_ATA) |
| 1157 | bool ata_scsi_dma_need_drain(struct request *rq); | 1160 | bool ata_scsi_dma_need_drain(struct request *rq); |
| 1158 | #else | 1161 | #else |
| @@ -1464,6 +1467,7 @@ extern const struct attribute_group *ata_common_sdev_groups[]; · 305 unmodified lines | |||
| 1464 | .ioctl = ata_scsi_ioctl, \ | 1467 | .ioctl = ata_scsi_ioctl, \ |
| 1465 | ATA_SCSI_COMPAT_IOCTL \ | 1468 | ATA_SCSI_COMPAT_IOCTL \ |
| 1466 | .queuecommand = ata_scsi_queuecmd, \ | 1469 | .queuecommand = ata_scsi_queuecmd, \ |
| 1470 | .eh_timed_out = ata_scsi_eh_timed_out, \ | ||
| 1467 | .dma_need_drain = ata_scsi_dma_need_drain, \ | 1471 | .dma_need_drain = ata_scsi_dma_need_drain, \ |
| 1468 | .this_id = ATA_SHT_THIS_ID, \ | 1472 | .this_id = ATA_SHT_THIS_ID, \ |
| 1469 | .emulated = ATA_SHT_EMULATED, \ | 1473 | .emulated = ATA_SHT_EMULATED, \ |
| @@ -705,6 +705,7 @@ void sas_task_abort(struct sas_task *); · 704 unmodified lines | |||
| 705 | int sas_eh_abort_handler(struct scsi_cmnd *cmd); | 705 | int sas_eh_abort_handler(struct scsi_cmnd *cmd); |
| 706 | int sas_eh_device_reset_handler(struct scsi_cmnd *cmd); | 706 | int sas_eh_device_reset_handler(struct scsi_cmnd *cmd); |
| 707 | int sas_eh_target_reset_handler(struct scsi_cmnd *cmd); | 707 | int sas_eh_target_reset_handler(struct scsi_cmnd *cmd); |
| 708 | enum scsi_timeout_action sas_eh_timed_out(struct scsi_cmnd *cmd); | ||
| 708 | 709 | ||
| 709 | extern void sas_target_destroy(struct scsi_target *); | 710 | extern void sas_target_destroy(struct scsi_target *); |
| 710 | extern int sas_sdev_init(struct scsi_device *); | 711 | extern int sas_sdev_init(struct scsi_device *); |
| @@ -743,6 +744,7 @@ void sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event, · 32 unmodified lines | |||
| 743 | .this_id = -1, \ | 744 | .this_id = -1, \ |
| 744 | .eh_device_reset_handler = sas_eh_device_reset_handler, \ | 745 | .eh_device_reset_handler = sas_eh_device_reset_handler, \ |
| 745 | .eh_target_reset_handler = sas_eh_target_reset_handler, \ | 746 | .eh_target_reset_handler = sas_eh_target_reset_handler, \ |
| 747 | .eh_timed_out = sas_eh_timed_out, \ | ||
| 746 | .target_destroy = sas_target_destroy, \ | 748 | .target_destroy = sas_target_destroy, \ |
| 747 | .ioctl = sas_ioctl, \ | 749 | .ioctl = sas_ioctl, \ |
| 748 | 750 | ||