host.c (852809559e4680ba4768262a6c3d21454fcd460e) host.c (ffe191c92ff195d73f9130b1490045ca2dd4c5e0)
1/*
2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *

--- 1040 unchanged lines hidden (view full) ---

1049 /* Now initialize the completion queue */
1050 scic_sds_controller_initialize_completion_queue(scic);
1051
1052 /* Initialize the unsolicited frame queue for use */
1053 scic_sds_controller_initialize_unsolicited_frame_queue(scic);
1054
1055 /* Start all of the ports on this controller */
1056 for (index = 0; index < scic->logical_port_entries; index++) {
1/*
2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *

--- 1040 unchanged lines hidden (view full) ---

1049 /* Now initialize the completion queue */
1050 scic_sds_controller_initialize_completion_queue(scic);
1051
1052 /* Initialize the unsolicited frame queue for use */
1053 scic_sds_controller_initialize_unsolicited_frame_queue(scic);
1054
1055 /* Start all of the ports on this controller */
1056 for (index = 0; index < scic->logical_port_entries; index++) {
1057 struct scic_sds_port *sci_port = &ihost->ports[index].sci;
1057 struct isci_port *iport = &ihost->ports[index];
1058
1058
1059 result = scic_sds_port_start(sci_port);
1059 result = scic_sds_port_start(iport);
1060 if (result)
1061 return result;
1062 }
1063
1064 scic_sds_controller_start_next_phy(scic);
1065
1066 sci_mod_timer(&scic->timer, timeout);
1067

--- 233 unchanged lines hidden (view full) ---

1301 scic_controller_stop(&ihost->sci, SCIC_CONTROLLER_STOP_TIMEOUT);
1302 spin_unlock_irq(&ihost->scic_lock);
1303
1304 wait_for_stop(ihost);
1305 scic_controller_reset(&ihost->sci);
1306
1307 /* Cancel any/all outstanding port timers */
1308 for (i = 0; i < ihost->sci.logical_port_entries; i++) {
1060 if (result)
1061 return result;
1062 }
1063
1064 scic_sds_controller_start_next_phy(scic);
1065
1066 sci_mod_timer(&scic->timer, timeout);
1067

--- 233 unchanged lines hidden (view full) ---

1301 scic_controller_stop(&ihost->sci, SCIC_CONTROLLER_STOP_TIMEOUT);
1302 spin_unlock_irq(&ihost->scic_lock);
1303
1304 wait_for_stop(ihost);
1305 scic_controller_reset(&ihost->sci);
1306
1307 /* Cancel any/all outstanding port timers */
1308 for (i = 0; i < ihost->sci.logical_port_entries; i++) {
1309 struct scic_sds_port *sci_port = &ihost->ports[i].sci;
1310 del_timer_sync(&sci_port->timer.timer);
1309 struct isci_port *iport = &ihost->ports[i];
1310 del_timer_sync(&iport->timer.timer);
1311 }
1312
1313 /* Cancel any/all outstanding phy timers */
1314 for (i = 0; i < SCI_MAX_PHYS; i++) {
1315 struct isci_phy *iphy = &ihost->phys[i];
1316 del_timer_sync(&iphy->sata_timer.timer);
1317 }
1318

--- 228 unchanged lines hidden (view full) ---

1547static enum sci_status scic_sds_controller_stop_ports(struct scic_sds_controller *scic)
1548{
1549 u32 index;
1550 enum sci_status port_status;
1551 enum sci_status status = SCI_SUCCESS;
1552 struct isci_host *ihost = scic_to_ihost(scic);
1553
1554 for (index = 0; index < scic->logical_port_entries; index++) {
1311 }
1312
1313 /* Cancel any/all outstanding phy timers */
1314 for (i = 0; i < SCI_MAX_PHYS; i++) {
1315 struct isci_phy *iphy = &ihost->phys[i];
1316 del_timer_sync(&iphy->sata_timer.timer);
1317 }
1318

--- 228 unchanged lines hidden (view full) ---

1547static enum sci_status scic_sds_controller_stop_ports(struct scic_sds_controller *scic)
1548{
1549 u32 index;
1550 enum sci_status port_status;
1551 enum sci_status status = SCI_SUCCESS;
1552 struct isci_host *ihost = scic_to_ihost(scic);
1553
1554 for (index = 0; index < scic->logical_port_entries; index++) {
1555 struct scic_sds_port *sci_port = &ihost->ports[index].sci;
1555 struct isci_port *iport = &ihost->ports[index];
1556
1556
1557 port_status = scic_sds_port_stop(sci_port);
1557 port_status = scic_sds_port_stop(iport);
1558
1559 if ((port_status != SCI_SUCCESS) &&
1560 (port_status != SCI_FAILURE_INVALID_STATE)) {
1561 status = SCI_FAILURE;
1562
1563 dev_warn(scic_to_dev(scic),
1564 "%s: Controller stop operation failed to "
1565 "stop port %d because of status %d.\n",
1566 __func__,
1558
1559 if ((port_status != SCI_SUCCESS) &&
1560 (port_status != SCI_FAILURE_INVALID_STATE)) {
1561 status = SCI_FAILURE;
1562
1563 dev_warn(scic_to_dev(scic),
1564 "%s: Controller stop operation failed to "
1565 "stop port %d because of status %d.\n",
1566 __func__,
1567 sci_port->logical_port_index,
1567 iport->logical_port_index,
1568 port_status);
1569 }
1570 }
1571
1572 return status;
1573}
1574
1575static enum sci_status scic_sds_controller_stop_devices(struct scic_sds_controller *scic)

--- 199 unchanged lines hidden (view full) ---

1775
1776 scic->scu_registers = scu_base;
1777 scic->smu_registers = smu_base;
1778
1779 scic_sds_port_configuration_agent_construct(&scic->port_agent);
1780
1781 /* Construct the ports for this controller */
1782 for (i = 0; i < SCI_MAX_PORTS; i++)
1568 port_status);
1569 }
1570 }
1571
1572 return status;
1573}
1574
1575static enum sci_status scic_sds_controller_stop_devices(struct scic_sds_controller *scic)

