FreeBSD/sys/dev/isci/scil/scif_sas_controller_state_handlers.c
static
SCI_STATUS scif_sas_controller_ready_complete_high_priority_io_handler(
   SCI_BASE_CONTROLLER_T    * controller,
   SCI_BASE_REMOTE_DEVICE_T * remote_device,
   SCI_BASE_REQUEST_T       * io_request
)
{
   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_IO_REQUEST_T    * fw_io         = (SCIF_SAS_IO_REQUEST_T*)
                                              io_request;
   SCI_IO_STATUS core_completion_status =
                    scic_request_get_sci_status(fw_io->parent.core_object);

   U8 response_data[SCIF_SAS_RESPONSE_DATA_LENGTH];

   SCI_STATUS                 status;
   SCI_STATUS                 core_status;

   SCIF_LOG_TRACE((
      sci_base_object_get_logger(fw_controller),
      SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_IO_REQUEST,
      "scif_sas_controller_ready_complete_high_priority_io_handler(0x%x, 0x%x, 0x%x) enter\n",
      controller, remote_device, io_request
   ));

   // In high priority path, we ask the core to finish IO request before framework.

   // retrieve and save io response from core now.
   memcpy(response_data,
          scic_io_request_get_response_iu_address(fw_io->parent.core_object),
          SCIF_SAS_RESPONSE_DATA_LENGTH
         );

   core_status = scic_controller_complete_io(
                    fw_controller->core_object,
                    fw_device->core_object,
                    fw_io->parent.core_object
                 );

   fw_io->parent.state_handlers->destruct_handler(&fw_io->parent.parent);
   status = fw_device->domain->state_handlers->complete_high_priority_io_handler(
               &fw_device->domain->parent,
               remote_device,
               io_request,
               (void *)response_data,
               core_completion_status
            );

   if (status == SCI_SUCCESS)
      status = core_status;

   if (status == SCI_SUCCESS)
   {
       //issue DPC to start next internal io in high prioriy queue.
      if( !sci_pool_empty(fw_controller->hprq.pool) )
         scif_cb_start_internal_io_task_schedule(
            fw_controller,
            scif_sas_controller_start_high_priority_io,
            fw_controller
         );
   }
   else
   {
      SCIF_LOG_WARNING((
         sci_base_object_get_logger(fw_controller),
         SCIF_LOG_OBJECT_CONTROLLER,
         "Controller:0x%x IORequest:0x%x Status:0x%x CoreStatus:0x%x "
         "failure to complete IO\n",
         fw_controller, fw_io, status, core_status
      ));
   }

   return status;
}
/**
 * @brief This method provides READY state specific handling for
 *        when a user attempts to complete a high priority IO request.
 *
 * @param[in]  controller This parameter specifies the controller object
 *             on which the user is attempting to perform a complete IO
 *             operation.
 * @param[in]  remote_device This parameter specifies the remote deivce
 *             object on which the user is attempting to perform a start IO
 *             operation.
 * @param[in]  io_request This parameter specifies the IO request to be
 *             started.
 *
 * @return This method returns an indication of whether the complete IO
 *         operation succeeded.
 * @retval SCI_SUCCESS This value is returned when the complete IO operation
 *         begins successfully.
 */
@brief This method provides READY state specific handling for
when a user attempts to complete a high priority IO request.

@param[in]  controller This parameter specifies the controller object
on which the user is attempting to perform a complete IO
operation.
@param[in]  remote_device This parameter specifies the remote deivce
object on which the user is attempting to perform a start IO
operation.
@param[in]  io_request This parameter specifies the IO request to be
started.

