diff options
Diffstat (limited to 'drivers/scsi/isci/host.c')
-rw-r--r-- | drivers/scsi/isci/host.c | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index d91cd6d82747..c5c2733a5197 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -311,7 +311,7 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc | |||
311 | 311 | ||
312 | struct isci_host *ihost = scic_to_ihost(scic); | 312 | struct isci_host *ihost = scic_to_ihost(scic); |
313 | struct scu_unsolicited_frame_header *frame_header; | 313 | struct scu_unsolicited_frame_header *frame_header; |
314 | struct scic_sds_phy *phy; | 314 | struct isci_phy *iphy; |
315 | struct scic_sds_remote_device *device; | 315 | struct scic_sds_remote_device *device; |
316 | 316 | ||
317 | enum sci_status result = SCI_FAILURE; | 317 | enum sci_status result = SCI_FAILURE; |
@@ -332,8 +332,8 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc | |||
332 | 332 | ||
333 | if (frame_header->is_address_frame) { | 333 | if (frame_header->is_address_frame) { |
334 | index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); | 334 | index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); |
335 | phy = &ihost->phys[index].sci; | 335 | iphy = &ihost->phys[index]; |
336 | result = scic_sds_phy_frame_handler(phy, frame_index); | 336 | result = scic_sds_phy_frame_handler(iphy, frame_index); |
337 | } else { | 337 | } else { |
338 | 338 | ||
339 | index = SCU_GET_COMPLETION_INDEX(completion_entry); | 339 | index = SCU_GET_COMPLETION_INDEX(completion_entry); |
@@ -344,8 +344,8 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc | |||
344 | * device that has not yet been created. In either case forwared | 344 | * device that has not yet been created. In either case forwared |
345 | * the frame to the PE and let it take care of the frame data. */ | 345 | * the frame to the PE and let it take care of the frame data. */ |
346 | index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); | 346 | index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); |
347 | phy = &ihost->phys[index].sci; | 347 | iphy = &ihost->phys[index]; |
348 | result = scic_sds_phy_frame_handler(phy, frame_index); | 348 | result = scic_sds_phy_frame_handler(iphy, frame_index); |
349 | } else { | 349 | } else { |
350 | if (index < scic->remote_node_entries) | 350 | if (index < scic->remote_node_entries) |
351 | device = scic->device_table[index]; | 351 | device = scic->device_table[index]; |
@@ -372,7 +372,7 @@ static void scic_sds_controller_event_completion(struct scic_sds_controller *sci | |||
372 | struct isci_host *ihost = scic_to_ihost(scic); | 372 | struct isci_host *ihost = scic_to_ihost(scic); |
373 | struct scic_sds_remote_device *device; | 373 | struct scic_sds_remote_device *device; |
374 | struct isci_request *ireq; | 374 | struct isci_request *ireq; |
375 | struct scic_sds_phy *phy; | 375 | struct isci_phy *iphy; |
376 | u32 index; | 376 | u32 index; |
377 | 377 | ||
378 | index = SCU_GET_COMPLETION_INDEX(completion_entry); | 378 | index = SCU_GET_COMPLETION_INDEX(completion_entry); |
@@ -452,8 +452,8 @@ static void scic_sds_controller_event_completion(struct scic_sds_controller *sci | |||
452 | * we get the event notification. This is a type 4 event. */ | 452 | * we get the event notification. This is a type 4 event. */ |
453 | case SCU_EVENT_TYPE_OSSP_EVENT: | 453 | case SCU_EVENT_TYPE_OSSP_EVENT: |
454 | index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); | 454 | index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); |
455 | phy = &ihost->phys[index].sci; | 455 | iphy = &ihost->phys[index]; |
456 | scic_sds_phy_event_handler(phy, completion_entry); | 456 | scic_sds_phy_event_handler(iphy, completion_entry); |
457 | break; | 457 | break; |
458 | 458 | ||
459 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: | 459 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: |
@@ -862,11 +862,11 @@ static void scic_sds_controller_transition_to_ready( | |||
862 | } | 862 | } |
863 | } | 863 | } |
864 | 864 | ||
865 | static bool is_phy_starting(struct scic_sds_phy *sci_phy) | 865 | static bool is_phy_starting(struct isci_phy *iphy) |
866 | { | 866 | { |
867 | enum scic_sds_phy_states state; | 867 | enum scic_sds_phy_states state; |
868 | 868 | ||
869 | state = sci_phy->sm.current_state_id; | 869 | state = iphy->sm.current_state_id; |
870 | switch (state) { | 870 | switch (state) { |
871 | case SCI_PHY_STARTING: | 871 | case SCI_PHY_STARTING: |
872 | case SCI_PHY_SUB_INITIAL: | 872 | case SCI_PHY_SUB_INITIAL: |
@@ -896,7 +896,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro | |||
896 | { | 896 | { |
897 | struct isci_host *ihost = scic_to_ihost(scic); | 897 | struct isci_host *ihost = scic_to_ihost(scic); |
898 | struct scic_sds_oem_params *oem = &scic->oem_parameters.sds1; | 898 | struct scic_sds_oem_params *oem = &scic->oem_parameters.sds1; |
899 | struct scic_sds_phy *sci_phy; | 899 | struct isci_phy *iphy; |
900 | enum sci_status status; | 900 | enum sci_status status; |
901 | 901 | ||
902 | status = SCI_SUCCESS; | 902 | status = SCI_SUCCESS; |
@@ -910,10 +910,10 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro | |||
910 | u8 index; | 910 | u8 index; |
911 | 911 | ||
912 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 912 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
913 | sci_phy = &ihost->phys[index].sci; | 913 | iphy = &ihost->phys[index]; |
914 | state = sci_phy->sm.current_state_id; | 914 | state = iphy->sm.current_state_id; |
915 | 915 | ||
916 | if (!phy_get_non_dummy_port(sci_phy)) | 916 | if (!phy_get_non_dummy_port(iphy)) |
917 | continue; | 917 | continue; |
918 | 918 | ||
919 | /* The controller start operation is complete iff: | 919 | /* The controller start operation is complete iff: |
@@ -922,9 +922,9 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro | |||
922 | * - have an indication of a connected device and it has | 922 | * - have an indication of a connected device and it has |
923 | * finished the link training process. | 923 | * finished the link training process. |
924 | */ | 924 | */ |
925 | if ((sci_phy->is_in_link_training == false && state == SCI_PHY_INITIAL) || | 925 | if ((iphy->is_in_link_training == false && state == SCI_PHY_INITIAL) || |
926 | (sci_phy->is_in_link_training == false && state == SCI_PHY_STOPPED) || | 926 | (iphy->is_in_link_training == false && state == SCI_PHY_STOPPED) || |
927 | (sci_phy->is_in_link_training == true && is_phy_starting(sci_phy))) { | 927 | (iphy->is_in_link_training == true && is_phy_starting(iphy))) { |
928 | is_controller_start_complete = false; | 928 | is_controller_start_complete = false; |
929 | break; | 929 | break; |
930 | } | 930 | } |
@@ -939,10 +939,10 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro | |||
939 | scic->phy_startup_timer_pending = false; | 939 | scic->phy_startup_timer_pending = false; |
940 | } | 940 | } |
941 | } else { | 941 | } else { |
942 | sci_phy = &ihost->phys[scic->next_phy_to_start].sci; | 942 | iphy = &ihost->phys[scic->next_phy_to_start]; |
943 | 943 | ||
944 | if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { | 944 | if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { |
945 | if (phy_get_non_dummy_port(sci_phy) == NULL) { | 945 | if (phy_get_non_dummy_port(iphy) == NULL) { |
946 | scic->next_phy_to_start++; | 946 | scic->next_phy_to_start++; |
947 | 947 | ||
948 | /* Caution recursion ahead be forwarned | 948 | /* Caution recursion ahead be forwarned |
@@ -958,7 +958,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro | |||
958 | } | 958 | } |
959 | } | 959 | } |
960 | 960 | ||
961 | status = scic_sds_phy_start(sci_phy); | 961 | status = scic_sds_phy_start(iphy); |
962 | 962 | ||
963 | if (status == SCI_SUCCESS) { | 963 | if (status == SCI_SUCCESS) { |
964 | sci_mod_timer(&scic->phy_timer, | 964 | sci_mod_timer(&scic->phy_timer, |
@@ -970,7 +970,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro | |||
970 | "to stop phy %d because of status " | 970 | "to stop phy %d because of status " |
971 | "%d.\n", | 971 | "%d.\n", |
972 | __func__, | 972 | __func__, |
973 | ihost->phys[scic->next_phy_to_start].sci.phy_index, | 973 | ihost->phys[scic->next_phy_to_start].phy_index, |
974 | status); | 974 | status); |
975 | } | 975 | } |
976 | 976 | ||
@@ -1312,8 +1312,8 @@ void isci_host_deinit(struct isci_host *ihost) | |||
1312 | 1312 | ||
1313 | /* Cancel any/all outstanding phy timers */ | 1313 | /* Cancel any/all outstanding phy timers */ |
1314 | for (i = 0; i < SCI_MAX_PHYS; i++) { | 1314 | for (i = 0; i < SCI_MAX_PHYS; i++) { |
1315 | struct scic_sds_phy *sci_phy = &ihost->phys[i].sci; | 1315 | struct isci_phy *iphy = &ihost->phys[i]; |
1316 | del_timer_sync(&sci_phy->sata_timer.timer); | 1316 | del_timer_sync(&iphy->sata_timer.timer); |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | del_timer_sync(&ihost->sci.port_agent.timer.timer); | 1319 | del_timer_sync(&ihost->sci.port_agent.timer.timer); |
@@ -1527,7 +1527,7 @@ static enum sci_status scic_sds_controller_stop_phys(struct scic_sds_controller | |||
1527 | status = SCI_SUCCESS; | 1527 | status = SCI_SUCCESS; |
1528 | 1528 | ||
1529 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 1529 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
1530 | phy_status = scic_sds_phy_stop(&ihost->phys[index].sci); | 1530 | phy_status = scic_sds_phy_stop(&ihost->phys[index]); |
1531 | 1531 | ||
1532 | if (phy_status != SCI_SUCCESS && | 1532 | if (phy_status != SCI_SUCCESS && |
1533 | phy_status != SCI_FAILURE_INVALID_STATE) { | 1533 | phy_status != SCI_FAILURE_INVALID_STATE) { |
@@ -1537,7 +1537,7 @@ static enum sci_status scic_sds_controller_stop_phys(struct scic_sds_controller | |||
1537 | "%s: Controller stop operation failed to stop " | 1537 | "%s: Controller stop operation failed to stop " |
1538 | "phy %d because of status %d.\n", | 1538 | "phy %d because of status %d.\n", |
1539 | __func__, | 1539 | __func__, |
1540 | ihost->phys[index].sci.phy_index, phy_status); | 1540 | ihost->phys[index].phy_index, phy_status); |
1541 | } | 1541 | } |
1542 | } | 1542 | } |
1543 | 1543 | ||
@@ -1786,7 +1786,7 @@ static enum sci_status scic_controller_construct(struct scic_sds_controller *sci | |||
1786 | /* Construct the phys for this controller */ | 1786 | /* Construct the phys for this controller */ |
1787 | for (i = 0; i < SCI_MAX_PHYS; i++) { | 1787 | for (i = 0; i < SCI_MAX_PHYS; i++) { |
1788 | /* Add all the PHYs to the dummy port */ | 1788 | /* Add all the PHYs to the dummy port */ |
1789 | scic_sds_phy_construct(&ihost->phys[i].sci, | 1789 | scic_sds_phy_construct(&ihost->phys[i], |
1790 | &ihost->ports[SCI_MAX_PORTS].sci, i); | 1790 | &ihost->ports[SCI_MAX_PORTS].sci, i); |
1791 | } | 1791 | } |
1792 | 1792 | ||
@@ -1865,7 +1865,7 @@ static void power_control_timeout(unsigned long data) | |||
1865 | struct sci_timer *tmr = (struct sci_timer *)data; | 1865 | struct sci_timer *tmr = (struct sci_timer *)data; |
1866 | struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), power_control.timer); | 1866 | struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), power_control.timer); |
1867 | struct isci_host *ihost = scic_to_ihost(scic); | 1867 | struct isci_host *ihost = scic_to_ihost(scic); |
1868 | struct scic_sds_phy *sci_phy; | 1868 | struct isci_phy *iphy; |
1869 | unsigned long flags; | 1869 | unsigned long flags; |
1870 | u8 i; | 1870 | u8 i; |
1871 | 1871 | ||
@@ -1886,8 +1886,8 @@ static void power_control_timeout(unsigned long data) | |||
1886 | if (scic->power_control.phys_waiting == 0) | 1886 | if (scic->power_control.phys_waiting == 0) |
1887 | break; | 1887 | break; |
1888 | 1888 | ||
1889 | sci_phy = scic->power_control.requesters[i]; | 1889 | iphy = scic->power_control.requesters[i]; |
1890 | if (sci_phy == NULL) | 1890 | if (iphy == NULL) |
1891 | continue; | 1891 | continue; |
1892 | 1892 | ||
1893 | if (scic->power_control.phys_granted_power >= | 1893 | if (scic->power_control.phys_granted_power >= |
@@ -1897,7 +1897,7 @@ static void power_control_timeout(unsigned long data) | |||
1897 | scic->power_control.requesters[i] = NULL; | 1897 | scic->power_control.requesters[i] = NULL; |
1898 | scic->power_control.phys_waiting--; | 1898 | scic->power_control.phys_waiting--; |
1899 | scic->power_control.phys_granted_power++; | 1899 | scic->power_control.phys_granted_power++; |
1900 | scic_sds_phy_consume_power_handler(sci_phy); | 1900 | scic_sds_phy_consume_power_handler(iphy); |
1901 | } | 1901 | } |
1902 | 1902 | ||
1903 | /* | 1903 | /* |
@@ -1919,14 +1919,14 @@ done: | |||
1919 | */ | 1919 | */ |
1920 | void scic_sds_controller_power_control_queue_insert( | 1920 | void scic_sds_controller_power_control_queue_insert( |
1921 | struct scic_sds_controller *scic, | 1921 | struct scic_sds_controller *scic, |
1922 | struct scic_sds_phy *sci_phy) | 1922 | struct isci_phy *iphy) |
1923 | { | 1923 | { |
1924 | BUG_ON(sci_phy == NULL); | 1924 | BUG_ON(iphy == NULL); |
1925 | 1925 | ||
1926 | if (scic->power_control.phys_granted_power < | 1926 | if (scic->power_control.phys_granted_power < |
1927 | scic->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) { | 1927 | scic->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) { |
1928 | scic->power_control.phys_granted_power++; | 1928 | scic->power_control.phys_granted_power++; |
1929 | scic_sds_phy_consume_power_handler(sci_phy); | 1929 | scic_sds_phy_consume_power_handler(iphy); |
1930 | 1930 | ||
1931 | /* | 1931 | /* |
1932 | * stop and start the power_control timer. When the timer fires, the | 1932 | * stop and start the power_control timer. When the timer fires, the |
@@ -1941,7 +1941,7 @@ void scic_sds_controller_power_control_queue_insert( | |||
1941 | 1941 | ||
1942 | } else { | 1942 | } else { |
1943 | /* Add the phy in the waiting list */ | 1943 | /* Add the phy in the waiting list */ |
1944 | scic->power_control.requesters[sci_phy->phy_index] = sci_phy; | 1944 | scic->power_control.requesters[iphy->phy_index] = iphy; |
1945 | scic->power_control.phys_waiting++; | 1945 | scic->power_control.phys_waiting++; |
1946 | } | 1946 | } |
1947 | } | 1947 | } |
@@ -1954,15 +1954,15 @@ void scic_sds_controller_power_control_queue_insert( | |||
1954 | */ | 1954 | */ |
1955 | void scic_sds_controller_power_control_queue_remove( | 1955 | void scic_sds_controller_power_control_queue_remove( |
1956 | struct scic_sds_controller *scic, | 1956 | struct scic_sds_controller *scic, |
1957 | struct scic_sds_phy *sci_phy) | 1957 | struct isci_phy *iphy) |
1958 | { | 1958 | { |
1959 | BUG_ON(sci_phy == NULL); | 1959 | BUG_ON(iphy == NULL); |
1960 | 1960 | ||
1961 | if (scic->power_control.requesters[sci_phy->phy_index] != NULL) { | 1961 | if (scic->power_control.requesters[iphy->phy_index] != NULL) { |
1962 | scic->power_control.phys_waiting--; | 1962 | scic->power_control.phys_waiting--; |
1963 | } | 1963 | } |
1964 | 1964 | ||
1965 | scic->power_control.requesters[sci_phy->phy_index] = NULL; | 1965 | scic->power_control.requesters[iphy->phy_index] = NULL; |
1966 | } | 1966 | } |
1967 | 1967 | ||
1968 | #define AFE_REGISTER_WRITE_DELAY 10 | 1968 | #define AFE_REGISTER_WRITE_DELAY 10 |
@@ -2225,7 +2225,7 @@ static enum sci_status scic_controller_initialize(struct scic_sds_controller *sc | |||
2225 | * are accessed during the port initialization. | 2225 | * are accessed during the port initialization. |
2226 | */ | 2226 | */ |
2227 | for (i = 0; i < SCI_MAX_PHYS; i++) { | 2227 | for (i = 0; i < SCI_MAX_PHYS; i++) { |
2228 | result = scic_sds_phy_initialize(&ihost->phys[i].sci, | 2228 | result = scic_sds_phy_initialize(&ihost->phys[i], |
2229 | &scic->scu_registers->peg0.pe[i].tl, | 2229 | &scic->scu_registers->peg0.pe[i].tl, |
2230 | &scic->scu_registers->peg0.pe[i].ll); | 2230 | &scic->scu_registers->peg0.pe[i].ll); |
2231 | if (result != SCI_SUCCESS) | 2231 | if (result != SCI_SUCCESS) |
@@ -2484,43 +2484,43 @@ int isci_host_init(struct isci_host *isci_host) | |||
2484 | } | 2484 | } |
2485 | 2485 | ||
2486 | void scic_sds_controller_link_up(struct scic_sds_controller *scic, | 2486 | void scic_sds_controller_link_up(struct scic_sds_controller *scic, |
2487 | struct scic_sds_port *port, struct scic_sds_phy *phy) | 2487 | struct scic_sds_port *port, struct isci_phy *iphy) |
2488 | { | 2488 | { |
2489 | switch (scic->sm.current_state_id) { | 2489 | switch (scic->sm.current_state_id) { |
2490 | case SCIC_STARTING: | 2490 | case SCIC_STARTING: |
2491 | sci_del_timer(&scic->phy_timer); | 2491 | sci_del_timer(&scic->phy_timer); |
2492 | scic->phy_startup_timer_pending = false; | 2492 | scic->phy_startup_timer_pending = false; |
2493 | scic->port_agent.link_up_handler(scic, &scic->port_agent, | 2493 | scic->port_agent.link_up_handler(scic, &scic->port_agent, |
2494 | port, phy); | 2494 | port, iphy); |
2495 | scic_sds_controller_start_next_phy(scic); | 2495 | scic_sds_controller_start_next_phy(scic); |
2496 | break; | 2496 | break; |
2497 | case SCIC_READY: | 2497 | case SCIC_READY: |
2498 | scic->port_agent.link_up_handler(scic, &scic->port_agent, | 2498 | scic->port_agent.link_up_handler(scic, &scic->port_agent, |
2499 | port, phy); | 2499 | port, iphy); |
2500 | break; | 2500 | break; |
2501 | default: | 2501 | default: |
2502 | dev_dbg(scic_to_dev(scic), | 2502 | dev_dbg(scic_to_dev(scic), |
2503 | "%s: SCIC Controller linkup event from phy %d in " | 2503 | "%s: SCIC Controller linkup event from phy %d in " |
2504 | "unexpected state %d\n", __func__, phy->phy_index, | 2504 | "unexpected state %d\n", __func__, iphy->phy_index, |
2505 | scic->sm.current_state_id); | 2505 | scic->sm.current_state_id); |
2506 | } | 2506 | } |
2507 | } | 2507 | } |
2508 | 2508 | ||
2509 | void scic_sds_controller_link_down(struct scic_sds_controller *scic, | 2509 | void scic_sds_controller_link_down(struct scic_sds_controller *scic, |
2510 | struct scic_sds_port *port, struct scic_sds_phy *phy) | 2510 | struct scic_sds_port *port, struct isci_phy *iphy) |
2511 | { | 2511 | { |
2512 | switch (scic->sm.current_state_id) { | 2512 | switch (scic->sm.current_state_id) { |
2513 | case SCIC_STARTING: | 2513 | case SCIC_STARTING: |
2514 | case SCIC_READY: | 2514 | case SCIC_READY: |
2515 | scic->port_agent.link_down_handler(scic, &scic->port_agent, | 2515 | scic->port_agent.link_down_handler(scic, &scic->port_agent, |
2516 | port, phy); | 2516 | port, iphy); |
2517 | break; | 2517 | break; |
2518 | default: | 2518 | default: |
2519 | dev_dbg(scic_to_dev(scic), | 2519 | dev_dbg(scic_to_dev(scic), |
2520 | "%s: SCIC Controller linkdown event from phy %d in " | 2520 | "%s: SCIC Controller linkdown event from phy %d in " |
2521 | "unexpected state %d\n", | 2521 | "unexpected state %d\n", |
2522 | __func__, | 2522 | __func__, |
2523 | phy->phy_index, | 2523 | iphy->phy_index, |
2524 | scic->sm.current_state_id); | 2524 | scic->sm.current_state_id); |
2525 | } | 2525 | } |
2526 | } | 2526 | } |