FreeBSD/sys/dev/isci/scil/scic_sds_smp_request.c
/**
 * @brief This method is called by the SCI user to build an SMP pass-through
 *        IO request.
 *
 * @pre
 *        - The user must have previously called scic_io_request_construct()
 *          on the supplied IO request.
 *
 * @param[in]  scic_smp_request This parameter specifies the handle to the
 *             io request object to be built.
 *
 * @param[in]  passthru_cb This parameter specifies the pointer to the callback
 *             structure that contains the function pointers
 *
 * @return Indicate if the controller successfully built the IO request.
 */
@brief This method is called by the SCI user to build an SMP pass-through
IO request.

@pre
- The user must have previously called scic_io_request_construct()
on the supplied IO request.

@param[in]  scic_smp_request This parameter specifies the handle to the
io request object to be built.

@param[in]  passthru_cb This parameter specifies the pointer to the callback
structure that contains the function pointers

@return Indicate if the controller successfully built the IO request.
@brief This method is called by the SCI user to build an SMP pass - through IO request . @pre - The user must have previously called scic_io_request_construct () on the supplied IO request . @param [ in ] scic_smp_request This parameter specifies the handle to the io request object to be built . @param [ in ] passthru_cb This parameter specifies the pointer to the callback structure that contains the function pointers @return Indicate if the controller successfully built the IO request .
SCI_STATUS scic_io_request_construct_smp_pass_through(
   SCI_IO_REQUEST_HANDLE_T  scic_smp_request,
   SCIC_SMP_PASSTHRU_REQUEST_CALLBACKS_T *passthru_cb
)
{
   SMP_REQUEST_T smp_request;
   U8 * request_buffer;
   U32 request_buffer_length_in_bytes;
   SCIC_SDS_REQUEST_T *this_request = (SCIC_SDS_REQUEST_T *) scic_smp_request;
   SCIC_LOG_TRACE((
      sci_base_object_get_logger(this_request),
      SCIC_LOG_OBJECT_SMP_IO_REQUEST,
      "scic_io_request_construct_smp_pass_through(0x%x) enter\n",
      this_request
   ));
   this_request->protocol                     = SCIC_SMP_PROTOCOL;
   this_request->has_started_substate_machine = TRUE;
   request_buffer_length_in_bytes = passthru_cb->scic_cb_smp_passthru_get_request (
                                       (void *)this_request,
                                       &request_buffer
                                    );
   memcpy((char *)&smp_request.request.vendor_specific_request,
        request_buffer,
        request_buffer_length_in_bytes);
   smp_request.header.request_length = (U8) (request_buffer_length_in_bytes / sizeof (U32));
   smp_request.header.smp_frame_type = passthru_cb->scic_cb_smp_passthru_get_frame_type ((void *)this_request);
   smp_request.header.function = passthru_cb->scic_cb_smp_passthru_get_function ((void *)this_request);
   smp_request.header.allocated_response_length = passthru_cb->scic_cb_smp_passthru_get_allocated_response_length((void *)this_request);
   sci_base_state_machine_construct(
      &this_request->started_substate_machine,
      &this_request->parent.parent,
      scic_sds_smp_request_started_substate_table,
      SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE
   );
   scu_smp_request_construct_task_context (this_request, &smp_request);
   sci_base_state_machine_change_state(
      &this_request->parent.state_machine,
      SCI_BASE_REQUEST_STATE_CONSTRUCTED
   );
   return SCI_SUCCESS;
}
SCI_STATUS scic_io_request_construct_smp_pass_through ( SCI_IO_REQUEST_HANDLE_T scic_smp_request , SCIC_SMP_PASSTHRU_REQUEST_CALLBACKS_T * passthru_cb ) { SMP_REQUEST_T smp_request ; U8 * request_buffer ; U32 request_buffer_length_in_bytes ; SCIC_SDS_REQUEST_T * this_request = ( SCIC_SDS_REQUEST_T * ) scic_smp_request ; SCIC_LOG_TRACE ( ( sci_base_object_get_logger ( this_request ) , SCIC_LOG_OBJECT_SMP_IO_REQUEST , " \n " , this_request ) ) ; this_request -> protocol = SCIC_SMP_PROTOCOL ; this_request -> has_started_substate_machine = TRUE ; request_buffer_length_in_bytes = passthru_cb -> scic_cb_smp_passthru_get_request ( ( void * ) this_request , & request_buffer ) ; memcpy ( ( char * ) & smp_request . request . vendor_specific_request , request_buffer , request_buffer_length_in_bytes ) ; smp_request . header . request_length = ( U8 ) ( request_buffer_length_in_bytes / sizeof ( U32 ) ) ; smp_request . header . smp_frame_type = passthru_cb -> scic_cb_smp_passthru_get_frame_type ( ( void * ) this_request ) ; smp_request . header . function = passthru_cb -> scic_cb_smp_passthru_get_function ( ( void * ) this_request ) ; smp_request . header . allocated_response_length = passthru_cb -> scic_cb_smp_passthru_get_allocated_response_length ( ( void * ) this_request ) ; sci_base_state_machine_construct ( & this_request -> started_substate_machine , & this_request -> parent . parent , scic_sds_smp_request_started_substate_table , SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE ) ; scu_smp_request_construct_task_context ( this_request , & smp_request ) ; sci_base_state_machine_change_state ( & this_request -> parent . state_machine , SCI_BASE_REQUEST_STATE_CONSTRUCTED ) ; return SCI_SUCCESS ; }
@brief This method is called by the SCI user to build an SMP pass-through
        IO request.
@brief This method is called by the SCI user to build an SMP pass - through IO request .
// Call the callback function to retrieve the SMP passthrough request //copy the request to smp request //the header length in smp_request is in dwords - the sas spec has similar way, //but the csmi header contains the number of bytes, so we need to convert the //number of bytes to number of dwords //Grab the other needed fields from the smp request using callbacks // Construct the started sub-state machine. // Construct the SMP SCU Task Context