FreeBSD/sys/dev/isci/scil/scic_sds_stp_remote_device.c
/**
 * This is the READY NCQ substate handler to start task management request. In this
 * routine, we suspend and resume the RNC.
 *
 * @param[in] device The target device a task management request towards to.
 * @param[in] request The task request.
 *
 * @return SCI_STATUS Always return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS status
 *     to let controller_start_task_handler know that the controller can't post TC for
 *     task request yet, instead, when RNC gets resumed, a controller_continue_task
 *     callback will be called.
 */
This is the READY NCQ substate handler to start task management request. In this
routine, we suspend and resume the RNC.

@param[in] device The target device a task management request towards to.
@param[in] request The task request.

@return SCI_STATUS Always return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS status
to let controller_start_task_handler know that the controller can't post TC for
task request yet, instead, when RNC gets resumed, a controller_continue_task
callback will be called.
This is the READY NCQ substate handler to start task management request . In this routine we suspend and resume the RNC . @param [ in ] device The target device a task management request towards to . @param [ in ] request The task request . @return SCI_STATUS Always return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS status to let controller_start_task_handler know that the controller can ' t post TC for task request yet instead when RNC gets resumed a controller_continue_task callback will be called .
static
SCI_STATUS scic_sds_stp_remote_device_ready_substate_start_request_handler(
   SCI_BASE_REMOTE_DEVICE_T * device,
   SCI_BASE_REQUEST_T       * request
)
{
   SCI_STATUS status;
   SCIC_SDS_REMOTE_DEVICE_T * this_device  = (SCIC_SDS_REMOTE_DEVICE_T *)device;
   SCIC_SDS_REQUEST_T       * this_request = (SCIC_SDS_REQUEST_T       *)request;
   status = this_device->owning_port->state_handlers->start_io_handler(
      this_device->owning_port,
      this_device,
      this_request
   );
   if (SCI_SUCCESS == status)
   {
      status =
         scic_sds_remote_node_context_start_task(this_device->rnc, this_request);
      if (SCI_SUCCESS == status)
      {
         status = this_request->state_handlers->parent.start_handler(request);
      }
      if (status == SCI_SUCCESS)
      {
         this_device->working_request = this_request;
         sci_base_state_machine_change_state(
            &this_device->ready_substate_machine,
            SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD
         );
         scic_sds_remote_node_context_suspend(
            this_device->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL);
         scic_sds_remote_node_context_resume(
            this_device->rnc,
            (SCIC_SDS_REMOTE_NODE_CONTEXT_CALLBACK)
                scic_sds_remote_device_continue_request,
            this_device);
      }
      scic_sds_remote_device_start_request(this_device,this_request,status);
      return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS;
   }
   return status;
}
static SCI_STATUS scic_sds_stp_remote_device_ready_substate_start_request_handler ( SCI_BASE_REMOTE_DEVICE_T * device , SCI_BASE_REQUEST_T * request ) { SCI_STATUS status ; SCIC_SDS_REMOTE_DEVICE_T * this_device = ( SCIC_SDS_REMOTE_DEVICE_T * ) device ; SCIC_SDS_REQUEST_T * this_request = ( SCIC_SDS_REQUEST_T * ) request ; status = this_device -> owning_port -> state_handlers -> start_io_handler ( this_device -> owning_port , this_device , this_request ) ; if ( SCI_SUCCESS == status ) { status = scic_sds_remote_node_context_start_task ( this_device -> rnc , this_request ) ; if ( SCI_SUCCESS == status ) { status = this_request -> state_handlers -> parent . start_handler ( request ) ; } if ( status == SCI_SUCCESS ) { this_device -> working_request = this_request ; sci_base_state_machine_change_state ( & this_device -> ready_substate_machine , SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD ) ; scic_sds_remote_node_context_suspend ( this_device -> rnc , SCI_SOFTWARE_SUSPENSION , NULL , NULL ) ; scic_sds_remote_node_context_resume ( this_device -> rnc , ( SCIC_SDS_REMOTE_NODE_CONTEXT_CALLBACK ) scic_sds_remote_device_continue_request , this_device ) ; } scic_sds_remote_device_start_request ( this_device , this_request , status ) ; return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS ; } return status ; }
This is the READY NCQ substate handler to start task management request.
This is the READY NCQ substate handler to start task management request .
// Will the port allow the io request to start? /// @note If the remote device state is not IDLE this will replace ///       the request that probably resulted in the task management ///       request. //The remote node context must cleanup the TCi to NCQ mapping table. //The only way to do this correctly is to either write to the TLCR //register or to invalidate and repost the RNC. In either case the //remote node context state machine will take the correct action when //the remote node context is suspended and later resumed. //We need to let the controller start request handler know that it can't //post TC yet. We will provide a callback function to post TC when RNC gets //resumed.