485fefc08883b4bae4da56b7efb754f9c3cb6e1a
[linux-flexiantxendom0-3.2.10.git] / drivers / scsi / isci / core / scic_config_parameters.h
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_SDS_USER_PARAMETERS_H_
57 #define _SCIC_SDS_USER_PARAMETERS_H_
58
59 /**
60  * This file contains all of the structure definitions and interface methods
61  *    that can be called by a SCIC user on the SCU Driver Standard
62  *    (struct scic_sds_user_parameters) user parameter block.
63  *
64  *
65  */
66
67
68 #include "sci_status.h"
69 #include "intel_sas.h"
70 #include "sci_controller_constants.h"
71
72 struct scic_sds_controller;
73
74 /**
75  *
76  *
77  * SCIC_SDS_PARM_PHY_SPEED These constants define the speeds utilized for a
78  * phy/port.
79  */
80 #define SCIC_SDS_PARM_NO_SPEED   0
81
82 /**
83  *
84  *
85  * This value of 1 indicates generation 1 (i.e. 1.5 Gb/s).
86  */
87 #define SCIC_SDS_PARM_GEN1_SPEED 1
88
89 /**
90  *
91  *
92  * This value of 2 indicates generation 2 (i.e. 3.0 Gb/s).
93  */
94 #define SCIC_SDS_PARM_GEN2_SPEED 2
95
96 /**
97  *
98  *
99  * This value of 3 indicates generation 3 (i.e. 6.0 Gb/s).
100  */
101 #define SCIC_SDS_PARM_GEN3_SPEED 3
102
103 /**
104  *
105  *
106  * For range checks, the max speed generation
107  */
108 #define SCIC_SDS_PARM_MAX_SPEED SCIC_SDS_PARM_GEN3_SPEED
109
110 /**
111  * struct scic_sds_user_parameters - This structure delineates the various user
112  *    parameters that can be changed by the core user.
113  *
114  *
115  */
116 struct scic_sds_user_parameters {
117         struct sci_phy_user_params {
118                 /**
119                  * This field specifies the NOTIFY (ENABLE SPIN UP) primitive
120                  * insertion frequency for this phy index.
121                  */
122                 u32 notify_enable_spin_up_insertion_frequency;
123
124                 /**
125                  * This method specifies the number of transmitted DWORDs within which
126                  * to transmit a single ALIGN primitive.  This value applies regardless
127                  * of what type of device is attached or connection state.  A value of
128                  * 0 indicates that no ALIGN primitives will be inserted.
129                  */
130                 u16 align_insertion_frequency;
131
132                 /**
133                  * This method specifies the number of transmitted DWORDs within which
134                  * to transmit 2 ALIGN primitives.  This applies for SAS connections
135                  * only.  A minimum value of 3 is required for this field.
136                  */
137                 u16 in_connection_align_insertion_frequency;
138
139                 /**
140                  * This field indicates the maximum speed generation to be utilized
141                  * by phys in the supplied port.
142                  * - A value of 1 indicates generation 1 (i.e. 1.5 Gb/s).
143                  * - A value of 2 indicates generation 2 (i.e. 3.0 Gb/s).
144                  * - A value of 3 indicates generation 3 (i.e. 6.0 Gb/s).
145                  */
146                 u8 max_speed_generation;
147
148         } phys[SCI_MAX_PHYS];
149
150         /**
151          * This field specifies the maximum number of direct attached devices
152          * that can have power supplied to them simultaneously.
153          */
154         u8 max_number_concurrent_device_spin_up;
155
156         /**
157          * This field specifies the number of seconds to allow a phy to consume
158          * power before yielding to another phy.
159          *
160          */
161         u8 phy_spin_up_delay_interval;
162
163         /**
164          * These timer values specifies how long a link will remain open with no
165          * activity in increments of a microsecond, it can be in increments of
166          * 100 microseconds if the upper most bit is set.
167          *
168          */
169         u16 stp_inactivity_timeout;
170         u16 ssp_inactivity_timeout;
171
172         /**
173          * These timer values specifies how long a link will remain open in increments
174          * of 100 microseconds.
175          *
176          */
177         u16 stp_max_occupancy_timeout;
178         u16 ssp_max_occupancy_timeout;
179
180         /**
181          * This timer value specifies how long a link will remain open with no
182          * outbound traffic in increments of a microsecond.
183          *
184          */
185         u8 no_outbound_task_timeout;
186
187 };
188
189 /**
190  * This structure/union specifies the various different user parameter sets
191  *    available.  Each type is specific to a hardware controller version.
192  *
193  * union scic_user_parameters
194  */
195 union scic_user_parameters {
196         /**
197          * This field specifies the user parameters specific to the
198          * Storage Controller Unit (SCU) Driver Standard (SDS) version
199          * 1.
200          */
201         struct scic_sds_user_parameters sds1;
202
203 };
204
205
206 /**
207  *
208  *
209  * SCIC_SDS_OEM_PHY_MASK These constants define the valid values for phy_mask
210  */
211
212 /**
213  *
214  *
215  * This is the min value assignable to a port's phy mask
216  */
217 #define SCIC_SDS_PARM_PHY_MASK_MIN 0x0
218
219 /**
220  *
221  *
222  * This is the max value assignable to a port's phy mask
223  */
224 #define SCIC_SDS_PARM_PHY_MASK_MAX 0xF
225
226 /**
227  * struct scic_sds_oem_parameters - This structure delineates the various OEM
228  *    parameters that must be set the core user.
229  *
230  *
231  */
232 struct scic_sds_oem_parameters {
233         struct {
234                 /**
235                  * This field indicates whether Spread Spectrum Clocking (SSC)
236                  * should be enabled or disabled.
237                  */
238                 bool do_enable_ssc;
239
240         } controller;
241
242         struct {
243                 /**
244                  * This field specifies the phys to be contained inside a port.
245                  * The bit position in the mask specifies the index of the phy
246                  * to be contained in the port.  Multiple bits (i.e. phys)
247                  * can be contained in a single port.
248                  */
249                 u8 phy_mask;
250
251         } ports[SCI_MAX_PORTS];
252
253         struct sci_phy_oem_params {
254                 /**
255                  * This field specifies the SAS address to be transmitted on
256                  * for this phy index.
257                  */
258                 struct sci_sas_address sas_address;
259
260         } phys[SCI_MAX_PHYS];
261
262 };
263
264 /**
265  * This structure/union specifies the various different OEM parameter sets
266  *    available.  Each type is specific to a hardware controller version.
267  *
268  * union scic_oem_parameters
269  */
270 union scic_oem_parameters {
271         /**
272          * This field specifies the OEM parameters specific to the
273          * Storage Controller Unit (SCU) Driver Standard (SDS) version
274          * 1.
275          */
276         struct scic_sds_oem_parameters sds1;
277
278 };
279
280 /**
281  * scic_user_parameters_set() - This method allows the user to attempt to
282  *    change the user parameters utilized by the controller.
283  * @controller: This parameter specifies the controller on which to set the
284  *    user parameters.
285  * @user_parameters: This parameter specifies the USER_PARAMETERS object
286  *    containing the potential new values.
287  *
288  * Indicate if the update of the user parameters was successful. SCI_SUCCESS
289  * This value is returned if the operation succeeded. SCI_FAILURE_INVALID_STATE
290  * This value is returned if the attempt to change the user parameter failed,
291  * because changing one of the parameters is not currently allowed.
292  * SCI_FAILURE_INVALID_PARAMETER_VALUE This value is returned if the user
293  * supplied an invalid interrupt coalescence time, spin up delay interval, etc.
294  */
295 enum sci_status scic_user_parameters_set(
296         struct scic_sds_controller *controller,
297         union scic_user_parameters *user_parameters);
298
299 /**
300  * scic_user_parameters_get() - This method allows the user to retrieve the
301  *    user parameters utilized by the controller.
302  * @controller: This parameter specifies the controller on which to set the
303  *    user parameters.
304  * @user_parameters: This parameter specifies the USER_PARAMETERS object into
305  *    which the framework shall save it's parameters.
306  *
307  */
308 void scic_user_parameters_get(
309         struct scic_sds_controller *controller,
310         union scic_user_parameters *user_parameters);
311
312 /**
313  * scic_oem_parameters_set() - This method allows the user to attempt to change
314  *    the OEM parameters utilized by the controller.
315  * @controller: This parameter specifies the controller on which to set the
316  *    user parameters.
317  * @oem_parameters: This parameter specifies the OEM parameters object
318  *    containing the potential new values.
319  *
320  * Indicate if the update of the user parameters was successful. SCI_SUCCESS
321  * This value is returned if the operation succeeded. SCI_FAILURE_INVALID_STATE
322  * This value is returned if the attempt to change the user parameter failed,
323  * because changing one of the parameters is not currently allowed.
324  * SCI_FAILURE_INVALID_PARAMETER_VALUE This value is returned if the user
325  * supplied an unsupported value for one of the OEM parameters.
326  */
327 enum sci_status scic_oem_parameters_set(
328         struct scic_sds_controller *controller,
329         union scic_oem_parameters *oem_parameters);
330
331 /**
332  * scic_oem_parameters_get() - This method allows the user to retreive the OEM
333  *    parameters utilized by the controller.
334  * @controller: This parameter specifies the controller on which to set the
335  *    user parameters.
336  * @oem_parameters: This parameter specifies the OEM parameters object in which
337  *    to write the core's OEM parameters.
338  *
339  */
340 void scic_oem_parameters_get(
341         struct scic_sds_controller *controller,
342         union scic_oem_parameters *oem_parameters);
343
344
345 #endif  /* _SCIC_SDS_USER_PARAMETERS_H_ */
346