--- 199 unchanged lines hidden (view full) ---

1775
1776 scic->scu_registers = scu_base;
1777 scic->smu_registers = smu_base;
1778
1779 scic_sds_port_configuration_agent_construct(&scic->port_agent);
1780
1781 /* Construct the ports for this controller */
1782 for (i = 0; i < SCI_MAX_PORTS; i++)
1783 scic_sds_port_construct(&ihost->ports[i].sci, i, scic);
1784 scic_sds_port_construct(&ihost->ports[i].sci, SCIC_SDS_DUMMY_PORT, scic);
1783 scic_sds_port_construct(&ihost->ports[i], i, scic);
1784 scic_sds_port_construct(&ihost->ports[i], SCIC_SDS_DUMMY_PORT, scic);
1785
1786 /* Construct the phys for this controller */
1787 for (i = 0; i < SCI_MAX_PHYS; i++) {
1788 /* Add all the PHYs to the dummy port */
1789 scic_sds_phy_construct(&ihost->phys[i],
1785
1786 /* Construct the phys for this controller */
1787 for (i = 0; i < SCI_MAX_PHYS; i++) {
1788 /* Add all the PHYs to the dummy port */
1789 scic_sds_phy_construct(&ihost->phys[i],
1790 &ihost->ports[SCI_MAX_PORTS].sci, i);
1790 &ihost->ports[SCI_MAX_PORTS], i);
1791 }
1792
1793 scic->invalid_phy_mask = 0;
1794
1795 sci_init_timer(&scic->timer, controller_timeout);
1796
1797 /* Initialize the User and OEM parameters to default values. */
1798 scic_sds_controller_set_default_config_parameters(scic);

--- 429 unchanged lines hidden (view full) ---

2228 result = scic_sds_phy_initialize(&ihost->phys[i],
2229 &scic->scu_registers->peg0.pe[i].tl,
2230 &scic->scu_registers->peg0.pe[i].ll);
2231 if (result != SCI_SUCCESS)
2232 goto out;
2233 }
2234
2235 for (i = 0; i < scic->logical_port_entries; i++) {
1791 }
1792
1793 scic->invalid_phy_mask = 0;
1794
1795 sci_init_timer(&scic->timer, controller_timeout);
1796
1797 /* Initialize the User and OEM parameters to default values. */
1798 scic_sds_controller_set_default_config_parameters(scic);

--- 429 unchanged lines hidden (view full) ---

