/* * 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 <linux/completion.h> #include <linux/irqflags.h> #include "sas.h" #include <scsi/libsas.h> #include "remote_device.h" #include "remote_node_context.h" #include "isci.h" #include "request.h" #include "task.h" #include "host.h" /** * isci_task_refuse() - complete the request to the upper layer driver in * the case where an I/O needs to be completed back in the submit path. * @ihost: host on which the the request was queued * @task: request to complete * @response: response code for the completed task. * @status: status code for the completed task. * */ static void isci_task_refuse(struct isci_host *ihost, struct sas_task *task, enum service_response response, enum exec_status status) { … } #define for_each_sas_task(num, task) … static inline int isci_device_io_ready(struct isci_remote_device *idev, struct sas_task *task) { … } /** * isci_task_execute_task() - This function is one of the SAS Domain Template * functions. This function is called by libsas to send a task down to * hardware. * @task: This parameter specifies the SAS task to send. * @gfp_flags: This parameter specifies the context of this call. * * status, zero indicates success. */ int isci_task_execute_task(struct sas_task *task, gfp_t gfp_flags) { … } static struct isci_request *isci_task_request_build(struct isci_host *ihost, struct isci_remote_device *idev, u16 tag, struct isci_tmf *isci_tmf) { … } static int isci_task_execute_tmf(struct isci_host *ihost, struct isci_remote_device *idev, struct isci_tmf *tmf, unsigned long timeout_ms) { … } static void isci_task_build_tmf(struct isci_tmf *tmf, enum isci_tmf_function_codes code) { … } static void isci_task_build_abort_task_tmf(struct isci_tmf *tmf, enum isci_tmf_function_codes code, struct isci_request *old_request) { … } /* * isci_task_send_lu_reset_sas() - This function is called by of the SAS Domain * Template functions. * @lun: This parameter specifies the lun to be reset. * * status, zero indicates success. */ static int isci_task_send_lu_reset_sas( struct isci_host *isci_host, struct isci_remote_device *isci_device, u8 *lun) { … } int isci_task_lu_reset(struct domain_device *dev, u8 *lun) { … } /* int (*lldd_clear_nexus_port)(struct asd_sas_port *); */ int isci_task_clear_nexus_port(struct asd_sas_port *port) { … } int isci_task_clear_nexus_ha(struct sas_ha_struct *ha) { … } /* Task Management Functions. Must be called from process context. */ /** * isci_task_abort_task() - This function is one of the SAS Domain Template * functions. This function is called by libsas to abort a specified task. * @task: This parameter specifies the SAS task to abort. * * status, zero indicates success. */ int isci_task_abort_task(struct sas_task *task) { … } /** * isci_task_abort_task_set() - This function is one of the SAS Domain Template * functions. This is one of the Task Management functoins called by libsas, * to abort all task for the given lun. * @d_device: This parameter specifies the domain device associated with this * request. * @lun: This parameter specifies the lun associated with this request. * * status, zero indicates success. */ int isci_task_abort_task_set( struct domain_device *d_device, u8 *lun) { … } /** * isci_task_clear_task_set() - This function is one of the SAS Domain Template * functions. This is one of the Task Management functoins called by libsas. * @d_device: This parameter specifies the domain device associated with this * request. * @lun: This parameter specifies the lun associated with this request. * * status, zero indicates success. */ int isci_task_clear_task_set( struct domain_device *d_device, u8 *lun) { … } /** * isci_task_query_task() - This function is implemented to cause libsas to * correctly escalate the failed abort to a LUN or target reset (this is * because sas_scsi_find_task libsas function does not correctly interpret * all return codes from the abort task call). When TMF_RESP_FUNC_SUCC is * returned, libsas turns this into a LUN reset; when FUNC_FAILED is * returned, libsas will turn this into a target reset * @task: This parameter specifies the sas task being queried. * * status, zero indicates success. */ int isci_task_query_task( struct sas_task *task) { … } /* * isci_task_request_complete() - This function is called by the sci core when * an task request completes. * @ihost: This parameter specifies the ISCI host object * @ireq: This parameter is the completed isci_request object. * @completion_status: This parameter specifies the completion status from the * sci core. * * none. */ void isci_task_request_complete(struct isci_host *ihost, struct isci_request *ireq, enum sci_task_status completion_status) { … } static int isci_reset_device(struct isci_host *ihost, struct domain_device *dev, struct isci_remote_device *idev) { … } int isci_task_I_T_nexus_reset(struct domain_device *dev) { … }