FreeBSD/sys/dev/isci/scil/scic_sds_controller.c
/**
 * @brief This method is a private routine for processing the completion
 *        queue entries.
 *
 * @param[in] this_controller
 *
 * @return none
 */
@brief This method is a private routine for processing the completion
queue entries.



@return none
@brief This method is a private routine for processing the completion queue entries . @return none
static
void scic_sds_controller_transitioned_process_completions(
   SCIC_SDS_CONTROLLER_T * this_controller
)
{
   U32 completion_count = 0;
   U32 completion_entry;
   U32 get_index;
   U32 get_cycle;
   U32 event_index;
   U32 event_cycle;
   SCIC_LOG_TRACE((
      sci_base_object_get_logger(this_controller),
      SCIC_LOG_OBJECT_CONTROLLER,
      "scic_sds_controller_transitioned_process_completions(0x%x) enter\n",
      this_controller
   ));
   SCIC_LOG_TRACE((
      sci_base_object_get_logger(this_controller),
      SCIC_LOG_OBJECT_COMPLETION_QUEUE,
      "completion queue beginning get : 0x%08x\n",
      this_controller->completion_queue_get
   ));
   get_index = NORMALIZE_GET_POINTER(this_controller->completion_queue_get);
   get_cycle = SMU_CQGR_CYCLE_BIT & this_controller->completion_queue_get;
   event_index = NORMALIZE_EVENT_POINTER(this_controller->completion_queue_get);
   event_cycle = SMU_CQGR_EVENT_CYCLE_BIT & this_controller->completion_queue_get;
   while (
               NORMALIZE_GET_POINTER_CYCLE_BIT(get_cycle)
            == COMPLETION_QUEUE_CYCLE_BIT(
                  this_controller->completion_queue[get_index])
         )
   {
      completion_count++;
      completion_entry = this_controller->completion_queue[get_index];
      INCREMENT_COMPLETION_QUEUE_GET(this_controller, get_index, get_cycle);
      SCIC_LOG_TRACE((
         sci_base_object_get_logger(this_controller),
         SCIC_LOG_OBJECT_COMPLETION_QUEUE,
         "completion queue entry : 0x%08x\n",
         completion_entry
      ));
      switch (SCU_GET_COMPLETION_TYPE(completion_entry))
      {
      case SCU_COMPLETION_TYPE_TASK:
         scic_sds_controller_task_completion(this_controller, completion_entry);
      break;
      case SCU_COMPLETION_TYPE_NOTIFY:
         INCREMENT_EVENT_QUEUE_GET(this_controller, event_index, event_cycle);
      case SCU_COMPLETION_TYPE_EVENT:
      case SCU_COMPLETION_TYPE_SDMA:
      case SCU_COMPLETION_TYPE_UFI:
      default:
         SCIC_LOG_WARNING((
            sci_base_object_get_logger(this_controller),
            SCIC_LOG_OBJECT_CONTROLLER,
            "SCIC Controller ignoring completion type %x\n",
            completion_entry
         ));
      break;
      }
   }
   if (completion_count > 0)
   {
      this_controller->completion_queue_get =
           SMU_CQGR_GEN_BIT(ENABLE)
         | SMU_CQGR_GEN_BIT(EVENT_ENABLE)
         | event_cycle | SMU_CQGR_GEN_VAL(EVENT_POINTER, event_index)
         | get_cycle   | SMU_CQGR_GEN_VAL(POINTER, get_index)  ;
      SMU_CQGR_WRITE(this_controller, this_controller->completion_queue_get);
   }
   SCIC_LOG_TRACE((
      sci_base_object_get_logger(this_controller),
      SCIC_LOG_OBJECT_COMPLETION_QUEUE,
      "completion queue ending get : 0x%08x\n",
      this_controller->completion_queue_get
   ));
}
static void scic_sds_controller_transitioned_process_completions ( SCIC_SDS_CONTROLLER_T * this_controller ) { U32 completion_count = 0 ; U32 completion_entry ; U32 get_index ; U32 get_cycle ; U32 event_index ; U32 event_cycle ; SCIC_LOG_TRACE ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_CONTROLLER , " \n " , this_controller ) ) ; SCIC_LOG_TRACE ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_COMPLETION_QUEUE , " \n " , this_controller -> completion_queue_get ) ) ; get_index = NORMALIZE_GET_POINTER ( this_controller -> completion_queue_get ) ; get_cycle = SMU_CQGR_CYCLE_BIT & this_controller -> completion_queue_get ; event_index = NORMALIZE_EVENT_POINTER ( this_controller -> completion_queue_get ) ; event_cycle = SMU_CQGR_EVENT_CYCLE_BIT & this_controller -> completion_queue_get ; while ( NORMALIZE_GET_POINTER_CYCLE_BIT ( get_cycle ) == COMPLETION_QUEUE_CYCLE_BIT ( this_controller -> completion_queue [ get_index ] ) ) { completion_count ++ ; completion_entry = this_controller -> completion_queue [ get_index ] ; INCREMENT_COMPLETION_QUEUE_GET ( this_controller , get_index , get_cycle ) ; SCIC_LOG_TRACE ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_COMPLETION_QUEUE , " \n " , completion_entry ) ) ; switch ( SCU_GET_COMPLETION_TYPE ( completion_entry ) ) { case SCU_COMPLETION_TYPE_TASK : scic_sds_controller_task_completion ( this_controller , completion_entry ) ; break ; case SCU_COMPLETION_TYPE_NOTIFY : INCREMENT_EVENT_QUEUE_GET ( this_controller , event_index , event_cycle ) ; case SCU_COMPLETION_TYPE_EVENT : case SCU_COMPLETION_TYPE_SDMA : case SCU_COMPLETION_TYPE_UFI : default : SCIC_LOG_WARNING ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_CONTROLLER , " \n " , completion_entry ) ) ; break ; } } if ( completion_count > 0 ) { this_controller -> completion_queue_get = SMU_CQGR_GEN_BIT ( ENABLE ) | SMU_CQGR_GEN_BIT ( EVENT_ENABLE ) | event_cycle | SMU_CQGR_GEN_VAL ( EVENT_POINTER , event_index ) | get_cycle | SMU_CQGR_GEN_VAL ( POINTER , get_index ) ; SMU_CQGR_WRITE ( this_controller , this_controller -> completion_queue_get ) ; } SCIC_LOG_TRACE ( ( sci_base_object_get_logger ( this_controller ) , SCIC_LOG_OBJECT_COMPLETION_QUEUE , " \n " , this_controller -> completion_queue_get ) ) ; }
@brief This method is a private routine for processing the completion
        queue entries.
@brief This method is a private routine for processing the completion queue entries .
// Get the component parts of the completion queue // Fall-through // Update the get register if we completed one or more entries