FreeBSD/sys/dev/isci/scil/scic_sds_smp_request.c
/**
 * @brief This method will fill in the SCU Task Context for a SMP request. The
 *        following important settings are utilized:
 *
 *          -# task_type == SCU_TASK_TYPE_SMP.  This simply indicates
 *             that a normal request type (i.e. non-raw frame) is being
 *             utilized to perform task management.
 *          -# control_frame == 1.  This ensures that the proper endianness
 *             is set so that the bytes are transmitted in the right order
 *             for a smp request frame.
 *
 * @param[in] this_request This parameter specifies the smp request object
 *            being constructed.
 *
 * @return none
 */
@brief This method will fill in the SCU Task Context for a SMP request. The
following important settings are utilized.



@param[in] this_request This parameter specifies the smp request object
being constructed.

@return none
@brief This method will fill in the SCU Task Context for a SMP request . The following important settings are utilized . @param [ in ] this_request This parameter specifies the smp request object being constructed . @return none
void scu_smp_request_construct_task_context(
   SCIC_SDS_REQUEST_T *this_request,
   SMP_REQUEST_T      *smp_request
)
{
   SCI_PHYSICAL_ADDRESS      physical_address;
   SCIC_SDS_CONTROLLER_T    *owning_controller;
   SCIC_SDS_REMOTE_DEVICE_T *target_device;
   SCIC_SDS_PORT_T          *target_port;
   SCU_TASK_CONTEXT_T *task_context;
   scic_word_copy_with_swap(
      this_request->command_buffer,
      (U32*) smp_request,
      sizeof(SMP_REQUEST_T)/sizeof(U32)
   );
   task_context = scic_sds_request_get_task_context(this_request);
   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);
   SCIC_LOG_TRACE((
      sci_base_object_get_logger(this_request),
      SCIC_LOG_OBJECT_SMP_IO_REQUEST,
      "scu_smp_request_construct_task_context(0x%x) contents\n"
      "   reqlen=%x; function=%x;\n",
      this_request,
      smp_request->header.request_length,
      smp_request->header.function
   ));
   task_context->priority = 0;
   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_SMP;
   task_context->abort = 0;
   task_context->valid = SCU_TASK_CONTEXT_VALID;
   task_context->context_type = SCU_TASK_CONTEXT_TYPE;
   task_context->remote_node_index = this_request->target_device->rnc->remote_node_index;
   task_context->command_code = 0;
   task_context->task_type = SCU_TASK_TYPE_SMP_REQUEST;
   task_context->link_layer_control = 0;
   task_context->do_not_dma_ssp_good_response = 1;
   task_context->strict_ordering = 0;
   task_context->control_frame = 1;
   task_context->timeout_enable = 0;
   task_context->block_guard_enable = 0;
   task_context->address_modifier = 0;
   task_context->ssp_command_iu_length = smp_request->header.request_length;
   task_context->transfer_length_bytes = 0;
   memcpy((void *)(&task_context->type.smp), this_request->command_buffer, sizeof(U32) );
   task_context->task_phase = 0;
   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_smp_request_construct_task_context ( SCIC_SDS_REQUEST_T * this_request , SMP_REQUEST_T * smp_request ) { SCI_PHYSICAL_ADDRESS physical_address ; SCIC_SDS_CONTROLLER_T * owning_controller ; SCIC_SDS_REMOTE_DEVICE_T * target_device ; SCIC_SDS_PORT_T * target_port ; SCU_TASK_CONTEXT_T * task_context ; scic_word_copy_with_swap ( this_request -> command_buffer , ( U32 * ) smp_request , sizeof ( SMP_REQUEST_T ) / sizeof ( U32 ) ) ; task_context = scic_sds_request_get_task_context ( this_request ) ; 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 ) ; SCIC_LOG_TRACE ( ( sci_base_object_get_logger ( this_request ) , SCIC_LOG_OBJECT_SMP_IO_REQUEST , " \n " " \n " , this_request , smp_request -> header . request_length , smp_request -> header . function ) ) ; task_context -> priority = 0 ; 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_SMP ; task_context -> abort = 0 ; task_context -> valid = SCU_TASK_CONTEXT_VALID ; task_context -> context_type = SCU_TASK_CONTEXT_TYPE ; task_context -> remote_node_index = this_request -> target_device -> rnc -> remote_node_index ; task_context -> command_code = 0 ; task_context -> task_type = SCU_TASK_TYPE_SMP_REQUEST ; task_context -> link_layer_control = 0 ; task_context -> do_not_dma_ssp_good_response = 1 ; task_context -> strict_ordering = 0 ; task_context -> control_frame = 1 ; task_context -> timeout_enable = 0 ; task_context -> block_guard_enable = 0 ; task_context -> address_modifier = 0 ; task_context -> ssp_command_iu_length = smp_request -> header . request_length ; task_context -> transfer_length_bytes = 0 ; memcpy ( ( void * ) ( & task_context -> type . smp ) , this_request -> command_buffer , sizeof ( U32 ) ) ; task_context -> task_phase = 0 ; 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 will fill in the SCU Task Context for a SMP request.
@brief This method will fill in the SCU Task Context for a SMP request .
//byte swap the smp request. // Fill in the TC with the its required data // 00h //04h //08h //0ch //10h //14h //18h ~ 30h, protocol specific // since commandIU has been build by framework at this point, we just // copy the frist DWord from command IU to this location. //40h // "For SMP you could program it to zero. We would prefer that way so that // done code will be consistent." - Venki // 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 // command buffer should not contain command header. //SMP response comes as UF, so no need to set response IU address.