aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArtur Wojcik <artur.wojcik@intel.com>2011-05-04 03:58:16 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:46 -0400
commitcc3dbd0a9178865d4444f8e28b51715808e9ac85 (patch)
tree4f8da28b4740e0ddaeb3163a3d317f36bc49571c /drivers
parentd06b487b78f28a02efdcdcc9ec295bf230b9d0e8 (diff)
isci: unify isci_host data structures
Make it explicit that isci_host and scic_sds_controller are one in the same object. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> [removed ->ihost back pointer] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/isci/core/scic_sds_controller.c22
-rw-r--r--drivers/scsi/isci/core/scic_sds_controller.h6
-rw-r--r--drivers/scsi/isci/core/scic_sds_phy.c6
-rw-r--r--drivers/scsi/isci/core/scic_sds_port.c34
-rw-r--r--drivers/scsi/isci/core/scic_sds_port_configuration_agent.c9
-rw-r--r--drivers/scsi/isci/core/scic_sds_request.c2
-rw-r--r--drivers/scsi/isci/host.c51
-rw-r--r--drivers/scsi/isci/host.h12
-rw-r--r--drivers/scsi/isci/init.c4
-rw-r--r--drivers/scsi/isci/phy.c5
-rw-r--r--drivers/scsi/isci/phy.h2
-rw-r--r--drivers/scsi/isci/port.c29
-rw-r--r--drivers/scsi/isci/port.h5
-rw-r--r--drivers/scsi/isci/remote_device.c30
-rw-r--r--drivers/scsi/isci/request.c6
-rw-r--r--drivers/scsi/isci/sci_environment.h4
-rw-r--r--drivers/scsi/isci/task.c15
-rw-r--r--drivers/scsi/isci/task.h4
18 files changed, 83 insertions, 163 deletions
diff --git a/drivers/scsi/isci/core/scic_sds_controller.c b/drivers/scsi/isci/core/scic_sds_controller.c
index 3fe73cbc0524..ea510411460c 100644
--- a/drivers/scsi/isci/core/scic_sds_controller.c
+++ b/drivers/scsi/isci/core/scic_sds_controller.c
@@ -214,7 +214,7 @@ static void scic_sds_controller_power_control_timer_handler(
214 214
215static void scic_sds_controller_initialize_power_control(struct scic_sds_controller *scic) 215static void scic_sds_controller_initialize_power_control(struct scic_sds_controller *scic)
216{ 216{
217 struct isci_host *ihost = scic->ihost; 217 struct isci_host *ihost = scic_to_ihost(scic);
218 scic->power_control.timer = isci_timer_create(ihost, 218 scic->power_control.timer = isci_timer_create(ihost,
219 scic, 219 scic,
220 scic_sds_controller_power_control_timer_handler); 220 scic_sds_controller_power_control_timer_handler);
@@ -585,7 +585,7 @@ static void scic_sds_controller_transition_to_ready(
585 struct scic_sds_controller *scic, 585 struct scic_sds_controller *scic,
586 enum sci_status status) 586 enum sci_status status)
587{ 587{
588 struct isci_host *ihost = scic->ihost; 588 struct isci_host *ihost = scic_to_ihost(scic);
589 589
590 if (scic->state_machine.current_state_id == 590 if (scic->state_machine.current_state_id ==
591 SCI_BASE_CONTROLLER_STATE_STARTING) { 591 SCI_BASE_CONTROLLER_STATE_STARTING) {
@@ -603,7 +603,7 @@ static void scic_sds_controller_transition_to_ready(
603static void scic_sds_controller_timeout_handler(void *_scic) 603static void scic_sds_controller_timeout_handler(void *_scic)
604{ 604{
605 struct scic_sds_controller *scic = _scic; 605 struct scic_sds_controller *scic = _scic;
606 struct isci_host *ihost = scic->ihost; 606 struct isci_host *ihost = scic_to_ihost(scic);
607 struct sci_base_state_machine *sm = &scic->state_machine; 607 struct sci_base_state_machine *sm = &scic->state_machine;
608 608
609 if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STARTING) 609 if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STARTING)
@@ -771,7 +771,7 @@ static void scic_sds_controller_phy_startup_timeout_handler(void *_scic)
771 771
772static enum sci_status scic_sds_controller_initialize_phy_startup(struct scic_sds_controller *scic) 772static enum sci_status scic_sds_controller_initialize_phy_startup(struct scic_sds_controller *scic)
773{ 773{
774 struct isci_host *ihost = scic->ihost; 774 struct isci_host *ihost = scic_to_ihost(scic);
775 775
776 scic->phy_startup_timer = isci_timer_create(ihost, 776 scic->phy_startup_timer = isci_timer_create(ihost,
777 scic, 777 scic,
@@ -1775,7 +1775,7 @@ void scic_sds_controller_release_frame(
1775 */ 1775 */
1776static void scic_sds_controller_set_default_config_parameters(struct scic_sds_controller *scic) 1776static void scic_sds_controller_set_default_config_parameters(struct scic_sds_controller *scic)
1777{ 1777{
1778 struct isci_host *ihost = scic->ihost; 1778 struct isci_host *ihost = scic_to_ihost(scic);
1779 u16 index; 1779 u16 index;
1780 1780
1781 /* Default to APC mode. */ 1781 /* Default to APC mode. */
@@ -2619,17 +2619,12 @@ static enum sci_status scic_controller_set_interrupt_coalescence(
2619} 2619}
2620 2620
2621 2621
2622struct scic_sds_controller *scic_controller_alloc(struct device *dev)
2623{
2624 return devm_kzalloc(dev, sizeof(struct scic_sds_controller), GFP_KERNEL);
2625}
2626 2622
2627enum sci_status scic_controller_initialize( 2623enum sci_status scic_controller_initialize(struct scic_sds_controller *scic)
2628 struct scic_sds_controller *scic)
2629{ 2624{
2630 struct sci_base_state_machine *sm = &scic->state_machine; 2625 struct sci_base_state_machine *sm = &scic->state_machine;
2631 enum sci_status result = SCI_SUCCESS; 2626 enum sci_status result = SCI_SUCCESS;
2632 struct isci_host *ihost; 2627 struct isci_host *ihost = scic_to_ihost(scic);
2633 u32 index, state; 2628 u32 index, state;
2634 2629
2635 if (scic->state_machine.current_state_id != 2630 if (scic->state_machine.current_state_id !=
@@ -2640,9 +2635,6 @@ enum sci_status scic_controller_initialize(
2640 return SCI_FAILURE_INVALID_STATE; 2635 return SCI_FAILURE_INVALID_STATE;
2641 } 2636 }
2642 2637
2643
2644 ihost = scic->ihost;
2645
2646 sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING); 2638 sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING);
2647 2639
2648 scic->timeout_timer = isci_timer_create(ihost, 2640 scic->timeout_timer = isci_timer_create(ihost,
diff --git a/drivers/scsi/isci/core/scic_sds_controller.h b/drivers/scsi/isci/core/scic_sds_controller.h
index 08aee06c124d..0a9bb8b77256 100644
--- a/drivers/scsi/isci/core/scic_sds_controller.h
+++ b/drivers/scsi/isci/core/scic_sds_controller.h
@@ -125,7 +125,6 @@ struct scic_power_control {
125 125
126}; 126};
127 127
128struct isci_host;
129/** 128/**
130 * struct scic_sds_controller - 129 * struct scic_sds_controller -
131 * 130 *
@@ -133,11 +132,6 @@ struct isci_host;
133 */ 132 */
134struct scic_sds_controller { 133struct scic_sds_controller {
135 /** 134 /**
136 * The field specifies that the peer object for the controller.
137 */
138 struct isci_host *ihost;
139
140 /**
141 * This field contains the information for the base controller state 135 * This field contains the information for the base controller state
142 * machine. 136 * machine.
143 */ 137 */
diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c
index 18dc14a8f0ba..8f1e3db6bb2e 100644
--- a/drivers/scsi/isci/core/scic_sds_phy.c
+++ b/drivers/scsi/isci/core/scic_sds_phy.c
@@ -339,7 +339,7 @@ enum sci_status scic_sds_phy_initialize(
339 struct scu_link_layer_registers __iomem *link_layer_registers) 339 struct scu_link_layer_registers __iomem *link_layer_registers)
340{ 340{
341 struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy); 341 struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy);
342 struct isci_host *ihost = scic->ihost; 342 struct isci_host *ihost = scic_to_ihost(scic);
343 343
344 /* Create the SIGNATURE FIS Timeout timer for this phy */ 344 /* Create the SIGNATURE FIS Timeout timer for this phy */
345 sci_phy->sata_timeout_timer = 345 sci_phy->sata_timeout_timer =
@@ -1790,7 +1790,7 @@ scic_sds_phy_stopped_state_start_handler(struct scic_sds_phy *sci_phy)
1790 struct scic_sds_controller *scic; 1790 struct scic_sds_controller *scic;
1791 1791
1792 scic = scic_sds_phy_get_controller(sci_phy), 1792 scic = scic_sds_phy_get_controller(sci_phy),
1793 ihost = scic->ihost; 1793 ihost = scic_to_ihost(scic);
1794 1794
1795 /* Create the SIGNATURE FIS Timeout timer for this phy */ 1795 /* Create the SIGNATURE FIS Timeout timer for this phy */
1796 sci_phy->sata_timeout_timer = isci_timer_create(ihost, sci_phy, 1796 sci_phy->sata_timeout_timer = isci_timer_create(ihost, sci_phy,
@@ -2076,7 +2076,7 @@ static void scic_sds_phy_stopped_state_enter(void *object)
2076{ 2076{
2077 struct scic_sds_phy *sci_phy = object; 2077 struct scic_sds_phy *sci_phy = object;
2078 struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy); 2078 struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy);
2079 struct isci_host *ihost = scic->ihost; 2079 struct isci_host *ihost = scic_to_ihost(scic);
2080 2080
2081 /* 2081 /*
2082 * @todo We need to get to the controller to place this PE in a 2082 * @todo We need to get to the controller to place this PE in a
diff --git a/drivers/scsi/isci/core/scic_sds_port.c b/drivers/scsi/isci/core/scic_sds_port.c
index 0c89fc1c09f8..04a56c5a68d9 100644
--- a/drivers/scsi/isci/core/scic_sds_port.c
+++ b/drivers/scsi/isci/core/scic_sds_port.c
@@ -625,7 +625,7 @@ static void scic_sds_port_activate_phy(struct scic_sds_port *sci_port,
625 bool do_notify_user) 625 bool do_notify_user)
626{ 626{
627 struct scic_sds_controller *scic = sci_port->owning_controller; 627 struct scic_sds_controller *scic = sci_port->owning_controller;
628 struct isci_host *ihost = scic->ihost; 628 struct isci_host *ihost = scic_to_ihost(scic);
629 629
630 if (sci_phy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) 630 if (sci_phy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA)
631 scic_sds_phy_resume(sci_phy); 631 scic_sds_phy_resume(sci_phy);
@@ -644,7 +644,7 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port,
644{ 644{
645 struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); 645 struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port);
646 struct isci_port *iport = sci_port->iport; 646 struct isci_port *iport = sci_port->iport;
647 struct isci_host *ihost = scic->ihost; 647 struct isci_host *ihost = scic_to_ihost(scic);
648 struct isci_phy *iphy = sci_phy->iphy; 648 struct isci_phy *iphy = sci_phy->iphy;
649 649
650 sci_port->active_phy_mask &= ~(1 << sci_phy->phy_index); 650 sci_port->active_phy_mask &= ~(1 << sci_phy->phy_index);
@@ -667,12 +667,10 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port,
667 * This function will disable the phy and report that the phy is not valid for 667 * This function will disable the phy and report that the phy is not valid for
668 * this port object. None 668 * this port object. None
669 */ 669 */
670static void scic_sds_port_invalid_link_up( 670static void scic_sds_port_invalid_link_up(struct scic_sds_port *sci_port,
671 struct scic_sds_port *sci_port, 671 struct scic_sds_phy *sci_phy)
672 struct scic_sds_phy *sci_phy)
673{ 672{
674 struct scic_sds_controller *scic = 673 struct scic_sds_controller *scic = sci_port->owning_controller;
675 scic_sds_port_get_controller(sci_port);
676 674
677 /* 675 /*
678 * Check to see if we have alreay reported this link as bad and if 676 * Check to see if we have alreay reported this link as bad and if
@@ -681,7 +679,7 @@ static void scic_sds_port_invalid_link_up(
681 */ 679 */
682 if ((scic->invalid_phy_mask & (1 << sci_phy->phy_index)) == 0) { 680 if ((scic->invalid_phy_mask & (1 << sci_phy->phy_index)) == 0) {
683 scic_sds_controller_set_invalid_phy(scic, sci_phy); 681 scic_sds_controller_set_invalid_phy(scic, sci_phy);
684 isci_port_invalid_link_up(scic, sci_port, sci_phy); 682 dev_warn(&scic_to_ihost(scic)->pdev->dev, "Invalid link up!\n");
685 } 683 }
686} 684}
687 685
@@ -971,7 +969,7 @@ void scic_sds_port_broadcast_change_received(
971 struct scic_sds_phy *sci_phy) 969 struct scic_sds_phy *sci_phy)
972{ 970{
973 struct scic_sds_controller *scic = sci_port->owning_controller; 971 struct scic_sds_controller *scic = sci_port->owning_controller;
974 struct isci_host *ihost = scic->ihost; 972 struct isci_host *ihost = scic_to_ihost(scic);
975 973
976 /* notify the user. */ 974 /* notify the user. */
977 isci_port_bc_change_received(ihost, sci_port, sci_phy); 975 isci_port_bc_change_received(ihost, sci_port, sci_phy);
@@ -1625,7 +1623,7 @@ static void scic_sds_port_ready_substate_operational_enter(void *object)
1625 struct scic_sds_port *sci_port = object; 1623 struct scic_sds_port *sci_port = object;
1626 struct scic_sds_controller *scic = 1624 struct scic_sds_controller *scic =
1627 scic_sds_port_get_controller(sci_port); 1625 scic_sds_port_get_controller(sci_port);
1628 struct isci_host *ihost = scic->ihost; 1626 struct isci_host *ihost = scic_to_ihost(scic);
1629 struct isci_port *iport = sci_port->iport; 1627 struct isci_port *iport = sci_port->iport;
1630 1628
1631 scic_sds_port_set_ready_state_handlers( 1629 scic_sds_port_set_ready_state_handlers(
@@ -1666,7 +1664,7 @@ static void scic_sds_port_ready_substate_operational_exit(void *object)
1666 struct scic_sds_port *sci_port = object; 1664 struct scic_sds_port *sci_port = object;
1667 struct scic_sds_controller *scic = 1665 struct scic_sds_controller *scic =
1668 scic_sds_port_get_controller(sci_port); 1666 scic_sds_port_get_controller(sci_port);
1669 struct isci_host *ihost = scic->ihost; 1667 struct isci_host *ihost = scic_to_ihost(scic);
1670 struct isci_port *iport = sci_port->iport; 1668 struct isci_port *iport = sci_port->iport;
1671 1669
1672 /* 1670 /*
@@ -1697,7 +1695,7 @@ static void scic_sds_port_ready_substate_configuring_enter(void *object)
1697 struct scic_sds_port *sci_port = object; 1695 struct scic_sds_port *sci_port = object;
1698 struct scic_sds_controller *scic = 1696 struct scic_sds_controller *scic =
1699 scic_sds_port_get_controller(sci_port); 1697 scic_sds_port_get_controller(sci_port);
1700 struct isci_host *ihost = scic->ihost; 1698 struct isci_host *ihost = scic_to_ihost(scic);
1701 struct isci_port *iport = sci_port->iport; 1699 struct isci_port *iport = sci_port->iport;
1702 1700
1703 scic_sds_port_set_ready_state_handlers( 1701 scic_sds_port_set_ready_state_handlers(
@@ -1784,7 +1782,7 @@ static enum sci_status
1784scic_sds_port_stopped_state_start_handler(struct scic_sds_port *sci_port) 1782scic_sds_port_stopped_state_start_handler(struct scic_sds_port *sci_port)
1785{ 1783{
1786 struct scic_sds_controller *scic = sci_port->owning_controller; 1784 struct scic_sds_controller *scic = sci_port->owning_controller;
1787 struct isci_host *ihost = scic->ihost; 1785 struct isci_host *ihost = scic_to_ihost(scic);
1788 enum sci_status status = SCI_SUCCESS; 1786 enum sci_status status = SCI_SUCCESS;
1789 u32 phy_mask; 1787 u32 phy_mask;
1790 1788
@@ -2259,16 +2257,12 @@ static void scic_sds_port_stopped_state_exit(void *object)
2259 */ 2257 */
2260static void scic_sds_port_ready_state_enter(void *object) 2258static void scic_sds_port_ready_state_enter(void *object)
2261{ 2259{
2262 struct scic_sds_controller *scic;
2263 struct scic_sds_port *sci_port = object; 2260 struct scic_sds_port *sci_port = object;
2264 struct isci_port *iport; 2261 struct scic_sds_controller *scic = sci_port->owning_controller;
2265 struct isci_host *ihost; 2262 struct isci_host *ihost = scic_to_ihost(scic);
2263 struct isci_port *iport = sci_port->iport;
2266 u32 prev_state; 2264 u32 prev_state;
2267 2265
2268 scic = scic_sds_port_get_controller(sci_port);
2269 ihost = scic->ihost;
2270 iport = sci_port->iport;
2271
2272 /* Put the ready state handlers in place though they will not be there long */ 2266 /* Put the ready state handlers in place though they will not be there long */
2273 scic_sds_port_set_base_state_handlers(sci_port, SCI_BASE_PORT_STATE_READY); 2267 scic_sds_port_set_base_state_handlers(sci_port, SCI_BASE_PORT_STATE_READY);
2274 2268
diff --git a/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c b/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
index df257ffa0f84..6b1f4a0ad990 100644
--- a/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
+++ b/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
@@ -808,20 +808,13 @@ void scic_sds_port_configuration_agent_construct(
808 } 808 }
809} 809}
810 810
811/**
812 *
813 * @controller: This is the controller object for which the port agent is being
814 * initialized.
815 *
816 * This method will construct the port configuration agent for this controller.
817 */
818enum sci_status scic_sds_port_configuration_agent_initialize( 811enum sci_status scic_sds_port_configuration_agent_initialize(
819 struct scic_sds_controller *scic, 812 struct scic_sds_controller *scic,
820 struct scic_sds_port_configuration_agent *port_agent) 813 struct scic_sds_port_configuration_agent *port_agent)
821{ 814{
822 enum sci_status status = SCI_SUCCESS; 815 enum sci_status status = SCI_SUCCESS;
823 enum scic_port_configuration_mode mode; 816 enum scic_port_configuration_mode mode;
824 struct isci_host *ihost = scic->ihost; 817 struct isci_host *ihost = scic_to_ihost(scic);
825 818
826 mode = scic->oem_parameters.sds1.controller.mode_type; 819 mode = scic->oem_parameters.sds1.controller.mode_type;
827 820
diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c
index 85e40ce96e96..6286decd62e5 100644
--- a/drivers/scsi/isci/core/scic_sds_request.c
+++ b/drivers/scsi/isci/core/scic_sds_request.c
@@ -1545,7 +1545,7 @@ static void scic_sds_request_completed_state_enter(void *object)
1545 struct scic_sds_request *sci_req = object; 1545 struct scic_sds_request *sci_req = object;
1546 struct scic_sds_controller *scic = 1546 struct scic_sds_controller *scic =
1547 scic_sds_request_get_controller(sci_req); 1547 scic_sds_request_get_controller(sci_req);
1548 struct isci_host *ihost = scic->ihost; 1548 struct isci_host *ihost = scic_to_ihost(scic);
1549 struct isci_request *ireq = sci_req->ireq; 1549 struct isci_request *ireq = sci_req->ireq;
1550 1550
1551 SET_STATE_HANDLER(sci_req, 1551 SET_STATE_HANDLER(sci_req,
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 55bfa3dbfb8f..d180ad8a8bcf 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -65,9 +65,8 @@
65irqreturn_t isci_msix_isr(int vec, void *data) 65irqreturn_t isci_msix_isr(int vec, void *data)
66{ 66{
67 struct isci_host *ihost = data; 67 struct isci_host *ihost = data;
68 struct scic_sds_controller *scic = ihost->core_controller;
69 68
70 if (scic_sds_controller_isr(scic)) 69 if (scic_sds_controller_isr(&ihost->sci))
71 tasklet_schedule(&ihost->completion_tasklet); 70 tasklet_schedule(&ihost->completion_tasklet);
72 71
73 return IRQ_HANDLED; 72 return IRQ_HANDLED;
@@ -77,7 +76,7 @@ irqreturn_t isci_intx_isr(int vec, void *data)
77{ 76{
78 irqreturn_t ret = IRQ_NONE; 77 irqreturn_t ret = IRQ_NONE;
79 struct isci_host *ihost = data; 78 struct isci_host *ihost = data;
80 struct scic_sds_controller *scic = ihost->core_controller; 79 struct scic_sds_controller *scic = &ihost->sci;
81 80
82 if (scic_sds_controller_isr(scic)) { 81 if (scic_sds_controller_isr(scic)) {
83 writel(SMU_ISR_COMPLETION, &scic->smu_registers->interrupt_status); 82 writel(SMU_ISR_COMPLETION, &scic->smu_registers->interrupt_status);
@@ -96,10 +95,9 @@ irqreturn_t isci_intx_isr(int vec, void *data)
96irqreturn_t isci_error_isr(int vec, void *data) 95irqreturn_t isci_error_isr(int vec, void *data)
97{ 96{
98 struct isci_host *ihost = data; 97 struct isci_host *ihost = data;
99 struct scic_sds_controller *scic = ihost->core_controller;
100 98
101 if (scic_sds_controller_error_isr(scic)) 99 if (scic_sds_controller_error_isr(&ihost->sci))
102 scic_sds_controller_error_handler(scic); 100 scic_sds_controller_error_handler(&ihost->sci);
103 101
104 return IRQ_HANDLED; 102 return IRQ_HANDLED;
105} 103}
@@ -145,21 +143,20 @@ int isci_host_scan_finished(struct Scsi_Host *shost, unsigned long time)
145void isci_host_scan_start(struct Scsi_Host *shost) 143void isci_host_scan_start(struct Scsi_Host *shost)
146{ 144{
147 struct isci_host *ihost = SHOST_TO_SAS_HA(shost)->lldd_ha; 145 struct isci_host *ihost = SHOST_TO_SAS_HA(shost)->lldd_ha;
148 struct scic_sds_controller *scic = ihost->core_controller; 146 unsigned long tmo = scic_controller_get_suggested_start_timeout(&ihost->sci);
149 unsigned long tmo = scic_controller_get_suggested_start_timeout(scic);
150 147
151 set_bit(IHOST_START_PENDING, &ihost->flags); 148 set_bit(IHOST_START_PENDING, &ihost->flags);
152 149
153 spin_lock_irq(&ihost->scic_lock); 150 spin_lock_irq(&ihost->scic_lock);
154 scic_controller_start(scic, tmo); 151 scic_controller_start(&ihost->sci, tmo);
155 scic_controller_enable_interrupts(scic); 152 scic_controller_enable_interrupts(&ihost->sci);
156 spin_unlock_irq(&ihost->scic_lock); 153 spin_unlock_irq(&ihost->scic_lock);
157} 154}
158 155
159void isci_host_stop_complete(struct isci_host *ihost, enum sci_status completion_status) 156void isci_host_stop_complete(struct isci_host *ihost, enum sci_status completion_status)
160{ 157{
161 isci_host_change_state(ihost, isci_stopped); 158 isci_host_change_state(ihost, isci_stopped);
162 scic_controller_disable_interrupts(ihost->core_controller); 159 scic_controller_disable_interrupts(&ihost->sci);
163 clear_bit(IHOST_STOP_PENDING, &ihost->flags); 160 clear_bit(IHOST_STOP_PENDING, &ihost->flags);
164 wake_up(&ihost->eventq); 161 wake_up(&ihost->eventq);
165} 162}
@@ -188,7 +185,7 @@ static void isci_host_completion_routine(unsigned long data)
188 185
189 spin_lock_irq(&isci_host->scic_lock); 186 spin_lock_irq(&isci_host->scic_lock);
190 187
191 scic_sds_controller_completion_handler(isci_host->core_controller); 188 scic_sds_controller_completion_handler(&isci_host->sci);
192 189
193 /* Take the lists of completed I/Os from the host. */ 190 /* Take the lists of completed I/Os from the host. */
194 191
@@ -276,7 +273,6 @@ static void isci_host_completion_routine(unsigned long data)
276 273
277void isci_host_deinit(struct isci_host *ihost) 274void isci_host_deinit(struct isci_host *ihost)
278{ 275{
279 struct scic_sds_controller *scic = ihost->core_controller;
280 int i; 276 int i;
281 277
282 isci_host_change_state(ihost, isci_stopping); 278 isci_host_change_state(ihost, isci_stopping);
@@ -293,11 +289,11 @@ void isci_host_deinit(struct isci_host *ihost)
293 set_bit(IHOST_STOP_PENDING, &ihost->flags); 289 set_bit(IHOST_STOP_PENDING, &ihost->flags);
294 290
295 spin_lock_irq(&ihost->scic_lock); 291 spin_lock_irq(&ihost->scic_lock);
296 scic_controller_stop(scic, SCIC_CONTROLLER_STOP_TIMEOUT); 292 scic_controller_stop(&ihost->sci, SCIC_CONTROLLER_STOP_TIMEOUT);
297 spin_unlock_irq(&ihost->scic_lock); 293 spin_unlock_irq(&ihost->scic_lock);
298 294
299 wait_for_stop(ihost); 295 wait_for_stop(ihost);
300 scic_controller_reset(scic); 296 scic_controller_reset(&ihost->sci);
301 isci_timer_list_destroy(ihost); 297 isci_timer_list_destroy(ihost);
302} 298}
303 299
@@ -347,25 +343,12 @@ int isci_host_init(struct isci_host *isci_host)
347{ 343{
348 int err = 0, i; 344 int err = 0, i;
349 enum sci_status status; 345 enum sci_status status;
350 struct scic_sds_controller *controller;
351 union scic_oem_parameters oem; 346 union scic_oem_parameters oem;
352 union scic_user_parameters scic_user_params; 347 union scic_user_parameters scic_user_params;
353 struct isci_pci_info *pci_info = to_pci_info(isci_host->pdev); 348 struct isci_pci_info *pci_info = to_pci_info(isci_host->pdev);
354 349
355 isci_timer_list_construct(isci_host); 350 isci_timer_list_construct(isci_host);
356 351
357 controller = scic_controller_alloc(&isci_host->pdev->dev);
358
359 if (!controller) {
360 dev_err(&isci_host->pdev->dev,
361 "%s: failed (%d)\n",
362 __func__,
363 err);
364 return -ENOMEM;
365 }
366
367 isci_host->core_controller = controller;
368 controller->ihost = isci_host;
369 spin_lock_init(&isci_host->state_lock); 352 spin_lock_init(&isci_host->state_lock);
370 spin_lock_init(&isci_host->scic_lock); 353 spin_lock_init(&isci_host->scic_lock);
371 spin_lock_init(&isci_host->queue_lock); 354 spin_lock_init(&isci_host->queue_lock);
@@ -374,7 +357,7 @@ int isci_host_init(struct isci_host *isci_host)
374 isci_host_change_state(isci_host, isci_starting); 357 isci_host_change_state(isci_host, isci_starting);
375 isci_host->can_queue = ISCI_CAN_QUEUE_VAL; 358 isci_host->can_queue = ISCI_CAN_QUEUE_VAL;
376 359
377 status = scic_controller_construct(controller, scu_base(isci_host), 360 status = scic_controller_construct(&isci_host->sci, scu_base(isci_host),
378 smu_base(isci_host)); 361 smu_base(isci_host));
379 362
380 if (status != SCI_SUCCESS) { 363 if (status != SCI_SUCCESS) {
@@ -393,7 +376,7 @@ int isci_host_init(struct isci_host *isci_host)
393 * parameters 376 * parameters
394 */ 377 */
395 isci_user_parameters_get(isci_host, &scic_user_params); 378 isci_user_parameters_get(isci_host, &scic_user_params);
396 status = scic_user_parameters_set(isci_host->core_controller, 379 status = scic_user_parameters_set(&isci_host->sci,
397 &scic_user_params); 380 &scic_user_params);
398 if (status != SCI_SUCCESS) { 381 if (status != SCI_SUCCESS) {
399 dev_warn(&isci_host->pdev->dev, 382 dev_warn(&isci_host->pdev->dev,
@@ -402,7 +385,7 @@ int isci_host_init(struct isci_host *isci_host)
402 return -ENODEV; 385 return -ENODEV;
403 } 386 }
404 387
405 scic_oem_parameters_get(controller, &oem); 388 scic_oem_parameters_get(&isci_host->sci, &oem);
406 389
407 /* grab any OEM parameters specified in orom */ 390 /* grab any OEM parameters specified in orom */
408 if (pci_info->orom) { 391 if (pci_info->orom) {
@@ -416,7 +399,7 @@ int isci_host_init(struct isci_host *isci_host)
416 } 399 }
417 } 400 }
418 401
419 status = scic_oem_parameters_set(isci_host->core_controller, &oem); 402 status = scic_oem_parameters_set(&isci_host->sci, &oem);
420 if (status != SCI_SUCCESS) { 403 if (status != SCI_SUCCESS) {
421 dev_warn(&isci_host->pdev->dev, 404 dev_warn(&isci_host->pdev->dev,
422 "%s: scic_oem_parameters_set failed\n", 405 "%s: scic_oem_parameters_set failed\n",
@@ -431,7 +414,7 @@ int isci_host_init(struct isci_host *isci_host)
431 INIT_LIST_HEAD(&isci_host->requests_to_errorback); 414 INIT_LIST_HEAD(&isci_host->requests_to_errorback);
432 415
433 spin_lock_irq(&isci_host->scic_lock); 416 spin_lock_irq(&isci_host->scic_lock);
434 status = scic_controller_initialize(isci_host->core_controller); 417 status = scic_controller_initialize(&isci_host->sci);
435 spin_unlock_irq(&isci_host->scic_lock); 418 spin_unlock_irq(&isci_host->scic_lock);
436 if (status != SCI_SUCCESS) { 419 if (status != SCI_SUCCESS) {
437 dev_warn(&isci_host->pdev->dev, 420 dev_warn(&isci_host->pdev->dev,
@@ -441,7 +424,7 @@ int isci_host_init(struct isci_host *isci_host)
441 return -ENODEV; 424 return -ENODEV;
442 } 425 }
443 426
444 err = scic_controller_mem_init(isci_host->core_controller); 427 err = scic_controller_mem_init(&isci_host->sci);
445 if (err) 428 if (err)
446 return err; 429 return err;
447 430
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h
index 8dc8d1c46986..00e4854e20d9 100644
--- a/drivers/scsi/isci/host.h
+++ b/drivers/scsi/isci/host.h
@@ -58,7 +58,7 @@
58#define _SCI_HOST_H_ 58#define _SCI_HOST_H_
59 59
60#include "phy.h" 60#include "phy.h"
61/*#include "task.h"*/ 61#include "scic_sds_controller.h"
62#include "timers.h" 62#include "timers.h"
63#include "remote_device.h" 63#include "remote_device.h"
64 64
@@ -75,7 +75,7 @@
75#define SCIC_CONTROLLER_STOP_TIMEOUT 5000 75#define SCIC_CONTROLLER_STOP_TIMEOUT 5000
76 76
77struct isci_host { 77struct isci_host {
78 struct scic_sds_controller *core_controller; 78 struct scic_sds_controller sci;
79 union scic_oem_parameters oem_parameters; 79 union scic_oem_parameters oem_parameters;
80 80
81 int id; /* unique within a given pci device */ 81 int id; /* unique within a given pci device */
@@ -219,6 +219,14 @@ static inline struct isci_host *dev_to_ihost(struct domain_device *dev)
219 return dev->port->ha->lldd_ha; 219 return dev->port->ha->lldd_ha;
220} 220}
221 221
222static inline struct isci_host *scic_to_ihost(struct scic_sds_controller *scic)
223{
224 /* XXX delete after merging scic_sds_contoller and isci_host */
225 struct isci_host *ihost = container_of(scic, typeof(*ihost), sci);
226
227 return ihost;
228}
229
222/** 230/**
223 * isci_host_scan_finished() - 231 * isci_host_scan_finished() -
224 * 232 *
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 6c2d686fe7c0..a5d5c0b97d00 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -268,7 +268,7 @@ static void isci_unregister(struct isci_host *isci_host)
268 268
269static int __devinit isci_pci_init(struct pci_dev *pdev) 269static int __devinit isci_pci_init(struct pci_dev *pdev)
270{ 270{
271 int err, bar_num, bar_mask; 271 int err, bar_num, bar_mask = 0;
272 void __iomem * const *iomap; 272 void __iomem * const *iomap;
273 273
274 err = pcim_enable_device(pdev); 274 err = pcim_enable_device(pdev);
@@ -556,7 +556,7 @@ static void __devexit isci_pci_remove(struct pci_dev *pdev)
556 for_each_isci_host(i, isci_host, pdev) { 556 for_each_isci_host(i, isci_host, pdev) {
557 isci_unregister(isci_host); 557 isci_unregister(isci_host);
558 isci_host_deinit(isci_host); 558 isci_host_deinit(isci_host);
559 scic_controller_disable_interrupts(isci_host->core_controller); 559 scic_controller_disable_interrupts(&isci_host->sci);
560 } 560 }
561} 561}
562 562
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index a690b6b664f7..160790a0de0e 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -79,7 +79,6 @@ void isci_phy_init(
79 struct isci_host *isci_host, 79 struct isci_host *isci_host,
80 int index) 80 int index)
81{ 81{
82 struct scic_sds_controller *scic = isci_host->core_controller;
83 struct scic_sds_phy *scic_phy; 82 struct scic_sds_phy *scic_phy;
84 union scic_oem_parameters oem; 83 union scic_oem_parameters oem;
85 enum sci_status status = SCI_SUCCESS; 84 enum sci_status status = SCI_SUCCESS;
@@ -87,7 +86,7 @@ void isci_phy_init(
87 86
88 /*--------------- SCU_Phy Initialization Stuff -----------------------*/ 87 /*--------------- SCU_Phy Initialization Stuff -----------------------*/
89 88
90 status = scic_controller_get_phy_handle(scic, index, &scic_phy); 89 status = scic_controller_get_phy_handle(&isci_host->sci, index, &scic_phy);
91 if (status == SCI_SUCCESS) { 90 if (status == SCI_SUCCESS) {
92 phy->sci_phy_handle = scic_phy; 91 phy->sci_phy_handle = scic_phy;
93 scic_phy->iphy = phy; 92 scic_phy->iphy = phy;
@@ -95,7 +94,7 @@ void isci_phy_init(
95 dev_err(&isci_host->pdev->dev, 94 dev_err(&isci_host->pdev->dev,
96 "failed scic_controller_get_phy_handle\n"); 95 "failed scic_controller_get_phy_handle\n");
97 96
98 scic_oem_parameters_get(scic, &oem); 97 scic_oem_parameters_get(&isci_host->sci, &oem);
99 sas_addr = oem.sds1.phys[index].sas_address.high; 98 sas_addr = oem.sds1.phys[index].sas_address.high;
100 sas_addr <<= 32; 99 sas_addr <<= 32;
101 sas_addr |= oem.sds1.phys[index].sas_address.low; 100 sas_addr |= oem.sds1.phys[index].sas_address.low;
diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h
index d4c4975546e3..21f6050eadbe 100644
--- a/drivers/scsi/isci/phy.h
+++ b/drivers/scsi/isci/phy.h
@@ -85,8 +85,6 @@ struct isci_phy {
85#define to_isci_phy(p) \ 85#define to_isci_phy(p) \
86 container_of(p, struct isci_phy, sas_phy); 86 container_of(p, struct isci_phy, sas_phy);
87 87
88struct isci_host;
89
90void isci_phy_init( 88void isci_phy_init(
91 struct isci_phy *phy, 89 struct isci_phy *phy,
92 struct isci_host *isci_host, 90 struct isci_host *isci_host,
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c
index 2decafbeb968..8d96a10341b1 100644
--- a/drivers/scsi/isci/port.c
+++ b/drivers/scsi/isci/port.c
@@ -90,7 +90,6 @@ void isci_port_init(
90 int index) 90 int index)
91{ 91{
92 struct scic_sds_port *scic_port; 92 struct scic_sds_port *scic_port;
93 struct scic_sds_controller *controller = isci_host->core_controller;
94 93
95 INIT_LIST_HEAD(&isci_port->remote_dev_list); 94 INIT_LIST_HEAD(&isci_port->remote_dev_list);
96 INIT_LIST_HEAD(&isci_port->domain_dev_list); 95 INIT_LIST_HEAD(&isci_port->domain_dev_list);
@@ -99,7 +98,7 @@ void isci_port_init(
99 isci_port->isci_host = isci_host; 98 isci_port->isci_host = isci_host;
100 isci_port_change_state(isci_port, isci_freed); 99 isci_port_change_state(isci_port, isci_freed);
101 100
102 (void)scic_controller_get_port_handle(controller, index, &scic_port); 101 (void)scic_controller_get_port_handle(&isci_host->sci, index, &scic_port);
103 isci_port->sci_port_handle = scic_port; 102 isci_port->sci_port_handle = scic_port;
104 scic_port->iport = isci_port; 103 scic_port->iport = isci_port;
105} 104}
@@ -415,33 +414,9 @@ int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *ipor
415 return ret; 414 return ret;
416} 415}
417 416
418/**
419 * isci_port_invalid_link_up() - This function informs the SCI Core user that
420 * a phy/link became ready, but the phy is not allowed in the port. In some
421 * situations the underlying hardware only allows for certain phy to port
422 * mappings. If these mappings are violated, then this API is invoked.
423 * @controller: This parameter represents the controller which contains the
424 * port.
425 * @port: This parameter specifies the SCI port object for which the callback
426 * is being invoked.
427 * @phy: This parameter specifies the phy that came ready, but the phy can't be
428 * a valid member of the port.
429 *
430 */
431void isci_port_invalid_link_up(struct scic_sds_controller *scic,
432 struct scic_sds_port *sci_port,
433 struct scic_sds_phy *phy)
434{
435 struct isci_host *ihost = scic->ihost;
436
437 dev_warn(&ihost->pdev->dev, "Invalid link up!\n");
438}
439
440void isci_port_stop_complete(struct scic_sds_controller *scic, 417void isci_port_stop_complete(struct scic_sds_controller *scic,
441 struct scic_sds_port *sci_port, 418 struct scic_sds_port *sci_port,
442 enum sci_status completion_status) 419 enum sci_status completion_status)
443{ 420{
444 struct isci_host *ihost = scic->ihost; 421 dev_dbg(&scic_to_ihost(scic)->pdev->dev, "Port stop complete\n");
445
446 dev_dbg(&ihost->pdev->dev, "Port stop complete\n");
447} 422}
diff --git a/drivers/scsi/isci/port.h b/drivers/scsi/isci/port.h
index eeac7bbc9430..ac1ac86ead6f 100644
--- a/drivers/scsi/isci/port.h
+++ b/drivers/scsi/isci/port.h
@@ -147,11 +147,6 @@ void isci_port_hard_reset_complete(
147int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *iport, 147int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *iport,
148 struct isci_phy *iphy); 148 struct isci_phy *iphy);
149 149
150void isci_port_invalid_link_up(
151 struct scic_sds_controller *scic,
152 struct scic_sds_port *sci_port,
153 struct scic_sds_phy *phy);
154
155void isci_port_stop_complete( 150void isci_port_stop_complete(
156 struct scic_sds_controller *scic, 151 struct scic_sds_controller *scic,
157 struct scic_sds_port *sci_port, 152 struct scic_sds_port *sci_port,
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index ee6fe1db8f99..734d028448b0 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -815,7 +815,7 @@ static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handl
815 * As a result, avoid sending the ready notification. 815 * As a result, avoid sending the ready notification.
816 */ 816 */
817 if (sci_dev->state_machine.previous_state_id != SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ) 817 if (sci_dev->state_machine.previous_state_id != SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ)
818 isci_remote_device_ready(scic->ihost, idev); 818 isci_remote_device_ready(scic_to_ihost(scic), idev);
819} 819}
820 820
821static void scic_sds_remote_device_initial_state_enter(void *object) 821static void scic_sds_remote_device_initial_state_enter(void *object)
@@ -918,21 +918,16 @@ static void isci_remote_device_stop_complete(struct isci_host *ihost,
918static void scic_sds_remote_device_stopped_state_enter(void *object) 918static void scic_sds_remote_device_stopped_state_enter(void *object)
919{ 919{
920 struct scic_sds_remote_device *sci_dev = object; 920 struct scic_sds_remote_device *sci_dev = object;
921 struct scic_sds_controller *scic; 921 struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller;
922 struct isci_remote_device *idev; 922 struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
923 struct isci_host *ihost;
924 u32 prev_state; 923 u32 prev_state;
925 924
926 scic = scic_sds_remote_device_get_controller(sci_dev);
927 ihost = scic->ihost;
928 idev = sci_dev_to_idev(sci_dev);
929
930 /* If we are entering from the stopping state let the SCI User know that 925 /* If we are entering from the stopping state let the SCI User know that
931 * the stop operation has completed. 926 * the stop operation has completed.
932 */ 927 */
933 prev_state = sci_dev->state_machine.previous_state_id; 928 prev_state = sci_dev->state_machine.previous_state_id;
934 if (prev_state == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING) 929 if (prev_state == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING)
935 isci_remote_device_stop_complete(ihost, idev); 930 isci_remote_device_stop_complete(scic_to_ihost(scic), idev);
936 931
937 scic_sds_controller_remote_device_stopped(scic, sci_dev); 932 scic_sds_controller_remote_device_stopped(scic, sci_dev);
938} 933}
@@ -941,7 +936,7 @@ static void scic_sds_remote_device_starting_state_enter(void *object)
941{ 936{
942 struct scic_sds_remote_device *sci_dev = object; 937 struct scic_sds_remote_device *sci_dev = object;
943 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); 938 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
944 struct isci_host *ihost = scic->ihost; 939 struct isci_host *ihost = scic_to_ihost(scic);
945 struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); 940 struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
946 941
947 isci_remote_device_not_ready(ihost, idev, 942 isci_remote_device_not_ready(ihost, idev,
@@ -952,7 +947,8 @@ static void scic_sds_remote_device_ready_state_enter(void *object)
952{ 947{
953 struct scic_sds_remote_device *sci_dev = object; 948 struct scic_sds_remote_device *sci_dev = object;
954 struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; 949 struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller;
955 struct domain_device *dev = sci_dev_to_domain(sci_dev); 950 struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
951 struct domain_device *dev = idev->domain_dev;
956 952
957 scic->remote_device_sequence[sci_dev->rnc.remote_node_index]++; 953 scic->remote_device_sequence[sci_dev->rnc.remote_node_index]++;
958 954
@@ -963,7 +959,7 @@ static void scic_sds_remote_device_ready_state_enter(void *object)
963 sci_base_state_machine_change_state(&sci_dev->state_machine, 959 sci_base_state_machine_change_state(&sci_dev->state_machine,
964 SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); 960 SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
965 } else 961 } else
966 isci_remote_device_ready(scic->ihost, sci_dev_to_idev(sci_dev)); 962 isci_remote_device_ready(scic_to_ihost(scic), idev);
967} 963}
968 964
969static void scic_sds_remote_device_ready_state_exit(void *object) 965static void scic_sds_remote_device_ready_state_exit(void *object)
@@ -975,7 +971,7 @@ static void scic_sds_remote_device_ready_state_exit(void *object)
975 struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; 971 struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller;
976 struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); 972 struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
977 973
978 isci_remote_device_not_ready(scic->ihost, idev, 974 isci_remote_device_not_ready(scic_to_ihost(scic), idev,
979 SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED); 975 SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED);
980 } 976 }
981} 977}
@@ -1019,7 +1015,7 @@ static void scic_sds_stp_remote_device_ready_cmd_substate_enter(void *object)
1019 1015
1020 BUG_ON(sci_dev->working_request == NULL); 1016 BUG_ON(sci_dev->working_request == NULL);
1021 1017
1022 isci_remote_device_not_ready(scic->ihost, sci_dev_to_idev(sci_dev), 1018 isci_remote_device_not_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev),
1023 SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED); 1019 SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED);
1024} 1020}
1025 1021
@@ -1030,7 +1026,7 @@ static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(void *obje
1030 struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); 1026 struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
1031 1027
1032 if (sci_dev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED) 1028 if (sci_dev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED)
1033 isci_remote_device_not_ready(scic->ihost, idev, 1029 isci_remote_device_not_ready(scic_to_ihost(scic), idev,
1034 sci_dev->not_ready_reason); 1030 sci_dev->not_ready_reason);
1035} 1031}
1036 1032
@@ -1039,7 +1035,7 @@ static void scic_sds_smp_remote_device_ready_idle_substate_enter(void *object)
1039 struct scic_sds_remote_device *sci_dev = object; 1035 struct scic_sds_remote_device *sci_dev = object;
1040 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); 1036 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
1041 1037
1042 isci_remote_device_ready(scic->ihost, sci_dev_to_idev(sci_dev)); 1038 isci_remote_device_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev));
1043} 1039}
1044 1040
1045static void scic_sds_smp_remote_device_ready_cmd_substate_enter(void *object) 1041static void scic_sds_smp_remote_device_ready_cmd_substate_enter(void *object)
@@ -1049,7 +1045,7 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(void *object)
1049 1045
1050 BUG_ON(sci_dev->working_request == NULL); 1046 BUG_ON(sci_dev->working_request == NULL);
1051 1047
1052 isci_remote_device_not_ready(scic->ihost, sci_dev_to_idev(sci_dev), 1048 isci_remote_device_not_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev),
1053 SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED); 1049 SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED);
1054} 1050}
1055 1051
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index 36adc1589efa..0521c045d43b 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -201,7 +201,7 @@ static enum sci_status isci_io_request_build(
201 * we will let the core allocate the IO tag. 201 * we will let the core allocate the IO tag.
202 */ 202 */
203 status = scic_io_request_construct( 203 status = scic_io_request_construct(
204 isci_host->core_controller, 204 &isci_host->sci,
205 sci_device, 205 sci_device,
206 SCI_CONTROLLER_INVALID_IO_TAG, 206 SCI_CONTROLLER_INVALID_IO_TAG,
207 request, 207 request,
@@ -394,7 +394,7 @@ int isci_request_execute(
394 394
395 /* send the request, let the core assign the IO TAG. */ 395 /* send the request, let the core assign the IO TAG. */
396 status = scic_controller_start_io( 396 status = scic_controller_start_io(
397 isci_host->core_controller, 397 &isci_host->sci,
398 sci_device, 398 sci_device,
399 request->sci_request_handle, 399 request->sci_request_handle,
400 SCI_CONTROLLER_INVALID_IO_TAG 400 SCI_CONTROLLER_INVALID_IO_TAG
@@ -1186,7 +1186,7 @@ void isci_request_io_request_complete(
1186 ); 1186 );
1187 1187
1188 /* complete the io request to the core. */ 1188 /* complete the io request to the core. */
1189 scic_controller_complete_io(isci_host->core_controller, 1189 scic_controller_complete_io(&isci_host->sci,
1190 &isci_device->sci, 1190 &isci_device->sci,
1191 request->sci_request_handle); 1191 request->sci_request_handle);
1192 /* NULL the request handle so it cannot be completed or 1192 /* NULL the request handle so it cannot be completed or
diff --git a/drivers/scsi/isci/sci_environment.h b/drivers/scsi/isci/sci_environment.h
index 41636c34da9e..8394f60c5c2b 100644
--- a/drivers/scsi/isci/sci_environment.h
+++ b/drivers/scsi/isci/sci_environment.h
@@ -62,9 +62,7 @@
62 62
63static inline struct device *scic_to_dev(struct scic_sds_controller *scic) 63static inline struct device *scic_to_dev(struct scic_sds_controller *scic)
64{ 64{
65 struct isci_host *isci_host = scic->ihost; 65 return &scic_to_ihost(scic)->pdev->dev;
66
67 return &isci_host->pdev->dev;
68} 66}
69 67
70static inline struct device *sciphy_to_dev(struct scic_sds_phy *sci_phy) 68static inline struct device *sciphy_to_dev(struct scic_sds_phy *sci_phy)
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
index 3a3f54677e5b..cabad0b03ee5 100644
--- a/drivers/scsi/isci/task.c
+++ b/drivers/scsi/isci/task.c
@@ -299,7 +299,7 @@ static enum sci_status isci_task_request_build(
299 299
300 /* let the core do it's construct. */ 300 /* let the core do it's construct. */
301 status = scic_task_request_construct( 301 status = scic_task_request_construct(
302 isci_host->core_controller, 302 &isci_host->sci,
303 sci_device, 303 sci_device,
304 SCI_CONTROLLER_INVALID_IO_TAG, 304 SCI_CONTROLLER_INVALID_IO_TAG,
305 request, 305 request,
@@ -378,7 +378,7 @@ static void isci_tmf_timeout_cb(void *tmf_request_arg)
378 378
379 /* Terminate the TMF transmit request. */ 379 /* Terminate the TMF transmit request. */
380 status = scic_controller_terminate_request( 380 status = scic_controller_terminate_request(
381 request->isci_host->core_controller, 381 &request->isci_host->sci,
382 &request->isci_device->sci, 382 &request->isci_device->sci,
383 request->sci_request_handle 383 request->sci_request_handle
384 ); 384 );
@@ -469,7 +469,7 @@ int isci_task_execute_tmf(
469 469
470 /* start the TMF io. */ 470 /* start the TMF io. */
471 status = scic_controller_start_task( 471 status = scic_controller_start_task(
472 isci_host->core_controller, 472 &isci_host->sci,
473 sci_device, 473 sci_device,
474 request->sci_request_handle, 474 request->sci_request_handle,
475 SCI_CONTROLLER_INVALID_IO_TAG 475 SCI_CONTROLLER_INVALID_IO_TAG
@@ -772,7 +772,7 @@ static void isci_terminate_request_core(
772 was_terminated = true; 772 was_terminated = true;
773 needs_cleanup_handling = true; 773 needs_cleanup_handling = true;
774 status = scic_controller_terminate_request( 774 status = scic_controller_terminate_request(
775 isci_host->core_controller, 775 &isci_host->sci,
776 &isci_device->sci, 776 &isci_device->sci,
777 isci_request->sci_request_handle); 777 isci_request->sci_request_handle);
778 } 778 }
@@ -1466,12 +1466,9 @@ isci_task_request_complete(struct isci_host *ihost,
1466 /* PRINT_TMF( ((struct isci_tmf *)request->task)); */ 1466 /* PRINT_TMF( ((struct isci_tmf *)request->task)); */
1467 tmf_complete = tmf->complete; 1467 tmf_complete = tmf->complete;
1468 1468
1469 scic_controller_complete_io(ihost->core_controller, 1469 scic_controller_complete_io(&ihost->sci, &idev->sci,
1470 &idev->sci,
1471 ireq->sci_request_handle); 1470 ireq->sci_request_handle);
1472 1471 /* NULL the request handle to make sure it cannot be terminated
1473 /*
1474 * NULL the request handle to make sure it cannot be terminated
1475 * or completed again. 1472 * or completed again.
1476 */ 1473 */
1477 ireq->sci_request_handle = NULL; 1474 ireq->sci_request_handle = NULL;
diff --git a/drivers/scsi/isci/task.h b/drivers/scsi/isci/task.h
index aa2458658d1e..ecc5f1395063 100644
--- a/drivers/scsi/isci/task.h
+++ b/drivers/scsi/isci/task.h
@@ -52,14 +52,12 @@
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 */ 54 */
55 55#ifndef _ISCI_TASK_H_
56#if !defined(_ISCI_TASK_H_)
57#define _ISCI_TASK_H_ 56#define _ISCI_TASK_H_
58 57
59#include <scsi/sas_ata.h> 58#include <scsi/sas_ata.h>
60 59
61struct isci_request; 60struct isci_request;
62struct isci_host;
63 61
64/** 62/**
65 * enum isci_tmf_cb_state - This enum defines the possible states in which the 63 * enum isci_tmf_cb_state - This enum defines the possible states in which the