FreeBSD/sys/dev/isci/scil/scif_sas_remote_device_state_handlers.c
/**
 * @brief This method provides STOPPED state specific handling for
 *        when the user attempts to destruct the remote device.
 *
 * @param[in]  remote_device This parameter specifies the remote device
 *             object for which the framework is attempting to start.
 *
 * @return This method returns an indication as to whether the destruct
 *         operation completed successfully.
 */
@brief This method provides STOPPED state specific handling for
when the user attempts to destruct the remote device.

@param[in]  remote_device This parameter specifies the remote device
object for which the framework is attempting to start.

@return This method returns an indication as to whether the destruct
operation completed successfully.
@brief This method provides STOPPED state specific handling for when the user attempts to destruct the remote device . @param [ in ] remote_device This parameter specifies the remote device object for which the framework is attempting to start . @return This method returns an indication as to whether the destruct operation completed successfully .
static
SCI_STATUS scif_sas_remote_device_stopped_destruct_handler(
   SCI_BASE_REMOTE_DEVICE_T * remote_device
)
{
   SCI_STATUS                 status;
   SCIF_SAS_REMOTE_DEVICE_T * fw_device = (SCIF_SAS_REMOTE_DEVICE_T *)
                                          remote_device;
   SMP_DISCOVER_RESPONSE_PROTOCOLS_T  dev_protocols;
   scic_remote_device_get_protocols(fw_device->core_object, &dev_protocols);
   if(dev_protocols.u.bits.attached_smp_target)
      scif_sas_smp_remote_device_removed(fw_device);
   status = scic_remote_device_destruct(fw_device->core_object);
   if (status == SCI_SUCCESS)
   {
      sci_base_state_machine_change_state(
         &fw_device->parent.state_machine, SCI_BASE_REMOTE_DEVICE_STATE_FINAL
      );
      scif_sas_remote_device_deinitialize_state_logging(fw_device);
   }
   else
   {
      SCIF_LOG_ERROR((
         sci_base_object_get_logger(fw_device),
         SCIF_LOG_OBJECT_REMOTE_DEVICE | SCIF_LOG_OBJECT_REMOTE_DEVICE_CONFIG,
         "Device:0x%x Status:0x%x failed to destruct core device\n",
         fw_device
      ));
   }
   return status;
}
static SCI_STATUS scif_sas_remote_device_stopped_destruct_handler ( SCI_BASE_REMOTE_DEVICE_T * remote_device ) { SCI_STATUS status ; SCIF_SAS_REMOTE_DEVICE_T * fw_device = ( SCIF_SAS_REMOTE_DEVICE_T * ) remote_device ; SMP_DISCOVER_RESPONSE_PROTOCOLS_T dev_protocols ; scic_remote_device_get_protocols ( fw_device -> core_object , & dev_protocols ) ; if ( dev_protocols . u . bits . attached_smp_target ) scif_sas_smp_remote_device_removed ( fw_device ) ; status = scic_remote_device_destruct ( fw_device -> core_object ) ; if ( status == SCI_SUCCESS ) { sci_base_state_machine_change_state ( & fw_device -> parent . state_machine , SCI_BASE_REMOTE_DEVICE_STATE_FINAL ) ; scif_sas_remote_device_deinitialize_state_logging ( fw_device ) ; } else { SCIF_LOG_ERROR ( ( sci_base_object_get_logger ( fw_device ) , SCIF_LOG_OBJECT_REMOTE_DEVICE | SCIF_LOG_OBJECT_REMOTE_DEVICE_CONFIG , " \n " , fw_device ) ) ; } return status ; }
@brief This method provides STOPPED state specific handling for
        when the user attempts to destruct the remote device.
@brief This method provides STOPPED state specific handling for when the user attempts to destruct the remote device .
//For smp device, need to clear its smp phy list first.