isci: kill sci_types.h
[deliverable/linux.git] / drivers / scsi / isci / core / scic_remote_device.h
CommitLineData
6f231dda
DW
1/*
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.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *
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.
12 *
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.
17 *
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.
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
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
38 * distribution.
39 * * Neither the name of Intel Corporation nor the names of its
40 * contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 */
55
56#ifndef _SCIC_REMOTE_DEVICE_H_
57#define _SCIC_REMOTE_DEVICE_H_
58
59/**
60 * This file contains all of the interface methods that can be called by an
61 * SCIC user on the device object.
62 *
63 *
64 */
65
66
6f231dda
DW
67#include "sci_status.h"
68#include "intel_sas.h"
69
70struct scic_sds_port;
71struct scic_sds_remote_device;
72
73/**
74 *
75 *
76 *
77 */
78enum scic_remote_device_not_ready_reason_code {
79 SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED,
80 SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED,
81 SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED,
82 SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED,
83 SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED,
84
85 SCIC_REMOTE_DEVICE_NOT_READY_REASON_CODE_MAX
86
87};
88
89/**
90 * scic_remote_device_get_object_size() - This method simply returns the
91 * maximum memory space needed to store a remote device object.
92 *
93 * a positive integer value indicating the size (in bytes) of the remote device
94 * object.
95 */
96u32 scic_remote_device_get_object_size(
97 void);
98
99struct scic_sds_port;
100struct scic_sds_remote_device;
101/**
102 * scic_remote_device_construct() - This method will perform the construction
103 * common to all remote device objects.
104 * @sci_port: SAS/SATA port through which this device is accessed.
105 * @sci_dev: remote device to construct
106 *
107 * It isn't necessary to call scic_remote_device_destruct() for device objects
108 * that have only called this method for construction. Once subsequent
109 * construction methods have been invoked (e.g.
110 * scic_remote_device_da_construct()), then destruction should occur. none
111 */
112void scic_remote_device_construct(struct scic_sds_port *sci_port,
113 struct scic_sds_remote_device *sci_dev);
114
115/**
116 * scic_remote_device_da_construct() - This method will construct a
117 * SCIC_REMOTE_DEVICE object for a direct attached (da) device. The
118 * information (e.g. IAF, Signature FIS, etc.) necessary to build the device
119 * is known to the SCI Core since it is contained in the scic_phy object.
120 * @remote_device: This parameter specifies the remote device to be destructed.
121 *
122 * The user must have previously called scic_remote_device_construct() Remote
123 * device objects are a limited resource. As such, they must be protected.
124 * Thus calls to construct and destruct are mutually exclusive and
125 * non-reentrant. Indicate if the remote device was successfully constructed.
126 * SCI_SUCCESS Returned if the device was successfully constructed.
127 * SCI_FAILURE_DEVICE_EXISTS Returned if the device has already been
128 * constructed. If it's an additional phy for the target, then call
129 * scic_remote_device_da_add_phy(). SCI_FAILURE_UNSUPPORTED_PROTOCOL Returned
130 * if the supplied parameters necessitate creation of a remote device for which
131 * the protocol is not supported by the underlying controller hardware.
132 * SCI_FAILURE_INSUFFICIENT_RESOURCES This value is returned if the core
133 * controller associated with the supplied parameters is unable to support
134 * additional remote devices.
135 */
136enum sci_status scic_remote_device_da_construct(
137 struct scic_sds_remote_device *remote_device);
138
139/**
140 * scic_remote_device_ea_construct() - This method will construct an
141 * SCIC_REMOTE_DEVICE object for an expander attached (ea) device from an
142 * SMP Discover Response.
143 * @remote_device: This parameter specifies the remote device to be destructed.
144 * @discover_response: This parameter specifies the SMP Discovery Response to
145 * be used in device creation.
146 *
147 * The user must have previously called scic_remote_device_construct() Remote
148 * device objects are a limited resource. As such, they must be protected.
149 * Thus calls to construct and destruct are mutually exclusive and
150 * non-reentrant. Indicate if the remote device was successfully constructed.
151 * SCI_SUCCESS Returned if the device was successfully constructed.
152 * SCI_FAILURE_DEVICE_EXISTS Returned if the device has already been
153 * constructed. If it's an additional phy for the target, then call
154 * scic_ea_remote_device_add_phy(). SCI_FAILURE_UNSUPPORTED_PROTOCOL Returned
155 * if the supplied parameters necessitate creation of a remote device for which
156 * the protocol is not supported by the underlying controller hardware.
157 * SCI_FAILURE_INSUFFICIENT_RESOURCES This value is returned if the core
158 * controller associated with the supplied parameters is unable to support
159 * additional remote devices.
160 */
161enum sci_status scic_remote_device_ea_construct(
162 struct scic_sds_remote_device *remote_device,
163 struct smp_response_discover *discover_response);
164
165/**
166 * scic_remote_device_destruct() - This method is utilized to free up a core's
167 * remote device object.
168 * @remote_device: This parameter specifies the remote device to be destructed.
169 *
170 * Remote device objects are a limited resource. As such, they must be
171 * protected. Thus calls to construct and destruct are mutually exclusive and
172 * non-reentrant. The return value shall indicate if the device was
173 * successfully destructed or if some failure occurred. enum sci_status This value
174 * is returned if the device is successfully destructed.
175 * SCI_FAILURE_INVALID_REMOTE_DEVICE This value is returned if the supplied
176 * device isn't valid (e.g. it's already been destoryed, the handle isn't
177 * valid, etc.).
178 */
179enum sci_status scic_remote_device_destruct(
180 struct scic_sds_remote_device *remote_device);
181
182
183
184
185
186/**
187 * scic_remote_device_start() - This method will start the supplied remote
188 * device. This method enables normal IO requests to flow through to the
189 * remote device.
190 * @remote_device: This parameter specifies the device to be started.
191 * @timeout: This parameter specifies the number of milliseconds in which the
192 * start operation should complete.
193 *
194 * An indication of whether the device was successfully started. SCI_SUCCESS
195 * This value is returned if the device was successfully started.
196 * SCI_FAILURE_INVALID_PHY This value is returned if the user attempts to start
197 * the device when there have been no phys added to it.
198 */
199enum sci_status scic_remote_device_start(
200 struct scic_sds_remote_device *remote_device,
201 u32 timeout);
202
203/**
204 * scic_remote_device_stop() - This method will stop both transmission and
205 * reception of link activity for the supplied remote device. This method
206 * disables normal IO requests from flowing through to the remote device.
207 * @remote_device: This parameter specifies the device to be stopped.
208 * @timeout: This parameter specifies the number of milliseconds in which the
209 * stop operation should complete.
210 *
211 * An indication of whether the device was successfully stopped. SCI_SUCCESS
212 * This value is returned if the transmission and reception for the device was
213 * successfully stopped.
214 */
215enum sci_status scic_remote_device_stop(
216 struct scic_sds_remote_device *remote_device,
217 u32 timeout);
218
219/**
220 * scic_remote_device_reset() - This method will reset the device making it
221 * ready for operation. This method must be called anytime the device is
222 * reset either through a SMP phy control or a port hard reset request.
223 * @remote_device: This parameter specifies the device to be reset.
224 *
225 * This method does not actually cause the device hardware to be reset. This
226 * method resets the software object so that it will be operational after a
227 * device hardware reset completes. An indication of whether the device reset
228 * was accepted. SCI_SUCCESS This value is returned if the device reset is
229 * started.
230 */
231enum sci_status scic_remote_device_reset(
232 struct scic_sds_remote_device *remote_device);
233
234/**
235 * scic_remote_device_reset_complete() - This method informs the device object
236 * that the reset operation is complete and the device can resume operation
237 * again.
238 * @remote_device: This parameter specifies the device which is to be informed
239 * of the reset complete operation.
240 *
241 * An indication that the device is resuming operation. SCI_SUCCESS the device
242 * is resuming operation.
243 */
244enum sci_status scic_remote_device_reset_complete(
245 struct scic_sds_remote_device *remote_device);
246
247
248
249/**
250 * scic_remote_device_get_connection_rate() - This method simply returns the
251 * link rate at which communications to the remote device occur.
252 * @remote_device: This parameter specifies the device for which to get the
253 * connection rate.
254 *
255 * Return the link rate at which we transfer for the supplied remote device.
256 */
257enum sci_sas_link_rate scic_remote_device_get_connection_rate(
258 struct scic_sds_remote_device *remote_device);
259
260/**
261 * scic_remote_device_get_protocols() - This method will indicate which
262 * protocols are supported by this remote device.
263 * @remote_device: This parameter specifies the device for which to return the
264 * protocol.
265 * @protocols: This parameter specifies the output values, from the remote
266 * device object, which indicate the protocols supported by the supplied
267 * remote_device.
268 *
269 * The type of protocols supported by this device. The values are returned as
270 * part of a bit mask in order to allow for multi-protocol support.
271 */
272void scic_remote_device_get_protocols(
273 struct scic_sds_remote_device *remote_device,
274 struct smp_discover_response_protocols *protocols);
275
276
277#if !defined(DISABLE_ATAPI)
278/**
279 * scic_remote_device_is_atapi() -
280 * @this_device: The device whose type is to be decided.
281 *
282 * This method first decide whether a device is a stp target, then decode the
283 * signature fis of a DA STP device to tell whether it is a standard end disk
284 * or an ATAPI device. bool Indicate a device is ATAPI device or not.
285 */
286bool scic_remote_device_is_atapi(
287 struct scic_sds_remote_device *device_handle);
288#else /* !defined(DISABLE_ATAPI) */
289#define scic_remote_device_is_atapi(device_handle) false
290#endif /* !defined(DISABLE_ATAPI) */
291
292
293#endif /* _SCIC_REMOTE_DEVICE_H_ */
294
This page took 0.050596 seconds and 5 git commands to generate.