linux/drivers/scsi/isci/request.c

/*
 * This file is provided under a dual BSD/GPLv2 license.  When using or
 * redistributing this file, you may do so under either license.
 *
 * GPL LICENSE SUMMARY
 *
 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 * The full GNU General Public License is included in this distribution
 * in the file called LICENSE.GPL.
 *
 * BSD LICENSE
 *
 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *   * Neither the name of Intel Corporation nor the names of its
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <scsi/scsi_cmnd.h>
#include "isci.h"
#include "task.h"
#include "request.h"
#include "scu_completion_codes.h"
#include "scu_event_codes.h"
#include "sas.h"

#undef C
#define C
const char *req_state_name(enum sci_base_request_states state)
{}
#undef C

static struct scu_sgl_element_pair *to_sgl_element_pair(struct isci_request *ireq,
							int idx)
{}

static dma_addr_t to_sgl_element_pair_dma(struct isci_host *ihost,
					  struct isci_request *ireq, u32 idx)
{}

static void init_sgl_element(struct scu_sgl_element *e, struct scatterlist *sg)
{}

static void sci_request_build_sgl(struct isci_request *ireq)
{}

static void sci_io_request_build_ssp_command_iu(struct isci_request *ireq)
{}

static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq)
{}

/*
 * This method is will fill in the SCU Task Context for any type of SSP request.
 */
static void scu_ssp_request_construct_task_context(
	struct isci_request *ireq,
	struct scu_task_context *task_context)
{}

static u8 scu_bg_blk_size(struct scsi_device *sdp)
{}

static u32 scu_dif_bytes(u32 len, u32 sector_size)
{}

static void scu_ssp_ireq_dif_insert(struct isci_request *ireq, u8 type, u8 op)
{}

static void scu_ssp_ireq_dif_strip(struct isci_request *ireq, u8 type, u8 op)
{}

/*
 * This method is will fill in the SCU Task Context for a SSP IO request.
 */
static void scu_ssp_io_request_construct_task_context(struct isci_request *ireq,
						      enum dma_data_direction dir,
						      u32 len)
{}

/**
 * scu_ssp_task_request_construct_task_context() - This method will fill in
 *    the SCU Task Context for a SSP Task request.  The following important
 *    settings are utilized: -# priority == SCU_TASK_PRIORITY_HIGH.  This
 *    ensures that the task request is issued ahead of other task destined
 *    for the same Remote Node. -# task_type == SCU_TASK_TYPE_IOREAD.  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 task frame.
 * @ireq: This parameter specifies the task request object being constructed.
 */
static void scu_ssp_task_request_construct_task_context(struct isci_request *ireq)
{}

/**
 * scu_sata_request_construct_task_context()
 * This method is will fill in the SCU Task Context for any type of SATA
 *    request.  This is called from the various SATA constructors.
 * @ireq: The general IO request object which is to be used in
 *    constructing the SCU task context.
 * @task_context: The buffer pointer for the SCU task context which is being
 *    constructed.
 *
 * The general io request construction is complete. The buffer assignment for
 * the command buffer is complete. none Revisit task context construction to
 * determine what is common for SSP/SMP/STP task context structures.
 */
static void scu_sata_request_construct_task_context(
	struct isci_request *ireq,
	struct scu_task_context *task_context)
{}

static void scu_stp_raw_request_construct_task_context(struct isci_request *ireq)
{}

static enum sci_status sci_stp_pio_request_construct(struct isci_request *ireq,
							  bool copy_rx_frame)
{}

/*
 * sci_stp_optimized_request_construct()
 * @ireq: This parameter specifies the request to be constructed as an
 *    optimized request.
 * @optimized_task_type: This parameter specifies whether the request is to be
 *    an UDMA request or a NCQ request. - A value of 0 indicates UDMA. - A
 *    value of 1 indicates NCQ.
 *
 * This method will perform request construction common to all types of STP
 * requests that are optimized by the silicon (i.e. UDMA, NCQ). This method
 * returns an indication as to whether the construction was successful.
 */
static void sci_stp_optimized_request_construct(struct isci_request *ireq,
						     u8 optimized_task_type,
						     u32 len,
						     enum dma_data_direction dir)
{}

static void sci_atapi_construct(struct isci_request *ireq)
{}

static enum sci_status
sci_io_request_construct_sata(struct isci_request *ireq,
			       u32 len,
			       enum dma_data_direction dir,
			       bool copy)
{}

static enum sci_status sci_io_request_construct_basic_ssp(struct isci_request *ireq)
{}

void sci_task_request_construct_ssp(struct isci_request *ireq)
{}

static enum sci_status sci_io_request_construct_basic_sata(struct isci_request *ireq)
{}

#define SCU_TASK_CONTEXT_SRAM
/**
 * sci_req_tx_bytes - bytes transferred when reply underruns request
 * @ireq: request that was terminated early
 */
