FreeBSD/sys/dev/isci/scil/scic_sds_stp_remote_device.c
/**
 *  This method will handle events received while the STP device is in the
 *  ready command substate.
 *
 *  @param [in] this_device This is the device object that is receiving the
 *         event.
 *  @param [in] event_code The event code to process.
 *
 *  @return SCI_STATUS
 */
This method will handle events received while the STP device is in the
ready command substate.

@param [in] this_device This is the device object that is receiving the
event.
@param [in] event_code The event code to process.


This method will handle events received while the STP device is in the ready command substate . @param [ in ] this_device This is the device object that is receiving the event . @param [ in ] event_code The event code to process .
static
SCI_STATUS scic_sds_stp_remote_device_ready_ncq_substate_event_handler(
   SCIC_SDS_REMOTE_DEVICE_T * this_device,
   U32                        event_code
)
{
   SCI_STATUS status;
   status = scic_sds_remote_device_general_event_handler(this_device, event_code);
   switch (scu_get_event_code(event_code))
   {
   case SCU_EVENT_TL_RNC_SUSPEND_TX:
   case SCU_EVENT_TL_RNC_SUSPEND_TX_RX:
      break;
   case SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_DATA_LEN_ERR:
   case SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_OFFSET_ERR:
   case SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_DMASETUP_DIERR:
   case SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_XFERCNT_ERR:
   case SCU_EVENT_TL_RNC_SUSPEND_TX_RX_DONE_PLD_LEN_ERR:
      this_device->not_ready_reason =
         SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED;
      sci_base_state_machine_change_state(
         &this_device->ready_substate_machine,
         SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR
      );
      SCIC_LOG_WARNING((
         sci_base_object_get_logger(this_device),
         SCIC_LOG_OBJECT_STP_REMOTE_TARGET,
         "SCIC Remote device 0x%x received driver suspend event %x while in ncq ready substate %d\n",
         this_device, event_code, sci_base_state_machine_get_state(&this_device->ready_substate_machine)
      ));
      status = scic_sds_remote_device_resume(this_device);
      break;
   case SCU_EVENT_POST_RCN_RELEASE:
      SCIC_LOG_INFO((
         sci_base_object_get_logger(this_device),
         SCIC_LOG_OBJECT_STP_REMOTE_TARGET,
         "SCIC Remote device 0x%x received driver release event %x while in the ready substate %d\n",
         this_device, event_code, sci_base_state_machine_get_state(&this_device->ready_substate_machine)
      ));
      break;
   default:
      SCIC_LOG_WARNING((
         sci_base_object_get_logger(this_device),
         SCIC_LOG_OBJECT_STP_REMOTE_TARGET,
         "SCIC Remote device 0x%x received driver unexpected event %x while in the ready substate %d\n",
         this_device, event_code, sci_base_state_machine_get_state(&this_device->ready_substate_machine)
      ));
      status = SCI_FAILURE_INVALID_STATE;
      break;
   }
   return status;
}
static SCI_STATUS scic_sds_stp_remote_device_ready_ncq_substate_event_handler ( SCIC_SDS_REMOTE_DEVICE_T * this_device , U32 event_code ) { SCI_STATUS status ; status = scic_sds_remote_device_general_event_handler ( this_device , event_code ) ; switch ( scu_get_event_code ( event_code ) ) { case SCU_EVENT_TL_RNC_SUSPEND_TX : case SCU_EVENT_TL_RNC_SUSPEND_TX_RX : break ; case SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_DATA_LEN_ERR : case SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_OFFSET_ERR : case SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_DMASETUP_DIERR : case SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_XFERCNT_ERR : case SCU_EVENT_TL_RNC_SUSPEND_TX_RX_DONE_PLD_LEN_ERR : this_device -> not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED ; sci_base_state_machine_change_state ( & this_device -> ready_substate_machine , SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR ) ; SCIC_LOG_WARNING ( ( sci_base_object_get_logger ( this_device ) , SCIC_LOG_OBJECT_STP_REMOTE_TARGET , " \n " , this_device , event_code , sci_base_state_machine_get_state ( & this_device -> ready_substate_machine ) ) ) ; status = scic_sds_remote_device_resume ( this_device ) ; break ; case SCU_EVENT_POST_RCN_RELEASE : SCIC_LOG_INFO ( ( sci_base_object_get_logger ( this_device ) , SCIC_LOG_OBJECT_STP_REMOTE_TARGET , " \n " , this_device , event_code , sci_base_state_machine_get_state ( & this_device -> ready_substate_machine ) ) ) ; break ; default : SCIC_LOG_WARNING ( ( sci_base_object_get_logger ( this_device ) , SCIC_LOG_OBJECT_STP_REMOTE_TARGET , " \n " , this_device , event_code , sci_base_state_machine_get_state ( & this_device -> ready_substate_machine ) ) ) ; status = SCI_FAILURE_INVALID_STATE ; break ; } return status ; }
This method will handle events received while the STP device is in the
  ready command substate.
This method will handle events received while the STP device is in the ready command substate .
/// @todo We need to decode and understand why the hardware suspended the device. ///       The suspension reason was probably due to an SDB error FIS received. // We have a notification that the driver requested a suspend operation // this should not happen. // Since we didn't expect to get here start the device again. /// @todo Do we need to store the suspend state on the device? // Some other event just log it and continue