FreeBSD/sys/dev/isci/scil/scif_sas_smp_io_request.c
/**
 * @brief This method will allocate the internal IO request object and
 *        construct its contents based upon the supplied SMP request.
 *
 * @param[in] fw_controller This parameter specifies the controller object
 *            from which to allocate the internal IO request.
 * @param[in] fw_device This parameter specifies the remote device for
 *            which the internal IO request is destined.
 * @param[in] smp_request This parameter specifies the SMP request contents
 *            to be sent to the SMP target.
 *
 * @return void * The address of built scif sas smp request.
 */
@brief This method will allocate the internal IO request object and
construct its contents based upon the supplied SMP request.

@param[in] fw_controller This parameter specifies the controller object
from which to allocate the internal IO request.
@param[in] fw_device This parameter specifies the remote device for
which the internal IO request is destined.
@param[in] smp_request This parameter specifies the SMP request contents
to be sent to the SMP target.

@return void * The address of built scif sas smp request.
@brief This method will allocate the internal IO request object and construct its contents based upon the supplied SMP request . @param [ in ] fw_controller This parameter specifies the controller object from which to allocate the internal IO request . @param [ in ] fw_device This parameter specifies the remote device for which the internal IO request is destined . @param [ in ] smp_request This parameter specifies the SMP request contents to be sent to the SMP target . @return void * The address of built scif sas smp request .
static
void * scif_sas_smp_request_build(
   SCIF_SAS_CONTROLLER_T    * fw_controller,
   SCIF_SAS_REMOTE_DEVICE_T * fw_device,
   SMP_REQUEST_T            * smp_request,
   void                     * external_request_object,
   void                     * external_memory
)
{
   if (external_memory != NULL && external_request_object != NULL)
   {
      scif_sas_io_request_construct_smp(
         fw_controller,
         fw_device,
         external_memory,
         (char *)external_memory + sizeof(SCIF_SAS_IO_REQUEST_T),
         SCI_CONTROLLER_INVALID_IO_TAG,
         smp_request,
         external_request_object
      );
      return external_memory;
   }
   else
   {
      void * internal_io_memory;
      internal_io_memory = scif_sas_controller_allocate_internal_request(fw_controller);
      ASSERT(internal_io_memory != NULL);
      if (internal_io_memory != NULL)
      {
         scif_sas_internal_io_request_construct_smp(
            fw_controller,
            fw_device,
            internal_io_memory,
            SCI_CONTROLLER_INVALID_IO_TAG,
            smp_request
         );
      }
      else
      {
         SCIF_LOG_ERROR((
            sci_base_object_get_logger(fw_controller),
            SCIF_LOG_OBJECT_IO_REQUEST,
            "scif_sas_smp_request_build, no memory available!\n"
         ));
      }
      return internal_io_memory;
   }
}
static void * scif_sas_smp_request_build ( SCIF_SAS_CONTROLLER_T * fw_controller , SCIF_SAS_REMOTE_DEVICE_T * fw_device , SMP_REQUEST_T * smp_request , void * external_request_object , void * external_memory ) { if ( external_memory != NULL && external_request_object != NULL ) { scif_sas_io_request_construct_smp ( fw_controller , fw_device , external_memory , ( char * ) external_memory + sizeof ( SCIF_SAS_IO_REQUEST_T ) , SCI_CONTROLLER_INVALID_IO_TAG , smp_request , external_request_object ) ; return external_memory ; } else { void * internal_io_memory ; internal_io_memory = scif_sas_controller_allocate_internal_request ( fw_controller ) ; ASSERT ( internal_io_memory != NULL ) ; if ( internal_io_memory != NULL ) { scif_sas_internal_io_request_construct_smp ( fw_controller , fw_device , internal_io_memory , SCI_CONTROLLER_INVALID_IO_TAG , smp_request ) ; } else { SCIF_LOG_ERROR ( ( sci_base_object_get_logger ( fw_controller ) , SCIF_LOG_OBJECT_IO_REQUEST , " \n " ) ) ; } return internal_io_memory ; } }
@brief This method will allocate the internal IO request object and
        construct its contents based upon the supplied SMP request.
@brief This method will allocate the internal IO request object and construct its contents based upon the supplied SMP request .
//construct, only when we got valid io memory.