FreeBSD/sys/dev/isci/scil/scic_sds_stp_request.c
/**
 * @brief This method is will fill in the SCU Task Context for any type of
 *        SATA request.  This is called from the various SATA constructors.
 *
 * @pre The general io request construction is complete.
 * @pre The buffer assignment for the command buffer is complete.
 *
 * @param[in] this_request The general IO request object which is to be used
 *       in constructing the SCU task context.
 * @param[in] task_context The buffer pointer for the SCU task context which
 *       is being constructed.
 *
 * @return none
 *
 * @todo Revisit task context construction to determine what is common for
 *       SSP/SMP/STP task context structures.
 */
@brief This method is will fill in the SCU Task Context for any type of
SATA request.  This is called from the various SATA constructors.

@pre The general io request construction is complete.
@pre The buffer assignment for the command buffer is complete.

@param[in] this_request The general IO request object which is to be used
in constructing the SCU task context.
@param[in] task_context The buffer pointer for the SCU task context which
is being constructed.

@return none

@todo Revisit task context construction to determine what is common for
SSP/SMP/STP task context structures.
@brief This method is will fill in the SCU Task Context for any type of SATA request . This is called from the various SATA constructors . @pre The general io request construction is complete . @pre The buffer assignment for the command buffer is complete . @param [ in ] this_request The general IO request object which is to be used in constructing the SCU task context . @param [ in ] task_context The buffer pointer for the SCU task context which is being constructed . @return none @todo Revisit task context construction to determine what is common for SSP / SMP / STP task context structures .
void scu_sata_reqeust_construct_task_context(
   SCIC_SDS_REQUEST_T * this_request,
   SCU_TASK_CONTEXT_T * task_context
)
{
   SCI_PHYSICAL_ADDRESS      physical_address;
   SCIC_SDS_CONTROLLER_T    *owning_controller;
   SCIC_SDS_REMOTE_DEVICE_T *target_device;
   SCIC_SDS_PORT_T          *target_port;
   owning_controller = scic_sds_request_get_controller(this_request);
   target_device = scic_sds_request_get_device(this_request);
   target_port = scic_sds_request_get_port(this_request);
   task_context->abort = 0;
   task_context->priority = SCU_TASK_PRIORITY_NORMAL;
   task_context->initiator_request = 1;
   task_context->connection_rate =
      scic_remote_device_get_connection_rate(target_device);
   task_context->protocol_engine_index =
      scic_sds_controller_get_protocol_engine_group(owning_controller);
   task_context->logical_port_index =
      scic_sds_port_get_index(target_port);
   task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_STP;
   task_context->valid = SCU_TASK_CONTEXT_VALID;
   task_context->context_type = SCU_TASK_CONTEXT_TYPE;
   task_context->remote_node_index =
      scic_sds_remote_device_get_index(this_request->target_device);
   task_context->command_code = 0;
   task_context->link_layer_control = 0;
   task_context->do_not_dma_ssp_good_response = 1;
   task_context->strict_ordering = 0;
   task_context->control_frame = 0;
   task_context->timeout_enable = 0;
   task_context->block_guard_enable = 0;
   task_context->address_modifier = 0;
   task_context->task_phase = 0x01;
   task_context->ssp_command_iu_length =
      (sizeof(SATA_FIS_REG_H2D_T) - sizeof(U32)) / sizeof(U32);
   task_context->type.words[0] = *(U32 *)this_request->command_buffer;
   if (this_request->was_tag_assigned_by_user)
   {
      this_request->post_context = (
           SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC
         | (
                scic_sds_controller_get_protocol_engine_group(owning_controller)
             << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT
           )
         | (
                 scic_sds_port_get_index(target_port)
              << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT
           )
         | scic_sds_io_tag_get_index(this_request->io_tag)
      );
   }
   else
   {
      this_request->post_context = (
           SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC
         | (
               scic_sds_controller_get_protocol_engine_group(owning_controller)
            << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT
           )
         | (
                scic_sds_port_get_index(target_port)
             << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT
           )
      );
   }
   scic_cb_io_request_get_physical_address(
      scic_sds_request_get_controller(this_request),
      this_request,
      ((char *)this_request->command_buffer) + sizeof(U32),
      &physical_address
   );
   task_context->command_iu_upper =
      sci_cb_physical_address_upper(physical_address);
   task_context->command_iu_lower =
      sci_cb_physical_address_lower(physical_address);
   task_context->response_iu_upper = 0;
   task_context->response_iu_lower = 0;
}
void scu_sata_reqeust_construct_task_context ( SCIC_SDS_REQUEST_T * this_request , SCU_TASK_CONTEXT_T * task_context ) { SCI_PHYSICAL_ADDRESS physical_address ; SCIC_SDS_CONTROLLER_T * owning_controller ; SCIC_SDS_REMOTE_DEVICE_T * target_device ; SCIC_SDS_PORT_T * target_port ; owning_controller = scic_sds_request_get_controller ( this_request ) ; target_device = scic_sds_request_get_device ( this_request ) ; target_port = scic_sds_request_get_port ( this_request ) ; task_context -> abort = 0 ; task_context -> priority = SCU_TASK_PRIORITY_NORMAL ; task_context -> initiator_request = 1 ; task_context -> connection_rate = scic_remote_device_get_connection_rate ( target_device ) ; task_context -> protocol_engine_index = scic_sds_controller_get_protocol_engine_group ( owning_controller ) ; task_context -> logical_port_index = scic_sds_port_get_index ( target_port ) ; task_context -> protocol_type = SCU_TASK_CONTEXT_PROTOCOL_STP ; task_context -> valid = SCU_TASK_CONTEXT_VALID ; task_context -> context_type = SCU_TASK_CONTEXT_TYPE ; task_context -> remote_node_index = scic_sds_remote_device_get_index ( this_request -> target_device ) ; task_context -> command_code = 0 ; task_context -> link_layer_control = 0 ; task_context -> do_not_dma_ssp_good_response = 1 ; task_context -> strict_ordering = 0 ; task_context -> control_frame = 0 ; task_context -> timeout_enable = 0 ; task_context -> block_guard_enable = 0 ; task_context -> address_modifier = 0 ; task_context -> task_phase = 0x01 ; task_context -> ssp_command_iu_length = ( sizeof ( SATA_FIS_REG_H2D_T ) - sizeof ( U32 ) ) / sizeof ( U32 ) ; task_context -> type . words [ 0 ] = * ( U32 * ) this_request -> command_buffer ; if ( this_request -> was_tag_assigned_by_user ) { this_request -> post_context = ( SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | ( scic_sds_controller_get_protocol_engine_group ( owning_controller ) << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT ) | ( scic_sds_port_get_index ( target_port ) << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT ) | scic_sds_io_tag_get_index ( this_request -> io_tag ) ) ; } else { this_request -> post_context = ( SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | ( scic_sds_controller_get_protocol_engine_group ( owning_controller ) << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT ) | ( scic_sds_port_get_index ( target_port ) << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT ) ) ; } scic_cb_io_request_get_physical_address ( scic_sds_request_get_controller ( this_request ) , this_request , ( ( char * ) this_request -> command_buffer ) + sizeof ( U32 ) , & physical_address ) ; task_context -> command_iu_upper = sci_cb_physical_address_upper ( physical_address ) ; task_context -> command_iu_lower = sci_cb_physical_address_lower ( physical_address ) ; task_context -> response_iu_upper = 0 ; task_context -> response_iu_lower = 0 ; }
@brief This method is will fill in the SCU Task Context for any type of
        SATA request.
@brief This method is will fill in the SCU Task Context for any type of SATA request .
// Fill in the TC with the its required data // Set the first word of the H2D REG FIS // Build the task context now since we have already read the data // Build the task context now since we have already read the data // This is not assigned because we have to wait until we get a TCi // Copy the physical address for the command buffer to the SCU Task Context // We must offset the command buffer by 4 bytes because the first 4 bytes are // transferred in the body of the TC // SATA Requests do not have a response buffer