static u32 sci_req_tx_bytes(struct isci_request *ireq)
{}

enum sci_status sci_request_start(struct isci_request *ireq)
{}

enum sci_status
sci_io_request_terminate(struct isci_request *ireq)
{}

enum sci_status sci_request_complete(struct isci_request *ireq)
{}

enum sci_status sci_io_request_event_handler(struct isci_request *ireq,
						  u32 event_code)
{}

/*
 * This function copies response data for requests returning response data
 *    instead of sense data.
 * @sci_req: This parameter specifies the request object for which to copy
 *    the response data.
 */
static void sci_io_request_copy_response(struct isci_request *ireq)
{}

static enum sci_status
request_started_state_tc_event(struct isci_request *ireq,
			       u32 completion_code)
{}

static enum sci_status
request_aborting_state_tc_event(struct isci_request *ireq,
				u32 completion_code)
{}

static enum sci_status ssp_task_request_await_tc_event(struct isci_request *ireq,
						       u32 completion_code)
{}

static enum sci_status
smp_request_await_response_tc_event(struct isci_request *ireq,
				    u32 completion_code)
{}

static enum sci_status
smp_request_await_tc_event(struct isci_request *ireq,
			   u32 completion_code)
{}

static struct scu_sgl_element *pio_sgl_next(struct isci_stp_request *stp_req)
{}

static enum sci_status
stp_request_non_data_await_h2d_tc_event(struct isci_request *ireq,
					u32 completion_code)
{}

#define SCU_MAX_FRAME_BUFFER_SIZE

/* transmit DATA_FIS from (current sgl + offset) for input
 * parameter length. current sgl and offset is alreay stored in the IO request
 */
static enum sci_status sci_stp_request_pio_data_out_trasmit_data_frame(
	struct isci_request *ireq,
	u32 length)
{}

static enum sci_status sci_stp_request_pio_data_out_transmit_data(struct isci_request *ireq)
{}

/**
 * sci_stp_request_pio_data_in_copy_data_buffer()
 * @stp_req: The request that is used for the SGL processing.
 * @data_buf: The buffer of data to be copied.
 * @len: The length of the data transfer.
 *
 * Copy the data from the buffer for the length specified to the IO request SGL
 * specified data region. enum sci_status
 */
static enum sci_status
sci_stp_request_pio_data_in_copy_data_buffer(struct isci_stp_request *stp_req,
					     u8 *data_buf, u32 len)
{}

/**
 * sci_stp_request_pio_data_in_copy_data()
 * @stp_req: The PIO DATA IN request that is to receive the data.
 * @data_buffer: The buffer to copy from.
 *
 * Copy the data buffer to the io request data region. enum sci_status
 */
static enum sci_status sci_stp_request_pio_data_in_copy_data(
	struct isci_stp_request *stp_req,
	u8 *data_buffer)
{}

static enum sci_status
stp_request_pio_await_h2d_completion_tc_event(struct isci_request *ireq,
					      u32 completion_code)
{}

static enum sci_status
pio_data_out_tx_done_tc_event(struct isci_request *ireq,
			      u32 completion_code)
{}

static enum sci_status sci_stp_request_udma_general_frame_handler(struct isci_request *ireq,
								       u32 frame_index)
{}

static enum sci_status process_unsolicited_fis(struct isci_request *ireq,
					       u32 frame_index)
{}

static enum sci_status atapi_d2h_reg_frame_handler(struct isci_request *ireq,
						   u32 frame_index)
{}

static void scu_atapi_reconstruct_raw_frame_task_context(struct isci_request *ireq)
{}

static void scu_atapi_construct_task_context(struct isci_request *ireq)
{}

enum sci_status
sci_io_request_frame_handler(struct isci_request *ireq,
				  u32 frame_index)
{}

static enum sci_status stp_request_udma_await_tc_event(struct isci_request *ireq,
						       u32 completion_code)
{}

static enum sci_status atapi_raw_completion(struct isci_request *ireq, u32 completion_code,
						  enum sci_base_request_states next)
{}

static enum sci_status atapi_data_tc_completion_handler(struct isci_request *ireq,
							u32 completion_code)
{}

static int sci_request_smp_completion_status_is_tx_suspend(
	unsigned int completion_status)
{}

static int sci_request_smp_completion_status_is_tx_rx_suspend(
	unsigned int completion_status)
{}

static int sci_request_ssp_completion_status_is_tx_suspend(
	unsigned int completion_status)
{}

static int sci_request_ssp_completion_status_is_tx_rx_suspend(
	unsigned int completion_status)
{}

static int sci_request_stpsata_completion_status_is_tx_suspend(
	unsigned int completion_status)
{}


static int sci_request_stpsata_completion_status_is_tx_rx_suspend(
	unsigned int completion_status)
{}

static void sci_request_handle_suspending_completions(
	struct isci_request *ireq,
	u32 completion_code)
{}

