FreeBSD/sys/dev/isci/scil/scif_sas_controller_state_handlers.c
/**
 * @brief This method provides RESET state specific handling for
 *        when a user attempts to initialize a controller.  This is a legal
 *        state in which to attempt an initialize call.
 *
 * @param[in]  controller This parameter specifies the controller object
 *             on which the user is attempting to perform an initialize
 *             operation.
 *
 * @return This method returns an indication of whether the initialize
 *         operation succeeded.
 * @retval SCI_SUCCESS This value when the initialization completes
 *         successfully.
 */
@brief This method provides RESET state specific handling for
when a user attempts to initialize a controller.  This is a legal
state in which to attempt an initialize call.

@param[in]  controller This parameter specifies the controller object
on which the user is attempting to perform an initialize
operation.

@return This method returns an indication of whether the initialize
operation succeeded.
@retval SCI_SUCCESS This value when the initialization completes
successfully.
@brief This method provides RESET state specific handling for when a user attempts to initialize a controller . This is a legal state in which to attempt an initialize call . @param [ in ] controller This parameter specifies the controller object on which the user is attempting to perform an initialize operation . @return This method returns an indication of whether the initialize operation succeeded . @retval SCI_SUCCESS This value when the initialization completes successfully .
static
SCI_STATUS scif_sas_controller_reset_initialize_handler(
   SCI_BASE_CONTROLLER_T    * controller
)
{
   SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T *)controller;
   SCI_STATUS              status;
   U32                     index;
   SCIF_LOG_TRACE((
      sci_base_object_get_logger(fw_controller),
      SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION,
      "scif_sas_controller_reset_initialize_handler(0x%x) enter\n",
      controller
   ));
   sci_base_state_machine_change_state(
      &fw_controller->parent.state_machine,
      SCI_BASE_CONTROLLER_STATE_INITIALIZING
   );
   scif_sas_controller_build_mdl(fw_controller);
   for (index = 0; index < SCI_MAX_DOMAINS; index++)
      scif_sas_domain_initialize(&fw_controller->domains[index]);
   scif_cb_lock_associate(fw_controller, &fw_controller->hprq.lock);
   status = scic_controller_initialize(fw_controller->core_object);
   if (status == SCI_SUCCESS)
   {
      sci_base_state_machine_change_state(
         &fw_controller->parent.state_machine,
         SCI_BASE_CONTROLLER_STATE_INITIALIZED
      );
   }
   if (status != SCI_SUCCESS)
   {
      scif_sas_controller_release_resource(fw_controller);
      SCIF_LOG_ERROR((
         sci_base_object_get_logger(fw_controller),
         SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION,
         "Controller:0x%x Status:0x%x unable to successfully initialize.\n",
         fw_controller, status
      ));
   }
   return status;
}
static SCI_STATUS scif_sas_controller_reset_initialize_handler ( SCI_BASE_CONTROLLER_T * controller ) { SCIF_SAS_CONTROLLER_T * fw_controller = ( SCIF_SAS_CONTROLLER_T * ) controller ; SCI_STATUS status ; U32 index ; SCIF_LOG_TRACE ( ( sci_base_object_get_logger ( fw_controller ) , SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION , " \n " , controller ) ) ; sci_base_state_machine_change_state ( & fw_controller -> parent . state_machine , SCI_BASE_CONTROLLER_STATE_INITIALIZING ) ; scif_sas_controller_build_mdl ( fw_controller ) ; for ( index = 0 ; index < SCI_MAX_DOMAINS ; index ++ ) scif_sas_domain_initialize ( & fw_controller -> domains [ index ] ) ; scif_cb_lock_associate ( fw_controller , & fw_controller -> hprq . lock ) ; status = scic_controller_initialize ( fw_controller -> core_object ) ; if ( status == SCI_SUCCESS ) { sci_base_state_machine_change_state ( & fw_controller -> parent . state_machine , SCI_BASE_CONTROLLER_STATE_INITIALIZED ) ; } if ( status != SCI_SUCCESS ) { scif_sas_controller_release_resource ( fw_controller ) ; SCIF_LOG_ERROR ( ( sci_base_object_get_logger ( fw_controller ) , SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION , " \n " , fw_controller , status ) ) ; } return status ; }
@brief This method provides RESET state specific handling for
        when a user attempts to initialize a controller.
@brief This method provides RESET state specific handling for when a user attempts to initialize a controller .
// Perform any domain object initialization that is necessary. // Attempt to initialize the core controller. // Initialization failed, Release resources and do not change state