2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
9 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23 * The full GNU General Public License is included in this distribution
24 * in the file called LICENSE.GPL.
28 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29 * All rights reserved.
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
35 * * Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * * Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in
39 * the documentation and/or other materials provided with the
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 #ifndef _SCIF_REMOTE_DEVICE_H_
57 #define _SCIF_REMOTE_DEVICE_H_
62 * @brief This file contains all of the interface methods that can be called
63 * by an SCI Framework user on a remote device object. The
64 * framework remote device object provides management of resets for
65 * the remote device, IO thresholds, potentially NCQ tag management,
73 #include <dev/isci/scil/sci_types.h>
74 #include <dev/isci/scil/sci_status.h>
75 #include <dev/isci/scil/intel_sas.h>
79 * This constant is utilized to inform the user that there is no defined
80 * maximum request queue depth associated with a remote device.
82 #define SCIF_REMOTE_DEVICE_NO_MAX_QUEUE_DEPTH 0xFFFF
85 * @brief This method simply returns the maximum memory space needed to
86 * store a remote device object. The value returned includes enough
87 * space for the framework and core device objects.
89 * @return a positive integer value indicating the size (in bytes) of the
90 * remote device object.
92 U32 scif_remote_device_get_object_size(
97 * @brief This method performs the construction common to all device object
98 * types in the framework.
101 * - Remote device objects in the core are a limited resource. Since
102 * the framework construction/destruction methods wrap the core, the
103 * user must ensure that a construct or destruct method is never
104 * invoked when an existing construct or destruct method is ongoing.
105 * This method shall be utilized for discovered direct attached
107 * - It isn't necessary to call scif_remote_device_destruct() for
108 * device objects that have only called this method for construction.
109 * Once subsequent construction methods have been invoked (e.g.
110 * scif_remote_device_da_construct()), then destruction should occur.
112 * @param[in] domain This parameter specifies the domain in which this
113 * remote device is contained.
114 * @param[in] remote_device_memory This parameter specifies the memory
115 * location into which this method shall construct the new
116 * framework device object.
117 * @param[out] new_scif_remote_device_handle This parameter specifies the
118 * handle to be used to communicate with the newly constructed
119 * framework remote device.
123 void scif_remote_device_construct(
124 SCI_DOMAIN_HANDLE_T domain,
125 void * remote_device_memory,
126 SCI_REMOTE_DEVICE_HANDLE_T * new_scif_remote_device_handle
130 * @brief This method constructs a new framework remote device object. The
131 * remote device object shall remember it's counterpart core device
132 * object as well as the domain in which it is contained.
134 * @note Remote device objects in the core are a limited resource. Since
135 * the framework construction/destruction methods wrap the core, the
136 * user must ensure that a construct or destruct method is never
137 * invoked when an existing construct or destruct method is ongoing.
138 * This method shall be utilized for discovered direct attached
141 * @pre The user must have previously called scif_remote_device_construct()
143 * @param[in] remote_device This parameter specifies the framework device
144 * for which to perform direct attached specific construction.
145 * @param[in] sas_address This parameter specifies the SAS address of the
146 * remote device object being constructed.
147 * @param[in] protocols This parameter specifies the protocols supported
148 * by the remote device to be constructed.
150 * @return Indicate if the remote device was successfully constructed.
151 * @retval SCI_SUCCESS This value is returned if the remote device was
152 * successfully constructed.
153 * @retval SCI_FAILURE_DEVICE_EXISTS Returned if the device has already
155 * @retval SCI_FAILURE_INSUFFICIENT_RESOURCES This value is returned if
156 * the core controller associated with the supplied parameters
157 * is unable to support additional remote devices.
159 SCI_STATUS scif_remote_device_da_construct(
160 SCI_REMOTE_DEVICE_HANDLE_T remote_device,
161 SCI_SAS_ADDRESS_T * sas_address,
162 SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T * protocols
166 * @brief This method constructs a new framework remote device object. The
167 * remote device object shall remember it's counterpart core device
168 * object as well as the domain in which it is contained.
170 * @pre The user must have previously called scif_remote_device_construct()
172 * @note Remote device objects in the core are a limited resource. Since
173 * the framework construction/destruction methods wrap the core, the
174 * user must ensure that a construct or destruct method is never
175 * invoked when an existing construct or destruct method is ongoing.
176 * This method shall be utilized for discovered expander attached
179 * @param[in] remote_device This parameter specifies the framework device
180 * for which to perform expander specific construction.
181 * @param[in] containing_device This parameter specifies the remote
182 * device (i.e. an expander) that contains the device being
184 * @param[in] smp_response This parameter specifies the SMP_RESPONSE_DISCOVER
185 * associated with the remote device being constructed.
187 * @return Indicate if the remote device was successfully constructed.
188 * @retval SCI_SUCCESS This value is returned if the remote device was
189 * successfully constructed.
190 * @retval SCI_FAILURE_DEVICE_EXISTS Returned if the device has already
192 * @retval SCI_FAILURE_INSUFFICIENT_RESOURCES This value is returned if
193 * the core controller associated with the supplied parameters
194 * is unable to support additional remote devices.
196 SCI_STATUS scif_remote_device_ea_construct(
197 SCI_REMOTE_DEVICE_HANDLE_T remote_device,
198 SCI_REMOTE_DEVICE_HANDLE_T containing_device,
199 SMP_RESPONSE_DISCOVER_T * smp_response
204 * @brief This method is utilized to free up a framework's remote
207 * @note Remote device objects in the core are a limited resource. Since
208 * the framework construction/destruction methods wrap the core, the
209 * user must ensure that a construct or destruct method is never
210 * invoked when an existing construct or destruct method is ongoing.
212 * @param[in] remote_device This parameter specifies the remote device to be
215 * @return The return value shall indicate if the device was successfully
216 * destructed or if some failure occurred.
217 * @retval SCI_STATUS This value is returned if the device is successfully
219 * @retval SCI_FAILURE_INVALID_REMOTE_DEVICE This value is returned if the
220 * supplied device isn't valid (e.g. it's already been destructed,
221 * the handle isn't valid, etc.).
223 SCI_STATUS scif_remote_device_destruct(
224 SCI_REMOTE_DEVICE_HANDLE_T remote_device
228 * @brief This method simply returns the SCI Core object handle that is
229 * associated with the supplied SCI Framework object.
231 * @param[in] remote_device This parameter specifies the framework device
232 * for which to return the associated core remote device.
234 * @return This method returns a handle to the core remote device object
235 * associated with the framework remote device object.
236 * @retval SCI_INVALID_HANDLE This return value indicates that the SCI Core
237 * remote device handle for the supplied framework device is invalid.
239 SCI_REMOTE_DEVICE_HANDLE_T scif_remote_device_get_scic_handle(
240 SCI_REMOTE_DEVICE_HANDLE_T remote_device
244 * @brief This method returns the maximum queue depth supported for the
245 * supplied target by this SCI Framework impementation.
247 * @param[in] remote_device This parameter specifies the framework
248 * device for which to return the maximum queue depth.
250 * @return This method returns a value indicating the maximum number of
251 * IO requests that can be outstanding for the target at any
253 * @retval SCIF_REMOTE_DEVICE_NO_MAX_QUEUE_DEPTH This value is returned
254 * when there is no defined maximum queue depth for the target.
256 U16 scif_remote_device_get_max_queue_depth(
257 SCI_REMOTE_DEVICE_HANDLE_T remote_device
261 * @brief This method will return the handle to the parent device of the
264 * @param[in] remote_device This parameter specifies the device for which
265 * to return the parent device.
266 * @param[out] containing_device This parameter specifies the device
267 * handle, from the remote device object, which indicate
268 * the parent device of the supplied remote_device.
272 SCI_STATUS scif_remote_device_get_containing_device(
273 SCI_REMOTE_DEVICE_HANDLE_T remote_device,
274 SCI_REMOTE_DEVICE_HANDLE_T * containing_device
278 * @brief This method returns the number of IO currently started
279 * to the supplied target. It does not include task
280 * management requests.
282 * @param[in] remote_device This parameter specifies the framework
283 * device for which to return the number of started IO.
285 * @return This method returns a value indicating the number of started
288 U32 scif_remote_device_get_started_io_count(
289 SCI_REMOTE_DEVICE_HANDLE_T remote_device
294 #endif // __cplusplus
296 #endif // _SCIF_REMOTE_DEVICE_H_