2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
33 * * Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in
37 * the documentation and/or other materials provided with the
40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 #ifndef _SCIF_REMOTE_DEVICE_H_
55 #define _SCIF_REMOTE_DEVICE_H_
60 * @brief This file contains all of the interface methods that can be called
61 * by an SCI Framework user on a remote device object. The
62 * framework remote device object provides management of resets for
63 * the remote device, IO thresholds, potentially NCQ tag management,
71 #include <dev/isci/scil/sci_types.h>
72 #include <dev/isci/scil/sci_status.h>
73 #include <dev/isci/scil/intel_sas.h>
77 * This constant is utilized to inform the user that there is no defined
78 * maximum request queue depth associated with a remote device.
80 #define SCIF_REMOTE_DEVICE_NO_MAX_QUEUE_DEPTH 0xFFFF
83 * @brief This method simply returns the maximum memory space needed to
84 * store a remote device object. The value returned includes enough
85 * space for the framework and core device objects.
87 * @return a positive integer value indicating the size (in bytes) of the
88 * remote device object.
90 U32 scif_remote_device_get_object_size(
95 * @brief This method performs the construction common to all device object
96 * types in the framework.
99 * - Remote device objects in the core are a limited resource. Since
100 * the framework construction/destruction methods wrap the core, the
101 * user must ensure that a construct or destruct method is never
102 * invoked when an existing construct or destruct method is ongoing.
103 * This method shall be utilized for discovered direct attached
105 * - It isn't necessary to call scif_remote_device_destruct() for
106 * device objects that have only called this method for construction.
107 * Once subsequent construction methods have been invoked (e.g.
108 * scif_remote_device_da_construct()), then destruction should occur.
110 * @param[in] domain This parameter specifies the domain in which this
111 * remote device is contained.
112 * @param[in] remote_device_memory This parameter specifies the memory
113 * location into which this method shall construct the new
114 * framework device object.
115 * @param[out] new_scif_remote_device_handle This parameter specifies the
116 * handle to be used to communicate with the newly constructed
117 * framework remote device.
121 void scif_remote_device_construct(
122 SCI_DOMAIN_HANDLE_T domain,
123 void * remote_device_memory,
124 SCI_REMOTE_DEVICE_HANDLE_T * new_scif_remote_device_handle
128 * @brief This method constructs a new framework remote device object. The
129 * remote device object shall remember it's counterpart core device
130 * object as well as the domain in which it is contained.
132 * @note Remote device objects in the core are a limited resource. Since
133 * the framework construction/destruction methods wrap the core, the
134 * user must ensure that a construct or destruct method is never
135 * invoked when an existing construct or destruct method is ongoing.
136 * This method shall be utilized for discovered direct attached
139 * @pre The user must have previously called scif_remote_device_construct()
141 * @param[in] remote_device This parameter specifies the framework device
142 * for which to perform direct attached specific construction.
143 * @param[in] sas_address This parameter specifies the SAS address of the
144 * remote device object being constructed.
145 * @param[in] protocols This parameter specifies the protocols supported
146 * by the remote device to be constructed.
148 * @return Indicate if the remote device was successfully constructed.
149 * @retval SCI_SUCCESS This value is returned if the remote device was
150 * successfully constructed.
151 * @retval SCI_FAILURE_DEVICE_EXISTS Returned if the device has already
153 * @retval SCI_FAILURE_INSUFFICIENT_RESOURCES This value is returned if
154 * the core controller associated with the supplied parameters
155 * is unable to support additional remote devices.
157 SCI_STATUS scif_remote_device_da_construct(
158 SCI_REMOTE_DEVICE_HANDLE_T remote_device,
159 SCI_SAS_ADDRESS_T * sas_address,
160 SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T * protocols
164 * @brief This method constructs a new framework remote device object. The
165 * remote device object shall remember it's counterpart core device
166 * object as well as the domain in which it is contained.
168 * @pre The user must have previously called scif_remote_device_construct()
170 * @note Remote device objects in the core are a limited resource. Since
171 * the framework construction/destruction methods wrap the core, the
172 * user must ensure that a construct or destruct method is never
173 * invoked when an existing construct or destruct method is ongoing.
174 * This method shall be utilized for discovered expander attached
177 * @param[in] remote_device This parameter specifies the framework device
178 * for which to perform expander specific construction.
179 * @param[in] containing_device This parameter specifies the remote
180 * device (i.e. an expander) that contains the device being
182 * @param[in] smp_response This parameter specifies the SMP_RESPONSE_DISCOVER
183 * associated with the remote device being constructed.
185 * @return Indicate if the remote device was successfully constructed.
186 * @retval SCI_SUCCESS This value is returned if the remote device was
187 * successfully constructed.
188 * @retval SCI_FAILURE_DEVICE_EXISTS Returned if the device has already
190 * @retval SCI_FAILURE_INSUFFICIENT_RESOURCES This value is returned if
191 * the core controller associated with the supplied parameters
192 * is unable to support additional remote devices.
194 SCI_STATUS scif_remote_device_ea_construct(
195 SCI_REMOTE_DEVICE_HANDLE_T remote_device,
196 SCI_REMOTE_DEVICE_HANDLE_T containing_device,
197 SMP_RESPONSE_DISCOVER_T * smp_response
202 * @brief This method is utilized to free up a framework's remote
205 * @note Remote device objects in the core are a limited resource. Since
206 * the framework construction/destruction methods wrap the core, the
207 * user must ensure that a construct or destruct method is never
208 * invoked when an existing construct or destruct method is ongoing.
210 * @param[in] remote_device This parameter specifies the remote device to be
213 * @return The return value shall indicate if the device was successfully
214 * destructed or if some failure occurred.
215 * @retval SCI_STATUS This value is returned if the device is successfully
217 * @retval SCI_FAILURE_INVALID_REMOTE_DEVICE This value is returned if the
218 * supplied device isn't valid (e.g. it's already been destructed,
219 * the handle isn't valid, etc.).
221 SCI_STATUS scif_remote_device_destruct(
222 SCI_REMOTE_DEVICE_HANDLE_T remote_device
226 * @brief This method simply returns the SCI Core object handle that is
227 * associated with the supplied SCI Framework object.
229 * @param[in] remote_device This parameter specifies the framework device
230 * for which to return the associated core remote device.
232 * @return This method returns a handle to the core remote device object
233 * associated with the framework remote device object.
234 * @retval SCI_INVALID_HANDLE This return value indicates that the SCI Core
235 * remote device handle for the supplied framework device is invalid.
237 SCI_REMOTE_DEVICE_HANDLE_T scif_remote_device_get_scic_handle(
238 SCI_REMOTE_DEVICE_HANDLE_T remote_device
242 * @brief This method returns the maximum queue depth supported for the
243 * supplied target by this SCI Framework impementation.
245 * @param[in] remote_device This parameter specifies the framework
246 * device for which to return the maximum queue depth.
248 * @return This method returns a value indicating the maximum number of
249 * IO requests that can be outstanding for the target at any
251 * @retval SCIF_REMOTE_DEVICE_NO_MAX_QUEUE_DEPTH This value is returned
252 * when there is no defined maximum queue depth for the target.
254 U16 scif_remote_device_get_max_queue_depth(
255 SCI_REMOTE_DEVICE_HANDLE_T remote_device
259 * @brief This method will return the handle to the parent device of the
262 * @param[in] remote_device This parameter specifies the device for which
263 * to return the parent device.
264 * @param[out] containing_device This parameter specifies the device
265 * handle, from the remote device object, which indicate
266 * the parent device of the supplied remote_device.
270 SCI_STATUS scif_remote_device_get_containing_device(
271 SCI_REMOTE_DEVICE_HANDLE_T remote_device,
272 SCI_REMOTE_DEVICE_HANDLE_T * containing_device
276 * @brief This method returns the number of IO currently started
277 * to the supplied target. It does not include task
278 * management requests.
280 * @param[in] remote_device This parameter specifies the framework
281 * device for which to return the number of started IO.
283 * @return This method returns a value indicating the number of started
286 U32 scif_remote_device_get_started_io_count(
287 SCI_REMOTE_DEVICE_HANDLE_T remote_device
292 #endif // __cplusplus
294 #endif // _SCIF_REMOTE_DEVICE_H_