aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci
diff options
context:
space:
mode:
authorAndrzej Jakowski <andrzej.jakowski@intel.com>2012-03-08 14:38:50 -0500
committerDan Williams <dan.j.williams@intel.com>2012-05-17 15:27:28 -0400
commit6119908f0fe3737bba2f64eff70599c3e41d522e (patch)
treeb78a7d433149ba3def1d427a7f4662d17eb00dd6 /drivers/scsi/isci
parentd1dc5e2d21a55538167d7ce82aa147c91c5e6788 (diff)
isci: Changes in COMSAS timings enabling ISCI to detect buggy disc drives.
This patch extends timings in COMSAS signaling, so ISCI can detect disc drives having issues to send COMSAS in correct time frame. Signed-off-by: Andrzej Jakowski <andrzej.jakowski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci')
-rw-r--r--drivers/scsi/isci/phy.c55
-rw-r--r--drivers/scsi/isci/registers.h8
2 files changed, 63 insertions, 0 deletions
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index 474330fdbe1c..85b26ac9074c 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -668,6 +668,19 @@ static const char *phy_event_name(u32 event_code)
668 phy_to_host(iphy)->id, iphy->phy_index, \ 668 phy_to_host(iphy)->id, iphy->phy_index, \
669 phy_state_name(state), phy_event_name(code), code) 669 phy_state_name(state), phy_event_name(code), code)
670 670
671
672void scu_link_layer_set_txcomsas_timeout(struct isci_phy *iphy, u32 timeout)
673{
674 u32 val;
675
676 /* Extend timeout */
677 val = readl(&iphy->link_layer_registers->transmit_comsas_signal);
678 val &= ~SCU_SAS_LLTXCOMSAS_GEN_VAL(NEGTIME, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_MASK);
679 val |= SCU_SAS_LLTXCOMSAS_GEN_VAL(NEGTIME, timeout);
680
681 writel(val, &iphy->link_layer_registers->transmit_comsas_signal);
682}
683
671enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code) 684enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
672{ 685{
673 enum sci_phy_states state = iphy->sm.current_state_id; 686 enum sci_phy_states state = iphy->sm.current_state_id;
@@ -683,6 +696,13 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
683 sci_phy_start_sata_link_training(iphy); 696 sci_phy_start_sata_link_training(iphy);
684 iphy->is_in_link_training = true; 697 iphy->is_in_link_training = true;
685 break; 698 break;
699 case SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT:
700 /* Extend timeout value */
701 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_EXTENDED);
702
703 /* Start the oob/sn state machine over again */
704 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
705 break;
686 default: 706 default:
687 phy_event_dbg(iphy, state, event_code); 707 phy_event_dbg(iphy, state, event_code);
688 return SCI_FAILURE; 708 return SCI_FAILURE;
@@ -717,9 +737,19 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
717 sci_phy_start_sata_link_training(iphy); 737 sci_phy_start_sata_link_training(iphy);
718 break; 738 break;
719 case SCU_EVENT_LINK_FAILURE: 739 case SCU_EVENT_LINK_FAILURE:
740 /* Change the timeout value to default */
741 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT);
742
720 /* Link failure change state back to the starting state */ 743 /* Link failure change state back to the starting state */
721 sci_change_state(&iphy->sm, SCI_PHY_STARTING); 744 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
722 break; 745 break;
746 case SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT:
747 /* Extend the timeout value */
748 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_EXTENDED);
749
750 /* Start the oob/sn state machine over again */
751 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
752 break;
723 default: 753 default:
724 phy_event_warn(iphy, state, event_code); 754 phy_event_warn(iphy, state, event_code);
725 return SCI_FAILURE; 755 return SCI_FAILURE;
@@ -740,7 +770,14 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
740 sci_phy_start_sata_link_training(iphy); 770 sci_phy_start_sata_link_training(iphy);
741 break; 771 break;
742 case SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT: 772 case SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT:
773 /* Extend the timeout value */
774 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_EXTENDED);
775
776 /* Start the oob/sn state machine over again */
777 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
778 break;
743 case SCU_EVENT_LINK_FAILURE: 779 case SCU_EVENT_LINK_FAILURE:
780 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT);
744 case SCU_EVENT_HARD_RESET_RECEIVED: 781 case SCU_EVENT_HARD_RESET_RECEIVED:
745 /* Start the oob/sn state machine over again */ 782 /* Start the oob/sn state machine over again */
746 sci_change_state(&iphy->sm, SCI_PHY_STARTING); 783 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
@@ -753,6 +790,9 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
753 case SCI_PHY_SUB_AWAIT_SAS_POWER: 790 case SCI_PHY_SUB_AWAIT_SAS_POWER:
754 switch (scu_get_event_code(event_code)) { 791 switch (scu_get_event_code(event_code)) {
755 case SCU_EVENT_LINK_FAILURE: 792 case SCU_EVENT_LINK_FAILURE:
793 /* Change the timeout value to default */
794 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT);
795
756 /* Link failure change state back to the starting state */ 796 /* Link failure change state back to the starting state */
757 sci_change_state(&iphy->sm, SCI_PHY_STARTING); 797 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
758 break; 798 break;
@@ -764,6 +804,9 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
764 case SCI_PHY_SUB_AWAIT_SATA_POWER: 804 case SCI_PHY_SUB_AWAIT_SATA_POWER:
765 switch (scu_get_event_code(event_code)) { 805 switch (scu_get_event_code(event_code)) {
766 case SCU_EVENT_LINK_FAILURE: 806 case SCU_EVENT_LINK_FAILURE:
807 /* Change the timeout value to default */
808 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT);
809
767 /* Link failure change state back to the starting state */ 810 /* Link failure change state back to the starting state */
768 sci_change_state(&iphy->sm, SCI_PHY_STARTING); 811 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
769 break; 812 break;
@@ -788,6 +831,9 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
788 case SCI_PHY_SUB_AWAIT_SATA_PHY_EN: 831 case SCI_PHY_SUB_AWAIT_SATA_PHY_EN:
789 switch (scu_get_event_code(event_code)) { 832 switch (scu_get_event_code(event_code)) {
790 case SCU_EVENT_LINK_FAILURE: 833 case SCU_EVENT_LINK_FAILURE:
834 /* Change the timeout value to default */
835 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT);
836
791 /* Link failure change state back to the starting state */ 837 /* Link failure change state back to the starting state */
792 sci_change_state(&iphy->sm, SCI_PHY_STARTING); 838 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
793 break; 839 break;
@@ -836,6 +882,9 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
836 SCI_PHY_SUB_AWAIT_SIG_FIS_UF); 882 SCI_PHY_SUB_AWAIT_SIG_FIS_UF);
837 break; 883 break;
838 case SCU_EVENT_LINK_FAILURE: 884 case SCU_EVENT_LINK_FAILURE:
885 /* Change the timeout value to default */
886 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT);
887
839 /* Link failure change state back to the starting state */ 888 /* Link failure change state back to the starting state */
840 sci_change_state(&iphy->sm, SCI_PHY_STARTING); 889 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
841 break; 890 break;
@@ -859,6 +908,9 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
859 break; 908 break;
860 909
861 case SCU_EVENT_LINK_FAILURE: 910 case SCU_EVENT_LINK_FAILURE:
911 /* Change the timeout value to default */
912 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT);
913
862 /* Link failure change state back to the starting state */ 914 /* Link failure change state back to the starting state */
863 sci_change_state(&iphy->sm, SCI_PHY_STARTING); 915 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
864 break; 916 break;
@@ -871,6 +923,9 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
871 case SCI_PHY_READY: 923 case SCI_PHY_READY:
872 switch (scu_get_event_code(event_code)) { 924 switch (scu_get_event_code(event_code)) {
873 case SCU_EVENT_LINK_FAILURE: 925 case SCU_EVENT_LINK_FAILURE:
926 /* Set default timeout */
927 scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT);
928
874 /* Link failure change state back to the starting state */ 929 /* Link failure change state back to the starting state */
875 sci_change_state(&iphy->sm, SCI_PHY_STARTING); 930 sci_change_state(&iphy->sm, SCI_PHY_STARTING);
876 break; 931 break;
diff --git a/drivers/scsi/isci/registers.h b/drivers/scsi/isci/registers.h
index 7eb0ccd45fe6..97f3ceb8d724 100644
--- a/drivers/scsi/isci/registers.h
+++ b/drivers/scsi/isci/registers.h
@@ -1239,6 +1239,14 @@ struct scu_transport_layer_registers {
1239#define SCU_SAS_LLCTL_GEN_BIT(name) \ 1239#define SCU_SAS_LLCTL_GEN_BIT(name) \
1240 SCU_GEN_BIT(SCU_SAS_LINK_LAYER_CONTROL_ ## name) 1240 SCU_GEN_BIT(SCU_SAS_LINK_LAYER_CONTROL_ ## name)
1241 1241
1242#define SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT (0xF0)
1243#define SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_EXTENDED (0x1FF)
1244#define SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_SHIFT (0)
1245#define SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_MASK (0x3FF)
1246
1247#define SCU_SAS_LLTXCOMSAS_GEN_VAL(name, value) \
1248 SCU_GEN_VALUE(SCU_SAS_LINK_LAYER_TXCOMSAS_ ## name, value)
1249
1242 1250
1243/* #define SCU_FRXHECR_DCNT_OFFSET 0x00B0 */ 1251/* #define SCU_FRXHECR_DCNT_OFFSET 0x00B0 */
1244#define SCU_PSZGCR_OFFSET 0x00E4 1252#define SCU_PSZGCR_OFFSET 0x00E4