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