FreeBSD/sys/dev/isci/scil/scic_sds_stp_request.c
/**
 * This method processes frames received from the target while waiting
 * for a device to host register FIS.  If a non-register FIS is received
 * during this time, it is treated as a protocol violation from an
 * IO perspective.
 *
 * @param[in] request This parameter specifies the request for which a
 *            frame has been received.
 * @param[in] frame_index This parameter specifies the index of the frame
 *            that has been received.
 *
 * @return Indicate if the received frame was processed successfully.
 */
This method processes frames received from the target while waiting
for a device to host register FIS.  If a non-register FIS is received
during this time, it is treated as a protocol violation from an
IO perspective.

@param[in] request This parameter specifies the request for which a
frame has been received.
@param[in] frame_index This parameter specifies the index of the frame
that has been received.

@return Indicate if the received frame was processed successfully.
This method processes frames received from the target while waiting for a device to host register FIS . If a non - register FIS is received during this time it is treated as a protocol violation from an IO perspective . @param [ in ] request This parameter specifies the request for which a frame has been received . @param [ in ] frame_index This parameter specifies the index of the frame that has been received . @return Indicate if the received frame was processed successfully .
static
SCI_STATUS scic_sds_stp_request_soft_reset_await_d2h_frame_handler(
   SCIC_SDS_REQUEST_T * request,
   U32                  frame_index
)
{
   SCI_STATUS               status;
   SATA_FIS_HEADER_T      * frame_header;
   U32                    * frame_buffer;
   SCIC_SDS_STP_REQUEST_T * this_request = (SCIC_SDS_STP_REQUEST_T *)request;
   SCIC_SDS_CONTROLLER_T  * owning_controller = this_request->parent.owning_controller;
   SCIC_LOG_TRACE((
      sci_base_object_get_logger(this_request),
      SCIC_LOG_OBJECT_STP_IO_REQUEST,
      "scic_sds_stp_request_soft_reset_await_d2h_frame_handler(0x%x, 0x%x) enter\n",
      this_request, frame_index
   ));
   status = scic_sds_unsolicited_frame_control_get_header(
               &(owning_controller->uf_control),
               frame_index,
               (void**) &frame_header
            );
   if (status == SCI_SUCCESS)
   {
      switch (frame_header->fis_type)
      {
      case SATA_FIS_TYPE_REGD2H:
         scic_sds_unsolicited_frame_control_get_buffer(
            &(owning_controller->uf_control),
            frame_index,
            (void**) &frame_buffer
         );
         scic_sds_controller_copy_sata_response(
            &this_request->d2h_reg_fis, (U32 *)frame_header, frame_buffer
         );
         scic_sds_request_set_status(
            &this_request->parent,
            SCU_TASK_DONE_CHECK_RESPONSE,
            SCI_FAILURE_IO_RESPONSE_VALID
         );
         break;
      default:
         SCIC_LOG_WARNING((
            sci_base_object_get_logger(this_request),
            SCIC_LOG_OBJECT_STP_IO_REQUEST,
            "IO Request:0x%x Frame Id:%d protocol violation occurred\n",
            this_request, frame_index
         ));
         scic_sds_request_set_status(
            &this_request->parent,
            SCU_TASK_DONE_UNEXP_FIS,
            SCI_FAILURE_PROTOCOL_VIOLATION
         );
         break;
      }
      sci_base_state_machine_change_state(
         &this_request->parent.parent.state_machine,
         SCI_BASE_REQUEST_STATE_COMPLETED
      );
      scic_sds_controller_release_frame(
         owning_controller, frame_index
      );
   }
   else
   {
      SCIC_LOG_ERROR((
         sci_base_object_get_logger(this_request),
         SCIC_LOG_OBJECT_STP_IO_REQUEST,
         "SCIC IO Request 0x%x could not get frame header for frame index %d, status %x\n",
         this_request, frame_index, status
      ));
   }
   return status;
}
static SCI_STATUS scic_sds_stp_request_soft_reset_await_d2h_frame_handler ( SCIC_SDS_REQUEST_T * request , U32 frame_index ) { SCI_STATUS status ; SATA_FIS_HEADER_T * frame_header ; U32 * frame_buffer ; SCIC_SDS_STP_REQUEST_T * this_request = ( SCIC_SDS_STP_REQUEST_T * ) request ; SCIC_SDS_CONTROLLER_T * owning_controller = this_request -> parent . owning_controller ; SCIC_LOG_TRACE ( ( sci_base_object_get_logger ( this_request ) , SCIC_LOG_OBJECT_STP_IO_REQUEST , " \n " , this_request , frame_index ) ) ; status = scic_sds_unsolicited_frame_control_get_header ( & ( owning_controller -> uf_control ) , frame_index , ( void * * ) & frame_header ) ; if ( status == SCI_SUCCESS ) { switch ( frame_header -> fis_type ) { case SATA_FIS_TYPE_REGD2H : scic_sds_unsolicited_frame_control_get_buffer ( & ( owning_controller -> uf_control ) , frame_index , ( void * * ) & frame_buffer ) ; scic_sds_controller_copy_sata_response ( & this_request -> d2h_reg_fis , ( U32 * ) frame_header , frame_buffer ) ; scic_sds_request_set_status ( & this_request -> parent , SCU_TASK_DONE_CHECK_RESPONSE , SCI_FAILURE_IO_RESPONSE_VALID ) ; break ; default : SCIC_LOG_WARNING ( ( sci_base_object_get_logger ( this_request ) , SCIC_LOG_OBJECT_STP_IO_REQUEST , " \n " , this_request , frame_index ) ) ; scic_sds_request_set_status ( & this_request -> parent , SCU_TASK_DONE_UNEXP_FIS , SCI_FAILURE_PROTOCOL_VIOLATION ) ; break ; } sci_base_state_machine_change_state ( & this_request -> parent . parent . state_machine , SCI_BASE_REQUEST_STATE_COMPLETED ) ; scic_sds_controller_release_frame ( owning_controller , frame_index ) ; } else { SCIC_LOG_ERROR ( ( sci_base_object_get_logger ( this_request ) , SCIC_LOG_OBJECT_STP_IO_REQUEST , " \n " , this_request , frame_index , status ) ) ; } return status ; }
This method processes frames received from the target while waiting
 for a device to host register FIS.
This method processes frames received from the target while waiting for a device to host register FIS .
// Save off the controller, so that we do not touch the request after it //  is completed. // The command has completed with error // Frame has been decoded return it to the controller