enum sci_status
sci_io_request_tc_completion(struct isci_request *ireq,
			     u32 completion_code)
{}

/**
 * isci_request_process_response_iu() - This function sets the status and
 *    response iu, in the task struct, from the request object for the upper
 *    layer driver.
 * @task: This parameter is the task struct from the upper layer driver.
 * @resp_iu: This parameter points to the response iu of the completed request.
 * @dev: This parameter specifies the linux device struct.
 *
 * none.
 */
static void isci_request_process_response_iu(
	struct sas_task *task,
	struct ssp_response_iu *resp_iu,
	struct device *dev)
{}

/**
 * isci_request_set_open_reject_status() - This function prepares the I/O
 *    completion for OPEN_REJECT conditions.
 * @request: This parameter is the completed isci_request object.
 * @task: This parameter is the task struct from the upper layer driver.
 * @response_ptr: This parameter specifies the service response for the I/O.
 * @status_ptr: This parameter specifies the exec status for the I/O.
 * @open_rej_reason: This parameter specifies the encoded reason for the
 *    abandon-class reject.
 *
 * none.
 */
static void isci_request_set_open_reject_status(
	struct isci_request *request,
	struct sas_task *task,
	enum service_response *response_ptr,
	enum exec_status *status_ptr,
	enum sas_open_rej_reason open_rej_reason)
{}

/**
 * isci_request_handle_controller_specific_errors() - This function decodes
 *    controller-specific I/O completion error conditions.
 * @idev: Remote device
 * @request: This parameter is the completed isci_request object.
 * @task: This parameter is the task struct from the upper layer driver.
 * @response_ptr: This parameter specifies the service response for the I/O.
 * @status_ptr: This parameter specifies the exec status for the I/O.
 *
 * none.
 */
static void isci_request_handle_controller_specific_errors(
	struct isci_remote_device *idev,
	struct isci_request *request,
	struct sas_task *task,
	enum service_response *response_ptr,
	enum exec_status *status_ptr)
{}

static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_fis *fis)
{}

static void isci_request_io_request_complete(struct isci_host *ihost,
					     struct isci_request *request,
					     enum sci_io_status completion_status)
{}

static void sci_request_started_state_enter(struct sci_base_state_machine *sm)
{}

static void sci_request_completed_state_enter(struct sci_base_state_machine *sm)
{}

static void sci_request_aborting_state_enter(struct sci_base_state_machine *sm)
{}

static void sci_stp_request_started_non_data_await_h2d_completion_enter(struct sci_base_state_machine *sm)
{}

static void sci_stp_request_started_pio_await_h2d_completion_enter(struct sci_base_state_machine *sm)
{}

static const struct sci_base_state sci_request_state_table[] =;

static void
sci_general_request_construct(struct isci_host *ihost,
				   struct isci_remote_device *idev,
				   struct isci_request *ireq)
{}

static enum sci_status
sci_io_request_construct(struct isci_host *ihost,
			  struct isci_remote_device *idev,
			  struct isci_request *ireq)
{}

enum sci_status sci_task_request_construct(struct isci_host *ihost,
					    struct isci_remote_device *idev,
					    u16 io_tag, struct isci_request *ireq)
{}

static enum sci_status isci_request_ssp_request_construct(
	struct isci_request *request)
{}

static enum sci_status isci_request_stp_request_construct(struct isci_request *ireq)
{}

static enum sci_status
sci_io_request_construct_smp(struct device *dev,
			      struct isci_request *ireq,
			      struct sas_task *task)
{}

/*
 * isci_smp_request_build() - This function builds the smp request.
 * @ireq: This parameter points to the isci_request allocated in the
 *    request construct function.
 *
 * SCI_SUCCESS on successfull completion, or specific failure code.
 */
static enum sci_status isci_smp_request_build(struct isci_request *ireq)
{}

/**
 * isci_io_request_build() - This function builds the io request object.
 * @ihost: This parameter specifies the ISCI host object
 * @request: This parameter points to the isci_request object allocated in the
 *    request construct function.
 * @idev: This parameter is the handle for the sci core's remote device
 *    object that is the destination for this request.
 *
 * SCI_SUCCESS on successfull completion, or specific failure code.
 */
static enum sci_status isci_io_request_build(struct isci_host *ihost,
					     struct isci_request *request,
					     struct isci_remote_device *idev)
{}

static struct isci_request *isci_request_from_tag(struct isci_host *ihost, u16 tag)
{}

struct isci_request *isci_io_request_from_tag(struct isci_host *ihost,
					      struct sas_task *task,
					      u16 tag)
{}

struct isci_request *isci_tmf_request_from_tag(struct isci_host *ihost,
					       struct isci_tmf *isci_tmf,
					       u16 tag)
{}

int isci_request_execute(struct isci_host *ihost, struct isci_remote_device *idev,
			 struct sas_task *task, struct isci_request *ireq)
{}