diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-04-21 21:44:45 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:00:38 -0400 |
commit | a1a113b0a1ea437daf099b44f8a39e93a02a3f47 (patch) | |
tree | c9576cfc8c12447d0932accee0e3b59d175c08d9 /drivers/scsi/isci/remote_node_context.c | |
parent | b87ee3075b090e1dd0bdf40b295142b606d55e64 (diff) |
isci: kill smp_discover_response_protocols in favor of domain_device.dev_type
This is step 1 of removing the contortions to:
1/ unparse expander phy data into a smp discover frame
2/ open-code-parse the smp discover fram into a domain_device.dev_type equivalent
libsas has already spent cycles determining the dev_type, so now that
scic_sds_remote_device is unified with isci_remote_device we can
directly reference dev_type.
This might also change multi-level expander detection as we previously only
looked at dev_type == EDGE_DEV and we did not consider the FANOUT_DEV case.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/remote_node_context.c')
-rw-r--r-- | drivers/scsi/isci/remote_node_context.c | 63 |
1 files changed, 22 insertions, 41 deletions
diff --git a/drivers/scsi/isci/remote_node_context.c b/drivers/scsi/isci/remote_node_context.c index bdf0b5101cfa..285232fd5e63 100644 --- a/drivers/scsi/isci/remote_node_context.c +++ b/drivers/scsi/isci/remote_node_context.c | |||
@@ -106,8 +106,9 @@ bool scic_sds_remote_node_context_is_ready( | |||
106 | static void scic_sds_remote_node_context_construct_buffer( | 106 | static void scic_sds_remote_node_context_construct_buffer( |
107 | struct scic_sds_remote_node_context *sci_rnc) | 107 | struct scic_sds_remote_node_context *sci_rnc) |
108 | { | 108 | { |
109 | union scu_remote_node_context *rnc; | ||
110 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); | 109 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); |
110 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | ||
111 | union scu_remote_node_context *rnc; | ||
111 | struct scic_sds_controller *scic; | 112 | struct scic_sds_controller *scic; |
112 | 113 | ||
113 | scic = scic_sds_remote_device_get_controller(sci_dev); | 114 | scic = scic_sds_remote_device_get_controller(sci_dev); |
@@ -134,11 +135,7 @@ static void scic_sds_remote_node_context_construct_buffer( | |||
134 | 135 | ||
135 | rnc->ssp.arbitration_wait_time = 0; | 136 | rnc->ssp.arbitration_wait_time = 0; |
136 | 137 | ||
137 | 138 | if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { | |
138 | if ( | ||
139 | sci_dev->target_protocols.u.bits.attached_sata_device | ||
140 | || sci_dev->target_protocols.u.bits.attached_stp_target | ||
141 | ) { | ||
142 | rnc->ssp.connection_occupancy_timeout = | 139 | rnc->ssp.connection_occupancy_timeout = |
143 | scic->user_parameters.sds1.stp_max_occupancy_timeout; | 140 | scic->user_parameters.sds1.stp_max_occupancy_timeout; |
144 | rnc->ssp.connection_inactivity_timeout = | 141 | rnc->ssp.connection_inactivity_timeout = |
@@ -639,45 +636,30 @@ static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_ha | |||
639 | scics_sds_remote_node_context_callback callback, | 636 | scics_sds_remote_node_context_callback callback, |
640 | void *callback_parameter) | 637 | void *callback_parameter) |
641 | { | 638 | { |
642 | enum sci_status status; | 639 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); |
643 | struct smp_discover_response_protocols protocols; | 640 | struct domain_device *dev = sci_dev_to_domain(sci_dev); |
641 | enum sci_status status = SCI_SUCCESS; | ||
644 | 642 | ||
645 | scic_sds_remote_node_context_setup_to_resume( | 643 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, callback, |
646 | sci_rnc, callback, callback_parameter | 644 | callback_parameter); |
647 | ); | ||
648 | 645 | ||
649 | /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ | 646 | /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ |
650 | 647 | if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) | |
651 | scic_remote_device_get_protocols(rnc_to_dev(sci_rnc), &protocols); | 648 | sci_base_state_machine_change_state(&sci_rnc->state_machine, |
652 | 649 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | |
653 | if ( | 650 | else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { |
654 | (protocols.u.bits.attached_ssp_target == 1) | 651 | if (sci_dev->is_direct_attached) { |
655 | || (protocols.u.bits.attached_smp_target == 1) | ||
656 | ) { | ||
657 | sci_base_state_machine_change_state( | ||
658 | &sci_rnc->state_machine, | ||
659 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE | ||
660 | ); | ||
661 | |||
662 | status = SCI_SUCCESS; | ||
663 | } else if (protocols.u.bits.attached_stp_target == 1) { | ||
664 | if (rnc_to_dev(sci_rnc)->is_direct_attached) { | ||
665 | /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ | 652 | /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ |
666 | sci_base_state_machine_change_state( | 653 | sci_base_state_machine_change_state( |
667 | &sci_rnc->state_machine, | 654 | &sci_rnc->state_machine, |
668 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE | 655 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); |
669 | ); | ||
670 | } else { | 656 | } else { |
671 | sci_base_state_machine_change_state( | 657 | sci_base_state_machine_change_state( |
672 | &sci_rnc->state_machine, | 658 | &sci_rnc->state_machine, |
673 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE | 659 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE); |
674 | ); | ||
675 | } | 660 | } |
676 | 661 | } else | |
677 | status = SCI_SUCCESS; | ||
678 | } else { | ||
679 | status = SCI_FAILURE; | 662 | status = SCI_FAILURE; |
680 | } | ||
681 | 663 | ||
682 | return status; | 664 | return status; |
683 | } | 665 | } |
@@ -932,6 +914,7 @@ static void scic_sds_remote_node_context_validate_context_buffer( | |||
932 | struct scic_sds_remote_node_context *sci_rnc) | 914 | struct scic_sds_remote_node_context *sci_rnc) |
933 | { | 915 | { |
934 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); | 916 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); |
917 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | ||
935 | union scu_remote_node_context *rnc_buffer; | 918 | union scu_remote_node_context *rnc_buffer; |
936 | 919 | ||
937 | rnc_buffer = scic_sds_controller_get_remote_node_context_buffer( | 920 | rnc_buffer = scic_sds_controller_get_remote_node_context_buffer( |
@@ -942,7 +925,7 @@ static void scic_sds_remote_node_context_validate_context_buffer( | |||
942 | rnc_buffer->ssp.is_valid = true; | 925 | rnc_buffer->ssp.is_valid = true; |
943 | 926 | ||
944 | if (!sci_dev->is_direct_attached && | 927 | if (!sci_dev->is_direct_attached && |
945 | sci_dev->target_protocols.u.bits.attached_stp_target) { | 928 | (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP))) { |
946 | scic_sds_remote_device_post_request(sci_dev, | 929 | scic_sds_remote_device_post_request(sci_dev, |
947 | SCU_CONTEXT_COMMAND_POST_RNC_96); | 930 | SCU_CONTEXT_COMMAND_POST_RNC_96); |
948 | } else { | 931 | } else { |
@@ -1063,11 +1046,12 @@ static void scic_sds_remote_node_context_resuming_state_enter( | |||
1063 | struct sci_base_object *object) | 1046 | struct sci_base_object *object) |
1064 | { | 1047 | { |
1065 | struct scic_sds_remote_node_context *rnc; | 1048 | struct scic_sds_remote_node_context *rnc; |
1066 | struct smp_discover_response_protocols protocols; | ||
1067 | struct scic_sds_remote_device *sci_dev; | 1049 | struct scic_sds_remote_device *sci_dev; |
1050 | struct domain_device *dev; | ||
1068 | 1051 | ||
1069 | rnc = (struct scic_sds_remote_node_context *)object; | 1052 | rnc = (struct scic_sds_remote_node_context *)object; |
1070 | sci_dev = rnc_to_dev(rnc); | 1053 | sci_dev = rnc_to_dev(rnc); |
1054 | dev = sci_dev_to_domain(sci_dev); | ||
1071 | 1055 | ||
1072 | SET_STATE_HANDLER( | 1056 | SET_STATE_HANDLER( |
1073 | rnc, | 1057 | rnc, |
@@ -1081,13 +1065,10 @@ static void scic_sds_remote_node_context_resuming_state_enter( | |||
1081 | * resume because of a target reset we also need to update | 1065 | * resume because of a target reset we also need to update |
1082 | * the STPTLDARNI register with the RNi of the device | 1066 | * the STPTLDARNI register with the RNi of the device |
1083 | */ | 1067 | */ |
1084 | scic_remote_device_get_protocols(sci_dev, &protocols); | 1068 | if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) && |
1085 | 1069 | sci_dev->is_direct_attached) | |
1086 | if (protocols.u.bits.attached_stp_target == 1 && | ||
1087 | sci_dev->is_direct_attached) { | ||
1088 | scic_sds_port_setup_transports(sci_dev->owning_port, | 1070 | scic_sds_port_setup_transports(sci_dev->owning_port, |
1089 | rnc->remote_node_index); | 1071 | rnc->remote_node_index); |
1090 | } | ||
1091 | 1072 | ||
1092 | scic_sds_remote_device_post_request(sci_dev, SCU_CONTEXT_COMMAND_POST_RNC_RESUME); | 1073 | scic_sds_remote_device_post_request(sci_dev, SCU_CONTEXT_COMMAND_POST_RNC_RESUME); |
1093 | } | 1074 | } |