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_REMOTE_DEVICE_H_ 55230557Sjimharris#define _SCIF_REMOTE_DEVICE_H_ 56230557Sjimharris 57230557Sjimharris/** 58230557Sjimharris * @file 59230557Sjimharris * 60230557Sjimharris * @brief This file contains all of the interface methods that can be called 61230557Sjimharris * by an SCI Framework user on a remote device object. The 62230557Sjimharris * framework remote device object provides management of resets for 63230557Sjimharris * the remote device, IO thresholds, potentially NCQ tag management, 64230557Sjimharris * etc. 65230557Sjimharris */ 66230557Sjimharris 67230557Sjimharris#ifdef __cplusplus 68230557Sjimharrisextern "C" { 69230557Sjimharris#endif // __cplusplus 70230557Sjimharris 71230557Sjimharris#include <dev/isci/scil/sci_types.h> 72230557Sjimharris#include <dev/isci/scil/sci_status.h> 73230557Sjimharris#include <dev/isci/scil/intel_sas.h> 74230557Sjimharris 75230557Sjimharris 76230557Sjimharris/** 77230557Sjimharris * This constant is utilized to inform the user that there is no defined 78230557Sjimharris * maximum request queue depth associated with a remote device. 79230557Sjimharris */ 80230557Sjimharris#define SCIF_REMOTE_DEVICE_NO_MAX_QUEUE_DEPTH 0xFFFF 81230557Sjimharris 82230557Sjimharris/** 83230557Sjimharris * @brief This method simply returns the maximum memory space needed to 84230557Sjimharris * store a remote device object. The value returned includes enough 85230557Sjimharris * space for the framework and core device objects. 86230557Sjimharris * 87230557Sjimharris * @return a positive integer value indicating the size (in bytes) of the 88230557Sjimharris * remote device object. 89230557Sjimharris */ 90230557SjimharrisU32 scif_remote_device_get_object_size( 91230557Sjimharris void 92230557Sjimharris); 93230557Sjimharris 94230557Sjimharris/** 95230557Sjimharris * @brief This method performs the construction common to all device object 96230557Sjimharris * types in the framework. 97230557Sjimharris * 98230557Sjimharris * @note 99230557Sjimharris * - Remote device objects in the core are a limited resource. Since 100230557Sjimharris * the framework construction/destruction methods wrap the core, the 101230557Sjimharris * user must ensure that a construct or destruct method is never 102230557Sjimharris * invoked when an existing construct or destruct method is ongoing. 103230557Sjimharris * This method shall be utilized for discovered direct attached 104230557Sjimharris * devices. 105230557Sjimharris * - It isn't necessary to call scif_remote_device_destruct() for 106230557Sjimharris * device objects that have only called this method for construction. 107230557Sjimharris * Once subsequent construction methods have been invoked (e.g. 108230557Sjimharris * scif_remote_device_da_construct()), then destruction should occur. 109230557Sjimharris * 110230557Sjimharris * @param[in] domain This parameter specifies the domain in which this 111230557Sjimharris * remote device is contained. 112230557Sjimharris * @param[in] remote_device_memory This parameter specifies the memory 113230557Sjimharris * location into which this method shall construct the new 114230557Sjimharris * framework device object. 115230557Sjimharris * @param[out] new_scif_remote_device_handle This parameter specifies the 116230557Sjimharris * handle to be used to communicate with the newly constructed 117230557Sjimharris * framework remote device. 118230557Sjimharris * 119230557Sjimharris * @return none 120230557Sjimharris */ 121230557Sjimharrisvoid scif_remote_device_construct( 122230557Sjimharris SCI_DOMAIN_HANDLE_T domain, 123230557Sjimharris void * remote_device_memory, 124230557Sjimharris SCI_REMOTE_DEVICE_HANDLE_T * new_scif_remote_device_handle 125230557Sjimharris); 126230557Sjimharris 127230557Sjimharris/** 128230557Sjimharris * @brief This method constructs a new framework remote device object. The 129230557Sjimharris * remote device object shall remember it's counterpart core device 130230557Sjimharris * object as well as the domain in which it is contained. 131230557Sjimharris * 132230557Sjimharris * @note Remote device objects in the core are a limited resource. Since 133230557Sjimharris * the framework construction/destruction methods wrap the core, the 134230557Sjimharris * user must ensure that a construct or destruct method is never 135230557Sjimharris * invoked when an existing construct or destruct method is ongoing. 136230557Sjimharris * This method shall be utilized for discovered direct attached 137230557Sjimharris * devices. 138230557Sjimharris * 139230557Sjimharris * @pre The user must have previously called scif_remote_device_construct() 140230557Sjimharris * 141230557Sjimharris * @param[in] remote_device This parameter specifies the framework device 142230557Sjimharris * for which to perform direct attached specific construction. 143230557Sjimharris * @param[in] sas_address This parameter specifies the SAS address of the 144230557Sjimharris * remote device object being constructed. 145230557Sjimharris * @param[in] protocols This parameter specifies the protocols supported 146230557Sjimharris * by the remote device to be constructed. 147230557Sjimharris * 148230557Sjimharris * @return Indicate if the remote device was successfully constructed. 149230557Sjimharris * @retval SCI_SUCCESS This value is returned if the remote device was 150230557Sjimharris * successfully constructed. 151230557Sjimharris * @retval SCI_FAILURE_DEVICE_EXISTS Returned if the device has already 152230557Sjimharris * been constructed. 153230557Sjimharris * @retval SCI_FAILURE_INSUFFICIENT_RESOURCES This value is returned if 154230557Sjimharris * the core controller associated with the supplied parameters 155230557Sjimharris * is unable to support additional remote devices. 156230557Sjimharris */ 157230557SjimharrisSCI_STATUS scif_remote_device_da_construct( 158230557Sjimharris SCI_REMOTE_DEVICE_HANDLE_T remote_device, 159230557Sjimharris SCI_SAS_ADDRESS_T * sas_address, 160230557Sjimharris SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T * protocols 161230557Sjimharris); 162230557Sjimharris 163230557Sjimharris/** 164230557Sjimharris * @brief This method constructs a new framework remote device object. The 165230557Sjimharris * remote device object shall remember it's counterpart core device 166230557Sjimharris * object as well as the domain in which it is contained. 167230557Sjimharris * 168230557Sjimharris * @pre The user must have previously called scif_remote_device_construct() 169230557Sjimharris * 170230557Sjimharris * @note Remote device objects in the core are a limited resource. Since 171230557Sjimharris * the framework construction/destruction methods wrap the core, the 172230557Sjimharris * user must ensure that a construct or destruct method is never 173230557Sjimharris * invoked when an existing construct or destruct method is ongoing. 174230557Sjimharris * This method shall be utilized for discovered expander attached 175230557Sjimharris * devices. 176230557Sjimharris * 177230557Sjimharris * @param[in] remote_device This parameter specifies the framework device 178230557Sjimharris * for which to perform expander specific construction. 179230557Sjimharris * @param[in] containing_device This parameter specifies the remote 180230557Sjimharris * device (i.e. an expander) that contains the device being 181230557Sjimharris * constructed. 182230557Sjimharris * @param[in] smp_response This parameter specifies the SMP_RESPONSE_DISCOVER 183230557Sjimharris * associated with the remote device being constructed. 184230557Sjimharris * 185230557Sjimharris * @return Indicate if the remote device was successfully constructed. 186230557Sjimharris * @retval SCI_SUCCESS This value is returned if the remote device was 187230557Sjimharris * successfully constructed. 188230557Sjimharris * @retval SCI_FAILURE_DEVICE_EXISTS Returned if the device has already 189230557Sjimharris * been constructed. 190230557Sjimharris * @retval SCI_FAILURE_INSUFFICIENT_RESOURCES This value is returned if 191230557Sjimharris * the core controller associated with the supplied parameters 192230557Sjimharris * is unable to support additional remote devices. 193230557Sjimharris */ 194230557SjimharrisSCI_STATUS scif_remote_device_ea_construct( 195230557Sjimharris SCI_REMOTE_DEVICE_HANDLE_T remote_device, 196230557Sjimharris SCI_REMOTE_DEVICE_HANDLE_T containing_device, 197230557Sjimharris SMP_RESPONSE_DISCOVER_T * smp_response 198230557Sjimharris); 199230557Sjimharris 200230557Sjimharris 201230557Sjimharris/** 202230557Sjimharris * @brief This method is utilized to free up a framework's remote 203230557Sjimharris * device object. 204230557Sjimharris * 205230557Sjimharris * @note Remote device objects in the core are a limited resource. Since 206230557Sjimharris * the framework construction/destruction methods wrap the core, the 207230557Sjimharris * user must ensure that a construct or destruct method is never 208230557Sjimharris * invoked when an existing construct or destruct method is ongoing. 209230557Sjimharris * 210230557Sjimharris * @param[in] remote_device This parameter specifies the remote device to be 211230557Sjimharris * destructed. 212230557Sjimharris * 213230557Sjimharris * @return The return value shall indicate if the device was successfully 214230557Sjimharris * destructed or if some failure occurred. 215230557Sjimharris * @retval SCI_STATUS This value is returned if the device is successfully 216230557Sjimharris * destructed. 217230557Sjimharris * @retval SCI_FAILURE_INVALID_REMOTE_DEVICE This value is returned if the 218230557Sjimharris * supplied device isn't valid (e.g. it's already been destructed, 219230557Sjimharris * the handle isn't valid, etc.). 220230557Sjimharris */ 221230557SjimharrisSCI_STATUS scif_remote_device_destruct( 222230557Sjimharris SCI_REMOTE_DEVICE_HANDLE_T remote_device 223230557Sjimharris); 224230557Sjimharris 225230557Sjimharris/** 226230557Sjimharris * @brief This method simply returns the SCI Core object handle that is 227230557Sjimharris * associated with the supplied SCI Framework object. 228230557Sjimharris * 229230557Sjimharris * @param[in] remote_device This parameter specifies the framework device 230230557Sjimharris * for which to return the associated core remote device. 231230557Sjimharris * 232230557Sjimharris * @return This method returns a handle to the core remote device object 233230557Sjimharris * associated with the framework remote device object. 234230557Sjimharris * @retval SCI_INVALID_HANDLE This return value indicates that the SCI Core 235230557Sjimharris * remote device handle for the supplied framework device is invalid. 236230557Sjimharris */ 237230557SjimharrisSCI_REMOTE_DEVICE_HANDLE_T scif_remote_device_get_scic_handle( 238230557Sjimharris SCI_REMOTE_DEVICE_HANDLE_T remote_device 239230557Sjimharris); 240230557Sjimharris 241230557Sjimharris/** 242230557Sjimharris * @brief This method returns the maximum queue depth supported for the 243230557Sjimharris * supplied target by this SCI Framework impementation. 244230557Sjimharris * 245230557Sjimharris * @param[in] remote_device This parameter specifies the framework 246230557Sjimharris * device for which to return the maximum queue depth. 247230557Sjimharris * 248230557Sjimharris * @return This method returns a value indicating the maximum number of 249230557Sjimharris * IO requests that can be outstanding for the target at any 250230557Sjimharris * point in time. 251230557Sjimharris * @retval SCIF_REMOTE_DEVICE_NO_MAX_QUEUE_DEPTH This value is returned 252230557Sjimharris * when there is no defined maximum queue depth for the target. 253230557Sjimharris */ 254230557SjimharrisU16 scif_remote_device_get_max_queue_depth( 255230557Sjimharris SCI_REMOTE_DEVICE_HANDLE_T remote_device 256230557Sjimharris); 257230557Sjimharris 258230557Sjimharris/** 259230557Sjimharris * @brief This method will return the handle to the parent device of the 260230557Sjimharris * remote device. 261230557Sjimharris * 262230557Sjimharris * @param[in] remote_device This parameter specifies the device for which 263230557Sjimharris * to return the parent device. 264230557Sjimharris * @param[out] containing_device This parameter specifies the device 265230557Sjimharris * handle, from the remote device object, which indicate 266230557Sjimharris * the parent device of the supplied remote_device. 267230557Sjimharris * 268230557Sjimharris * @return none 269230557Sjimharris */ 270230557SjimharrisSCI_STATUS scif_remote_device_get_containing_device( 271230557Sjimharris SCI_REMOTE_DEVICE_HANDLE_T remote_device, 272230557Sjimharris SCI_REMOTE_DEVICE_HANDLE_T * containing_device 273230557Sjimharris); 274230557Sjimharris 275230557Sjimharris/** 276230557Sjimharris * @brief This method returns the number of IO currently started 277230557Sjimharris * to the supplied target. It does not include task 278230557Sjimharris * management requests. 279230557Sjimharris * 280230557Sjimharris * @param[in] remote_device This parameter specifies the framework 281230557Sjimharris * device for which to return the number of started IO. 282230557Sjimharris * 283230557Sjimharris * @return This method returns a value indicating the number of started 284230557Sjimharris * IO requests. 285230557Sjimharris */ 286230557SjimharrisU32 scif_remote_device_get_started_io_count( 287230557Sjimharris SCI_REMOTE_DEVICE_HANDLE_T remote_device 288230557Sjimharris); 289230557Sjimharris 290230557Sjimharris#ifdef __cplusplus 291230557Sjimharris} 292230557Sjimharris#endif // __cplusplus 293230557Sjimharris 294230557Sjimharris#endif // _SCIF_REMOTE_DEVICE_H_ 295230557Sjimharris 296