1230557Sjimharris/*- 2230557Sjimharris * This file is provided under a dual BSD/GPLv2 license. When using or 3230557Sjimharris * redistributing this file, you may do so under either license. 4230557Sjimharris * 5230557Sjimharris * GPL LICENSE SUMMARY 6230557Sjimharris * 7230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8230557Sjimharris * 9230557Sjimharris * This program is free software; you can redistribute it and/or modify 10230557Sjimharris * it under the terms of version 2 of the GNU General Public License as 11230557Sjimharris * published by the Free Software Foundation. 12230557Sjimharris * 13230557Sjimharris * This program is distributed in the hope that it will be useful, but 14230557Sjimharris * WITHOUT ANY WARRANTY; without even the implied warranty of 15230557Sjimharris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16230557Sjimharris * General Public License for more details. 17230557Sjimharris * 18230557Sjimharris * You should have received a copy of the GNU General Public License 19230557Sjimharris * along with this program; if not, write to the Free Software 20230557Sjimharris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21230557Sjimharris * The full GNU General Public License is included in this distribution 22230557Sjimharris * in the file called LICENSE.GPL. 23230557Sjimharris * 24230557Sjimharris * BSD LICENSE 25230557Sjimharris * 26230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27230557Sjimharris * All rights reserved. 28230557Sjimharris * 29230557Sjimharris * Redistribution and use in source and binary forms, with or without 30230557Sjimharris * modification, are permitted provided that the following conditions 31230557Sjimharris * are met: 32230557Sjimharris * 33230557Sjimharris * * Redistributions of source code must retain the above copyright 34230557Sjimharris * notice, this list of conditions and the following disclaimer. 35230557Sjimharris * * Redistributions in binary form must reproduce the above copyright 36230557Sjimharris * notice, this list of conditions and the following disclaimer in 37230557Sjimharris * the documentation and/or other materials provided with the 38230557Sjimharris * distribution. 39230557Sjimharris * 40230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51230557Sjimharris * 52230557Sjimharris * $FreeBSD$ 53230557Sjimharris */ 54230557Sjimharris#ifndef _SCIF_SAS_REQUEST_H_ 55230557Sjimharris#define _SCIF_SAS_REQUEST_H_ 56230557Sjimharris 57230557Sjimharris/** 58230557Sjimharris * @file 59230557Sjimharris * 60230557Sjimharris * @brief This file contains the protected interface structures, constants, 61230557Sjimharris * and methods for the SCIF_SAS_REQUEST object. This object provides 62230557Sjimharris * the common data and behavior to SAS IO and task management 63230557Sjimharris * request types. 64230557Sjimharris */ 65230557Sjimharris 66230557Sjimharris#ifdef __cplusplus 67230557Sjimharrisextern "C" { 68230557Sjimharris#endif // __cplusplus 69230557Sjimharris 70230557Sjimharris#include <dev/isci/scil/sati_translator_sequence.h> 71230557Sjimharris#include <dev/isci/scil/sci_types.h> 72230557Sjimharris#include <dev/isci/scil/sci_status.h> 73230557Sjimharris#include <dev/isci/scil/sci_fast_list.h> 74230557Sjimharris#include <dev/isci/scil/sci_base_request.h> 75230557Sjimharris 76230557Sjimharris#define SCIF_SAS_RESPONSE_DATA_LENGTH 120 77230557Sjimharris 78230557Sjimharrisstruct SCIF_SAS_CONTROLLER; 79230557Sjimharrisstruct SCIF_SAS_REMOTE_DEVICE; 80230557Sjimharrisstruct SCIF_SAS_TASK_REQUEST; 81230557Sjimharrisstruct SCIF_SAS_REQUEST; 82230557Sjimharris 83230557Sjimharristypedef SCI_STATUS (*SCIF_SAS_REQUEST_COMPLETION_HANDLER_T)( 84230557Sjimharris struct SCIF_SAS_CONTROLLER *, 85230557Sjimharris struct SCIF_SAS_REMOTE_DEVICE *, 86230557Sjimharris struct SCIF_SAS_REQUEST *, 87230557Sjimharris SCI_STATUS * 88230557Sjimharris); 89230557Sjimharris 90230557Sjimharris/** 91230557Sjimharris * @struct SCIF_SAS_STP_REQUEST 92230557Sjimharris * 93230557Sjimharris * @brief This structure contains all of the data specific to performing 94230557Sjimharris * SATA/STP IO and TASK requests. 95230557Sjimharris */ 96230557Sjimharristypedef struct SCIF_SAS_STP_REQUEST 97230557Sjimharris{ 98230557Sjimharris /** 99230557Sjimharris * This field contains the translation information utilized by SATI. 100230557Sjimharris * For more information on this field please refer to 101230557Sjimharris * SATI_TRANSLATOR_SEQUENCE. 102230557Sjimharris */ 103230557Sjimharris SATI_TRANSLATOR_SEQUENCE_T sequence; 104230557Sjimharris 105230557Sjimharris /** 106230557Sjimharris * This field contains the ncq tag being utilized by this IO request. 107230557Sjimharris * The NCQ tag value must be less than or equal to 31 (0 <= tag <= 31). 108230557Sjimharris */ 109230557Sjimharris U8 ncq_tag; 110230557Sjimharris 111230557Sjimharris} SCIF_SAS_STP_REQUEST_T; 112230557Sjimharris 113230557Sjimharris/** 114230557Sjimharris * @struct SCIF_SAS_REQUEST 115230557Sjimharris * 116230557Sjimharris * @brief The SCIF_SAS_REQUEST object abstracts the common SAS 117230557Sjimharris * IO & task management data and behavior for the framework component. 118230557Sjimharris */ 119230557Sjimharristypedef struct SCIF_SAS_REQUEST 120230557Sjimharris{ 121230557Sjimharris /** 122230557Sjimharris * All SAS request types (IO or Task management) have the SCI base 123230557Sjimharris * request as their parent object. 124230557Sjimharris */ 125230557Sjimharris SCI_BASE_REQUEST_T parent; 126230557Sjimharris 127230557Sjimharris /** 128230557Sjimharris * This field references the list of state specific handler methods to 129230557Sjimharris * be utilized for this request instance. 130230557Sjimharris */ 131230557Sjimharris SCI_BASE_REQUEST_STATE_HANDLER_T * state_handlers; 132230557Sjimharris 133230557Sjimharris SCIF_SAS_REQUEST_COMPLETION_HANDLER_T protocol_complete_handler; 134230557Sjimharris 135230557Sjimharris /** 136230557Sjimharris * This field is utilized to communicate state information relating 137230557Sjimharris * to this IO request and it's state transitions. 138230557Sjimharris */ 139230557Sjimharris SCI_STATUS status; 140230557Sjimharris 141230557Sjimharris /** 142230557Sjimharris * This field represents the remote device object to which this IO 143230557Sjimharris * request is destined. 144230557Sjimharris */ 145230557Sjimharris struct SCIF_SAS_REMOTE_DEVICE * device; 146230557Sjimharris 147230557Sjimharris /** 148230557Sjimharris * This field references the request object that has asked that this 149230557Sjimharris * request be terminated. 150230557Sjimharris */ 151230557Sjimharris struct SCIF_SAS_TASK_REQUEST * terminate_requestor; 152230557Sjimharris 153230557Sjimharris /** 154230557Sjimharris * This field provides list specific information that enables a request 155230557Sjimharris * to be placed in a list. 156230557Sjimharris */ 157230557Sjimharris SCI_FAST_LIST_ELEMENT_T list_element; 158230557Sjimharris 159230557Sjimharris /** 160230557Sjimharris * This field indicates if the current request is one internally 161230557Sjimharris * generated by the framework or if it is a user IO/task request. 162230557Sjimharris */ 163230557Sjimharris BOOL is_internal; 164230557Sjimharris 165230557Sjimharris /** 166230557Sjimharris * This field indicates the current request is a high priority one. 167230557Sjimharris * An internal request is always high priority. But an external request 168230557Sjimharris * could be high priority. 169230557Sjimharris */ 170230557Sjimharris BOOL is_high_priority; 171230557Sjimharris 172230557Sjimharris /** 173230557Sjimharris * This field indicates the current request should not be completed 174230557Sjimharris * until a pending abort task set request is completed. For NCQ errors, 175230557Sjimharris * it will allow waiting until the read log ext data is returned to 176230557Sjimharris * to determine how to fail/abort the pending ios. 177230557Sjimharris */ 178230557Sjimharris BOOL is_waiting_for_abort_task_set; 179230557Sjimharris 180230557Sjimharris /** 181230557Sjimharris * This field indicates the logical unit (LUN) for the request. 182230557Sjimharris * This field is utilized during internal IO requests. 183230557Sjimharris */ 184230557Sjimharris U32 lun; 185230557Sjimharris 186230557Sjimharris /** 187230557Sjimharris * This field specifies sata specific data for the reqeust object. 188230557Sjimharris * This data is only valid for SATA requests. 189230557Sjimharris */ 190230557Sjimharris SCIF_SAS_STP_REQUEST_T stp; 191230557Sjimharris 192230557Sjimharris /** 193230557Sjimharris * This field contains the handle for the SCI Core request object that is 194230557Sjimharris * managed by this framework request. 195230557Sjimharris */ 196230557Sjimharris SCI_IO_REQUEST_HANDLE_T core_object; 197230557Sjimharris 198230557Sjimharris} SCIF_SAS_REQUEST_T; 199230557Sjimharris 200230557Sjimharrisvoid scif_sas_request_construct( 201230557Sjimharris SCIF_SAS_REQUEST_T * fw_request, 202230557Sjimharris struct SCIF_SAS_REMOTE_DEVICE * fw_device, 203230557Sjimharris SCI_BASE_LOGGER_T * logger, 204230557Sjimharris SCI_BASE_STATE_T * state_table 205230557Sjimharris); 206230557Sjimharris 207230557SjimharrisSCI_STATUS scif_sas_request_terminate_start( 208230557Sjimharris SCIF_SAS_REQUEST_T * fw_request, 209230557Sjimharris SCI_IO_REQUEST_HANDLE_T core_request 210230557Sjimharris); 211230557Sjimharris 212230557Sjimharrisvoid scif_sas_request_terminate_complete( 213230557Sjimharris SCIF_SAS_REQUEST_T * fw_request 214230557Sjimharris); 215230557Sjimharris 216230557Sjimharris#ifdef __cplusplus 217230557Sjimharris} 218230557Sjimharris#endif // __cplusplus 219230557Sjimharris 220230557Sjimharris#endif // _SCIF_SAS_REQUEST_H_ 221230557Sjimharris 222