Lines Matching +full:xcvr +full:- +full:setup
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
100 * NORMALIZE_PUT_POINTER() -
110 * NORMALIZE_EVENT_POINTER() -
122 * NORMALIZE_GET_POINTER() -
131 * NORMALIZE_GET_POINTER_CYCLE_BIT() -
137 ((SMU_CQGR_CYCLE_BIT & (x)) << (31 - SMU_COMPLETION_QUEUE_GET_CYCLE_BIT_SHIFT))
140 * COMPLETION_QUEUE_CYCLE_BIT() -
152 sm->initial_state_id = initial_state; in sci_init_sm()
153 sm->previous_state_id = initial_state; in sci_init_sm()
154 sm->current_state_id = initial_state; in sci_init_sm()
155 sm->state_table = state_table; in sci_init_sm()
157 handler = sm->state_table[initial_state].enter_state; in sci_init_sm()
167 handler = sm->state_table[sm->current_state_id].exit_state; in sci_change_state()
171 sm->previous_state_id = sm->current_state_id; in sci_change_state()
172 sm->current_state_id = next_state; in sci_change_state()
174 handler = sm->state_table[sm->current_state_id].enter_state; in sci_change_state()
181 u32 get_value = ihost->completion_queue_get; in sci_controller_completion_queue_has_entries()
185 COMPLETION_QUEUE_CYCLE_BIT(ihost->completion_queue[get_index])) in sci_controller_completion_queue_has_entries()
200 writel(SMU_ISR_COMPLETION, &ihost->smu_registers->interrupt_status); in sci_controller_isr()
208 spin_lock(&ihost->scic_lock); in sci_controller_isr()
209 if (test_bit(IHOST_IRQ_ENABLED, &ihost->flags)) { in sci_controller_isr()
210 writel(0xFF000000, &ihost->smu_registers->interrupt_mask); in sci_controller_isr()
211 writel(0, &ihost->smu_registers->interrupt_mask); in sci_controller_isr()
213 spin_unlock(&ihost->scic_lock); in sci_controller_isr()
223 tasklet_schedule(&ihost->completion_tasklet); in isci_msix_isr()
233 readl(&ihost->smu_registers->interrupt_status); in sci_controller_error_isr()
249 writel(0xff, &ihost->smu_registers->interrupt_mask); in sci_controller_error_isr()
250 writel(0, &ihost->smu_registers->interrupt_mask); in sci_controller_error_isr()
258 struct isci_request *ireq = ihost->reqs[index]; in sci_controller_task_completion()
261 if (test_bit(IREQ_ACTIVE, &ireq->flags) && in sci_controller_task_completion()
262 ireq->io_tag != SCI_CONTROLLER_INVALID_IO_TAG && in sci_controller_task_completion()
263 ISCI_TAG_SEQ(ireq->io_tag) == ihost->io_request_sequence[index]) in sci_controller_task_completion()
281 ireq = ihost->reqs[index]; in sci_controller_sdma_completion()
282 dev_warn(&ihost->pdev->dev, "%s: %x for io request %p\n", in sci_controller_sdma_completion()
291 idev = ihost->device_table[index]; in sci_controller_sdma_completion()
292 dev_warn(&ihost->pdev->dev, "%s: %x for device %p\n", in sci_controller_sdma_completion()
299 dev_warn(&ihost->pdev->dev, "%s: unknown completion type %x\n", in sci_controller_sdma_completion()
318 frame_header = ihost->uf_control.buffers.array[frame_index].header; in sci_controller_unsolicited_frame()
319 ihost->uf_control.buffers.array[frame_index].state = UNSOLICITED_FRAME_IN_USE; in sci_controller_unsolicited_frame()
330 if (frame_header->is_address_frame) { in sci_controller_unsolicited_frame()
332 iphy = &ihost->phys[index]; in sci_controller_unsolicited_frame()
344 iphy = &ihost->phys[index]; in sci_controller_unsolicited_frame()
347 if (index < ihost->remote_node_entries) in sci_controller_unsolicited_frame()
348 idev = ihost->device_table[index]; in sci_controller_unsolicited_frame()
378 dev_err(&ihost->pdev->dev, in sci_controller_event_completion()
392 dev_err(&ihost->pdev->dev, in sci_controller_event_completion()
401 ireq = ihost->reqs[index]; in sci_controller_event_completion()
409 ireq = ihost->reqs[index]; in sci_controller_event_completion()
413 dev_warn(&ihost->pdev->dev, in sci_controller_event_completion()
424 idev = ihost->device_table[index]; in sci_controller_event_completion()
428 dev_warn(&ihost->pdev->dev, in sci_controller_event_completion()
450 iphy = &ihost->phys[index]; in sci_controller_event_completion()
457 if (index < ihost->remote_node_entries) { in sci_controller_event_completion()
458 idev = ihost->device_table[index]; in sci_controller_event_completion()
463 dev_err(&ihost->pdev->dev, in sci_controller_event_completion()
475 dev_warn(&ihost->pdev->dev, in sci_controller_event_completion()
492 dev_dbg(&ihost->pdev->dev, in sci_controller_process_completions()
495 ihost->completion_queue_get); in sci_controller_process_completions()
498 get_index = NORMALIZE_GET_POINTER(ihost->completion_queue_get); in sci_controller_process_completions()
499 get_cycle = SMU_CQGR_CYCLE_BIT & ihost->completion_queue_get; in sci_controller_process_completions()
501 event_get = NORMALIZE_EVENT_POINTER(ihost->completion_queue_get); in sci_controller_process_completions()
502 event_cycle = SMU_CQGR_EVENT_CYCLE_BIT & ihost->completion_queue_get; in sci_controller_process_completions()
506 == COMPLETION_QUEUE_CYCLE_BIT(ihost->completion_queue[get_index]) in sci_controller_process_completions()
510 ent = ihost->completion_queue[get_index]; in sci_controller_process_completions()
514 (SMU_COMPLETION_QUEUE_GET_CYCLE_BIT_SHIFT - SCU_MAX_COMPLETION_QUEUE_SHIFT); in sci_controller_process_completions()
515 get_index = (get_index+1) & (SCU_MAX_COMPLETION_QUEUE_ENTRIES-1); in sci_controller_process_completions()
517 dev_dbg(&ihost->pdev->dev, in sci_controller_process_completions()
541 (SMU_COMPLETION_QUEUE_GET_EVENT_CYCLE_BIT_SHIFT - SCU_MAX_EVENTS_SHIFT); in sci_controller_process_completions()
542 event_get = (event_get+1) & (SCU_MAX_EVENTS-1); in sci_controller_process_completions()
548 dev_warn(&ihost->pdev->dev, in sci_controller_process_completions()
559 ihost->completion_queue_get = in sci_controller_process_completions()
567 writel(ihost->completion_queue_get, in sci_controller_process_completions()
568 &ihost->smu_registers->completion_queue_get); in sci_controller_process_completions()
572 dev_dbg(&ihost->pdev->dev, in sci_controller_process_completions()
575 ihost->completion_queue_get); in sci_controller_process_completions()
584 readl(&ihost->smu_registers->interrupt_status); in sci_controller_error_handler()
590 writel(SMU_ISR_QUEUE_SUSPEND, &ihost->smu_registers->interrupt_status); in sci_controller_error_handler()
592 dev_err(&ihost->pdev->dev, "%s: status: %#x\n", __func__, in sci_controller_error_handler()
595 sci_change_state(&ihost->sm, SCIC_FAILED); in sci_controller_error_handler()
603 writel(0, &ihost->smu_registers->interrupt_mask); in sci_controller_error_handler()
612 writel(SMU_ISR_COMPLETION, &ihost->smu_registers->interrupt_status); in isci_intx_isr()
613 tasklet_schedule(&ihost->completion_tasklet); in isci_intx_isr()
616 spin_lock(&ihost->scic_lock); in isci_intx_isr()
618 spin_unlock(&ihost->scic_lock); in isci_intx_isr()
636 * isci_host_start_complete() - This function is called by the core library,
646 dev_info(&ihost->pdev->dev, in isci_host_start_complete()
648 clear_bit(IHOST_START_PENDING, &ihost->flags); in isci_host_start_complete()
649 wake_up(&ihost->eventq); in isci_host_start_complete()
655 struct isci_host *ihost = ha->lldd_ha; in isci_host_scan_finished()
657 if (test_bit(IHOST_START_PENDING, &ihost->flags)) in isci_host_scan_finished()
666 * sci_controller_get_suggested_start_timeout() - This method returns the
689 * --------------------------------- in sci_controller_get_suggested_start_timeout()
694 * per interval - 1 (once OEM parameters are supported). in sci_controller_get_suggested_start_timeout()
699 + ((SCI_MAX_PHYS - 1) * SCIC_SDS_CONTROLLER_POWER_CONTROL_INTERVAL); in sci_controller_get_suggested_start_timeout()
704 set_bit(IHOST_IRQ_ENABLED, &ihost->flags); in sci_controller_enable_interrupts()
705 writel(0, &ihost->smu_registers->interrupt_mask); in sci_controller_enable_interrupts()
710 clear_bit(IHOST_IRQ_ENABLED, &ihost->flags); in sci_controller_disable_interrupts()
711 writel(0xffffffff, &ihost->smu_registers->interrupt_mask); in sci_controller_disable_interrupts()
712 readl(&ihost->smu_registers->interrupt_mask); /* flush */ in sci_controller_disable_interrupts()
720 readl(&ihost->scu_registers->peg0.ptsg.control); in sci_controller_enable_port_task_scheduler()
725 &ihost->scu_registers->peg0.ptsg.control); in sci_controller_enable_port_task_scheduler()
738 readl(&ihost->smu_registers->task_context_assignment[0]); in sci_controller_assign_task_entries()
741 (SMU_TCA_GEN_VAL(ENDING, ihost->task_context_entries - 1)) | in sci_controller_assign_task_entries()
745 &ihost->smu_registers->task_context_assignment[0]); in sci_controller_assign_task_entries()
756 ihost->completion_queue_get = 0; in sci_controller_initialize_completion_queue()
759 (SMU_CQC_QUEUE_LIMIT_SET(SCU_MAX_COMPLETION_QUEUE_ENTRIES - 1) | in sci_controller_initialize_completion_queue()
760 SMU_CQC_EVENT_LIMIT_SET(SCU_MAX_EVENTS - 1)); in sci_controller_initialize_completion_queue()
763 &ihost->smu_registers->completion_queue_control); in sci_controller_initialize_completion_queue()
775 &ihost->smu_registers->completion_queue_get); in sci_controller_initialize_completion_queue()
784 &ihost->smu_registers->completion_queue_put); in sci_controller_initialize_completion_queue()
792 ihost->completion_queue[index] = 0x80000000; in sci_controller_initialize_completion_queue()
807 &ihost->scu_registers->sdma.unsolicited_frame_queue_control); in sci_controller_initialize_unsolicited_frame_queue()
809 /* Setup the get pointer for the unsolicited frame queue */ in sci_controller_initialize_unsolicited_frame_queue()
816 &ihost->scu_registers->sdma.unsolicited_frame_get_pointer); in sci_controller_initialize_unsolicited_frame_queue()
817 /* Setup the put pointer for the unsolicited frame queue */ in sci_controller_initialize_unsolicited_frame_queue()
820 &ihost->scu_registers->sdma.unsolicited_frame_put_pointer); in sci_controller_initialize_unsolicited_frame_queue()
825 if (ihost->sm.current_state_id == SCIC_STARTING) { in sci_controller_transition_to_ready()
830 sci_change_state(&ihost->sm, SCIC_READY); in sci_controller_transition_to_ready()
840 state = iphy->sm.current_state_id; in is_phy_starting()
864 struct isci_phy *iphy = &ihost->phys[i]; in is_controller_start_complete()
865 u32 state = iphy->sm.current_state_id; in is_controller_start_complete()
877 * - all links have been given an opportunity to start in is_controller_start_complete()
878 * - have no indication of a connected device in is_controller_start_complete()
879 * - have an indication of a connected device and it has in is_controller_start_complete()
882 if ((iphy->is_in_link_training == false && state == SCI_PHY_INITIAL) || in is_controller_start_complete()
883 (iphy->is_in_link_training == false && state == SCI_PHY_STOPPED) || in is_controller_start_complete()
884 (iphy->is_in_link_training == true && is_phy_starting(iphy)) || in is_controller_start_complete()
885 (ihost->port_agent.phy_ready_mask != ihost->port_agent.phy_configured_mask)) in is_controller_start_complete()
893 * sci_controller_start_next_phy - start phy
902 struct sci_oem_params *oem = &ihost->oem_parameters; in sci_controller_start_next_phy()
908 if (ihost->phy_startup_timer_pending) in sci_controller_start_next_phy()
911 if (ihost->next_phy_to_start >= SCI_MAX_PHYS) { in sci_controller_start_next_phy()
914 sci_del_timer(&ihost->phy_timer); in sci_controller_start_next_phy()
915 ihost->phy_startup_timer_pending = false; in sci_controller_start_next_phy()
918 iphy = &ihost->phys[ihost->next_phy_to_start]; in sci_controller_start_next_phy()
920 if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { in sci_controller_start_next_phy()
922 ihost->next_phy_to_start++; in sci_controller_start_next_phy()
940 sci_mod_timer(&ihost->phy_timer, in sci_controller_start_next_phy()
942 ihost->phy_startup_timer_pending = true; in sci_controller_start_next_phy()
944 dev_warn(&ihost->pdev->dev, in sci_controller_start_next_phy()
949 ihost->phys[ihost->next_phy_to_start].phy_index, in sci_controller_start_next_phy()
953 ihost->next_phy_to_start++; in sci_controller_start_next_phy()
966 spin_lock_irqsave(&ihost->scic_lock, flags); in phy_startup_timeout()
968 if (tmr->cancel) in phy_startup_timeout()
971 ihost->phy_startup_timer_pending = false; in phy_startup_timeout()
978 spin_unlock_irqrestore(&ihost->scic_lock, flags); in phy_startup_timeout()
983 return CIRC_CNT(ihost->tci_head, ihost->tci_tail, SCI_MAX_IO_REQUESTS); in isci_tci_active()
992 if (ihost->sm.current_state_id != SCIC_INITIALIZED) { in sci_controller_start()
993 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n", in sci_controller_start()
994 __func__, ihost->sm.current_state_id); in sci_controller_start()
999 BUILD_BUG_ON(SCI_MAX_IO_REQUESTS > 1 << sizeof(ihost->tci_pool[0]) * 8); in sci_controller_start()
1000 ihost->tci_head = 0; in sci_controller_start()
1001 ihost->tci_tail = 0; in sci_controller_start()
1002 for (index = 0; index < ihost->task_context_entries; index++) in sci_controller_start()
1006 sci_remote_node_table_initialize(&ihost->available_remote_nodes, in sci_controller_start()
1007 ihost->remote_node_entries); in sci_controller_start()
1028 for (index = 0; index < ihost->logical_port_entries; index++) { in sci_controller_start()
1029 struct isci_port *iport = &ihost->ports[index]; in sci_controller_start()
1038 sci_mod_timer(&ihost->timer, timeout); in sci_controller_start()
1040 sci_change_state(&ihost->sm, SCIC_STARTING); in sci_controller_start()
1047 struct isci_host *ihost = SHOST_TO_SAS_HA(shost)->lldd_ha; in isci_host_start()
1050 set_bit(IHOST_START_PENDING, &ihost->flags); in isci_host_start()
1052 spin_lock_irq(&ihost->scic_lock); in isci_host_start()
1055 spin_unlock_irq(&ihost->scic_lock); in isci_host_start()
1061 clear_bit(IHOST_STOP_PENDING, &ihost->flags); in isci_host_stop_complete()
1062 wake_up(&ihost->eventq); in isci_host_stop_complete()
1072 writel(SMU_ISR_COMPLETION, &ihost->smu_registers->interrupt_status); in sci_controller_completion_handler()
1074 writel(0xFF000000, &ihost->smu_registers->interrupt_mask); in sci_controller_completion_handler()
1075 writel(0, &ihost->smu_registers->interrupt_mask); in sci_controller_completion_handler()
1080 if (!test_bit(IREQ_ABORT_PATH_ACTIVE, &ireq->flags) && in ireq_done()
1081 !(task->task_state_flags & SAS_TASK_STATE_ABORTED)) { in ireq_done()
1082 if (test_bit(IREQ_COMPLETE_IN_TARGET, &ireq->flags)) { in ireq_done()
1084 dev_dbg(&ihost->pdev->dev, in ireq_done()
1085 "%s: Normal - ireq/task = %p/%p\n", in ireq_done()
1087 task->lldd_task = NULL; in ireq_done()
1088 task->task_done(task); in ireq_done()
1090 dev_dbg(&ihost->pdev->dev, in ireq_done()
1091 "%s: Error - ireq/task = %p/%p\n", in ireq_done()
1093 if (sas_protocol_ata(task->task_proto)) in ireq_done()
1094 task->lldd_task = NULL; in ireq_done()
1098 task->lldd_task = NULL; in ireq_done()
1100 if (test_and_clear_bit(IREQ_ABORT_PATH_ACTIVE, &ireq->flags)) in ireq_done()
1101 wake_up_all(&ihost->eventq); in ireq_done()
1103 if (!test_bit(IREQ_NO_AUTO_FREE_TAG, &ireq->flags)) in ireq_done()
1104 isci_free_tag(ihost, ireq->io_tag); in ireq_done()
1107 * isci_host_completion_routine() - This function is the delayed service
1119 spin_lock_irq(&ihost->scic_lock); in isci_host_completion_routine()
1121 spin_unlock_irq(&ihost->scic_lock); in isci_host_completion_routine()
1127 active = isci_tci_active(ihost) - SCI_MAX_PORTS; in isci_host_completion_routine()
1135 &ihost->smu_registers->interrupt_coalesce_control); in isci_host_completion_routine()
1139 * sci_controller_stop() - This method will stop an individual controller
1142 * conditions are met: -# the method return status is SCI_SUCCESS. -# the
1158 if (ihost->sm.current_state_id != SCIC_READY) { in sci_controller_stop()
1159 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n", in sci_controller_stop()
1160 __func__, ihost->sm.current_state_id); in sci_controller_stop()
1164 sci_mod_timer(&ihost->timer, timeout); in sci_controller_stop()
1165 sci_change_state(&ihost->sm, SCIC_STOPPING); in sci_controller_stop()
1170 * sci_controller_reset() - This method will reset the supplied core
1183 switch (ihost->sm.current_state_id) { in sci_controller_reset()
1192 sci_change_state(&ihost->sm, SCIC_RESETTING); in sci_controller_reset()
1195 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n", in sci_controller_reset()
1196 __func__, ihost->sm.current_state_id); in sci_controller_reset()
1210 phy_status = sci_phy_stop(&ihost->phys[index]); in sci_controller_stop_phys()
1216 dev_warn(&ihost->pdev->dev, in sci_controller_stop_phys()
1220 ihost->phys[index].phy_index, phy_status); in sci_controller_stop_phys()
1229 * isci_host_deinit - shutdown frame reception and dma
1245 writel(SGPIO_HW_CONTROL, &ihost->scu_registers->peg0.sgpio.output_data_select[i]); in isci_host_deinit()
1247 set_bit(IHOST_STOP_PENDING, &ihost->flags); in isci_host_deinit()
1249 spin_lock_irq(&ihost->scic_lock); in isci_host_deinit()
1251 spin_unlock_irq(&ihost->scic_lock); in isci_host_deinit()
1265 writel(0, &ihost->scu_registers->peg0.sgpio.interface_control); in isci_host_deinit()
1267 spin_lock_irq(&ihost->scic_lock); in isci_host_deinit()
1269 spin_unlock_irq(&ihost->scic_lock); in isci_host_deinit()
1272 for (i = 0; i < ihost->logical_port_entries; i++) { in isci_host_deinit()
1273 struct isci_port *iport = &ihost->ports[i]; in isci_host_deinit()
1274 del_timer_sync(&iport->timer.timer); in isci_host_deinit()
1279 struct isci_phy *iphy = &ihost->phys[i]; in isci_host_deinit()
1280 del_timer_sync(&iphy->sata_timer.timer); in isci_host_deinit()
1283 del_timer_sync(&ihost->port_agent.timer.timer); in isci_host_deinit()
1285 del_timer_sync(&ihost->power_control.timer.timer); in isci_host_deinit()
1287 del_timer_sync(&ihost->timer.timer); in isci_host_deinit()
1289 del_timer_sync(&ihost->phy_timer.timer); in isci_host_deinit()
1294 struct pci_dev *pdev = isci_host->pdev; in scu_base()
1295 int id = isci_host->id; in scu_base()
1302 struct pci_dev *pdev = isci_host->pdev; in smu_base()
1303 int id = isci_host->id; in smu_base()
1312 sci_change_state(&ihost->sm, SCIC_RESET); in sci_controller_initial_state_enter()
1319 sci_del_timer(&ihost->timer); in sci_controller_starting_state_exit()
1330 * sci_controller_set_interrupt_coalescence() - This method allows the user to
1362 * ----- --- --- ----- in sci_controller_set_interrupt_coalescence()
1363 * 0 - - Disabled in sci_controller_set_interrupt_coalescence()
1413 if ((coalesce_timeout - max) < (2 * min - coalesce_timeout)) in sci_controller_set_interrupt_coalescence()
1432 &ihost->smu_registers->interrupt_coalesce_control); in sci_controller_set_interrupt_coalescence()
1435 ihost->interrupt_coalesce_number = (u16)coalesce_number; in sci_controller_set_interrupt_coalescence()
1436 ihost->interrupt_coalesce_timeout = coalesce_timeout / 100; in sci_controller_set_interrupt_coalescence()
1448 val = readl(&ihost->smu_registers->clock_gating_control); in sci_controller_ready_state_enter()
1453 writel(val, &ihost->smu_registers->clock_gating_control); in sci_controller_ready_state_enter()
1473 for (index = 0; index < ihost->logical_port_entries; index++) { in sci_controller_stop_ports()
1474 struct isci_port *iport = &ihost->ports[index]; in sci_controller_stop_ports()
1482 dev_warn(&ihost->pdev->dev, in sci_controller_stop_ports()
1486 iport->logical_port_index, in sci_controller_stop_ports()
1502 for (index = 0; index < ihost->remote_node_entries; index++) { in sci_controller_stop_devices()
1503 if (ihost->device_table[index] != NULL) { in sci_controller_stop_devices()
1505 device_status = sci_remote_device_stop(ihost->device_table[index], 0); in sci_controller_stop_devices()
1509 dev_warn(&ihost->pdev->dev, in sci_controller_stop_devices()
1514 ihost->device_table[index], device_status); in sci_controller_stop_devices()
1537 sci_del_timer(&ihost->timer); in sci_controller_stopping_state_exit()
1546 writel(0xFFFFFFFF, &ihost->smu_registers->soft_reset_control); in sci_controller_reset_hardware()
1552 writel(0x00000000, &ihost->smu_registers->completion_queue_get); in sci_controller_reset_hardware()
1555 writel(0, &ihost->scu_registers->sdma.unsolicited_frame_get_pointer); in sci_controller_reset_hardware()
1558 writel(~SMU_INTERRUPT_STATUS_RESERVED_MASK, &ihost->smu_registers->interrupt_status); in sci_controller_reset_hardware()
1566 sci_change_state(&ihost->sm, SCIC_RESET); in sci_controller_resetting_state_enter()
1597 struct sci_base_state_machine *sm = &ihost->sm; in controller_timeout()
1600 spin_lock_irqsave(&ihost->scic_lock, flags); in controller_timeout()
1602 if (tmr->cancel) in controller_timeout()
1605 if (sm->current_state_id == SCIC_STARTING) in controller_timeout()
1607 else if (sm->current_state_id == SCIC_STOPPING) { in controller_timeout()
1611 dev_err(&ihost->pdev->dev, in controller_timeout()
1617 spin_unlock_irqrestore(&ihost->scic_lock, flags); in controller_timeout()
1626 sci_init_sm(&ihost->sm, sci_controller_state_table, SCIC_INITIAL); in sci_controller_construct()
1628 ihost->scu_registers = scu_base; in sci_controller_construct()
1629 ihost->smu_registers = smu_base; in sci_controller_construct()
1631 sci_port_configuration_agent_construct(&ihost->port_agent); in sci_controller_construct()
1635 sci_port_construct(&ihost->ports[i], i, ihost); in sci_controller_construct()
1636 sci_port_construct(&ihost->ports[i], SCIC_SDS_DUMMY_PORT, ihost); in sci_controller_construct()
1641 sci_phy_construct(&ihost->phys[i], in sci_controller_construct()
1642 &ihost->ports[SCI_MAX_PORTS], i); in sci_controller_construct()
1645 ihost->invalid_phy_mask = 0; in sci_controller_construct()
1647 sci_init_timer(&ihost->timer, controller_timeout); in sci_controller_construct()
1657 if (oem->ports[i].phy_mask > SCIC_SDS_PARM_PHY_MASK_MAX) in sci_oem_parameters_validate()
1658 return -EINVAL; in sci_oem_parameters_validate()
1661 if (oem->phys[i].sas_address.high == 0 && in sci_oem_parameters_validate()
1662 oem->phys[i].sas_address.low == 0) in sci_oem_parameters_validate()
1663 return -EINVAL; in sci_oem_parameters_validate()
1665 if (oem->controller.mode_type == SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE) { in sci_oem_parameters_validate()
1667 if (oem->ports[i].phy_mask != 0) in sci_oem_parameters_validate()
1668 return -EINVAL; in sci_oem_parameters_validate()
1669 } else if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { in sci_oem_parameters_validate()
1673 phy_mask |= oem->ports[i].phy_mask; in sci_oem_parameters_validate()
1676 return -EINVAL; in sci_oem_parameters_validate()
1678 return -EINVAL; in sci_oem_parameters_validate()
1680 if (oem->controller.max_concurr_spin_up > MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT || in sci_oem_parameters_validate()
1681 oem->controller.max_concurr_spin_up < 1) in sci_oem_parameters_validate()
1682 return -EINVAL; in sci_oem_parameters_validate()
1684 if (oem->controller.do_enable_ssc) { in sci_oem_parameters_validate()
1685 if (version < ISCI_ROM_VER_1_1 && oem->controller.do_enable_ssc != 1) in sci_oem_parameters_validate()
1686 return -EINVAL; in sci_oem_parameters_validate()
1689 u8 test = oem->controller.ssc_sata_tx_spread_level; in sci_oem_parameters_validate()
1699 return -EINVAL; in sci_oem_parameters_validate()
1702 test = oem->controller.ssc_sas_tx_spread_level; in sci_oem_parameters_validate()
1703 if (oem->controller.ssc_sas_tx_type == 0) { in sci_oem_parameters_validate()
1710 return -EINVAL; in sci_oem_parameters_validate()
1712 } else if (oem->controller.ssc_sas_tx_type == 1) { in sci_oem_parameters_validate()
1719 return -EINVAL; in sci_oem_parameters_validate()
1730 if (ihost->user_parameters.max_concurr_spinup) in max_spin_up()
1731 return min_t(u8, ihost->user_parameters.max_concurr_spinup, in max_spin_up()
1734 return min_t(u8, ihost->oem_parameters.controller.max_concurr_spin_up, in max_spin_up()
1746 spin_lock_irqsave(&ihost->scic_lock, flags); in power_control_timeout()
1748 if (tmr->cancel) in power_control_timeout()
1751 ihost->power_control.phys_granted_power = 0; in power_control_timeout()
1753 if (ihost->power_control.phys_waiting == 0) { in power_control_timeout()
1754 ihost->power_control.timer_started = false; in power_control_timeout()
1760 if (ihost->power_control.phys_waiting == 0) in power_control_timeout()
1763 iphy = ihost->power_control.requesters[i]; in power_control_timeout()
1767 if (ihost->power_control.phys_granted_power >= max_spin_up(ihost)) in power_control_timeout()
1770 ihost->power_control.requesters[i] = NULL; in power_control_timeout()
1771 ihost->power_control.phys_waiting--; in power_control_timeout()
1772 ihost->power_control.phys_granted_power++; in power_control_timeout()
1775 if (iphy->protocol == SAS_PROTOCOL_SSP) { in power_control_timeout()
1779 struct isci_phy *requester = ihost->power_control.requesters[j]; in power_control_timeout()
1787 u8 other = memcmp(requester->frame_rcvd.iaf.sas_addr, in power_control_timeout()
1788 iphy->frame_rcvd.iaf.sas_addr, in power_control_timeout()
1789 sizeof(requester->frame_rcvd.iaf.sas_addr)); in power_control_timeout()
1792 ihost->power_control.requesters[j] = NULL; in power_control_timeout()
1793 ihost->power_control.phys_waiting--; in power_control_timeout()
1806 ihost->power_control.timer_started = true; in power_control_timeout()
1809 spin_unlock_irqrestore(&ihost->scic_lock, flags); in power_control_timeout()
1817 if (ihost->power_control.phys_granted_power < max_spin_up(ihost)) { in sci_controller_power_control_queue_insert()
1818 ihost->power_control.phys_granted_power++; in sci_controller_power_control_queue_insert()
1825 if (ihost->power_control.timer_started) in sci_controller_power_control_queue_insert()
1826 sci_del_timer(&ihost->power_control.timer); in sci_controller_power_control_queue_insert()
1828 sci_mod_timer(&ihost->power_control.timer, in sci_controller_power_control_queue_insert()
1830 ihost->power_control.timer_started = true; in sci_controller_power_control_queue_insert()
1842 current_phy = &ihost->phys[i]; in sci_controller_power_control_queue_insert()
1844 other = memcmp(current_phy->frame_rcvd.iaf.sas_addr, in sci_controller_power_control_queue_insert()
1845 iphy->frame_rcvd.iaf.sas_addr, in sci_controller_power_control_queue_insert()
1846 sizeof(current_phy->frame_rcvd.iaf.sas_addr)); in sci_controller_power_control_queue_insert()
1848 if (current_phy->sm.current_state_id == SCI_PHY_READY && in sci_controller_power_control_queue_insert()
1849 current_phy->protocol == SAS_PROTOCOL_SSP && in sci_controller_power_control_queue_insert()
1858 ihost->power_control.requesters[iphy->phy_index] = iphy; in sci_controller_power_control_queue_insert()
1859 ihost->power_control.phys_waiting++; in sci_controller_power_control_queue_insert()
1869 if (ihost->power_control.requesters[iphy->phy_index]) in sci_controller_power_control_queue_remove()
1870 ihost->power_control.phys_waiting--; in sci_controller_power_control_queue_remove()
1872 ihost->power_control.requesters[iphy->phy_index] = NULL; in sci_controller_power_control_queue_remove()
1897 + ihost->id; in to_cable_select()
1899 return &ihost->oem_parameters.controller.cable_selection_mask; in to_cable_select()
1923 struct scu_afe_registers __iomem *afe = &ihost->scu_registers->afe; in sci_controller_afe_initialization()
1924 const struct sci_oem_params *oem = &ihost->oem_parameters; in sci_controller_afe_initialization()
1925 struct pci_dev *pdev = ihost->pdev; in sci_controller_afe_initialization()
1931 writel(0x0081000f, &afe->afe_dfx_master_control0); in sci_controller_afe_initialization()
1938 writel(0x0007FFFF, &afe->afe_pmsn_master_control2); in sci_controller_afe_initialization()
1944 writel(0x00005A00, &afe->afe_bias_control); in sci_controller_afe_initialization()
1946 writel(0x00005F00, &afe->afe_bias_control); in sci_controller_afe_initialization()
1948 writel(0x00005500, &afe->afe_bias_control); in sci_controller_afe_initialization()
1954 writel(0x80040908, &afe->afe_pll_control0); in sci_controller_afe_initialization()
1956 writel(0x80040A08, &afe->afe_pll_control0); in sci_controller_afe_initialization()
1958 writel(0x80000B08, &afe->afe_pll_control0); in sci_controller_afe_initialization()
1960 writel(0x00000B08, &afe->afe_pll_control0); in sci_controller_afe_initialization()
1962 writel(0x80000B08, &afe->afe_pll_control0); in sci_controller_afe_initialization()
1969 afe_status = readl(&afe->afe_common_block_status); in sci_controller_afe_initialization()
1977 writel(0x7bcc96ad, &afe->afe_pmsn_master_control0); in sci_controller_afe_initialization()
1982 struct scu_afe_transceiver __iomem *xcvr = &afe->scu_afe_xcvr[phy_id]; in sci_controller_afe_initialization() local
1983 const struct sci_phy_oem_params *oem_phy = &oem->phys[phy_id]; in sci_controller_afe_initialization()
1993 writel(0x00004512, &xcvr->afe_xcvr_control0); in sci_controller_afe_initialization()
1996 writel(0x0050100F, &xcvr->afe_xcvr_control1); in sci_controller_afe_initialization()
2000 writel(0x00030000, &xcvr->afe_tx_ssc_control); in sci_controller_afe_initialization()
2004 writel(0x00010202, &xcvr->afe_tx_ssc_control); in sci_controller_afe_initialization()
2010 writel(0x00014500, &xcvr->afe_xcvr_control0); in sci_controller_afe_initialization()
2014 writel(0x00010202, &xcvr->afe_tx_ssc_control); in sci_controller_afe_initialization()
2020 writel(0x0001C500, &xcvr->afe_xcvr_control0); in sci_controller_afe_initialization()
2028 writel(0x000003F0, &xcvr->afe_channel_control); in sci_controller_afe_initialization()
2030 writel(0x000003D7, &xcvr->afe_channel_control); in sci_controller_afe_initialization()
2033 writel(0x000003D4, &xcvr->afe_channel_control); in sci_controller_afe_initialization()
2035 writel(0x000001E7, &xcvr->afe_channel_control); in sci_controller_afe_initialization()
2038 writel(0x000001E4, &xcvr->afe_channel_control); in sci_controller_afe_initialization()
2041 &xcvr->afe_channel_control); in sci_controller_afe_initialization()
2045 &xcvr->afe_channel_control); in sci_controller_afe_initialization()
2051 writel(0x00040000, &xcvr->afe_tx_control); in sci_controller_afe_initialization()
2060 writel(0x00004100, &xcvr->afe_xcvr_control0); in sci_controller_afe_initialization()
2062 writel(0x00014100, &xcvr->afe_xcvr_control0); in sci_controller_afe_initialization()
2064 writel(0x0001C100, &xcvr->afe_xcvr_control0); in sci_controller_afe_initialization()
2069 writel(0x3F11103F, &xcvr->afe_rx_ssc_control0); in sci_controller_afe_initialization()
2071 writel(0x3F11103F, &xcvr->afe_rx_ssc_control0); in sci_controller_afe_initialization()
2074 writel(0x00040000, &xcvr->afe_tx_control); in sci_controller_afe_initialization()
2076 writel(0x01400C0F, &xcvr->afe_rx_ssc_control1); in sci_controller_afe_initialization()
2079 writel(0x3F6F103F, &xcvr->afe_rx_ssc_control0); in sci_controller_afe_initialization()
2083 writel(0x00040000, &xcvr->afe_tx_control); in sci_controller_afe_initialization()
2087 &xcvr->afe_xcvr_control1); in sci_controller_afe_initialization()
2090 writel(0x000003E0, &xcvr->afe_dfx_rx_control1); in sci_controller_afe_initialization()
2095 &xcvr->afe_rx_ssc_control0); in sci_controller_afe_initialization()
2099 writel(0x00040000, &xcvr->afe_tx_control); in sci_controller_afe_initialization()
2104 writel(oem_phy->afe_tx_amp_control0, &xcvr->afe_tx_amp_control0); in sci_controller_afe_initialization()
2107 writel(oem_phy->afe_tx_amp_control1, &xcvr->afe_tx_amp_control1); in sci_controller_afe_initialization()
2110 writel(oem_phy->afe_tx_amp_control2, &xcvr->afe_tx_amp_control2); in sci_controller_afe_initialization()
2113 writel(oem_phy->afe_tx_amp_control3, &xcvr->afe_tx_amp_control3); in sci_controller_afe_initialization()
2118 writel(0x00010f00, &afe->afe_dfx_master_control0); in sci_controller_afe_initialization()
2124 sci_init_timer(&ihost->power_control.timer, power_control_timeout); in sci_controller_initialize_power_control()
2126 memset(ihost->power_control.requesters, 0, in sci_controller_initialize_power_control()
2127 sizeof(ihost->power_control.requesters)); in sci_controller_initialize_power_control()
2129 ihost->power_control.phys_waiting = 0; in sci_controller_initialize_power_control()
2130 ihost->power_control.phys_granted_power = 0; in sci_controller_initialize_power_control()
2135 struct sci_base_state_machine *sm = &ihost->sm; in sci_controller_initialize()
2139 if (ihost->sm.current_state_id != SCIC_RESET) { in sci_controller_initialize()
2140 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n", in sci_controller_initialize()
2141 __func__, ihost->sm.current_state_id); in sci_controller_initialize()
2147 sci_init_timer(&ihost->phy_timer, phy_startup_timeout); in sci_controller_initialize()
2149 ihost->next_phy_to_start = 0; in sci_controller_initialize()
2150 ihost->phy_startup_timer_pending = false; in sci_controller_initialize()
2163 writel(0, &ihost->smu_registers->soft_reset_control); in sci_controller_initialize()
2168 for (i = 100; i >= 1; i--) { in sci_controller_initialize()
2173 status = readl(&ihost->smu_registers->control_status); in sci_controller_initialize()
2184 val = readl(&ihost->smu_registers->device_context_capacity); in sci_controller_initialize()
2187 ihost->logical_port_entries = min(smu_max_ports(val), SCI_MAX_PORTS); in sci_controller_initialize()
2188 ihost->task_context_entries = min(smu_max_task_contexts(val), SCI_MAX_IO_REQUESTS); in sci_controller_initialize()
2189 ihost->remote_node_entries = min(smu_max_rncs(val), SCI_MAX_REMOTE_DEVICES); in sci_controller_initialize()
2195 for (i = 0; i < ihost->logical_port_entries; i++) { in sci_controller_initialize()
2197 *ptsg = &ihost->scu_registers->peg0.ptsg; in sci_controller_initialize()
2199 writel(i, &ptsg->protocol_engine[i]); in sci_controller_initialize()
2203 val = readl(&ihost->scu_registers->sdma.pdma_configuration); in sci_controller_initialize()
2205 writel(val, &ihost->scu_registers->sdma.pdma_configuration); in sci_controller_initialize()
2207 val = readl(&ihost->scu_registers->sdma.cdma_configuration); in sci_controller_initialize()
2209 writel(val, &ihost->scu_registers->sdma.cdma_configuration); in sci_controller_initialize()
2216 result = sci_phy_initialize(&ihost->phys[i], in sci_controller_initialize()
2217 &ihost->scu_registers->peg0.pe[i].tl, in sci_controller_initialize()
2218 &ihost->scu_registers->peg0.pe[i].ll); in sci_controller_initialize()
2223 for (i = 0; i < ihost->logical_port_entries; i++) { in sci_controller_initialize()
2224 struct isci_port *iport = &ihost->ports[i]; in sci_controller_initialize()
2226 iport->port_task_scheduler_registers = &ihost->scu_registers->peg0.ptsg.port[i]; in sci_controller_initialize()
2227 iport->port_pe_configuration_register = &ihost->scu_registers->peg0.ptsg.protocol_engine[0]; in sci_controller_initialize()
2228 iport->viit_registers = &ihost->scu_registers->peg0.viit[i]; in sci_controller_initialize()
2231 result = sci_port_configuration_agent_initialize(ihost, &ihost->port_agent); in sci_controller_initialize()
2246 struct device *dev = &ihost->pdev->dev; in sci_controller_dma_alloc()
2250 /* detect re-initialization */ in sci_controller_dma_alloc()
2251 if (ihost->completion_queue) in sci_controller_dma_alloc()
2255 ihost->completion_queue = dmam_alloc_coherent(dev, size, &ihost->cq_dma, in sci_controller_dma_alloc()
2257 if (!ihost->completion_queue) in sci_controller_dma_alloc()
2258 return -ENOMEM; in sci_controller_dma_alloc()
2260 size = ihost->remote_node_entries * sizeof(union scu_remote_node_context); in sci_controller_dma_alloc()
2261 ihost->remote_node_context_table = dmam_alloc_coherent(dev, size, &ihost->rnc_dma, in sci_controller_dma_alloc()
2264 if (!ihost->remote_node_context_table) in sci_controller_dma_alloc()
2265 return -ENOMEM; in sci_controller_dma_alloc()
2267 size = ihost->task_context_entries * sizeof(struct scu_task_context), in sci_controller_dma_alloc()
2268 ihost->task_context_table = dmam_alloc_coherent(dev, size, &ihost->tc_dma, in sci_controller_dma_alloc()
2270 if (!ihost->task_context_table) in sci_controller_dma_alloc()
2271 return -ENOMEM; in sci_controller_dma_alloc()
2274 ihost->ufi_buf = dmam_alloc_coherent(dev, size, &ihost->ufi_dma, GFP_KERNEL); in sci_controller_dma_alloc()
2275 if (!ihost->ufi_buf) in sci_controller_dma_alloc()
2276 return -ENOMEM; in sci_controller_dma_alloc()
2284 return -ENOMEM; in sci_controller_dma_alloc()
2286 ireq->tc = &ihost->task_context_table[i]; in sci_controller_dma_alloc()
2287 ireq->owning_controller = ihost; in sci_controller_dma_alloc()
2288 ireq->request_daddr = dma; in sci_controller_dma_alloc()
2289 ireq->isci_host = ihost; in sci_controller_dma_alloc()
2290 ihost->reqs[i] = ireq; in sci_controller_dma_alloc()
2303 writel(lower_32_bits(ihost->cq_dma), &ihost->smu_registers->completion_queue_lower); in sci_controller_mem_init()
2304 writel(upper_32_bits(ihost->cq_dma), &ihost->smu_registers->completion_queue_upper); in sci_controller_mem_init()
2306 writel(lower_32_bits(ihost->rnc_dma), &ihost->smu_registers->remote_node_context_lower); in sci_controller_mem_init()
2307 writel(upper_32_bits(ihost->rnc_dma), &ihost->smu_registers->remote_node_context_upper); in sci_controller_mem_init()
2309 writel(lower_32_bits(ihost->tc_dma), &ihost->smu_registers->host_task_table_lower); in sci_controller_mem_init()
2310 writel(upper_32_bits(ihost->tc_dma), &ihost->smu_registers->host_task_table_upper); in sci_controller_mem_init()
2318 writel(lower_32_bits(ihost->uf_control.headers.physical_address), in sci_controller_mem_init()
2319 &ihost->scu_registers->sdma.uf_header_base_address_lower); in sci_controller_mem_init()
2320 writel(upper_32_bits(ihost->uf_control.headers.physical_address), in sci_controller_mem_init()
2321 &ihost->scu_registers->sdma.uf_header_base_address_upper); in sci_controller_mem_init()
2323 writel(lower_32_bits(ihost->uf_control.address_table.physical_address), in sci_controller_mem_init()
2324 &ihost->scu_registers->sdma.uf_address_table_lower); in sci_controller_mem_init()
2325 writel(upper_32_bits(ihost->uf_control.address_table.physical_address), in sci_controller_mem_init()
2326 &ihost->scu_registers->sdma.uf_address_table_upper); in sci_controller_mem_init()
2332 * isci_host_init - (re-)initialize hardware and internal (private) state
2336 * one-time initialization objects like locks and waitqueues, are
2344 spin_lock_irq(&ihost->scic_lock); in isci_host_init()
2346 spin_unlock_irq(&ihost->scic_lock); in isci_host_init()
2348 dev_err(&ihost->pdev->dev, in isci_host_init()
2349 "%s: sci_controller_construct failed - status = %x\n", in isci_host_init()
2352 return -ENODEV; in isci_host_init()
2355 spin_lock_irq(&ihost->scic_lock); in isci_host_init()
2357 spin_unlock_irq(&ihost->scic_lock); in isci_host_init()
2359 dev_warn(&ihost->pdev->dev, in isci_host_init()
2360 "%s: sci_controller_initialize failed -" in isci_host_init()
2363 return -ENODEV; in isci_host_init()
2371 writel(1, &ihost->scu_registers->peg0.sgpio.interface_control); in isci_host_init()
2373 writel(SGPIO_HW_CONTROL, &ihost->scu_registers->peg0.sgpio.output_data_select[i]); in isci_host_init()
2374 writel(0, &ihost->scu_registers->peg0.sgpio.vendor_specific_code); in isci_host_init()
2382 switch (ihost->sm.current_state_id) { in sci_controller_link_up()
2384 sci_del_timer(&ihost->phy_timer); in sci_controller_link_up()
2385 ihost->phy_startup_timer_pending = false; in sci_controller_link_up()
2386 ihost->port_agent.link_up_handler(ihost, &ihost->port_agent, in sci_controller_link_up()
2391 ihost->port_agent.link_up_handler(ihost, &ihost->port_agent, in sci_controller_link_up()
2395 dev_dbg(&ihost->pdev->dev, in sci_controller_link_up()
2397 "unexpected state %d\n", __func__, iphy->phy_index, in sci_controller_link_up()
2398 ihost->sm.current_state_id); in sci_controller_link_up()
2405 switch (ihost->sm.current_state_id) { in sci_controller_link_down()
2408 ihost->port_agent.link_down_handler(ihost, &ihost->port_agent, in sci_controller_link_down()
2412 dev_dbg(&ihost->pdev->dev, in sci_controller_link_down()
2416 iphy->phy_index, in sci_controller_link_down()
2417 ihost->sm.current_state_id); in sci_controller_link_down()
2425 for (index = 0; index < ihost->remote_node_entries; index++) { in sci_controller_has_remote_devices_stopping()
2426 if ((ihost->device_table[index] != NULL) && in sci_controller_has_remote_devices_stopping()
2427 (ihost->device_table[index]->sm.current_state_id == SCI_DEV_STOPPING)) in sci_controller_has_remote_devices_stopping()
2437 if (ihost->sm.current_state_id != SCIC_STOPPING) { in sci_controller_remote_device_stopped()
2438 dev_dbg(&ihost->pdev->dev, in sci_controller_remote_device_stopped()
2442 ihost->sm.current_state_id); in sci_controller_remote_device_stopped()
2452 dev_dbg(&ihost->pdev->dev, "%s[%d]: %#x\n", in sci_controller_post_request()
2453 __func__, ihost->id, request); in sci_controller_post_request()
2455 writel(request, &ihost->smu_registers->post_context_port); in sci_controller_post_request()
2465 if (task_index < ihost->task_context_entries) { in sci_request_by_tag()
2466 struct isci_request *ireq = ihost->reqs[task_index]; in sci_request_by_tag()
2468 if (test_bit(IREQ_ACTIVE, &ireq->flags)) { in sci_request_by_tag()
2471 if (task_sequence == ihost->io_request_sequence[task_index]) in sci_request_by_tag()
2502 &ihost->available_remote_nodes, remote_node_count in sci_controller_allocate_remote_node_context()
2506 ihost->device_table[node_index] = idev; in sci_controller_allocate_remote_node_context()
2522 if (ihost->device_table[node_id] == idev) { in sci_controller_free_remote_node_context()
2523 ihost->device_table[node_id] = NULL; in sci_controller_free_remote_node_context()
2526 &ihost->available_remote_nodes, remote_node_count, node_id in sci_controller_free_remote_node_context()
2540 sizeof(struct dev_to_host_fis) - sizeof(u32)); in sci_controller_copy_sata_response()
2545 if (sci_unsolicited_frame_control_release_frame(&ihost->uf_control, frame_index)) in sci_controller_release_frame()
2546 writel(ihost->uf_control.get, in sci_controller_release_frame()
2547 &ihost->scu_registers->sdma.unsolicited_frame_get_pointer); in sci_controller_release_frame()
2552 u16 tail = ihost->tci_tail & (SCI_MAX_IO_REQUESTS-1); in isci_tci_free()
2554 ihost->tci_pool[tail] = tci; in isci_tci_free()
2555 ihost->tci_tail = tail + 1; in isci_tci_free()
2560 u16 head = ihost->tci_head & (SCI_MAX_IO_REQUESTS-1); in isci_tci_alloc()
2561 u16 tci = ihost->tci_pool[head]; in isci_tci_alloc()
2563 ihost->tci_head = head + 1; in isci_tci_alloc()
2569 return CIRC_SPACE(ihost->tci_head, ihost->tci_tail, SCI_MAX_IO_REQUESTS); in isci_tci_space()
2576 u8 seq = ihost->io_request_sequence[tci]; in isci_alloc_tag()
2593 if (seq == ihost->io_request_sequence[tci]) { in isci_free_tag()
2594 ihost->io_request_sequence[tci] = (seq+1) & (SCI_MAX_SEQ-1); in isci_free_tag()
2609 if (ihost->sm.current_state_id != SCIC_READY) { in sci_controller_start_io()
2610 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n", in sci_controller_start_io()
2611 __func__, ihost->sm.current_state_id); in sci_controller_start_io()
2619 set_bit(IREQ_ACTIVE, &ireq->flags); in sci_controller_start_io()
2620 sci_controller_post_request(ihost, ireq->post_context); in sci_controller_start_io()
2634 if (ihost->sm.current_state_id != SCIC_READY) { in sci_controller_terminate_request()
2635 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n", in sci_controller_terminate_request()
2636 __func__, ihost->sm.current_state_id); in sci_controller_terminate_request()
2641 dev_dbg(&ihost->pdev->dev, "%s: status=%d; ireq=%p; flags=%lx\n", in sci_controller_terminate_request()
2642 __func__, status, ireq, ireq->flags); in sci_controller_terminate_request()
2645 !test_bit(IREQ_PENDING_ABORT, &ireq->flags) && in sci_controller_terminate_request()
2646 !test_and_set_bit(IREQ_TC_ABORT_POSTED, &ireq->flags)) { in sci_controller_terminate_request()
2648 * POST_TC_ABORT request sub-type. in sci_controller_terminate_request()
2651 ihost, ireq->post_context | in sci_controller_terminate_request()
2658 * sci_controller_complete_io() - This method will perform core specific
2661 * reused (i.e. re-constructed).
2674 switch (ihost->sm.current_state_id) { in sci_controller_complete_io()
2683 clear_bit(IREQ_ACTIVE, &ireq->flags); in sci_controller_complete_io()
2686 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n", in sci_controller_complete_io()
2687 __func__, ihost->sm.current_state_id); in sci_controller_complete_io()
2695 struct isci_host *ihost = ireq->owning_controller; in sci_controller_continue_io()
2697 if (ihost->sm.current_state_id != SCIC_READY) { in sci_controller_continue_io()
2698 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n", in sci_controller_continue_io()
2699 __func__, ihost->sm.current_state_id); in sci_controller_continue_io()
2703 set_bit(IREQ_ACTIVE, &ireq->flags); in sci_controller_continue_io()
2704 sci_controller_post_request(ihost, ireq->post_context); in sci_controller_continue_io()
2709 * sci_controller_start_task() - This method is called by the SCIC user to
2723 if (ihost->sm.current_state_id != SCIC_READY) { in sci_controller_start_task()
2724 dev_warn(&ihost->pdev->dev, in sci_controller_start_task()
2734 set_bit(IREQ_ACTIVE, &ireq->flags); in sci_controller_start_task()
2743 set_bit(IREQ_ACTIVE, &ireq->flags); in sci_controller_start_task()
2744 sci_controller_post_request(ihost, ireq->post_context); in sci_controller_start_task()
2759 return -EINVAL; in sci_write_gpio_tx_gp()
2780 writel(val, &ihost->scu_registers->peg0.sgpio.output_data_select[d]); in sci_write_gpio_tx_gp()
2792 struct isci_host *ihost = sas_ha->lldd_ha; in isci_gpio_write()
2800 written = -EINVAL; in isci_gpio_write()