2228 result = scic_sds_phy_initialize(&ihost->phys[i],
2229 &scic->scu_registers->peg0.pe[i].tl,
2230 &scic->scu_registers->peg0.pe[i].ll);
2231 if (result != SCI_SUCCESS)
2232 goto out;
2233 }
2234
2235 for (i = 0; i < scic->logical_port_entries; i++) {
2236 result = scic_sds_port_initialize(&ihost->ports[i].sci,
2236 result = scic_sds_port_initialize(&ihost->ports[i],
2237 &scic->scu_registers->peg0.ptsg.port[i],
2238 &scic->scu_registers->peg0.ptsg.protocol_engine,
2239 &scic->scu_registers->peg0.viit[i]);
2240
2241 if (result != SCI_SUCCESS)
2242 goto out;
2243 }
2244

--- 234 unchanged lines hidden (view full) ---

2479
2480 isci_host->reqs[i] = ireq;
2481 }
2482
2483 return 0;
2484}
2485
2486void scic_sds_controller_link_up(struct scic_sds_controller *scic,
2237 &scic->scu_registers->peg0.ptsg.port[i],
2238 &scic->scu_registers->peg0.ptsg.protocol_engine,
2239 &scic->scu_registers->peg0.viit[i]);
2240
2241 if (result != SCI_SUCCESS)
2242 goto out;
2243 }
2244

--- 234 unchanged lines hidden (view full) ---

2479
2480 isci_host->reqs[i] = ireq;
2481 }
2482
2483 return 0;
2484}
2485
2486void scic_sds_controller_link_up(struct scic_sds_controller *scic,
2487 struct scic_sds_port *port, struct isci_phy *iphy)
2487 struct isci_port *iport, struct isci_phy *iphy)
2488{
2489 switch (scic->sm.current_state_id) {
2490 case SCIC_STARTING:
2491 sci_del_timer(&scic->phy_timer);
2492 scic->phy_startup_timer_pending = false;
2493 scic->port_agent.link_up_handler(scic, &scic->port_agent,
2488{
2489 switch (scic->sm.current_state_id) {
2490 case SCIC_STARTING:
2491 sci_del_timer(&scic->phy_timer);
2492 scic->phy_startup_timer_pending = false;
2493 scic->port_agent.link_up_handler(scic, &scic->port_agent,
2494 port, iphy);
2494 iport, iphy);
2495 scic_sds_controller_start_next_phy(scic);
2496 break;
2497 case SCIC_READY:
2498 scic->port_agent.link_up_handler(scic, &scic->port_agent,
2495 scic_sds_controller_start_next_phy(scic);
2496 break;
2497 case SCIC_READY:
2498 scic->port_agent.link_up_handler(scic, &scic->port_agent,
2499 port, iphy);
2499 iport, iphy);
2500 break;
2501 default:
2502 dev_dbg(scic_to_dev(scic),
2503 "%s: SCIC Controller linkup event from phy %d in "
2504 "unexpected state %d\n", __func__, iphy->phy_index,
2505 scic->sm.current_state_id);
2506 }
2507}
2508
2509void scic_sds_controller_link_down(struct scic_sds_controller *scic,
2500 break;
2501 default:
2502 dev_dbg(scic_to_dev(scic),
2503 "%s: SCIC Controller linkup event from phy %d in "
2504 "unexpected state %d\n", __func__, iphy->phy_index,
2505 scic->sm.current_state_id);
2506 }
2507}
2508
2509void scic_sds_controller_link_down(struct scic_sds_controller *scic,
2510 struct scic_sds_port *port, struct isci_phy *iphy)
2510 struct isci_port *iport, struct isci_phy *iphy)
2511{
2512 switch (scic->sm.current_state_id) {
2513 case SCIC_STARTING:
2514 case SCIC_READY:
2515 scic->port_agent.link_down_handler(scic, &scic->port_agent,
2511{
2512 switch (scic->sm.current_state_id) {
2513 case SCIC_STARTING:
2514 case SCIC_READY:
2515 scic->port_agent.link_down_handler(scic, &scic->port_agent,
2516 port, iphy);
2516 iport, iphy);
2517 break;
2518 default:
2519 dev_dbg(scic_to_dev(scic),
2520 "%s: SCIC Controller linkdown event from phy %d in "
2521 "unexpected state %d\n",
2522 __func__,
2523 iphy->phy_index,
2524 scic->sm.current_state_id);

--- 437 unchanged lines hidden ---
2517 break;
2518 default:
2519 dev_dbg(scic_to_dev(scic),
2520 "%s: SCIC Controller linkdown event from phy %d in "
2521 "unexpected state %d\n",
2522 __func__,
2523 iphy->phy_index,
2524 scic->sm.current_state_id);

--- 437 unchanged lines hidden ---