@return This method returns an indication of whether the complete IO
operation succeeded.
@retval SCI_SUCCESS This value is returned when the complete IO operation
begins successfully.
@brief This method provides READY state specific handling for when a user attempts to complete a high priority IO request . @param [ in ] controller This parameter specifies the controller object on which the user is attempting to perform a complete IO operation . @param [ in ] remote_device This parameter specifies the remote deivce object on which the user is attempting to perform a start IO operation . @param [ in ] io_request This parameter specifies the IO request to be started . @return This method returns an indication of whether the complete IO operation succeeded . @retval SCI_SUCCESS This value is returned when the complete IO operation begins successfully .
static
SCI_STATUS scif_sas_controller_ready_complete_high_priority_io_handler(
   SCI_BASE_CONTROLLER_T    * controller,
   SCI_BASE_REMOTE_DEVICE_T * remote_device,
   SCI_BASE_REQUEST_T       * io_request
)
{
   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_IO_REQUEST_T    * fw_io         = (SCIF_SAS_IO_REQUEST_T*)
                                              io_request;
   SCI_IO_STATUS core_completion_status =
                    scic_request_get_sci_status(fw_io->parent.core_object);
   U8 response_data[SCIF_SAS_RESPONSE_DATA_LENGTH];
   SCI_STATUS                 status;
   SCI_STATUS                 core_status;
   SCIF_LOG_TRACE((
      sci_base_object_get_logger(fw_controller),
      SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_IO_REQUEST,
      "scif_sas_controller_ready_complete_high_priority_io_handler(0x%x, 0x%x, 0x%x) enter\n",
      controller, remote_device, io_request
   ));
   memcpy(response_data,
          scic_io_request_get_response_iu_address(fw_io->parent.core_object),
          SCIF_SAS_RESPONSE_DATA_LENGTH
         );
   core_status = scic_controller_complete_io(
                    fw_controller->core_object,
                    fw_device->core_object,
                    fw_io->parent.core_object
                 );
   fw_io->parent.state_handlers->destruct_handler(&fw_io->parent.parent);
   status = fw_device->domain->state_handlers->complete_high_priority_io_handler(
               &fw_device->domain->parent,
               remote_device,
               io_request,
               (void *)response_data,
               core_completion_status
            );
   if (status == SCI_SUCCESS)
      status = core_status;
   if (status == SCI_SUCCESS)
   {
      if( !sci_pool_empty(fw_controller->hprq.pool) )
         scif_cb_start_internal_io_task_schedule(
            fw_controller,
            scif_sas_controller_start_high_priority_io,
            fw_controller
         );
   }
   else
   {
      SCIF_LOG_WARNING((
         sci_base_object_get_logger(fw_controller),
         SCIF_LOG_OBJECT_CONTROLLER,
         "Controller:0x%x IORequest:0x%x Status:0x%x CoreStatus:0x%x "
         "failure to complete IO\n",
         fw_controller, fw_io, status, core_status
      ));
   }
   return status;
}
static SCI_STATUS scif_sas_controller_ready_complete_high_priority_io_handler ( SCI_BASE_CONTROLLER_T * controller , SCI_BASE_REMOTE_DEVICE_T * remote_device , SCI_BASE_REQUEST_T * io_request ) { 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_IO_REQUEST_T * fw_io = ( SCIF_SAS_IO_REQUEST_T * ) io_request ; SCI_IO_STATUS core_completion_status = scic_request_get_sci_status ( fw_io -> parent . core_object ) ; U8 response_data [ SCIF_SAS_RESPONSE_DATA_LENGTH ] ; SCI_STATUS status ; SCI_STATUS core_status ; SCIF_LOG_TRACE ( ( sci_base_object_get_logger ( fw_controller ) , SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_IO_REQUEST , " \n " , controller , remote_device , io_request ) ) ; memcpy ( response_data , scic_io_request_get_response_iu_address ( fw_io -> parent . core_object ) , SCIF_SAS_RESPONSE_DATA_LENGTH ) ; core_status = scic_controller_complete_io ( fw_controller -> core_object , fw_device -> core_object , fw_io -> parent . core_object ) ; fw_io -> parent . state_handlers -> destruct_handler ( & fw_io -> parent . parent ) ; status = fw_device -> domain -> state_handlers -> complete_high_priority_io_handler ( & fw_device -> domain -> parent , remote_device , io_request , ( void * ) response_data , core_completion_status ) ; if ( status == SCI_SUCCESS ) status = core_status ; if ( status == SCI_SUCCESS ) { if ( ! sci_pool_empty ( fw_controller -> hprq . pool ) ) scif_cb_start_internal_io_task_schedule ( fw_controller , scif_sas_controller_start_high_priority_io , fw_controller ) ; } else { SCIF_LOG_WARNING ( ( sci_base_object_get_logger ( fw_controller ) , SCIF_LOG_OBJECT_CONTROLLER , " " " \n " , fw_controller , fw_io , status , core_status ) ) ; } return status ; }
@brief This method provides READY state specific handling for
        when a user attempts to complete a high priority IO request.
@brief This method provides READY state specific handling for when a user attempts to complete a high priority IO request .
// In high priority path, we ask the core to finish IO request before framework. // retrieve and save io response from core now. //issue DPC to start next internal io in high prioriy queue.