Exemplo n.º 1
0
// ----------------------------------------------------------------------------
U32 scif_io_request_get_number_of_bytes_transferred(
   SCI_IO_REQUEST_HANDLE_T  scif_io_request
)
{
   SCIF_SAS_IO_REQUEST_T * fw_request = (SCIF_SAS_IO_REQUEST_T*) scif_io_request;

   if(scic_io_request_get_protocol(scif_io_request_get_scic_handle(scif_io_request))
       == SCIC_STP_PROTOCOL)
   {
      U16 sati_data_bytes_set =
             sati_get_number_data_bytes_set(&(fw_request->parent.stp.sequence));

      if (sati_data_bytes_set != 0)
         return sati_data_bytes_set;
      else
      {
#if !defined(DISABLE_ATAPI)
         U8 sat_protocol = fw_request->parent.stp.sequence.protocol;
         if ( sat_protocol & SAT_PROTOCOL_PACKET)
            return
               scif_sas_stp_packet_io_request_get_number_of_bytes_transferred(fw_request);
         else
#endif
            return scic_io_request_get_number_of_bytes_transferred(
                      scif_io_request_get_scic_handle(scif_io_request));
      }
   }
   else
   {
      return scic_io_request_get_number_of_bytes_transferred(
                scif_io_request_get_scic_handle(scif_io_request));
   }
}
Exemplo n.º 2
0
static SCI_STATUS
isci_smp_request_construct(struct ISCI_IO_REQUEST *request)
{
	SCI_STATUS status;
	SCIC_SMP_PASSTHRU_REQUEST_CALLBACKS_T callbacks;

	status = scif_request_construct(request->parent.controller_handle,
	    request->parent.remote_device_handle, SCI_CONTROLLER_INVALID_IO_TAG,
	    (void *)request,
	    (void *)((char*)request + sizeof(struct ISCI_IO_REQUEST)),
	    &request->sci_object);

	if (status == SCI_SUCCESS) {
		callbacks.scic_cb_smp_passthru_get_request =
		    &smp_io_request_cb_get_request_buffer;
		callbacks.scic_cb_smp_passthru_get_function =
		    &smp_io_request_cb_get_function;
		callbacks.scic_cb_smp_passthru_get_frame_type =
		    &smp_io_request_cb_get_frame_type;
		callbacks.scic_cb_smp_passthru_get_allocated_response_length =
		    &smp_io_request_cb_get_allocated_response_length;

		/* create the smp passthrough part of the io request */
		status = scic_io_request_construct_smp_pass_through(
		    scif_io_request_get_scic_handle(request->sci_object),
		    &callbacks);
	}

	return (status);
}
Exemplo n.º 3
0
/**
 * @brief This method will get the number of bytes transferred in an packet IO.
 *
 * @param[in] fw_io This parameter specifies the stp packet io request whose
 *                     actual transferred length is to be retrieved.
 *
 * @return Actual length of transferred data.
 */
U32 scif_sas_stp_packet_io_request_get_number_of_bytes_transferred(
   SCIF_SAS_IO_REQUEST_T * fw_io
)
{
   SCI_IO_REQUEST_HANDLE_T scic_io = scif_io_request_get_scic_handle(fw_io);
   SCI_IO_STATUS io_status = scic_request_get_sci_status (scic_io);
   U32 actual_data_length;

   if (io_status == SCI_IO_FAILURE_RESPONSE_VALID)
       actual_data_length = 0;
   else if (io_status == SCI_IO_SUCCESS_IO_DONE_EARLY)
   {
      actual_data_length = sati_atapi_translate_number_of_bytes_transferred(
         &fw_io->parent.stp.sequence, fw_io, fw_io);

      if (actual_data_length == 0)
         actual_data_length =
            scic_io_request_get_number_of_bytes_transferred(scic_io);
   }
   else
      actual_data_length =
         scic_io_request_get_number_of_bytes_transferred(scic_io);

   return actual_data_length;
}