diff options
Diffstat (limited to 'drivers/scsi/isci/remote_device.c')
-rw-r--r-- | drivers/scsi/isci/remote_device.c | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index 8c752abb4331..85e54f542075 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c | |||
@@ -456,7 +456,7 @@ static void sci_remote_device_start_request(struct isci_remote_device *idev, | |||
456 | sci_port_complete_io(iport, idev, ireq); | 456 | sci_port_complete_io(iport, idev, ireq); |
457 | else { | 457 | else { |
458 | kref_get(&idev->kref); | 458 | kref_get(&idev->kref); |
459 | sci_remote_device_increment_request_count(idev); | 459 | idev->started_request_count++; |
460 | } | 460 | } |
461 | } | 461 | } |
462 | 462 | ||
@@ -636,7 +636,7 @@ enum sci_status sci_remote_device_complete_io(struct isci_host *ihost, | |||
636 | * status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE". | 636 | * status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE". |
637 | */ | 637 | */ |
638 | sci_change_state(sm, SCI_STP_DEV_AWAIT_RESET); | 638 | sci_change_state(sm, SCI_STP_DEV_AWAIT_RESET); |
639 | } else if (sci_remote_device_get_request_count(idev) == 0) | 639 | } else if (idev->started_request_count == 0) |
640 | sci_change_state(sm, SCI_STP_DEV_IDLE); | 640 | sci_change_state(sm, SCI_STP_DEV_IDLE); |
641 | break; | 641 | break; |
642 | case SCI_SMP_DEV_CMD: | 642 | case SCI_SMP_DEV_CMD: |
@@ -650,10 +650,10 @@ enum sci_status sci_remote_device_complete_io(struct isci_host *ihost, | |||
650 | if (status != SCI_SUCCESS) | 650 | if (status != SCI_SUCCESS) |
651 | break; | 651 | break; |
652 | 652 | ||
653 | if (sci_remote_device_get_request_count(idev) == 0) | 653 | if (idev->started_request_count == 0) |
654 | sci_remote_node_context_destruct(&idev->rnc, | 654 | sci_remote_node_context_destruct(&idev->rnc, |
655 | rnc_destruct_done, | 655 | rnc_destruct_done, |
656 | idev); | 656 | idev); |
657 | break; | 657 | break; |
658 | } | 658 | } |
659 | 659 | ||
@@ -761,26 +761,17 @@ enum sci_status sci_remote_device_start_task(struct isci_host *ihost, | |||
761 | return status; | 761 | return status; |
762 | } | 762 | } |
763 | 763 | ||
764 | /** | 764 | void sci_remote_device_post_request(struct isci_remote_device *idev, u32 request) |
765 | * | ||
766 | * @sci_dev: | ||
767 | * @request: | ||
768 | * | ||
769 | * This method takes the request and bulids an appropriate SCU context for the | ||
770 | * request and then requests the controller to post the request. none | ||
771 | */ | ||
772 | void sci_remote_device_post_request( | ||
773 | struct isci_remote_device *idev, | ||
774 | u32 request) | ||
775 | { | 765 | { |
766 | struct isci_port *iport = idev->owning_port; | ||
776 | u32 context; | 767 | u32 context; |
777 | 768 | ||
778 | context = sci_remote_device_build_command_context(idev, request); | 769 | context = request | |
770 | (ISCI_PEG << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | | ||
771 | (iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | | ||
772 | idev->rnc.remote_node_index; | ||
779 | 773 | ||
780 | sci_controller_post_request( | 774 | sci_controller_post_request(iport->owning_controller, context); |
781 | sci_remote_device_get_controller(idev), | ||
782 | context | ||
783 | ); | ||
784 | } | 775 | } |
785 | 776 | ||
786 | /* called once the remote node context has transisitioned to a | 777 | /* called once the remote node context has transisitioned to a |
@@ -893,7 +884,7 @@ static void sci_remote_device_stopped_state_enter(struct sci_base_state_machine | |||
893 | static void sci_remote_device_starting_state_enter(struct sci_base_state_machine *sm) | 884 | static void sci_remote_device_starting_state_enter(struct sci_base_state_machine *sm) |
894 | { | 885 | { |
895 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); | 886 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
896 | struct isci_host *ihost = sci_remote_device_get_controller(idev); | 887 | struct isci_host *ihost = idev->owning_port->owning_controller; |
897 | 888 | ||
898 | isci_remote_device_not_ready(ihost, idev, | 889 | isci_remote_device_not_ready(ihost, idev, |
899 | SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED); | 890 | SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED); |
@@ -961,7 +952,7 @@ static void sci_stp_remote_device_ready_idle_substate_enter(struct sci_base_stat | |||
961 | static void sci_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) | 952 | static void sci_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) |
962 | { | 953 | { |
963 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); | 954 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
964 | struct isci_host *ihost = sci_remote_device_get_controller(idev); | 955 | struct isci_host *ihost = idev->owning_port->owning_controller; |
965 | 956 | ||
966 | BUG_ON(idev->working_request == NULL); | 957 | BUG_ON(idev->working_request == NULL); |
967 | 958 | ||
@@ -972,7 +963,7 @@ static void sci_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state | |||
972 | static void sci_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_state_machine *sm) | 963 | static void sci_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_state_machine *sm) |
973 | { | 964 | { |
974 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); | 965 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
975 | struct isci_host *ihost = sci_remote_device_get_controller(idev); | 966 | struct isci_host *ihost = idev->owning_port->owning_controller; |
976 | 967 | ||
977 | if (idev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED) | 968 | if (idev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED) |
978 | isci_remote_device_not_ready(ihost, idev, | 969 | isci_remote_device_not_ready(ihost, idev, |
@@ -982,7 +973,7 @@ static void sci_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base | |||
982 | static void sci_smp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) | 973 | static void sci_smp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) |
983 | { | 974 | { |
984 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); | 975 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
985 | struct isci_host *ihost = sci_remote_device_get_controller(idev); | 976 | struct isci_host *ihost = idev->owning_port->owning_controller; |
986 | 977 | ||
987 | isci_remote_device_ready(ihost, idev); | 978 | isci_remote_device_ready(ihost, idev); |
988 | } | 979 | } |
@@ -990,7 +981,7 @@ static void sci_smp_remote_device_ready_idle_substate_enter(struct sci_base_stat | |||
990 | static void sci_smp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) | 981 | static void sci_smp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) |
991 | { | 982 | { |
992 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); | 983 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
993 | struct isci_host *ihost = sci_remote_device_get_controller(idev); | 984 | struct isci_host *ihost = idev->owning_port->owning_controller; |
994 | 985 | ||
995 | BUG_ON(idev->working_request == NULL); | 986 | BUG_ON(idev->working_request == NULL); |
996 | 987 | ||