scif_sas_request.h revision 331722
1139743Simp/*- 2123474Swpaul * This file is provided under a dual BSD/GPLv2 license. When using or 3123474Swpaul * redistributing this file, you may do so under either license. 4123474Swpaul * 5123474Swpaul * GPL LICENSE SUMMARY 6123474Swpaul * 7123474Swpaul * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8123474Swpaul * 9123474Swpaul * This program is free software; you can redistribute it and/or modify 10123474Swpaul * it under the terms of version 2 of the GNU General Public License as 11123474Swpaul * published by the Free Software Foundation. 12123474Swpaul * 13123474Swpaul * This program is distributed in the hope that it will be useful, but 14123474Swpaul * WITHOUT ANY WARRANTY; without even the implied warranty of 15123474Swpaul * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16123474Swpaul * General Public License for more details. 17123474Swpaul * 18123474Swpaul * You should have received a copy of the GNU General Public License 19123474Swpaul * along with this program; if not, write to the Free Software 20123474Swpaul * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21123474Swpaul * The full GNU General Public License is included in this distribution 22123474Swpaul * in the file called LICENSE.GPL. 23123474Swpaul * 24123474Swpaul * BSD LICENSE 25123474Swpaul * 26123474Swpaul * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27123474Swpaul * All rights reserved. 28123474Swpaul * 29123474Swpaul * Redistribution and use in source and binary forms, with or without 30123474Swpaul * modification, are permitted provided that the following conditions 31123474Swpaul * are met: 32123474Swpaul * 33123474Swpaul * * Redistributions of source code must retain the above copyright 34123474Swpaul * notice, this list of conditions and the following disclaimer. 35123474Swpaul * * Redistributions in binary form must reproduce the above copyright 36123474Swpaul * notice, this list of conditions and the following disclaimer in 37124697Swpaul * the documentation and/or other materials provided with the 38124697Swpaul * distribution. 39123474Swpaul * 40123474Swpaul * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41123474Swpaul * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42123474Swpaul * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43123474Swpaul * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44123474Swpaul * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45124697Swpaul * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46123474Swpaul * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47123474Swpaul * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48123474Swpaul * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49123474Swpaul * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50123474Swpaul * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51123474Swpaul * 52129970Swpaul * $FreeBSD: stable/11/sys/dev/isci/scil/scif_sas_request.h 331722 2018-03-29 02:50:57Z eadler $ 53124697Swpaul */ 54123474Swpaul#ifndef _SCIF_SAS_REQUEST_H_ 55123474Swpaul#define _SCIF_SAS_REQUEST_H_ 56123474Swpaul 57123474Swpaul/** 58123474Swpaul * @file 59123474Swpaul * 60123474Swpaul * @brief This file contains the protected interface structures, constants, 61123474Swpaul * and methods for the SCIF_SAS_REQUEST object. This object provides 62123474Swpaul * the common data and behavior to SAS IO and task management 63123474Swpaul * request types. 64123474Swpaul */ 65123695Swpaul 66123695Swpaul#ifdef __cplusplus 67123695Swpaulextern "C" { 68123474Swpaul#endif // __cplusplus 69145485Swpaul 70123474Swpaul#include <dev/isci/scil/sati_translator_sequence.h> 71125551Swpaul#include <dev/isci/scil/sci_types.h> 72123474Swpaul#include <dev/isci/scil/sci_status.h> 73123474Swpaul#include <dev/isci/scil/sci_fast_list.h> 74142399Swpaul#include <dev/isci/scil/sci_base_request.h> 75123474Swpaul 76123474Swpaul#define SCIF_SAS_RESPONSE_DATA_LENGTH 120 77123474Swpaul 78123474Swpaulstruct SCIF_SAS_CONTROLLER; 79144888Swpaulstruct SCIF_SAS_REMOTE_DEVICE; 80144888Swpaulstruct SCIF_SAS_TASK_REQUEST; 81144888Swpaulstruct SCIF_SAS_REQUEST; 82144888Swpaul 83144888Swpaultypedef SCI_STATUS (*SCIF_SAS_REQUEST_COMPLETION_HANDLER_T)( 84144888Swpaul struct SCIF_SAS_CONTROLLER *, 85144888Swpaul struct SCIF_SAS_REMOTE_DEVICE *, 86144174Swpaul struct SCIF_SAS_REQUEST *, 87145895Swpaul SCI_STATUS * 88123474Swpaul); 89141963Swpaul 90144888Swpaul/** 91144888Swpaul * @struct SCIF_SAS_STP_REQUEST 92144888Swpaul * 93144888Swpaul * @brief This structure contains all of the data specific to performing 94144888Swpaul * SATA/STP IO and TASK requests. 95144888Swpaul */ 96144888Swpaultypedef struct SCIF_SAS_STP_REQUEST 97145895Swpaul{ 98141963Swpaul /** 99141963Swpaul * This field contains the translation information utilized by SATI. 100141963Swpaul * For more information on this field please refer to 101141963Swpaul * SATI_TRANSLATOR_SEQUENCE. 102125057Swpaul */ 103125057Swpaul SATI_TRANSLATOR_SEQUENCE_T sequence; 104144174Swpaul 105124060Swpaul /** 106123474Swpaul * This field contains the ncq tag being utilized by this IO request. 107123474Swpaul * The NCQ tag value must be less than or equal to 31 (0 <= tag <= 31). 108123474Swpaul */ 109123474Swpaul U8 ncq_tag; 110123474Swpaul 111123474Swpaul} SCIF_SAS_STP_REQUEST_T; 112141524Swpaul 113123474Swpaul/** 114123474Swpaul * @struct SCIF_SAS_REQUEST 115123474Swpaul * 116124060Swpaul * @brief The SCIF_SAS_REQUEST object abstracts the common SAS 117141963Swpaul * IO & task management data and behavior for the framework component. 118124060Swpaul */ 119124060Swpaultypedef struct SCIF_SAS_REQUEST 120124060Swpaul{ 121124122Swpaul /** 122141524Swpaul * All SAS request types (IO or Task management) have the SCI base 123141963Swpaul * request as their parent object. 124124122Swpaul */ 125124122Swpaul SCI_BASE_REQUEST_T parent; 126142399Swpaul 127124122Swpaul /** 128141963Swpaul * This field references the list of state specific handler methods to 129141963Swpaul * be utilized for this request instance. 130141963Swpaul */ 131144888Swpaul SCI_BASE_REQUEST_STATE_HANDLER_T * state_handlers; 132144888Swpaul 133141963Swpaul SCIF_SAS_REQUEST_COMPLETION_HANDLER_T protocol_complete_handler; 134141963Swpaul 135141963Swpaul /** 136125057Swpaul * This field is utilized to communicate state information relating 137125057Swpaul * to this IO request and it's state transitions. 138145895Swpaul */ 139145895Swpaul SCI_STATUS status; 140145895Swpaul 141124060Swpaul /** 142124060Swpaul * This field represents the remote device object to which this IO 143127311Swpaul * request is destined. 144125006Swpaul */ 145141963Swpaul struct SCIF_SAS_REMOTE_DEVICE * device; 146125006Swpaul 147125006Swpaul /** 148142399Swpaul * This field references the request object that has asked that this 149141963Swpaul * request be terminated. 150124697Swpaul */ 151141963Swpaul struct SCIF_SAS_TASK_REQUEST * terminate_requestor; 152141963Swpaul 153141963Swpaul /** 154141963Swpaul * This field provides list specific information that enables a request 155141963Swpaul * to be placed in a list. 156145895Swpaul */ 157125006Swpaul SCI_FAST_LIST_ELEMENT_T list_element; 158125006Swpaul 159125006Swpaul /** 160124122Swpaul * This field indicates if the current request is one internally 161141963Swpaul * generated by the framework or if it is a user IO/task request. 162124122Swpaul */ 163124122Swpaul BOOL is_internal; 164142399Swpaul 165141524Swpaul /** 166124122Swpaul * This field indicates the current request is a high priority one. 167141963Swpaul * An internal request is always high priority. But an external request 168141963Swpaul * could be high priority. 169141963Swpaul */ 170141963Swpaul BOOL is_high_priority; 171141963Swpaul 172141963Swpaul /** 173145895Swpaul * This field indicates the current request should not be completed 174145895Swpaul * until a pending abort task set request is completed. For NCQ errors, 175124060Swpaul * it will allow waiting until the read log ext data is returned to 176124060Swpaul * to determine how to fail/abort the pending ios. 177124060Swpaul */ 178124060Swpaul BOOL is_waiting_for_abort_task_set; 179124060Swpaul 180124060Swpaul /** 181124060Swpaul * This field indicates the logical unit (LUN) for the request. 182123474Swpaul * This field is utilized during internal IO requests. 183123474Swpaul */ 184123474Swpaul U32 lun; 185123474Swpaul 186124697Swpaul /** 187144174Swpaul * This field specifies sata specific data for the reqeust object. 188128229Swpaul * This data is only valid for SATA requests. 189144174Swpaul */ 190128229Swpaul SCIF_SAS_STP_REQUEST_T stp; 191128229Swpaul 192128229Swpaul /** 193128229Swpaul * This field contains the handle for the SCI Core request object that is 194144174Swpaul * managed by this framework request. 195144174Swpaul */ 196144174Swpaul SCI_IO_REQUEST_HANDLE_T core_object; 197144174Swpaul 198144174Swpaul} SCIF_SAS_REQUEST_T; 199144174Swpaul 200144174Swpaulvoid scif_sas_request_construct( 201144174Swpaul SCIF_SAS_REQUEST_T * fw_request, 202144174Swpaul struct SCIF_SAS_REMOTE_DEVICE * fw_device, 203128229Swpaul SCI_BASE_LOGGER_T * logger, 204128229Swpaul SCI_BASE_STATE_T * state_table 205128229Swpaul); 206128229Swpaul 207128229SwpaulSCI_STATUS scif_sas_request_terminate_start( 208128229Swpaul SCIF_SAS_REQUEST_T * fw_request, 209128229Swpaul SCI_IO_REQUEST_HANDLE_T core_request 210128229Swpaul); 211128229Swpaul 212128229Swpaulvoid scif_sas_request_terminate_complete( 213128229Swpaul SCIF_SAS_REQUEST_T * fw_request 214144888Swpaul); 215124100Swpaul 216124100Swpaul#ifdef __cplusplus 217124100Swpaul} 218124100Swpaul#endif // __cplusplus 219124100Swpaul 220124100Swpaul#endif // _SCIF_SAS_REQUEST_H_ 221144888Swpaul 222123474Swpaul