FreeBSD/sys/dev/isci/scil/scif_sas_controller_state_handlers.c
/**
 * @brief This method provides READY state specific handling for
 *        when a user attempts to start a task request.
 *
 * @param[in]  controller This parameter specifies the controller object
 *             on which the user is attempting to perform a start task
 *             operation.
 * @param[in]  remote_device This parameter specifies the remote deivce
 *             object on which the user is attempting to perform a start
 *             task operation.
 * @param[in]  task_request This parameter specifies the task management
 *             request to be started.
 * @param[in]  io_tag This parameter specifies the optional allocated
 *             IO tag.  Please reference scif_controller_start_task() for
 *             more information.
 *
 * @return This method returns an indication of whether the start task
 *         operation succeeded.
 * @retval SCI_SUCCESS This value is returned when the start task operation
 *         begins successfully.
 */
@brief This method provides READY state specific handling for
when a user attempts to start a task request.

@param[in]  controller This parameter specifies the controller object
on which the user is attempting to perform a start task
operation.
@param[in]  remote_device This parameter specifies the remote deivce
object on which the user is attempting to perform a start
task operation.
@param[in]  task_request This parameter specifies the task management
request to be started.
@param[in]  io_tag This parameter specifies the optional allocated
IO tag.  Please reference scif_controller_start_task() for
more information.

@return This method returns an indication of whether the start task
operation succeeded.
@retval SCI_SUCCESS This value is returned when the start task operation
begins successfully.
@brief This method provides READY state specific handling for when a user attempts to start a task request . @param [ in ] controller This parameter specifies the controller object on which the user is attempting to perform a start task operation . @param [ in ] remote_device This parameter specifies the remote deivce object on which the user is attempting to perform a start task operation . @param [ in ] task_request This parameter specifies the task management request to be started . @param [ in ] io_tag This parameter specifies the optional allocated IO tag . Please reference scif_controller_start_task () for more information . @return This method returns an indication of whether the start task operation succeeded . @retval SCI_SUCCESS This value is returned when the start task operation begins successfully .
static
SCI_STATUS scif_sas_controller_ready_start_task_handler(
   SCI_BASE_CONTROLLER_T    * controller,
   SCI_BASE_REMOTE_DEVICE_T * remote_device,
   SCI_BASE_REQUEST_T       * task_request,
   U16                        io_tag
)
{
   SCIF_SAS_CONTROLLER_T    * fw_controller = (SCIF_SAS_CONTROLLER_T*)
                                              controller;
   SCIF_SAS_REMOTE_DEVICE_T * fw_device = (SCIF_SAS_REMOTE_DEVICE_T*)
                                          remote_device;
   SCIF_SAS_TASK_REQUEST_T  * fw_task = (SCIF_SAS_TASK_REQUEST_T*)task_request;
   SCI_STATUS                 status;
   SCIF_LOG_TRACE((
      sci_base_object_get_logger(fw_controller),
      SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_TASK_MANAGEMENT,
      "scif_sas_controller_ready_start_task_handler(0x%x, 0x%x, 0x%x, 0x%x) enter\n",
      controller, remote_device, task_request, io_tag
   ));
   status = fw_device->domain->state_handlers->start_task_handler(
               &fw_device->domain->parent, remote_device, task_request
            );
   if (status == SCI_SUCCESS)
   {
      if (scif_sas_task_request_get_function(fw_task)
             == SCI_SAS_HARD_RESET)
      {
         scif_sas_remote_device_target_reset(
            fw_device,
            (SCIF_SAS_REQUEST_T *)fw_task
         );
         return SCI_SUCCESS;
      }
      status = (SCI_STATUS)scic_controller_start_task(
                  fw_controller->core_object,
                  fw_device->core_object,
                  fw_task->parent.core_object,
                  io_tag
               );
      if (status == SCI_SUCCESS)
      {
         fw_task->parent.state_handlers->start_handler(&fw_task->parent.parent);
      }
      else
      {
         fw_device->domain->state_handlers->complete_task_handler(
            &fw_device->domain->parent, remote_device, task_request
         );
         if (status == SCI_SUCCESS)
         {
            SCIF_LOG_WARNING((
               sci_base_object_get_logger(fw_controller),
               SCIF_LOG_OBJECT_CONTROLLER,
               "Controller:0x%x TaskRequest:0x%x Status:0x%x core start failed\n",
               fw_controller, fw_task, status
            ));
         }
      }
   }
   else
   {
      SCIF_LOG_WARNING((
         sci_base_object_get_logger(fw_controller),
         SCIF_LOG_OBJECT_CONTROLLER,
         "Controller:0x%x TaskRequest:0x%x Status:0x%x Task start failed\n",
         fw_controller, fw_task, status
      ));
   }
   return status;
}
static SCI_STATUS scif_sas_controller_ready_start_task_handler ( SCI_BASE_CONTROLLER_T * controller , SCI_BASE_REMOTE_DEVICE_T * remote_device , SCI_BASE_REQUEST_T * task_request , U16 io_tag ) { SCIF_SAS_CONTROLLER_T * fw_controller = ( SCIF_SAS_CONTROLLER_T * ) controller ; SCIF_SAS_REMOTE_DEVICE_T * fw_device = ( SCIF_SAS_REMOTE_DEVICE_T * ) remote_device ; SCIF_SAS_TASK_REQUEST_T * fw_task = ( SCIF_SAS_TASK_REQUEST_T * ) task_request ; SCI_STATUS status ; SCIF_LOG_TRACE ( ( sci_base_object_get_logger ( fw_controller ) , SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_TASK_MANAGEMENT , " \n " , controller , remote_device , task_request , io_tag ) ) ; status = fw_device -> domain -> state_handlers -> start_task_handler ( & fw_device -> domain -> parent , remote_device , task_request ) ; if ( status == SCI_SUCCESS ) { if ( scif_sas_task_request_get_function ( fw_task ) == SCI_SAS_HARD_RESET ) { scif_sas_remote_device_target_reset ( fw_device , ( SCIF_SAS_REQUEST_T * ) fw_task ) ; return SCI_SUCCESS ; } status = ( SCI_STATUS ) scic_controller_start_task ( fw_controller -> core_object , fw_device -> core_object , fw_task -> parent . core_object , io_tag ) ; if ( status == SCI_SUCCESS ) { fw_task -> parent . state_handlers -> start_handler ( & fw_task -> parent . parent ) ; } else { fw_device -> domain -> state_handlers -> complete_task_handler ( & fw_device -> domain -> parent , remote_device , task_request ) ; if ( status == SCI_SUCCESS ) { SCIF_LOG_WARNING ( ( sci_base_object_get_logger ( fw_controller ) , SCIF_LOG_OBJECT_CONTROLLER , " \n " , fw_controller , fw_task , status ) ) ; } } } else { SCIF_LOG_WARNING ( ( sci_base_object_get_logger ( fw_controller ) , SCIF_LOG_OBJECT_CONTROLLER , " \n " , fw_controller , fw_task , status ) ) ; } return status ; }
@brief This method provides READY state specific handling for
        when a user attempts to start a task request.
@brief This method provides READY state specific handling for when a user attempts to start a task request .
// Go off to special target reset path. Don't start task to core. // Ask the core to start processing for this task request. // We were able to start the core request. As a result, // commit to starting the request for the framework by changing // the state of the task request. // We were unable to start the core task request. As a result, // back out the start operation for the framework.  It's easier to // back out the framework start operation then to backout the core // start task operation.