FreeBSD/sys/dev/isci/scil/scic_sds_controller.c
/**
 * @brief This method processes an event completion entry.  This is called
 *        from within the controller completion handler.
 *
 * @param[in] this_controller
 * @param[in] completion_entry
 *
 * @return none
 */
@brief This method processes an event completion entry.  This is called
from within the controller completion handler.



@return none
@brief This method processes an event completion entry . This is called from within the controller completion handler . @return none
static
void scic_sds_controller_event_completion(
   SCIC_SDS_CONTROLLER_T *this_controller,
   U32                   completion_entry
)
{
   U32 index;
   SCIC_SDS_REQUEST_T       *io_request;
   SCIC_SDS_REMOTE_DEVICE_T *device;
   SCIC_SDS_PHY_T           *phy;
   index = SCU_GET_COMPLETION_INDEX(completion_entry);
   switch (scu_get_event_type(completion_entry))
   {
   case SCU_EVENT_TYPE_SMU_COMMAND_ERROR:
      SCIC_LOG_ERROR((
         sci_base_object_get_logger(this_controller),
         SCIC_LOG_OBJECT_CONTROLLER,
         "SCIC Controller 0x%x received SMU command error 0x%x\n",
         this_controller, completion_entry
      ));
      break;
   case SCU_EVENT_TYPE_FATAL_MEMORY_ERROR:
       this_controller->parent.error = SCI_CONTROLLER_FATAL_MEMORY_ERROR;
       sci_base_state_machine_change_state(
          scic_sds_controller_get_base_state_machine(this_controller),
          SCI_BASE_CONTROLLER_STATE_FAILED
       );
   case SCU_EVENT_TYPE_SMU_PCQ_ERROR:
   case SCU_EVENT_TYPE_SMU_ERROR:
      SCIC_LOG_ERROR((
         sci_base_object_get_logger(this_controller),
         SCIC_LOG_OBJECT_CONTROLLER,
         "SCIC Controller 0x%x received fatal controller event 0x%x\n",
         this_controller, completion_entry
      ));
      break;
   case SCU_EVENT_TYPE_TRANSPORT_ERROR:
      io_request = this_controller->io_request_table[index];
      scic_sds_io_request_event_handler(io_request, completion_entry);
      break;
   case SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT:
      switch (scu_get_event_specifier(completion_entry))
      {
      case SCU_EVENT_SPECIFIC_SMP_RESPONSE_NO_PE:
      case SCU_EVENT_SPECIFIC_TASK_TIMEOUT:
         io_request = this_controller->io_request_table[index];
         if (io_request != SCI_INVALID_HANDLE)
         {
            scic_sds_io_request_event_handler(io_request, completion_entry);
         }
         else
         {
            SCIC_LOG_WARNING((
               sci_base_object_get_logger(this_controller),
               SCIC_LOG_OBJECT_CONTROLLER |
               SCIC_LOG_OBJECT_SMP_IO_REQUEST |
               SCIC_LOG_OBJECT_SSP_IO_REQUEST |
               SCIC_LOG_OBJECT_STP_IO_REQUEST,
               "SCIC Controller 0x%x received event 0x%x for io request object that doesnt exist.\n",
               this_controller, completion_entry
            ));
         }
         break;
      case SCU_EVENT_SPECIFIC_IT_NEXUS_TIMEOUT:
         device = this_controller->device_table[index];
         if (device != SCI_INVALID_HANDLE)
         {
            scic_sds_remote_device_event_handler(device, completion_entry);
         }
         else
         {
            SCIC_LOG_WARNING((
               sci_base_object_get_logger(this_controller),
               SCIC_LOG_OBJECT_CONTROLLER |
               SCIC_LOG_OBJECT_SMP_REMOTE_TARGET |
               SCIC_LOG_OBJECT_SSP_REMOTE_TARGET |
               SCIC_LOG_OBJECT_STP_REMOTE_TARGET,
               "SCIC Controller 0x%x received event 0x%x for remote device object that doesnt exist.\n",
               this_controller, completion_entry
            ));
         }
         break;
      }
      break;
   case SCU_EVENT_TYPE_BROADCAST_CHANGE:
   case SCU_EVENT_TYPE_ERR_CNT_EVENT:
   case SCU_EVENT_TYPE_OSSP_EVENT:
      index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry);
      phy = &this_controller->phy_table[index];
      scic_sds_phy_event_handler(phy, completion_entry);
      break;
   case SCU_EVENT_TYPE_RNC_SUSPEND_TX:
   case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX:
   case SCU_EVENT_TYPE_RNC_OPS_MISC:
      if (index < this_controller->remote_node_entries)
      {
         device = this_controller->device_table[index];
         if (device != NULL)
         {
            scic_sds_remote_device_event_handler(device, completion_entry);
         }
      }
      else
      {
         SCIC_LOG_ERROR((
            sci_base_object_get_logger(this_controller),
            SCIC_LOG_OBJECT_CONTROLLER |
            SCIC_LOG_OBJECT_SMP_REMOTE_TARGET |
            SCIC_LOG_OBJECT_SSP_REMOTE_TARGET |
            SCIC_LOG_OBJECT_STP_REMOTE_TARGET,
            "SCIC Controller 0x%x received event 0x%x for remote device object 0x%0x that doesnt exist.\n",
            this_controller, completion_entry, index
         ));
      }
      break;
   default:
      SCIC_LOG_WARNING((
         sci_base_object_get_logger(this_controller),
         SCIC_LOG_OBJECT_CONTROLLER,
         "SCIC Controller received unknown event code %x\n",
         completion_entry
      ));
      break;
   }
}
static void scic_sds_controller_event_completion ( SCIC_SDS_CONTROLLER_T * this_controller , U32 completion_entry ) { U32 index ; SCIC_SDS_REQUEST_T * io_request ; SCIC_SDS_REMOTE_DEVICE_T * device ; SCIC_SDS_PHY_T * phy ; index = SCU_GET_COMPLETION_INDEX ( completion_entry ) ; switch ( scu_get_event_type ( completion_entry ) ) { case SCU_EVENT_TYPE_SMU_COMMAND_ERROR : SCIC_LOG_ERROR ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_CONTROLLER , " \n " , this_controller , completion_entry ) ) ; break ; case SCU_EVENT_TYPE_FATAL_MEMORY_ERROR : this_controller -> parent . error = SCI_CONTROLLER_FATAL_MEMORY_ERROR ; sci_base_state_machine_change_state ( scic_sds_controller_get_base_state_machine ( this_controller ) , SCI_BASE_CONTROLLER_STATE_FAILED ) ; case SCU_EVENT_TYPE_SMU_PCQ_ERROR : case SCU_EVENT_TYPE_SMU_ERROR : SCIC_LOG_ERROR ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_CONTROLLER , " \n " , this_controller , completion_entry ) ) ; break ; case SCU_EVENT_TYPE_TRANSPORT_ERROR : io_request = this_controller -> io_request_table [ index ] ; scic_sds_io_request_event_handler ( io_request , completion_entry ) ; break ; case SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT : switch ( scu_get_event_specifier ( completion_entry ) ) { case SCU_EVENT_SPECIFIC_SMP_RESPONSE_NO_PE : case SCU_EVENT_SPECIFIC_TASK_TIMEOUT : io_request = this_controller -> io_request_table [ index ] ; if ( io_request != SCI_INVALID_HANDLE ) { scic_sds_io_request_event_handler ( io_request , completion_entry ) ; } else { SCIC_LOG_WARNING ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_CONTROLLER | SCIC_LOG_OBJECT_SMP_IO_REQUEST | SCIC_LOG_OBJECT_SSP_IO_REQUEST | SCIC_LOG_OBJECT_STP_IO_REQUEST , " \n " , this_controller , completion_entry ) ) ; } break ; case SCU_EVENT_SPECIFIC_IT_NEXUS_TIMEOUT : device = this_controller -> device_table [ index ] ; if ( device != SCI_INVALID_HANDLE ) { scic_sds_remote_device_event_handler ( device , completion_entry ) ; } else { SCIC_LOG_WARNING ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_CONTROLLER | SCIC_LOG_OBJECT_SMP_REMOTE_TARGET | SCIC_LOG_OBJECT_SSP_REMOTE_TARGET | SCIC_LOG_OBJECT_STP_REMOTE_TARGET , " \n " , this_controller , completion_entry ) ) ; } break ; } break ; case SCU_EVENT_TYPE_BROADCAST_CHANGE : case SCU_EVENT_TYPE_ERR_CNT_EVENT : case SCU_EVENT_TYPE_OSSP_EVENT : index = SCU_GET_PROTOCOL_ENGINE_INDEX ( completion_entry ) ; phy = & this_controller -> phy_table [ index ] ; scic_sds_phy_event_handler ( phy , completion_entry ) ; break ; case SCU_EVENT_TYPE_RNC_SUSPEND_TX : case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX : case SCU_EVENT_TYPE_RNC_OPS_MISC : if ( index < this_controller -> remote_node_entries ) { device = this_controller -> device_table [ index ] ; if ( device != NULL ) { scic_sds_remote_device_event_handler ( device , completion_entry ) ; } } else { SCIC_LOG_ERROR ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_CONTROLLER | SCIC_LOG_OBJECT_SMP_REMOTE_TARGET | SCIC_LOG_OBJECT_SSP_REMOTE_TARGET | SCIC_LOG_OBJECT_STP_REMOTE_TARGET , " \n " , this_controller , completion_entry , index ) ) ; } break ; default : SCIC_LOG_WARNING ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_CONTROLLER , " \n " , completion_entry ) ) ; break ; } }
@brief This method processes an event completion entry.
@brief This method processes an event completion entry .
/// @todo The driver did something wrong and we need to fix the condtion. // report fatal memory error //continue as in following events // direct the broadcast change event to the phy first and then let // the phy redirect the broadcast change to the port object // direct error counter event to the phy object since that is where // we get the event notification.  This is a type 4 event.